7

Hello i am trying to make a spinner wheel in react native using Animatable. Following the example here (https://code.tutsplus.com/tutorials/practical-animations-in-react-native--cms-27567) I was able to rotate a rectangle box. Here is the code!

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

But the prob is here we are rotating a box creating using css, Is there a way where i can make my own spinner using html and css and rotate it and stop it according to the business rules?

enter image description here

Need some directions and suggestions thank you!

Salman Shaykh
  • 221
  • 5
  • 16

1 Answers1

1

You can use https://www.npmjs.com/package/react-native-wheel-of-fortune npm package for your purpose.

Shrikant Jha
  • 73
  • 11