kirillzyusko / react-native-keyboard-controller

Keyboard manager which works in identical way on both iOS and Android
https://kirillzyusko.github.io/react-native-keyboard-controller/
MIT License
1.78k stars 81 forks source link

KeyboardController + reanimated withTiming freezes the app on Android #683

Closed mlecoq closed 1 week ago

mlecoq commented 2 weeks ago

Describe the bug When I add KeyboardProvider and I use withTiming in an animation, my app freezes (only on android).

Code snippet

  const onInputFocus = useCallback(
    (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
      onFocus?.(e);
      isFocused.value = withTiming(1, {duration: 300}); // freezes on android
      // isFocused.value = 1;
    },
    [isFocused, onFocus],
  );

  const onInputBlur = useCallback(
    (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
      onBlur?.(e);
      isFocused.value = withTiming(0, {duration: 300}); // freezes on android
      //isFocused.value = 0;
    },
    [isFocused, onBlur],
  );

in this code

Repo for reproducing https://github.com/mlecoq/keyboardControllerIssue

To Reproduce Steps to reproduce the behavior:

  1. npx expo run:android
  2. tap on text field (under Welcome)
  3. the app is frozen

Smartphone (please complete the following information):