gpt4 book ai didi

ios - KeyboardAvoidingView不断调整高度

转载 作者:行者123 更新时间:2023-11-28 23:30:09 32 4
gpt4 key购买 nike

当与 map 一起使用时,KeyboardAvoidingView 会不断调整其高度。当 KeyboardAvoidingView 被禁用时,一切正常。

  • 我测试了不同的行为选项,但没有一个能够解决问题
  • 这只是 iOS 上使用 Google map 提供商时出现的问题

视频:https://www.dropbox.com/s/f8tix2gqmqz7i0i/height_bug.mov?dl=0

小部分结构:

<View style={ styles.container }>
<MapView style={ styles.map } provider="google">
{ markers }
<KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={ 90 }>
<View style={ styles.footer }>
<SafeAreaView>
{ toolbar }
</SafeAreaView>
</View>
</KeyboardAvoidingView>
</View>

可能相关的样式:

const styles = StyleSheet.create({
container: {
flex: 1
},
map: {
flex: 1
},
footer: {
backgroundColor: colors.WHITE
},
footerToolbar: {
flexDirection: 'row',
padding: sizes.SCREEN_MARGIN / 2
}
})

React 原生信息:

info 
React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
Memory: 1.58 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz => 0.59.8
npmGlobalPackages:
react-native-cli: 2.0.1

最佳答案

尝试使用 KeyboardAvoidingView 将整个组件包装在容器中。这个组件基本上只是一个底部填充的 View。此外,如果您要使用 SafeAreaView,最好将它放在外部组件上,因为它用于在 iOS 上为外部 View 提供间距,以确保它清除带槽口的 iOS 设备的边缘并且没有按钮。

关于ios - KeyboardAvoidingView不断调整高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56873968/

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