componentDidMount() { // Make sure Android back button works // https://reactnavigation.org/docs/custom-android-back-button-handling.html BackHandler.addEventListener('hardwareBackPress', this.onBackPress); // We set a timeout just to show the loading actually works // In a real app, replace this with e.g. a data fetch you want to wait for setTimeout( () => this.props.dispatch(setLoading(false)), 500, ); }
componentWillMount() { this.eventsToScheduleSelectionService(); BackHandler.addEventListener('hardwareBackPress', this.handleBackButton); this.props.navigation.setParams({onBackPress: this.handleBackButton}); }
componentDidMount() { this._s0 = this.props.navigation.addListener('willFocus', () => { BackHandler.addEventListener('hardwareBackPress', this.onBackButtonPressAndroid); }); this._s2 = this.props.navigation.addListener('willBlur', () => { BackHandler.removeEventListener('hardwareBackPress', this.onBackButtonPressAndroid); }); }
constructor(props) { super(props); this.state = { isFullScreen: false, currentUrl: this.props.navigation.state.params.url, videoHeight: defaultVideoHeight }; BackHandler.addEventListener('hardwareBackPress', this._backButtonPress); Orientation.addOrientationListener(this._orientationDidChange); }
componentDidMount() { Keyboard.addListener('keyboardDidShow', this._keyboardDidShow); Keyboard.addListener('keyboardDidHide', this._keyboardDidHide); BackHandler.addEventListener('hardwareBackPress', this.handleBackButton); }
events () { BackHandler.addEventListener('hardwareBackPress', function () { this.props.navigator.push({ id: this.props.previous, user: this.state.user, statsbar: this.state.statsbar_hidden }); }); }
componentDidMount () { if (Platform.OS === 'ios') return BackHandler.addEventListener('hardwareBackPress', () => { const { dispatch, nav } = this.props // change to whatever is your first screen, otherwise unpredictable results may occur if (nav.routes.length === 1 && (nav.routes[0].routeName === 'LaunchScreen')) { return false } // if (shouldCloseApp(nav)) return false dispatch({ type: 'Navigation/BACK' }) return true }) }
componentDidMount() { this.subscription = BackHandler.addEventListener( "hardwareBackPress", () => { const { onChangeInputMethod, inputMethod } = this.props; if (inputMethod === INPUT_METHOD.CUSTOM) { onChangeInputMethod(INPUT_METHOD.NONE); return true; } return false; } ); }
componentWillMount() { this.seperateEventsIntoDays(this.props.navigation.state.params.data); this.setState({data: this.props.navigation.state.params.data}); BackHandler.addEventListener('hardwareBackPress', this.handleBackButton); }
componentDidMount() { this.subscription = BackHandler.addEventListener( 'hardwareBackPress', () => { const { fullscreenImageId } = this.state; if (fullscreenImageId) { this.dismissFullscreenImage(); return true; } return false; }, ); }
componentDidMount() { if (Platform.OS === 'android') { BackHandler.addEventListener('backPress', this.handleBackButton); } }
componentDidMount() { this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleOK.bind(this)); this.props.navigation.setParams({ handleOK: this.handleOK.bind(this), }); this.onNoteLoad(); }
componentDidMount() { BackHandler.addEventListener("hardwareBackPress", this.onBackPress); const {data} = this.props.navigation.state.params this.props.initialize({ id : data.id, slug : data.slug, description : data.description }) }
componentDidMount () { if (Platform.OS === 'ios') return BackHandler.addEventListener('hardwareBackPress', () => { const { dispatch, nav } = this.props // change to whatever is your first screen, otherwise unpredictable results may occur if (nav.routes.length === 1 && (nav.routes[0].routeName === 'Movies')) { return false } // if (shouldCloseApp(nav)) return false dispatch({ type: 'Navigation/BACK' }) return true }) }
componentDidMount() { this.subscription = BackHandler.addEventListener( 'hardwareBackPress', () => { const { onChangeInputMethod, inputMethod } = this.props; if (inputMethod === INPUT_METHOD.CUSTOM) { onChangeInputMethod(INPUT_METHOD.NONE); return true; } return false; }, ); }