-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathApp.js
41 lines (38 loc) · 912 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from "react";
import { StyleSheet, Animated, Text, View } from "react-native";
class FadeInView extends React.Component {
state = {
fadeAnim: new Animated.Value(0) // Initial value for opacity: 0
};
componentDidMount() {
Animated.timing(this.state.fadeAnim, {
toValue: 1,
duration: 10000
}).start();
}
render() {
return (
<Animated.View
style={{
...this.props.style,
opacity: this.state.fadeAnim
}}
>
{this.props.children}
</Animated.View>
);
}
}
export default class App extends React.Component {
render() {
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<FadeInView>
<Text style={{ fontSize: 28, textAlign: "center", margin: 10 }}>
Fading in
</Text>
</FadeInView>
</View>
);
}
}