相关疑难解决方法(0)

如何使用 React Native 制作心跳动画?

我正在学习 React Native,我想要心跳动画

我这样做了,但这不是好结果,我想要心跳。

如果有人可以帮助我,那就太好了,非常感谢

import React, { PureComponent } from "react";
import { Animated, StyleSheet, Text, View } from "react-native";

export class Loading extends PureComponent {
  constructor(props: any) {
    super(props);
    this.state = {
      opacity: new Animated.Value(0),
    };
  }
  public componentDidMount() {
    Animated.timing(
      this.state.opacity,
      {
        toValue: 100,
        duration: 5000,
      },
    ).start(); 
  }

  public render() {
    return (
      <View>
        <View>
          <Animated.View
        style={[styles.animation, {
        opacity: this.state.opacity,
        transform: [
        {
          scale: this.state.opacity.interpolate({ 
            inputRange: [0.5, 1],
            outputRange: [1, 0.95],
          }),
        }]},
        ]}
          />
        </View> …
Run Code Online (Sandbox Code Playgroud)

animation react-native

4
推荐指数
3
解决办法
1万
查看次数

如何在 React Native 的 renderItem 函数中获取 FlatList 元素的高度

我是 React Native 的新手。我想FlatList在向左滑动时为删除项目设置动画。我获取了滑动的值并能够删除该项目,但并不顺利。

所以,我正在使用AnimatedReact Native 的 API,并希望在滑动后 1000 毫秒内使 FlatList 项目的高度为 0。

我正在使用输入范围和输出范围。但我无法获取当前元素的高度,因为所有元素的高度都是动态的。

react-native

3
推荐指数
1
解决办法
7582
查看次数

标签 统计

react-native ×2

animation ×1