componentWillMount () { this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow) this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide) }
componentDidMount() { let showListener = 'keyboardWillShow'; let hideListener = 'keyboardWillHide'; if (Platform.OS === 'android') { showListener = 'keyboardDidShow'; hideListener = 'keyboardDidHide'; } this.keyboardShowListener = Keyboard.addListener(showListener, this.keyboardShow); this.keyboardHideListener = Keyboard.addListener(hideListener, this.keyboardHide); }
componentDidMount() { InteractionManager.runAfterInteractions(() => { this.setState({loadingVisible: true}); ScreenInit.checkLogin(this); this._updateData(); /**添加新增地址侦听**/ this.listener_address_add = DeviceEventEmitter.addListener('addressListAddOne', () => { /**重新刷新页面更新数据**/ this._updateData(); }); }); }
componentDidMount() { this.listener_show = DeviceEventEmitter.addListener('orderRefundStatusShow', result => { if(result.index != this.index) return; this.setState({ visible: true, list: result.list, title: result.title, }); }); }
constructor(props) { super(props); const { navigate } = this.props.navigation; PushNotificationAndroid.registerNotificationActions(['Yes', 'No']); DeviceEventEmitter.addListener('notificationActionReceived', function (action) { const info = JSON.parse(action.dataJSON); if (info.action == 'Yes') { navigate('HelloWorld'); } }); }
componentDidMount() { this.listener_show = DeviceEventEmitter.addListener('confirmShow', (data) => { if(data.keys != this.state.keys) return; this.setState({ visible: true, data: data.data || this.state.data, params: data.params }); }); }
componentWillMount() { this.listener = DeviceEventEmitter.addListener('AddButtonPressed', () => { this.props.navigator.push({ screen: 'AddItem', title: 'Add Student' }); }); this.refreshData(); this.dbListener = DeviceEventEmitter.addListener('DataChangedEvent', () => { this.refreshData(); }); }
componentWillMount() { this.subscription = NativeAppEventEmitter.addListener( 'SongPlaying', this.updateCurrentlyPlaying ); }
componentDidMount() { InteractionManager.runAfterInteractions(() => { this.setState({loadingVisible: true}); ScreenInit.checkLogin(this); this._init(); }); this.listener_update = DeviceEventEmitter.addListener('sellerGoodsUpdate', () => { this._init(); }); }
componentWillMount () { this.keyboardWillShowSub = Keyboard.addListener('keyboardWillShow', this.keyboardWillShow); this.keyboardWillHideSub = Keyboard.addListener('keyboardWillHide', this.keyboardWillHide); }
componentDidMount() { /** * Because the native module directly emits event to the DeviceEventEmitter, * the only thing that needs to be done is adding an event listener to it */ this.listener = DeviceEventEmitter.addListener('javaToJS', this.handleEvent); }
componentWillMount () { // Using keyboardWillShow/Hide looks 1,000 times better, but doesn't work on Android // TODO: Revisit this if Android begins to support - https://github.com/facebook/react-native/issues/3468 this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this.keyboardDidShow) this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this.keyboardDidHide) }
componentDidMount() { Keyboard.addListener('keyboardDidShow', this._keyboardDidShow); Keyboard.addListener('keyboardDidHide', this._keyboardDidHide); BackHandler.addEventListener('hardwareBackPress', this.handleBackButton); }
componentWillMount () { this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow) this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide) }
componentWillMount () { // Using keyboardWillShow/Hide looks 1,000 times better, but doesn't work on Android // TODO: Revisit this if Android begins to support - https://github.com/facebook/react-native/issues/3468 this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this.keyboardDidShow) this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this.keyboardDidHide) }