[英]React Native ViewPager with a KeyboardAvoidingView as parent doesn't keep the keyboard up - iOS
When I use the ViewPager
from react-native-community/viewpager
with a KeyboardAvoidingView
and the style of ViewPager
is flex:1
and the behaviour of KeyboardAvoidingView is padding
the keyboard can't keep up.当我使用
react-native-community/viewpager
中的ViewPager
和KeyboardAvoidingView
并且ViewPager
的样式是flex:1
并且 KeyboardAvoidingView 的行为是padding
键盘无法跟上时。
<KeyboardAvoidingView style={{flex: 1}} behavior="padding">
<ViewPager
{...viewPagerProps}
ref={viewPagerRef}
scrollEnabled={false}
keyboardDismissMode="on-drag"
style={[{flex: 1, borderWidth: 1, borderColor: 'red'}, style]}
onPageScroll={Animated.forkEvent(onPageScroll, _onPageScroll)}
/>
{_renderBottomControls()}
</KeyboardAvoidingView>
_renderBottomControls() _renderBottomControls()
<SafeAreaView style={{flexDirection: 'row', justifyContent: 'space-between', padding: 8}}>
<Transitioning.View
transition={transition}
ref={transitionBackButtonRef}>
{currentPage !== 0 && (
<Button mode="text" compact onPress={_onPressPrevious}>
Voltar
</Button>
)}
</Transitioning.View>
<Button mode="contained" disabled={!isValid} onPress={_onPressNext}>
{isLastPage ? 'Concluir' : 'Continuar'}
</Button>
</SafeAreaView>
The fix for this was not obvious and I hope the developers will put this in the documentation对此的修复并不明显,我希望开发人员将其放入文档中
The view pager needs to be position absolute视图寻呼机需要是 position 绝对
<ViewPager style={{position: 'absolute'}}/>
Also if the screen is now being hiden by the keyboard, wrap the viewpager in a KeyboardAvoidingView
此外,如果屏幕现在被键盘隐藏,请将 viewpager 包装在
KeyboardAvoidingView
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.