Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Animating an image in react native

$
0
0

I am completely new to react native and I am trying to animate an image, any suggestions would help!

import React, { Component } from 'react';import { Animated, Easing } from 'react-native';import FontAwesome5Pro from 'react-native-vector-icons/FontAwesome5Pro';class AnimateIcon extends Component {  spinValue = new Animated.Value(0);  componentDidMount() {    this.spin();  }  spin = () => {    this.spinValue.setValue(0);    Animated.timing(this.spinValue, {      toValue: 1,      duration: 1000,      easing: Easing.linear,      useNativeDriver: true,    }).start(() => this.spin());  };  render() {    const { style, children } = this.props;    const rotate = this.spinValue.interpolate({      inputRange: [0, 1],      outputRange: ['0deg', '360deg'],    });    return (<Animated.View style={{ transform: [{ rotate }] }}><FontAwesome5Pro style={style}>{children}</FontAwesome5Pro></Animated.View>    );  }}export default AnimateIcon;

And I am getting the following error:

"Property 'style' does not exist on type 'Readonly<{}> & Readonly<{ children?: ReactNode; }>'


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>