React Native - Android LayoutAnimation键盘FlatView Bug

时间:2018-01-29 14:45:02

标签: android react-native keyboard layout-animation

我目前在(我认为)LayoutAnimation有一个恼人的问题。

我的问题如下,我有一个应用程序,我可以搜索整个FlatList,使用搜索按钮打开面板并将焦点放在打开键盘的TextInput上。如果我想通过电话的后退按钮手动关闭它,我想要关闭它的问题它关闭,一切都很好通过点击列表关闭它,但问题来自我关闭搜索(因此,即使不调用.blur(),也会从屏幕上删除TextInput并自动关闭键盘,但我也尝试过并遇到同样的问题。

以下是一些屏幕解释: List everything is fine Keyboard opened All the zone that was covered by the keyboard that is now gone is not used anymore for some reason

现在这里有一些代码:

 _onPressSearch() {
LayoutAnimation.easeInEaseOut();
this.setState({ 
  showSearch: !this.state.showSearch
 }, function () {
  ( this.state.showSearch ? 
    this.refs.searchInput.focus() : 
    this.setState({
      searchString: "",
      filtered: null
    }) )
});

}

    var searchBar = (this.state.showSearch ?
  <View>
    <TextInput
      style={styles.searchInput}
      ref='searchInput'
      onChangeText={this._onChangeText.bind(this)}
      value={this.state.searchString}
      underlineColorAndroid={Colors.search}
      maxLength={25}
      autoCapitalize='none'
      autoCorrect={false}
      placeholder={I18n.t('search')}
      placeholderTextColor={Colors.search}
      clearButtonMode='never' />
  </View> : <View />);


    <List style={{ flex: 1 }}>
      <FlatList
        data={(this.state.filtered === null ? this.state.listings : this.state.filtered)}
        keyExtractor={this._keyExtractor}
        extraData={this.state}
        renderItem={this._renderItem} />
    </List>

我正在使用:

    "react": "16.0.0-alpha.12",
    "react-native": "0.52.0",

我从0.49.4更新到0.52.0希望它能解决问题,但似乎不是

有关信息:在IOS中没有问题,我确实在Android上激活动画来获取动画。 此外,如果我删除动画LayoutAnimation.easeInEaseOut(); 一切都有效,除了我当然没有动画。

非常感谢

0 个答案:

没有答案