@@ -187,22 +187,6 @@ export default class Visibility extends Component {
187187 // Lifecycle
188188 // ----------------------------------------
189189
190- // eslint-disable-next-line camelcase
191- UNSAFE_componentWillReceiveProps ( { continuous, once, context, updateOn } ) {
192- const cleanHappened =
193- continuous !== this . props . continuous ||
194- once !== this . props . once ||
195- updateOn !== this . props . updateOn
196-
197- // Heads up! We should clean up array of happened callbacks, if values of these props are changed
198- if ( cleanHappened ) this . firedCallbacks = [ ]
199-
200- if ( context !== this . props . context || updateOn !== this . props . updateOn ) {
201- this . unattachHandlers ( this . props . context )
202- this . attachHandlers ( context , updateOn )
203- }
204- }
205-
206190 componentDidMount ( ) {
207191 this . mounted = true
208192
@@ -215,6 +199,21 @@ export default class Visibility extends Component {
215199 if ( fireOnMount ) this . update ( )
216200 }
217201
202+ componentDidUpdate ( prevProps ) {
203+ const cleanHappened =
204+ prevProps . continuous !== this . props . continuous ||
205+ prevProps . once !== this . props . once ||
206+ prevProps . updateOn !== this . props . updateOn
207+
208+ // Heads up! We should clean up array of happened callbacks, if values of these props are changed
209+ if ( cleanHappened ) this . firedCallbacks = [ ]
210+
211+ if ( prevProps . context !== this . props . context || prevProps . updateOn !== this . props . updateOn ) {
212+ this . unattachHandlers ( prevProps . context )
213+ this . attachHandlers ( this . props . context , this . props . updateOn )
214+ }
215+ }
216+
218217 componentWillUnmount ( ) {
219218 const { context } = this . props
220219
0 commit comments