gpt4 book ai didi

react native 键盘感知 ScrollView : Page scrolls down when I start typing

转载 作者:行者123 更新时间:2023-12-03 08:43:55 25 4
gpt4 key购买 nike

直到输入一切正常。然而,开始打字后,页面向下滚动(移动)。无论我做什么都无法解决这个问题......

<ImageBackground
source={bgSrc}
style={styles.background}
resizeMode="cover">

<StatusBar hidden={true} />

<KeyboardAwareScrollView
showsVerticalScrollIndicator={false}
enableOnAndroid
>

{screenToShow}

</KeyboardAwareScrollView>

</ImageBackground>

const styles = StyleSheet.create({
container: {
width: '100%',
height: height,
backgroundColor: '#555',
},
background: {
flex: 1,
width: null,
height: null,
justifyContent: 'center',
alignItems: 'center'
}
});

before typing, it's looking perfect

输入密码字段后,页面向下移动,如您所见:

after typing, it scroll down

最佳答案

这个库总是有点简陋。尝试这样的配置:

<KeyboardAwareScrollView
style={{ backgroundColor:
themeColors.boxPrimaryBackground, flexGrow: 1 }}
contentContainerStyle={{ width: '100%', margin: 0 }}
scrollEnabled={true}
extraScrollHeight={-125}
extraHeight={10}
keyboardOpeningTime={Number.MAX_SAFE_INTEGER}
showsVerticalScrollIndicator={false}
keyboardShouldPersistTaps={'handled'}
>
// add scroll content here
</ KeyboardAwareScrollView>

您真正需要添加的是keyboardOpeningTime={Number.MAX_SAFE_INTEGER}。和图书馆里面的动画有关系。祝你好运,希望这会有所帮助。

关于 react native 键盘感知 ScrollView : Page scrolls down when I start typing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62098070/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com