Activity Indicator in react native
Activity Indicator in react native
import React, {useEffect} from 'react';
import {ActivityIndicator, StyleSheet, Text, View} from 'react-native';
const App = () => {
const [isLoading, setIsLoading] = React.useState(true);
useEffect(() => {
setTimeout(() => {
setIsLoading(false);
}, 1000);
}, []);
if (isLoading) {
return (
<View style={[styles.container, styles.horizontal]}>
<ActivityIndicator size="large" color="#000" />
</View>
);
}
return (
<>
{/* <View style={[styles.container, styles.horizontal]}>
<ActivityIndicator size="large" color="#000" />
</View> */}
<Text>Yea</Text>
</>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
horizontal: {
flexDirection: 'row',
justifyContent: 'space-around',
padding: 10,
},
});
export default App;
Comments
Post a Comment