phamfoo / react-native-figma-squircle

Figma-flavored squircles for React Native
MIT License
318 stars 15 forks source link

Replaced `@react/auto-id` with `nanoid` #20

Closed a-corsini closed 1 year ago

a-corsini commented 1 year ago

@react/auto-id doesn't support React versions higher than 17. Replacing it with nanoid give us the same functionality with a lighter and faster package.

phamfoo commented 1 year ago

Thanks for the PR. However, this would generate a new id on every render. Looks like the issue with React 18 was fixed in this commit https://github.com/reach/reach-ui/commit/f50908c6203b44032b601307cb5e7b9aece8f4c6. Can you try bumping @react/auto-id to the latest version instead?

a-corsini commented 1 year ago

Hi @phamfoo, you are right I didn't account for the id changing on every render. I just pushed a new commit persisting the id between renders. I looked at the last commits for @reach/auto-id; they still don't support React 18 directly, just through a react-18 alias.

phamfoo commented 1 year ago

Sorry for the delayed response. I decided to go with a different approach (https://github.com/phamfoo/react-native-figma-squircle/commit/d3ee298687f9c2c94ebb423632571a54cb1986bd) that doesn't require using ClipPath. This also removes the need of generating a unique id for each clip path.