react-native-keyboard-listener icon indicating copy to clipboard operation
react-native-keyboard-listener copied to clipboard

Only Works onDidHide and onDidShow

Open baenacoco opened this issue 5 years ago • 3 comments

I am trying this, but testing all functions only works onDidHide and onDidShow. I testing that rendering the variable keyboardOpen.

<Modal animationType="none" transparent={false} visible={this.state.modalVisible} onRequestClose={this.modalCloset} > <KeyboardAvoidingView style={styles.contKeyboard} enabled> <View style={styles.contTexto}> <Text>{JSON.stringify(this.state.keyboardOpen)}</Text> <KeyboardListener onWillShow={() => { this.setState({ keyboardOpen: 'onWillShow' }); }} onWillHide={() => { this.setState({ keyboardOpen: 'onWillHide' }); }} onDidHide={() => { this.setState({ keyboardOpen: 'onDidHide' }); }} onDidShow={() => { this.setState({ keyboardOpen: 'onDidShow' }); }} onWillChangeFrame={() => { this.setState({ keyboardOpen: 'onWillChangeFrame' }); }} onDidChangeFrame={() => { this.setState({ keyboardOpen: 'onDidChangeFrame' }); }} /> <TextInput style={[styles.textoInput, styles.textoMediano]} name={'usuario'} placeholder={this.props.textoInicial} keyboardType={'default'} returnKeyType={'search'} blurOnSubmit={false} multiline={true} onChangeText={(value) => this.setState({ texto: value })} editable={this.props.activo} > {this.props.textoDiligenciado} </TextInput> </View> </KeyboardAvoidingView> <BotonNaranja titulo={'Listo!'} icon={'checksquareo'} onPress={() => { this.setModalVisible(false); }}> </BotonNaranja> </Modal>

baenacoco avatar Mar 12 '19 22:03 baenacoco

https://facebook.github.io/react-native/docs/keyboard

Note that if you set android:windowSoftInputMode to adjustResize or adjustNothing, only keyboardDidShow and keyboardDidHide events will be available on Android. keyboardWillShow as well as keyboardWillHide are generally not available on Android since there is no native corresponding event.

baenacoco avatar Mar 12 '19 23:03 baenacoco

Limits usability a fair bit, running into this now.

mdeatherage1992 avatar Feb 04 '20 19:02 mdeatherage1992

Should be in the README

JeremyBradshaw7 avatar Nov 19 '20 10:11 JeremyBradshaw7