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

Updating Message in Toast if message prop is updated and updating toast position on screen orientation change #20

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
8 changes: 7 additions & 1 deletion lib/ToastContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class ToastContainer extends Component {
textStyle: Text.propTypes.style,
delay: PropTypes.number,
hideOnPress: PropTypes.bool,
onPress: PropTypes.func,
onHide: PropTypes.func,
onHidden: PropTypes.func,
onShow: PropTypes.func,
Expand Down Expand Up @@ -208,6 +209,11 @@ class ToastContainer extends Component {
}
};

_hideOnPress = () => {
this.props.onPress && this.props.onPress();
this._hide();
}

render() {
let {props} = this;
const { windowWidth } = this.state;
Expand All @@ -227,7 +233,7 @@ class ToastContainer extends Component {
pointerEvents="box-none"
>
<TouchableWithoutFeedback
onPress={this.props.hideOnPress ? this._hide : null}
onPress={this.props.hideOnPress ? this._hideOnPress : null}
>
<Animated.View
style={[
Expand Down