Skip to content

Add native KeyboardAvoidingView (experimental_native) - #59511

Open
zoontek wants to merge 2 commits into
react:mainfrom
zoontek:native-keyboard-avoiding-view
Open

zoontek wants to merge 2 commits into
react:mainfrom
zoontek:native-keyboard-avoiding-view

Conversation

@zoontek

@zoontek zoontek commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

KeyboardAvoidingView follows the keyboard from JavaScript: it waits for a keyboard event, then animates its layout once with LayoutAnimation. The content does not move in sync with the keyboard, and interactive dismissal is not followed at all.

This PR adds an experimental_native prop, inspired by react-native-keyboard-controller. When it is set, a native view follows the keyboard frame by frame (UIKeyboardLayoutGuide on iOS, WindowInsetsAnimationCompat on Android) and sends the inset to the shared animation backend, which applies it to the layout.

Note that it requires the useSharedAnimatedBackend feature flag and an edge-to-edge app; otherwise, the JavaScript implementation (current) is used.

In following PRs, I plan to add keyboardWillShow and keyboardWillHide events, and possibly a translate-with-padding behavior and a KeyboardAwareScrollView component.

Changelog:

[GENERAL] [ADDED] - Add experimental_native prop to KeyboardAvoidingView to follow the keyboard animation natively

Test Plan:

Commands I ran, and their results:

  • yarn flow-check: no error
  • yarn build-types && yarn test-generated-typescript: passed
  • yarn eslint --max-warnings 0 on changed JS files: clean
  • yarn test packages/react-native/Libraries/Components/Keyboard: passed
  • yarn format-check-kotlin and yarn format-check-javascript: passed
  • yarn cxx-api-build: snapshots updated

Videos

Android

Android.mp4

iOS

iOS.mp4

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 26, 2026
@facebook-github-tools facebook-github-tools Bot added p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Oct 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant