Selaa lähdekoodia

componentWillReceiveProps logic moved to componentDidUpdate (#1999)

Pankaj Kumar 5 vuotta sitten
vanhempi
commit
627b2e4df9
1 muutettua tiedostoa jossa 5 lisäystä ja 8 poistoa
  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.uninstallPlugin(prevProps)
       this.installPlugin()
       this.installPlugin()
     }
     }
+    if (prevProps.open && !this.props.open) {
+      this.plugin.closeModal()
+    } else if (!prevProps.open && this.props.open) {
+      this.plugin.openModal()
+    }
   }
   }
 
 
   componentWillUnmount () {
   componentWillUnmount () {
@@ -55,14 +60,6 @@ class DashboardModal extends React.Component {
     uppy.removePlugin(this.plugin)
     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 () {
   render () {
     return h('div', {
     return h('div', {
       ref: (container) => {
       ref: (container) => {