Browse Source

componentWillReceiveProps logic moved to componentDidUpdate (#1999)

Pankaj Kumar 5 years ago
parent
commit
627b2e4df9
1 changed files with 5 additions and 8 deletions
  1. 5 8
      packages/@uppy/react/src/DashboardModal.js

+ 5 - 8
packages/@uppy/react/src/DashboardModal.js

@@ -20,6 +20,11 @@ class DashboardModal extends React.Component {
       this.uninstallPlugin(prevProps)
       this.installPlugin()
     }
+    if (prevProps.open && !this.props.open) {
+      this.plugin.closeModal()
+    } else if (!prevProps.open && this.props.open) {
+      this.plugin.openModal()
+    }
   }
 
   componentWillUnmount () {
@@ -55,14 +60,6 @@ class DashboardModal extends React.Component {
     uppy.removePlugin(this.plugin)
   }
 
-  componentWillReceiveProps (nextProps) {
-    if (this.props.open && !nextProps.open) {
-      this.plugin.closeModal()
-    } else if (!this.props.open && nextProps.open) {
-      this.plugin.openModal()
-    }
-  }
-
   render () {
     return h('div', {
       ref: (container) => {