KeyboardAvoidingView helps keep your app's content visible when the keyboard appears. It moves or resizes parts of the screen so users can still see and interact with inputs.
When you have text inputs near the bottom of the screen and the keyboard might cover them.
When you want to prevent the keyboard from hiding buttons or fields users need to tap.
When you want a smooth user experience without manual scrolling after the keyboard opens.
The keyboard still hides the TextInput on iOS devices.
medium
A. Missing <ScrollView> to enable scrolling when keyboard appears
B. behavior prop should be set to "height" on iOS
C. TextInput needs a fixed height style
D. KeyboardAvoidingView must be wrapped in a View with flex: 0
Solution
Step 1: Understand KeyboardAvoidingView limits
KeyboardAvoidingView alone may not scroll content; without ScrollView, inputs can be hidden if screen is small.
Step 2: Identify missing scroll container
Wrapping content in ScrollView allows scrolling when keyboard appears, preventing hiding.
Final Answer:
Missing <ScrollView> to enable scrolling when keyboard appears -> Option A
Quick Check:
Use ScrollView with KeyboardAvoidingView to avoid hiding [OK]
Hint: Add ScrollView inside KeyboardAvoidingView for scroll [OK]
Common Mistakes:
Changing behavior prop incorrectly
Not using flex: 1 on container
Assuming fixed height fixes keyboard overlap
5. You want to create a form that works well on both iOS and Android. Which is the best way to use KeyboardAvoidingView to handle the keyboard properly?
hard
A. Set behavior to "position" on iOS only and do not use ScrollView
B. Set behavior to "padding" on all platforms and wrap inputs in a ScrollView
C. Set behavior to "height" on Android, "padding" on iOS, and wrap inputs in a ScrollView
D. Do not use KeyboardAvoidingView; rely on default keyboard behavior
Solution
Step 1: Choose platform-specific behavior
Best practice is to use "padding" on iOS and "height" on Android for KeyboardAvoidingView behavior.
Step 2: Wrap inputs in ScrollView
ScrollView allows content to scroll if keyboard covers inputs, improving usability on small screens.
Final Answer:
Set behavior to "height" on Android, "padding" on iOS, and wrap inputs in a ScrollView -> Option C
Quick Check:
Platform behavior + ScrollView = best keyboard handling [OK]
Hint: Use platform check for behavior and add ScrollView [OK]
Common Mistakes:
Using same behavior for all platforms
Not wrapping inputs in ScrollView
Ignoring Android keyboard behavior differences
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.