Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using Pressable #167

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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