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

Only Works onDidHide and onDidShow #5

Open
baenacoco opened this issue Mar 12, 2019 · 3 comments
Open

Only Works onDidHide and onDidShow #5

baenacoco opened this issue Mar 12, 2019 · 3 comments

Comments

@baenacoco
Copy link

baenacoco commented Mar 12, 2019

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
Copy link
Author

baenacoco commented Mar 12, 2019

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.

@mdeatherage1992
Copy link

Limits usability a fair bit, running into this now.

@JeremyBradshaw7
Copy link

Should be in the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants