surajitsarkar19 / react-native-radial-gradient

Radial gradient library for react native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

bimusiek opened this issue · comments

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;

Facing the same issue

@oguzhnatly You can use our fork

@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]);

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)