|
@@ -11,6 +11,17 @@ const h = React.createElement
|
|
|
|
|
|
class ProgressBar extends React.Component {
|
|
|
componentDidMount () {
|
|
|
+ this.installPlugin()
|
|
|
+ }
|
|
|
+
|
|
|
+ componentDidUpdate (prevProps) {
|
|
|
+ if (prevProps.uppy !== this.props.uppy) {
|
|
|
+ this.uninstallPlugin(prevProps)
|
|
|
+ this.installPlugin()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ installPlugin () {
|
|
|
const uppy = this.props.uppy
|
|
|
const options = Object.assign(
|
|
|
{ id: 'react:ProgressBar' },
|
|
@@ -24,8 +35,8 @@ class ProgressBar extends React.Component {
|
|
|
this.plugin = uppy.getPlugin(options.id)
|
|
|
}
|
|
|
|
|
|
- componentWillUnmount () {
|
|
|
- const uppy = this.props.uppy
|
|
|
+ uninstallPlugin (props = this.props) {
|
|
|
+ const uppy = props.uppy
|
|
|
|
|
|
uppy.removePlugin(this.plugin)
|
|
|
}
|