有人能告诉我如何做到这一点吗,例如,在添加高度时从0设置动画,在删除高度时从0设置动画?

推荐答案

添加动画很容易,只需在列表行中使用componentDidMount中的Animated,例如:

componentDidMount = ()=> {
    Animated.timing(this.state._rowOpacity, {
        toValue: 1,
        duration: 250,
    }).start()
}

在react native中,在卸载组件之前设置组件动画要困难得多.您应该将处理程序设置为ListView.更改数据源时,区分数据,开始设置动画以隐藏删除的行,并将新数据源设置为ListView.

React-native相关问答推荐

使用 React Native 下载数据文件以供离线使用

错误发生意外错误:https://registry.yarnpkg.com/react-native-template-react-native-template-typescript:未找到

React Native 用于低互联网带宽的小型 apk APP应用

打包程序无法启动

redux saga 的delay延迟功能不起作用

eslint Parsing error: Unexpected token =

在 React Native 中仅显示第一行文本

在 React Native 中无法滚动到 ScrollView 的底部

如何在 ubuntu 上安装 facebook watchman?

如果我有 AngularJS 基础知识,怎么学习Thinking in ReactJS呢?

在Android上更改高度时react-native TextInput显示错误

有react-native复选框的例子吗?

React Native require(image) 返回数字

Animated.View 的样式props的Typescript定义

当数据为空时,React-Native FlatList 呈现零状态

React Native Image 不显示,我该如何解决?

在 React Native 中,如何使用浅渲染测试我的组件?

在 React Native 中使用小数

无法在react-native元素中扩展 Zip

如何在 React 中将函数与钩子绑定?