MCPcopy
hub / github.com/react-native-modal/react-native-modal / componentDidUpdate

Method componentDidUpdate

src/modal.tsx:272–302  ·  view source on GitHub ↗
(prevProps: ModalProps)

Source from the content-addressed store, hash-verified

270 }
271
272 componentDidUpdate(prevProps: ModalProps) {
273 // If the animations have been changed then rebuild them to make sure we're
274 // using the most up-to-date ones
275 if (
276 this.props.animationIn !== prevProps.animationIn ||
277 this.props.animationOut !== prevProps.animationOut
278 ) {
279 const {animationIn, animationOut} = buildAnimations(
280 extractAnimationFromProps(this.props),
281 );
282 this.animationIn = animationIn;
283 this.animationOut = animationOut;
284 }
285 // If backdrop opacity has been changed then make sure to update it
286 if (
287 this.props.backdropOpacity !== prevProps.backdropOpacity &&
288 this.backdropRef
289 ) {
290 this.backdropRef.transitionTo(
291 {opacity: this.props.backdropOpacity},
292 this.props.backdropTransitionInTiming,
293 );
294 }
295 // On modal open request, we slide the view up and fade in the backdrop
296 if (this.props.isVisible && !prevProps.isVisible) {
297 this.open();
298 } else if (!this.props.isVisible && prevProps.isVisible) {
299 // On modal close request, we slide the view down and fade out the backdrop
300 this.close();
301 }
302 }
303 getDeviceHeight = () => this.props.deviceHeight || this.state.deviceHeight;
304 getDeviceWidth = () => this.props.deviceWidth || this.state.deviceWidth;
305 onBackButtonPress = () => {

Callers

nothing calls this directly

Calls 2

buildAnimationsFunction · 0.90

Tested by

no test coverage detected