Created
July 24, 2018 11:49
-
-
Save kmagiera/f630e5562b1f6fee64aa0509cf0679ee 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