Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a spinner wheel in react native

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!

like image 272
Salman Shaykh Avatar asked Aug 15 '26 10:08

Salman Shaykh


1 Answers

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

like image 123
Shrikant Jha Avatar answered Aug 18 '26 02:08

Shrikant Jha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!