From 899b780548446eb40fd367c81824a99ac95425dc Mon Sep 17 00:00:00 2001 From: Brad Jones Date: Mon, 21 Aug 2023 20:08:37 -0600 Subject: [PATCH] Switch to using `Pressable` (#167) * Switch to using Pressable * Update ToastContainer.js --------- Co-authored-by: Sunny Luo --- lib/ToastContainer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } }