Andr3wHur5t / react-native-keyboard-spacer

Plug and play react-native keyboard spacer view.
MIT License
1.56k stars 219 forks source link

Please show a syntax example of how to use onToggle #42

Closed quadsurf closed 7 years ago

quadsurf commented 8 years ago

Everything works great, but when I tap in empty space areas above the keyboard and outside the form (in order to dismiss the keyboard as expected by user), the keyboard does not dismiss. I think I can get the keyboard to dismiss if I can see an example of how to use onToggle.

<KeyboardSpacer onToggle={true} />

or

<KeyboardSpacer onToggle={this.state.toggledStatus} />

neither worked btw

Andr3wHur5t commented 8 years ago

onToggle should be a function you can find a reference here.

This module only displaces the virtual keyboard, keyboard dismissal typically differs between applications and should be handled in your code.

This package may help react-native-dismiss-keyboard.

Andr3wHur5t commented 7 years ago

Closing for inactivity,

If your still having this issue please provide more details and reopen the issue.

zhaonian commented 6 years ago

Can you give me an example on how to pass a function to onToggle?

silverbuggy commented 6 years ago

@zhaonian and @quadsurf, here's an example of how to pass a function to onToggle:

handleOnToggle(keyboardState, keyboardSpace) {
    // Do whatever you want with keyboardState and keyboardSpace
}

render() {
    return <View>
        ...
        <KeyboardSpacer onToggle={this.handleOnToggle} />
        ...
    </View>
}