react-native-keyboard-area icon indicating copy to clipboard operation
react-native-keyboard-area copied to clipboard

Detailed example

Open Simacho239 opened this issue 5 years ago • 6 comments

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 avatar Oct 17 '20 08:10 Simacho239

@Simacho239 Hey I managed to use this lib perfectly. What's your problem?

origamih avatar Dec 31 '20 07:12 origamih

@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 avatar Jan 19 '21 09:01 hanjjang18

@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 avatar Jan 25 '21 08:01 origamih

@origamih Thanks for help!

hanjjang18 avatar Feb 02 '21 02:02 hanjjang18

@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

origamih avatar Feb 04 '21 17:02 origamih

Hi, i didnt see any example. can u provide it?

fukemy avatar Jun 01 '22 15:06 fukemy

@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>

fukemy avatar Jul 25 '22 08:07 fukemy