【发布时间】:2020-01-20 18:24:27
【问题描述】:
我的库 react-native-keyboard-aware-scroll-view 有问题。
我已经在 Android 中配置了 windowSoftInputMode="adjustPan" 并且我正在使用 enableOnAndroid 并且使用相同的代码,当我在底部使用 KeyboardAwareScrollView 之外的固定元素时,我有不同的行为。
问题在于,在 iOS 中,我有一个额外的填充,其高度与外部组件的高度相同。
这是我的测试代码:
import React from 'react';
import {
View,
Text,
TextInput,
} from 'react-native';
import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view'
const App = () => {
return (
<>
<KeyboardAwareScrollView enableOnAndroid extraHeight={0}>
<View style={{height: 600}}/>
<TextInput
placeholder='hey'
style={{
width: '100%',
borderWidth: 1,
height: 60
}} />
</KeyboardAwareScrollView>
<View style={{backgroundColor: '#f0f', paddingVertical: 20, width: '100%'}}>
<Text>Hello, I'm bottom View</Text>
</View>
</>
);
};
export default App;
这就是行为:
iOS
如您所见,TextInput 和 Keyboard 之间的高度填充比 Android 中的要大,并且正好等于底部 View 的高度。
安卓
我该如何解决这个问题?在此先感谢:)
测试于:
iOS:12.2
Android:API 28
RN:0.59.10 和 0.60.5
RNKASV:0.9.1
【问题讨论】:
标签: android ios react-native