Avoid Keyboard for whole View (dynamic offset) #119
-
Feature requestLibrary version: 2.4.6 Hi, with the following example function ExampleApp(): JSX.Element {
return (
<View style={{ flex: 1 }}>
<Text style={{ paddingTop: 50, paddingLeft: 30 }}>Go back</Text>
<View style={{ flex: 1 }} />
<View>
<AvoidSoftInputView
style={{ padding: 20, backgroundColor: 'blue' }}
hideAnimationDuration={80}
showAnimationDuration={80}
showAnimationDelay={0}
>
<TextInput style={{ backgroundColor: 'red', height: 45, paddingHorizontal: 20 }} />
<View style={{ height: 20, backgroundColor: 'yellow' }} />
<TextInput style={{ backgroundColor: 'red', height: 45, paddingHorizontal: 20 }} />
<View style={{ height: 80, backgroundColor: 'green' }} />
</AvoidSoftInputView>
</View>
</View>
);
} With the example above, I have two red boxes, a green area for CTA and blue padding. I always want the blue area to be above the Keyboard. My initial hope was that wrapping the whole View in Additionally, the Android Keyboard always aligns right at the bottom of the focused input while iOS always adds some space in between. Why is that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @saaymeen, I moved this to the Discussions section, because it's not an issue, but rather couple of questions, which I'll try to answer below.
If I get it correctly, you want to wrap each of form's inputs in its separate
So the module is intended to work with elements that trigger keyboard (on Android these are 100% text inputs, on iOS everything that is displayed inside iOS's
I don't know tbh, my guess would be that it's related with iOS bottom safe area inset, which is taken into consideration when computing offset that needs to be applied to make text input visible. If you have any more doubts, feel free to ask them here or open new discussion in Discussions section |
Beta Was this translation helpful? Give feedback.
Hi @saaymeen, I moved this to the Discussions section, because it's not an issue, but rather couple of questions, which I'll try to answer below.
If I get it correctly, you want to wrap each of form's inputs in its separate
AvoidSoftInputView
wrapper and give differentavoidOffset
prop for each of those wrappers