小编Sal*_*ykh的帖子

在 React Native 中创建一个旋转轮

你好,我正在尝试使用 Animatable 制作一个原生反应旋转轮。按照这里的示例(https://code.tutsplus.com/tutorials/practical-animations-in-react-native--cms-27567)我能够旋转一个矩形框。这是代码!

  <Animatable.View
                        ref={animation[0]}
                        style={[styles.box, { backgroundColor: animation[1] }]}
                        animation={animation[0]}
                        iterationCount={"infinite"}>
                        <Text style={styles.box_text}>{animation[0]}</Text>
 </Animatable.View>


const styles = StyleSheet.create({
        container: {
            flex: 1,
            flexDirection: 'column',
            padding: 20
        },
        row: {
            flex: 1,
            flexDirection: 'row',
            justifyContent: 'space-between'
        },
        box: {
            alignItems: 'center',
            justifyContent: 'center',
            height: 100,
            width: 100,
            backgroundColor: '#ccc'
        },
        box_text: {
            color: '#FFF'
        }
    });
Run Code Online (Sandbox Code Playgroud)

但问题是我们正在旋转一个使用 css 创建的盒子,有没有一种方法可以让我使用 html 和 css 制作自己的旋转器,并根据业务规则旋转它并停止它?

在此输入图像描述

需要一些指导和建议,谢谢!

react-native react-native-animatable

7
推荐指数
1
解决办法
5776
查看次数