Detailed example
Hey! Thanks for creating this. Would it be possible to please upload the detailed example you use in this so that we can have a look. We're having some issues implementing this package, but think the example might explain it for us 😀
@Simacho239 Hey I managed to use this lib perfectly. What's your problem?
@origamih How did you apply it? It is difficult because I can't figure out how the example components are organized. Can you show me the sample code?
@hanjjang18 I only use this to get the keyboard height when the soft input mode is adjustNothing.
const keyboardHeightChange = (isOpen: boolean, height: number) => {
// here you have the isOpen and height
};
// just use this to trigger the onChange event, I don't render anything here
<KeyboardArea
style={{height: 0, width: 0, zIndex: -100}}
isOpen={false}
onChange={keyboardHeightChange}>
</KeyboardArea>
@origamih Thanks for help!
@hanjjang18 the beautiful thing here is you can get the same behavior as iOS. So you can make a HOC or hooks, calculate some keyboard-related things, apply to both Android and iOS, because now Android doesn't do anything to the main layout, and yet you still can get the height and status
Hi, i didnt see any example. can u provide it?
@origamih @thomasgazzoni Plz i need your help, i cant not switch into other keyboard
const [customKeyboard, setCustomKeyboard] = useState(KEYBOARD_SYSTEM)
<KeyboardSpacer
ref={kbRef}
isOpen={customKeyboard == KEYBOARD_SYSTEM}
onChange={(isOpen: boolean, currentHeight: number) => {
console.log('onchange', isOpen, currentHeight)
}}>
<View style={{ backgroundColor: 'red', width: '100%', height: 100 }}/>
if (customKeyboard == KEYBOARD_EMOJI) return <ChatEmojiKeyboardInput width={width} height={getKbHeight} onSelectEmoji={onSelectEmoji} />
if (customKeyboard == KEYBOARD_MORE) return <ChatMoreKeyboardInput width={width} height={getKbHeight} onSelectedFile={onSelectedFile} onShareContact={onShareContact}/>
if (customKeyboard == KEYBOARD_VOICE) return <ChatVoiceKeyboardInput width={width} height={getKbHeight} onSendVoice={onSendVoice} />
</KeyboardSpacer>