React native Lottie loader (Animation Loader)

GitHub Repo for Lottie-React-Native:- https://github.com/react-native-community/lottie-react-native



import React, {useEffectfrom 'react';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  Text,
  StatusBar,
  ActivityIndicator,
from 'react-native';
import AnimatedLoader from 'react-native-animated-loader';
import LottieView from 'lottie-react-native';
import {createStackNavigatorfrom '@react-navigation/stack';
import {createDrawerNavigatorfrom '@react-navigation/drawer';

import Proflie from './screen/Proflie';

import {NavigationContainerfrom '@react-navigation/native';

const AppStack = createStackNavigator();

const Drawer = createDrawerNavigator();

const AppStackScreen = ({Navigation}) => {
  const [isLoadingsetIsLoading] = React.useState(true);

  useEffect(() => {
    setTimeout(() => {
      setIsLoading(false);
    }, 3000);
  }, []);

  if (isLoading) {
    return (
      <View style={{flex: 1justifyContent: 'center'alignItems: 'center'}}>
        <LottieView source={require('./assets/1.json')} autoPlay loop />
      </View>
    );
  }

  return (
    <NavigationContainer>
      <Drawer.Navigator>
        <Drawer.Screen name="Proflie" component={Proflie} />
      </Drawer.Navigator>
    </NavigationContainer>
  );
};

export default AppStackScreen;

Comments

Popular Posts