"import React, { Component } from 'react';
import { StyleSheet, Animated, View, Text } from 'react-native';
import {Actions} from 'react-native-router-flux';
const arr = []
for (var i = 0; i < 10; i++) {
arr.push(i)
}
class Loading extends Component {
constructor(props) {
super(props)
this.animatedValue = []
arr.forEach((value) => {
this.animatedValue[value] = new Animated.Value(0)
})
}
componentDidMount() {
this.animate();
this.activePage();
}
animate() {
const animations = arr.map((item) => {
return Animated.timing(
this.animatedValue[item],
{
toValue: 1,
duration: 50
}
)
})
if (this.animatedValue[10] == 1) {
this.animateHide();
}
Animated.sequence(animations).start(() => {
const animations = arr.map((item) => {
return Animated.timing(
this.animatedValue[item],
{
toValue: 0,
duration: 50
}
)
})
Animated.sequence(animations).start(() => this.animate())
})
}
activePage() {
setTimeout(() => {
if (true) {
Actions.reset('auth')
}
else {
Actions.reset('login')
}
}, 2000)
}
render() {
const animations = arr.map((a, i) => {
return <Animated.View key={i} style={[{ opacity: this.animatedValue[a] }, styles.animationView]} />
})
return (
<View style={styles.mainView}>
<View style={styles.viewTxt}>
</View>
<Text style={styles.loadingTxt}>
لطفا منتظر بمانید !
</Text>
<View style={{
flex: 0.5, flexDirection: 'row',
flexWrap: 'wrap', alignItems: 'flex-start',
}}>
{animations}
</View>
</View>
)
}
}
const styles = StyleSheet.create({
mainView: {
flex: 1,
backgroundColor: '#546E7A',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
},
viewTxt: {
flex: 0.5,
justifyContent: 'center',
alignItems: 'center'
},
loadingTxt: {
fontFamily: 'IRANSansMobile',
fontSize: 20,
color: 'white',
textAlign: 'center',
},
animationView: {
height: 10,
width: 10,
backgroundColor: '#FFEB3B',
marginLeft: 3,
marginTop: 3,
borderRadius: 10,
}
})
export default Loading;
"
@hesammousavi
به sir_gray کمک کنید تا مشکل خودش را حل کند؛ اینطور میتوانیم با هم پیشرفت کنیم.
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟