Skip to content

How to animate the MarkerView? #502

Answered by tyrauber
timweii asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @timweii, I have done this in rnmapbox/maps without modifying the library, and the same should work in maplibre-react-native using react-native-reanimated createAnimatedComponent and useAnimatedProps.

Something like this should work:

import Animated, { useAnimatedProps } from 'react-native-reanimated';
import { createAnimatedPropAdapter } from 'react-native-reanimated/src/reanimated2/PropAdapters';

 const [followPoint, setFollowPoint] = useState(null);
const AnimatedShape = Animated.createAnimatedComponent(Maplibre.ShapeSource);

  const animatedProps = useAnimatedProps(
    () => {
      const shape = {
              type: 'FeatureCollection',
              features: [
              …

Replies: 4 comments

Comment options

tyrauber
Apr 12, 2024
Maintainer Sponsor

You must be logged in to vote
0 replies
Answer selected by KiwiKilian
Comment options

You must be logged in to vote
0 replies
Comment options

tyrauber
Apr 15, 2024
Maintainer Sponsor

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #334 on November 15, 2024 17:59.