避免使用KeyboardAvoidingView推送标题

问题描述 投票:0回答:3

我在堆栈导航器中有一个容器组件,顶部是标题,包含消息和输入元素的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>

    )
  }
}
react-native keyboard
3个回答
0
投票

当StatusBar设置为隐藏https://github.com/facebook/react-native/issues/12980时,似乎KEYAvoidingView存在一个错误

删除它正常运行的隐藏标志


0
投票

在androidmanifest.xml中更改--- android:windowSoftInputMode =“adjustResize”---到--- android:windowSoftInputMode =“adjustPan”---


0
投票

使用KeyboardAwareScrollView它允许在键盘上方指定extraHeight prop

© www.soinside.com 2019 - 2024. All rights reserved.