KeyboardAvoidingView 适用于 EXPO 但不适用于 APK? [英] KeyboardAvoidingView works on EXPO but not on APK?
本文介绍了KeyboardAvoidingView 适用于 EXPO 但不适用于 APK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我买了这个在 Expo 中完美运行的主题,但是一旦我构建了 APK,键盘就会覆盖整个屏幕并且无法正常工作.
I bought this Theme which in Expo works flawlessly, but as soon as I build the APK, the Keyboard will cover the whole screen and wont work as supposed.
我正在使用 expo 进行测试,效果很好.
I'm using expo for testing and it works just fine.
return (
<SafeAreaView style={styles.container}>
<NavHeader title={thread.name} {...{navigation}} />
<FlatList
inverted
data={messages}
keyExtractor={message => `${message.date}`}
renderItem={({ item }) => (
<Msg message={item} name={item.me ? name : thread.name} picture={thread.picture} />
)}
/>
<KeyboardAvoidingView behavior={Platform.OS === "ios" ? "padding" : "height"} enabled>
<View style={styles.footer}>
<TextInput
style={styles.input}
placeholder="Write a message"
value={this.state.message}
onChangeText={message => this.setState({ message })}
autoFocus
blurOnSubmit={false}
returnKeyType="send"
onSubmitEditing={this.send}
underlineColorAndroid="transparent"
/>
<TouchableOpacity primary transparent onPress={this.send}>
<Text style={styles.btnText}>Send</Text>
</TouchableOpacity>
</View>
</KeyboardAvoidingView>
</SafeAreaView>
);
风格
const styles = StyleSheet.create({
container: {
flex: 1
},
footer: {
borderColor: Theme.palette.lightGray,
borderTopWidth: 1,
paddingLeft: Theme.spacing.small,
paddingRight: Theme.spacing.small,
flexDirection: "row",
alignItems: "center"
},
input: {
height: Theme.typography.regular.lineHeight + (Theme.spacing.base * 2),
flex: 1
},
btnText: {
color: Theme.palette.primary
}
});
我试过以下插件
使用 enableOnAndroid 属性
using the enableOnAndroid prop
https://github.com/APSL/react-native-键盘感知滚动视图
没有成功.
我在这里发帖:
https://github.com/APSL/react-native-keyboard-aware-scroll-view/issues/305
这里:
https://github.com/expo/expo/issues/2172
推荐答案
很遗憾,这是一个已知问题
Unfortunately this is a known issue
https://github.com/expo/expo/issues/2172
这篇关于KeyboardAvoidingView 适用于 EXPO 但不适用于 APK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文