Skip to content

Commit 899b780

Browse files
bradjones1sunnylqm
andauthored
Switch to using Pressable (#167)
* Switch to using Pressable * Update ToastContainer.js --------- Co-authored-by: Sunny Luo <[email protected]>
1 parent a21d38a commit 899b780

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/ToastContainer.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import {
88
Text,
99
Animated,
1010
Dimensions,
11-
TouchableWithoutFeedback,
11+
Pressable,
1212
Easing,
13-
Keyboard
13+
Keyboard,
14+
TouchableWithoutFeedback
1415
} from 'react-native';
1516
import { ViewPropTypes, TextPropTypes } from 'deprecated-react-native-prop-types';
1617
const TOAST_MAX_WIDTH = 0.8;
@@ -58,6 +59,7 @@ let styles = StyleSheet.create({
5859
}
5960
});
6061

62+
const Touchable = Pressable || TouchableWithoutFeedback;
6163
class ToastContainer extends Component {
6264
static displayName = 'ToastContainer';
6365

@@ -246,7 +248,7 @@ class ToastContainer extends Component {
246248
accessibilityHint={this.props.accessibilityHint ? this.props.accessibilityHint : undefined}
247249
accessibilityRole={this.props.accessibilityRole ? this.props.accessibilityRole : "alert"}
248250
>
249-
<TouchableWithoutFeedback
251+
<Touchable
250252
onPress={() => {
251253
typeof this.props.onPress === 'function' ? this.props.onPress() : null
252254
this.props.hideOnPress ? this._hide() : null
@@ -275,7 +277,7 @@ class ToastContainer extends Component {
275277
{this.props.children}
276278
</Text>
277279
</Animated.View>
278-
</TouchableWithoutFeedback>
280+
</Touchable>
279281
</View> : null;
280282
}
281283
}

0 commit comments

Comments
 (0)