From 95a010a99ed97aa769a3cb3843898199209191ea Mon Sep 17 00:00:00 2001 From: Brad Jones Date: Fri, 26 May 2023 12:37:36 -0600 Subject: [PATCH 1/2] Switch to using Pressable --- lib/ToastContainer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ToastContainer.js b/lib/ToastContainer.js index 7cc32fa..1cc6a4f 100644 --- a/lib/ToastContainer.js +++ b/lib/ToastContainer.js @@ -8,7 +8,7 @@ import { Text, Animated, Dimensions, - TouchableWithoutFeedback, + Pressable, Easing, Keyboard } from 'react-native'; @@ -246,7 +246,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 +275,7 @@ class ToastContainer extends Component { {this.props.children} - + : null; } } From b597b07e02b0d7c25319f0f7490430d162bfd030 Mon Sep 17 00:00:00 2001 From: Sunny Luo Date: Tue, 22 Aug 2023 10:08:09 +0800 Subject: [PATCH 2/2] Update ToastContainer.js --- lib/ToastContainer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ToastContainer.js b/lib/ToastContainer.js index 1cc6a4f..8d93919 100644 --- a/lib/ToastContainer.js +++ b/lib/ToastContainer.js @@ -10,7 +10,8 @@ import { Dimensions, 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; } }