2015-05-04 33 views
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,它这里没有出现,一般模版:

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> 
    ); 
    } 
}); 

而且代码t他的动画(不知道它是有用的,但我们永远不知道):

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); 
} 

回答

1

被问及其在Github上here有人回答我:

我错过了我的创建部分的属性在动画的定义:

create: { 
    type: LayoutAnimation.Types.linear, 
    property: LayoutAnimation.Properties.opacity, 
},