Search code examples
react-nativereact-native-ios

React Native How To Set Gif Image at Splash Screen?


I have created new react native mobile application and I need to set gif image to the splash screen. any example or source code can help me to do that.

render() {
    return (
      <View style={styles.container}>
        {/*<BackgroundImage source={Images.splashScreen}*/}
        {/*       style = {{width: 315, height: 383}} />*/}

        <Image
            style={{width: 300, height: 200}}
            source={{uri: 'http://gifsstore.com/public/upload/gifs/15609427721560942769.gif'}} />
      </View>
    );
  }

Solution

  • you can also use FastImage for that functionality. It also gives support for gif files

    you can also try below code

    import FastImage from 'react-native-fast-image'
    
       <FastImage
                style={{ width: "100%", height: "100%" }}
                source={{
                  uri: "your URL", //give your url here
                  priority: FastImage.priority.normal
                }}
                resizeMode={FastImage.resizeMode.contain}
                onLoad={() => {
                  setTimeout(
                    () => {
                    //navigate to another screen after some times
                    },
                    15000
                  );
                }}
              />