Skip to content

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

@j-q-in-berlin

Description

@j-q-in-berlin

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-move@2.9.1 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions