Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving the "defaultProps" warning (Relevant for react-native) #104

Open
j-q-in-berlin opened this issue Jan 8, 2025 · 0 comments
Open

Comments

@j-q-in-berlin
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-move/Animate/Animate.js b/node_modules/react-move/Animate/Animate.js
index 88dfed4..62c5a16 100644
--- a/node_modules/react-move/Animate/Animate.js
+++ b/node_modules/react-move/Animate/Animate.js
@@ -18,7 +18,7 @@ var keyAccessor = function keyAccessor() {
 };
 
 function Animate(props) {
-  var show = props.show,
+  var show = props.show ?? true,
       start = props.start,
       enter = props.enter,
       update = props.update,
@@ -81,8 +81,6 @@ Animate.propTypes = process.env.NODE_ENV !== "production" ? {
    */
   children: _propTypes.default.func.isRequired
 } : {};
-Animate.defaultProps = {
-  show: true
-};
+
 var _default = Animate;
 exports.default = _default;
\ No newline at end of file
diff --git a/node_modules/react-move/dist/react-move.js b/node_modules/react-move/dist/react-move.js
index d703469..daf83fe 100644
--- a/node_modules/react-move/dist/react-move.js
+++ b/node_modules/react-move/dist/react-move.js
@@ -2547,13 +2547,13 @@
 
 	function Animate(props) {
 	  const {
-	    show,
 	    start,
 	    enter,
 	    update,
 	    leave,
 	    children
 	  } = props;
+	  const show = props.show ?? true;
 	  const data = typeof start === 'function' ? start() : start;
 	  return React__default.createElement(NodeGroup, {
 	    data: show ? [data] : [],
@@ -2603,9 +2603,6 @@
 	   */
 	  children: propTypes.func.isRequired
 	};
-	Animate.defaultProps = {
-	  show: true
-	};
 
 	exports.Animate = Animate;
 	exports.NodeGroup = NodeGroup;
diff --git a/node_modules/react-move/es/Animate/Animate.js b/node_modules/react-move/es/Animate/Animate.js
index 6c63abe..58bcfce 100644
--- a/node_modules/react-move/es/Animate/Animate.js
+++ b/node_modules/react-move/es/Animate/Animate.js
@@ -7,7 +7,7 @@ var keyAccessor = function keyAccessor() {
 };
 
 function Animate(props) {
-  var show = props.show,
+  var show = props.show ?? true,
       start = props.start,
       enter = props.enter,
       update = props.update,
@@ -70,7 +70,5 @@ Animate.propTypes = process.env.NODE_ENV !== "production" ? {
    */
   children: PropTypes.func.isRequired
 } : {};
-Animate.defaultProps = {
-  show: true
-};
+
 export default Animate;
\ No newline at end of file

This issue body was partially generated by patch-package.

@j-q-in-berlin j-q-in-berlin changed the title Resolving the "defaultProps" warning Resolving the "defaultProps" warning (Relevant for react-native) Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant