【发布时间】:2018-05-29 02:56:48
【问题描述】:
我在堆栈导航器中有一个容器组件,顶部是标题,一个包含消息的滚动视图和一个输入元素
当我聚焦输入时,整个窗口被推上去,同时隐藏了标题
如何避免这种行为?
这是我正在使用的组件:
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>
)
}
}
【问题讨论】:
标签: react-native keyboard