suiss/ui · Component
Keyboard Scroll View
A scroll view that keeps the focused text field visible above the on-screen keyboard.
Keyboard Scroll View is an open-source component from suiss/ui for React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

KeyboardScrollView wraps the React Native ScrollView. When the keyboard opens, it measures how much of the view the keyboard covers, adds matching space at the end of the content and scroll indicator, and scrolls just enough to bring the focused input above the keyboard.
Use it for forms and other screens with text fields that would otherwise end up behind the keyboard.
Installation
Manual
- Install the dependencies:
-
Add the pieces it builds on: the primitives
components/primitives/hooks.tsx,components/primitives/keyboard.tsx. -
Copy the source into
components/ui/keyboard-scroll-view.tsx:
- Update the import paths to match your project.
- Install the dependencies:
-
Add the pieces it builds on: the primitives
components/primitives/hooks.tsx,components/primitives/keyboard.tsx. -
Copy the source into
components/ui/keyboard-scroll-view.tsx:
- Update the import paths to match your project.
-
Add the pieces it builds on: the primitives
components/primitives/hooks.tsx,components/primitives/keyboard.tsx. -
Copy the source into
components/ui/keyboard-scroll-view.tsx:
- Update the import paths to match your project.
-
Target iOS 17 or later.
-
Copy the theme files every view uses:
- Copy the source:
- Add the files to your app target.
- Set
minSdkto 24 or higher and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Place inputs anywhere inside the view; no extra setup is needed. Set bottomOffset to leave more space between the focused field and the keyboard.
All ScrollView props are passed through. By default taps on the content are handled while the keyboard is open (keyboardShouldPersistTaps="handled"), and dragging dismisses the keyboard.
KeyboardScrollViewContext exposes scrollToFocused, which children can call to bring the focused input into view again, for example after their layout changes.
Examples
Larger bottom offset
Keeps the focused field 64 points above the keyboard.

Focused
The last field is focused on mount and scrolled into view.

With bottom bar
A form above a bottom bar with a full-width button.

API Reference
KeyboardScrollView
| Prop | Type | Default | Description |
|---|---|---|---|
bottomOffset | number | 16 | Space kept between the focused input and the keyboard. Defaults to 16. |
Also accepts the props of ScrollViewProps, React.RefAttributes<ScrollView>.
Accessibility
- The view is a standard
ScrollView, so screen reader scrolling works as usual.
Notes
keyboardDismissModedefaults tointeractiveon iOS andon-dragon Android.- After a touch while the keyboard is open, the view checks the focused input again after a short delay.
- The view fills its parent with
flex-1. - Only an input that is inside the visible frame of the scroll view is adjusted; inputs scrolled out of view are left alone.



