question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transformation `Scale` not working

See original GitHub issue

I’d like to make a zoomable chart, with react-native-gesture-handler. But Chart Group doesn’t update when scale value was updated.

persudo code

function Zoomable() {
  const scale = useValue(1); // it works if I changed initial value.
  const pinchGesture = Gesture.Pinch()
    .onStart((e) => {
      "worklet";
      scale.current = e.scale;
    })
    .onUpdate((e) => {
      "worklet";
      scale.current = e.scale;
    });

  return (
    <GestureDetector gesture={pinchGesture}>
      <Canvas>
        <Group transform={[{scale: scale.current}]}>
          <Chart />
        </Group>
      </Canvas>
    </GestureDetector>
  )
}

dependencies

{
    "@shopify/react-native-skia": "^0.1.133",
    "react": "18.0.0",
    "react-native": "0.69.0",
    "react-native-gesture-handler": "^2.5.0",
    "react-native-reanimated": "^2.8.0"
  }

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wcandilloncommented, Jun 30, 2022

Hello there 🙋🏼‍♂️

We have a very fun pinch to zoom (and rotate/pan) example with gesture handler and reanimated at https://github.com/wcandillon/can-it-be-done-in-react-native/tree/master/bonuses/sticker-app/src This seems to fit your use case perfectly.

If you think that there is a bug with the implementation, please feel free to reopen this issue. If you have any questions on such examples, we will have video tutorial soon available on youtube on this exact topic and you can ask us in the discussion section at https://github.com/Shopify/react-native-skia/discussions

0reactions
wcandilloncommented, Oct 28, 2022

Yes that makes a lot of sense actually, thank you for pointing that out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

css - Transform scale property not working in Chrome & Safari
I am having another problem with this code. While this solution works in chrome, it still has the same effect in Safari and...
Read more >
Transform Scale Not Working - Adobe Support Community
Solved: When I use transform scale to change the size of an image, it defaults to 'maintain aspect ratio'. However, if I turn...
Read more >
[SOLVED] Scale Transformation Not Working - Forum | Webflow
I am facing a little yet mysterious issue with my Webflow Website. Indeed, the template I am using has a bunch of boxes...
Read more >
Css transform:scale(); not working..(solved) - Sololearn
I am able zoom (transform scale for earth) but not able zoom(transform scale for rocket) why anyone define it. htmlcsswebnotworkingtransform:scale();. 9th Sep ...
Read more >
scale() - CSS: Cascading Style Sheets - MDN Web Docs
The scale() CSS function defines a transformation that resizes an element on the ... Report problems with this compatibility data on GitHub ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found