When the height of TextInput changes, TextInput returns to its original position.
Environment
Library version: 4.0.1 OS version: iPhone 15 Pro simulator, iOS 17.0
Affected platforms
- [ ] Android
- [X] iOS
Current behavior
When the height of TextInput changes, TextInput returns to its original position. For more details, please refer to the attached video.
https://github.com/mateusz1913/react-native-avoid-softinput/assets/26135248/41d3f5a7-37a4-4e46-9b04-466e3e9b2520
I will excerpt a portion of the program.
const PostCommentModal: FC = ({id, imageUrl, title}) => {
...
const onFocusEffect = useCallback(() => {
AvoidSoftInput.setShouldMimicIOSBehavior(true);
return () => {
AvoidSoftInput.setShouldMimicIOSBehavior(false);
};
}, [])
useFocusEffect(onFocusEffect)
...
return (
<>
{ isModalOpen && <Animated.View style={[animatedOpacityStyle, s.overlay]} /> }
<Animated.View style={[animatedModalStyle, {bottom: insets.bottom, ...s.container}]}>
...
<View style={{height: modalHeight}}>
<ScrollView style={{borderTopColor: '#eee', borderTopWidth: 1}}>
...
</ScrollView>
<View>
<AvoidSoftInputView
style={s.inputArea}
avoidOffset={8}
hideAnimationDelay={0}
>
<View style={s.commentButton}>
<CircleAvatar size={32} />
<View style={s.fieldArea}>
<TextInput style={s.input} multiline placeholder="コメントを書く" />
...
</View>
</View>
</AvoidSoftInputView>
</View>
</View>
</Animated.View>
</>
)
}
Expected behavior
I want TextInput to remain in the same position even when its height changes.
Reproduction
Please refer to "Current behavior" for instructions on how to reproduce the issue and view the program.
Hey @wacci6, thanks for reporting the issue. Unfortunately, I cannot start investigation without proper reproduction repository that I can clone and iterate on. The code that you extracted is not enough, as it lacks information about styling used for text field and AvoidSoftInputView + there's some modalHeight applied to one of View components. Please provide the url to the minimal reproduction repository, then I'll be able to investigate
Closing as there's no activity since 4 months. If you want me to work on this issue, please provide link to repro, only then I can reopen the issue