Hard
En React Native, comment décrirez vous cette animation ?
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Animated,
Image,
Easing
} from 'react-native'
class AnimationExample extends React.Component {
constructor () {
super()
this.animValue = new Animated.Value(0)
}
componentDidMount () {
this.animate()
}
animate () {
this.animValue.setValue(0)
Animated.timing(
this.animValue,
{
toValue: 1,
duration: 4000,
easing: Easing.linear
}
).start(() => this.animate())
}
render () {
const anim = this.animValue.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '360deg']
})
return (
<View style={styles.container}>
<Animated.Image
style={{
width: 227,
height: 200,
transform: [{rotate: anim}] }}
source={{uri: 'https://s3.amazonaws.com/media-p.slid.es/uploads/alexanderfarennikov/images/1198519/reactjs.png'}}
/>
</View>
)
}
}
Author: Victor SabatierStatus: PublishedQuestion passed 468 times
Edit
5
Community EvaluationsNo one has reviewed this question yet, be the first!
Similar QuestionsMore questions about React Native
1
What is the output of the following code?
const App = () => {
const [count, setCount] = useState(0);
return ({
<Text>
The count is {count}
</Text>
<Button onPress={() => setCount(count + 1)}>
Increase
</Button>
});
};
export default App;
1
Which of the following code snippets will print 'Hello World' to the console?1
I can launch the debugger in Chrome from my app, I run `react-native log-ios` from my command line1
How to use StyleSheet in React Native1
Which of the following snippets are valid JSX?