Created
July 26, 2018 11:39
-
-
Save kmagiera/f944fc201acef897d8f2775e1c6668bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Composer extends Component { | |
state = { showAccessory: false }; | |
componentDidMount() { | |
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => | |
this.setState({ showAccessory: true }) | |
); | |
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => | |
this.setState({ showAccessory: false }) | |
); | |
} | |
componentWillUnmount() { | |
this.keyboardDidShowListener.remove(); | |
this.keyboardDidHideListener.remove(); | |
} | |
render() { | |
return ( | |
<View> | |
<EditTextComponent /> | |
{this.state.showAccessory && <AccessoryView />} | |
</View> | |
); | |
} | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment