diff --git a/packages/modal-enhanced-react-native-web/src/index.js b/packages/modal-enhanced-react-native-web/src/index.js index 37c016c..c9e0983 100644 --- a/packages/modal-enhanced-react-native-web/src/index.js +++ b/packages/modal-enhanced-react-native-web/src/index.js @@ -133,7 +133,7 @@ class ReactNativeModal extends Component { } } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (!this.state.isVisible && nextProps.isVisible) { this.setState({ isVisible: true, showContent: true }); } @@ -163,7 +163,7 @@ class ReactNativeModal extends Component { // }); } - componentWillUnmount() { + UNSAFE_componentWillUnmount() { // window.removeEventListener('resize', () => { // this.handleDimensionsUpdate(); // }); @@ -287,8 +287,7 @@ class ReactNativeModal extends Component { // User can define custom react-native-animatable animations, see PR #72 buildAnimations = (props) => { - let animationIn = props.animationIn; - let animationOut = props.animationOut; + let { animationIn, animationOut } = props; if (isObject(animationIn)) { const animationName = JSON.stringify(animationIn); @@ -373,7 +372,7 @@ class ReactNativeModal extends Component { ); } - let animationOut = this.animationOut; + let { animationOut } = this; if (this.inSwipeClosingState) { this.inSwipeClosingState = false; @@ -481,6 +480,7 @@ class ReactNativeModal extends Component { useNativeDriver={useNativeDriver} style={[ styles.backdrop, + this.props.backdropStyle, { backgroundColor: this.state.showContent ? backdropColor diff --git a/packages/modal-react-native-web/src/index.js b/packages/modal-react-native-web/src/index.js index d8198ac..c39e987 100644 --- a/packages/modal-react-native-web/src/index.js +++ b/packages/modal-react-native-web/src/index.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { Animated, Dimensions, Easing, Platform } from 'react-native'; +import { Animated, Dimensions, Easing, Platform, ViewPropTypes } from 'react-native'; import ModalPortal from './Portal'; import * as ariaAppHider from './ariaAppHider'; @@ -27,6 +27,7 @@ export default class Modal extends Component { children: PropTypes.node.isRequired, ariaHideApp: PropTypes.bool, appElement: PropTypes.instanceOf(SafeHTMLElement), + style: ViewPropTypes.style, }; static defaultProps = { @@ -56,7 +57,7 @@ export default class Modal extends Component { if (this.props.visible) this.handleShow(); } - componentWillReceiveProps({ visible }) { + UNSAFE_componentWillReceiveProps({ visible }) { if (visible && !this.props.visible) this.handleShow(); if (!visible && this.props.visible) this.handleClose(); } @@ -238,7 +239,7 @@ export default class Modal extends Component { } render() { - const { transparent, children } = this.props; + const { transparent, children, style } = this.props; const transparentStyle = transparent ? styles.bgTransparent @@ -249,7 +250,7 @@ export default class Modal extends Component { {children}