constructor(props) {
super(props);
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);//加上这句就有 效果了
// 初始状态
this.state = {
views:[],
num:0
};
}
componentWillUpdate(){//当视图 发生变化时候的回调
//ToastAndroid.show('componentWillUpdate...',ToastAndroid.SHORT);
LayoutAnimation.configureNext(CustomLayoutAnimation);//可以是自己定义的 LayoutAnimation.easeInEaseOut(); 也可以系统自带的
}
var CustomLayoutAnimation = {
duration: 2000,
create: {
type: LayoutAnimation.Types.linear,
property: LayoutAnimation.Properties.opacity,
},
update: {
type: LayoutAnimation.Types.easeInEaseOut,
},
};
自定义动画只有 增加视图会显示