Answers for "smooth user navigation react native maps"

0

smooth user navigation react native maps

const AnimatedImage = Animated.createAnimatedComponent(Image)

export default (props) =>  {
    const rotation = useRef(new Animated.Value(0)).current
    const bearingDegree = rotation.interpolate({
        inputRange: [0, 360],
        outputRange: ['0deg', '360deg'],
    });
   useEffect(() => {
        if(props.bearing !== null || props.bearing !== undefined) {
            Animated.timing(rotation, {
                toValue: props.bearing,
                useNativeDriver: true,
                duration: 10000,
            }).start()
        }
    }, [props.bearing])

  return (
        <Marker.Animated
            coordinate={markerOrigin.current.region}
            ref={marker}
            flat
            anchor={{ x: 0.5, y: 0.5 }}
        >
            <AnimatedImage
                source={require('../../assets/images/motor-map.png')}
                style={[styles.bike, {transform: [{rotate: bearingDegree}]}]}
                resizeMode="contain"
            />
        </Marker.Animated>
    )
}
Posted by: Guest on January-21-2021

Code answers related to "smooth user navigation react native maps"

Code answers related to "Javascript"

Browse Popular Code Answers by Language