[当我将ViewPager
中的react-native-community/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()
<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>
解决方法不明显,我希望开发人员将其放在文档中