Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using animations to transform these SVG properties does not take effect, but directly setting the values of these properties takes effect #2587

Open
ShaoGongBra opened this issue Dec 23, 2024 · 2 comments
Labels
Missing repro This issue need minimum repro scenario

Comments

@ShaoGongBra
Copy link

ShaoGongBra commented Dec 23, 2024

Description

translateX
translateY
scale
rotation
scale
...

Steps to reproduce

import { Animated, PanResponder, Easing } from 'react-native'

import { Svg, Rect } from 'react-native-svg'
import { useRef } from 'react'

const RectAnimated = Animated.createAnimatedComponent(Rect)

export const TouchEvent = () => {

  const moveOriginPan = useRef(new Animated.ValueXY({ x: 0, y: 0 }, { useNativeDriver: false })).current

  const moveOriginEvent = useRef(PanResponder.create({
    onMoveShouldSetPanResponder: () => true,
    onPanResponderMove: (e, gestureState) => {
      moveOriginPan.setValue({ x: gestureState.dx, y: gestureState.dy })
    },
    onPanResponderRelease: () => {
      Animated.timing(moveOriginPan, {
        toValue: { x: 0, y: 0 },
        duration: 600,
        easing: Easing.bounce,
        useNativeDriver: false
      }).start()
    }
  })).current


  return <Svg width={375} height={150}>
    <Rect width={375} height={150} fill='#fff' />
    <RectAnimated
      width={50}
      height={50}
      fill='#666'
      {...moveOriginEvent.panHandlers}
      x={150}
      y={50}
      translateX={moveOriginPan.x}
      translateY={moveOriginPan.y}
    />
  </Svg>
}

Snack or a link to a repository

https://github.com/duxapp/duxui

SVG version

15.10.1

React Native version

0.75.4

Platforms

Android, iOS

JavaScript runtime

None

Workflow

None

Architecture

Yes

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Dec 23, 2024
@ShaoGongBra
Copy link
Author

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

The above code block is the smallest case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro This issue need minimum repro scenario
Projects
None yet
Development

No branches or pull requests

1 participant