How do I display an animated gif in React Native?

前端 未结 8 1193
逝去的感伤
逝去的感伤 2020-12-02 22:10

How can I display an animated gif in react native. This is what I\'ve tried.

It works fine with a .

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 22:55

    import React,{useState} from 'react';
    
    **step1 import from react narive  You Can Use (Image) Or (ImageBackground)  **
    
    
    import { StyleSheet, Text, View ,ImageBackground} from 'react-native';
    
    
    
    
    
    function LoadingUsers() {
        return(
    
    
    
    **Step 2 require inside source ImageBackground **
    
    
    
    Loading..
    )
    }
     
    
    
    **Step 3 Set Width ANd height **
    
    
    const styles = StyleSheet.create({
        LoadingView:{
            flex:1,
        },
        Gif:{
            flex:1,
            width:"100%",
            height:"100%",
            justifyContent:"center",
            alignItems:"center",
            backgroundColor:'#000',
        }
      
        });
        export default LoadingUsers ;

提交回复
热议问题