diff --git a/lib/ToastContainer.js b/lib/ToastContainer.js index 7cc32fa..8d93919 100644 --- a/lib/ToastContainer.js +++ b/lib/ToastContainer.js @@ -8,9 +8,10 @@ import { Text, Animated, Dimensions, - TouchableWithoutFeedback, + Pressable, Easing, - Keyboard + Keyboard, + TouchableWithoutFeedback } from 'react-native'; import { ViewPropTypes, TextPropTypes } from 'deprecated-react-native-prop-types'; const TOAST_MAX_WIDTH = 0.8; @@ -58,6 +59,7 @@ let styles = StyleSheet.create({ } }); +const Touchable = Pressable || TouchableWithoutFeedback; class ToastContainer extends Component { static displayName = 'ToastContainer'; @@ -246,7 +248,7 @@ class ToastContainer extends Component { accessibilityHint={this.props.accessibilityHint ? this.props.accessibilityHint : undefined} accessibilityRole={this.props.accessibilityRole ? this.props.accessibilityRole : "alert"} > - { typeof this.props.onPress === 'function' ? this.props.onPress() : null this.props.hideOnPress ? this._hide() : null @@ -275,7 +277,7 @@ class ToastContainer extends Component { {this.props.children} - + : null; } }