Skip to content

Commit

Permalink
Switch to using Pressable (#167)
Browse files Browse the repository at this point in the history
* Switch to using Pressable

* Update ToastContainer.js

---------

Co-authored-by: Sunny Luo <[email protected]>
  • Loading branch information
bradjones1 and sunnylqm authored Aug 22, 2023
1 parent a21d38a commit 899b780
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/ToastContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -58,6 +59,7 @@ let styles = StyleSheet.create({
}
});

const Touchable = Pressable || TouchableWithoutFeedback;
class ToastContainer extends Component {
static displayName = 'ToastContainer';

Expand Down Expand Up @@ -246,7 +248,7 @@ class ToastContainer extends Component {
accessibilityHint={this.props.accessibilityHint ? this.props.accessibilityHint : undefined}
accessibilityRole={this.props.accessibilityRole ? this.props.accessibilityRole : "alert"}
>
<TouchableWithoutFeedback
<Touchable
onPress={() => {
typeof this.props.onPress === 'function' ? this.props.onPress() : null
this.props.hideOnPress ? this._hide() : null
Expand Down Expand Up @@ -275,7 +277,7 @@ class ToastContainer extends Component {
{this.props.children}
</Text>
</Animated.View>
</TouchableWithoutFeedback>
</Touchable>
</View> : null;
}
}
Expand Down

0 comments on commit 899b780

Please sign in to comment.