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

Center should be passed as {x: 0, y: 0} otherwise it won't update #27

Open
bimusiek opened this issue Apr 8, 2021 · 5 comments
Open

Comments

@bimusiek
Copy link

bimusiek commented Apr 8, 2021

On iOS, if you pass center as [0, 0] and dynamically update it to other value, it won't be updated. As on native side, it is recognised as CGPoint (not NSArray) thus React will not trigger setter for this property if it is not x,y;

@oguzhnatly
Copy link

Facing the same issue

@bimusiek
Copy link
Author

@oguzhnatly You can use our fork

@bimusiek
Copy link
Author

bimusiek commented Jun 17, 2021

@oguzhnatly Sorry, we did not make a PR nor fork for this. However in the code you can simply make an HOC with

  const convertedCenter = useMemo(() => {
    return !center || Platform.OS !== 'ios' ? center : { x: center[0], y: center[1] };
  }, [center]);

@oguzhnatly
Copy link

Thanks @bimusiek!

@canpoyrazoglu
Copy link

canpoyrazoglu commented Apr 2, 2023

I've tried passing it as {x: 0, y: 0} yet I get "Property is not configurable" error. However, passing it as an array also has no effect at all no matter what numbers I pass. Is it completely broken or am I missing something obvious here?

(iOS 16.2, RN 0.71.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants