我在堆栈导航器中有一个容器组件,顶部是标题,包含消息和输入元素的scrollview
当我关注输入时,整个窗口被推高,也隐藏了标题
我该如何避免这种行为?
这是我正在使用的组件:
class Chat extends Component {
static navigationOptions = ({navigation}) => {
return {
headerTitle: (
<Header
user={navigation.getParam('chat').partecipants[0]}
headerClick={() => navigation.getParam('openProfile')()}
/>
)
}
}
.....
render() {
...
return (
<KeyboardAvoidingView
style={{flex: 1}}
behavior={'padding'}
>
<ScrollView>
{messages}
</ScrollView>
<Input sendMessage={(m) => this.props.sendMessage(chat, m)}/>
</KeyboardAvoidingView>
)
}
}
当StatusBar设置为隐藏https://github.com/facebook/react-native/issues/12980时,似乎KEYAvoidingView存在一个错误
删除它正常运行的隐藏标志
在androidmanifest.xml中更改--- android:windowSoftInputMode =“adjustResize”---到--- android:windowSoftInputMode =“adjustPan”---
使用KeyboardAwareScrollView它允许在键盘上方指定extraHeight prop