Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

react native - How can I add gif to custom marker?

I want to add gip to image source in the marker, my app shows nothing as marker

Here is my code....

         <MapView
            initialRegion={region}
            maxZoomLevel={17}
            region={region}
        >
            {region.latitude !== 0 ? (
                <Marker
                    minDelta={0.5}
                    maxDelta={2}
                    coordinate={{
                        latitude: region.latitude,
                        longitude: region.longitude,
                    }}
                    title={'You are here!'}
                >
                    <View style={{height:10,width:10}}>
                        <Image 
                            resizeMode="center"
                            source={require('../src/images/1.gif')} 
                        />
                    </View>
                </Marker>  
            ):null}
        </MapView>

How i add gif to the marker?? Do i need animated marker for this???


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try this way

<MapView.Marker
  minDelta={0.5}
  maxDelta={2}
  coordinate={markerInfo.location}>

    <Image style={styles.image} source={require('../src/images/1.gif')} />
</MapView.Marker>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...