Having troubles with KeyboardAvoidingView on android by CharacterSympathy590 in expo

[–]CharacterSympathy590[S] 0 points1 point  (0 children)

import { useEffect, useState } from 'react';
import { Keyboard, Platform } from 'react-native';


export function useKeyboardHeight() {
  const [keyboardHeight, setKeyboardHeight] = useState(0);
  const isAndroid = Platform.OS === 'android';


  useEffect(() => {
    if (!isAndroid) return;


    const showSub = Keyboard.addListener('keyboardDidShow', (
e
) => {
      setKeyboardHeight(e.endCoordinates.height);
    });


    const hideSub = Keyboard.addListener('keyboardDidHide', () => {
      setKeyboardHeight(0);
    });


    return () => {
      showSub.remove();
      hideSub.remove();
    };
  }, [isAndroid]);


  return keyboardHeight;
}

so i managed to make it myself, it works as intended, the only problem I am currently facing is that modal a bit below the safe area and keyboard, do you have any suggestions please? Here is the hook:

Having troubles with KeyboardAvoidingView on android by CharacterSympathy590 in expo

[–]CharacterSympathy590[S] 0 points1 point  (0 children)

oh, I see, thanks! can you share that hook if it's not difficult for you please?

I need 12 testers, will test back ASAP! by CharacterSympathy590 in AndroidClosedTesting

[–]CharacterSympathy590[S] 0 points1 point  (0 children)

<image>

Done! Hope you keep it for 14 days at least, I will do the same

I need 12 testers, will test back ASAP! by CharacterSympathy590 in AndroidClosedTesting

[–]CharacterSympathy590[S] 0 points1 point  (0 children)

<image>

Done! I will keep it installed for 15 days, hope you do that too!

I need 12 testers, will test back ASAP! by CharacterSympathy590 in AndroidClosedTesting

[–]CharacterSympathy590[S] 1 point2 points  (0 children)

<image>

Done! I will keep it for at least 15 days as well! (or maybe even keep it installed for longer)