0

各アイテムがコンテンツ ビューを変更する SlideMenu を含むシーンをレンダリングしようとすると、次のエラーが発生します。

[RCTLog][tid:0x7f8f7054b4b0]
[RCTUIManager.m:466]>Unsupported layout animation createConfig property (null)

SlideMenuのレイアウトのアニメーションから来ていると思いますが、アイテムをクリックして「フラグメント」(コンテンツビューを意味する)の変更をトリガーした場合にのみ発生します。それ以外の場合、メニューは通常どおり閉じます。

「閉じる」をクリックすると、フラグメントは適切に表示されますが、SlideMenu が閉じられません。

これがアニメーション自体によるものなのか、要素の変更とアニメーションの組み合わせによるものなのかはわかりません。

これが私のコードの一部です:

toggleSlideMenu: function() {
  if (this.state.slideMenuIsAccessible){
    if(this.state.menuIsOpen) {
      //close Menu
    } else {
      //open Menu
    }
    queueAnimation(this.props.animation);
    this.center.setNativeProps({left: this.offset}); //updates UI
  }
});

フラグメントの選択は generalTemplate で行われます:

  matchIdToFragment: function(fragmentId) {
    switch (fragmentId) {
      case 'suggestions':
        return <Suggestions />;
      case 'onScreen':
        return <OnScreen />;
      case 'zap':
        return <Zap setFragmentId={this.props.setFragmentId} setItemId={this.setItemId}/>;
      case 'programDetails':
        return <ProgramDetails itemId={this.state.itemId}/> ;
    }
  },
  render: function() {
    var fragment = this.matchIdToFragment(this.props.fragmentId);

    return (
      <View style={styles.container}>
        <View style={styles.fragmentView}>
          {fragment}
        </View>
        <NavigationBar 
          onOpenUserMenu={this.onOpenUserMenu}
          toggleSlideMenu={this.toggleSlideMenu}/>   
      </View>
    );
  }

メニューの項目を押すと、メニューが閉じられます (ここには表示されていない ID が generalTemplate に送信されます)。

var Section = React.createClass({
  onPress: function() {
    this.props.toggleSlideMenu();
  },
  render: function() {
    return (
      <TouchableHighlight underlayColor='#DFDFDF' onPress={this.onPress}>
        //Name and icon of the menu item  
      </TouchableHighlight>
    );
  }
});

アニメーションのコード (有用かどうかはわかりませんが、わかりません):

var LayoutAnimation = require('react-native').LayoutAnimation;
var DEFAULT_ANIMATION = 'linear';

var animations = {
  layout: {
    linear: {
      duration: 300,
      create: {
        type: LayoutAnimation.Types.linear,
      },
      update: {
        type: LayoutAnimation.Types.linear,
        springDamping: 0.7,
      },
    },
  },
};

var layoutAnimationConfigs = {
  'spring': animations.layout.spring,
};

module.exports = function(animation) {
  var _animation = layoutAnimationConfigs[animation];
  if (!_animation) {
    _animation = layoutAnimationConfigs[DEFAULT_ANIMATION];
  }

  LayoutAnimation.configureNext(_animation);
}
4

1 に答える 1