Open trumpet2012 opened 1 month ago
Looking into this more it looks like gluestack is using the older "react-stately" package: https://github.com/adobe/react-spectrum/blob/react-stately%403.21.0/packages/react-stately/src/index.ts for defining the type instead of the newer "@react-stately" package.
Edit: not sure if this is a case of older vs newer package. I'm unfamiliar with that code base. I am however starting to think that this might be an issue with the types provided by react-spectrum
.
Description
Menu onSelectionChange not resolving to correct type.
CodeSandbox/Snack link
https://snack.expo.dev/@trumpet2012/gluestack-menu-typescript-issue
Steps to reproduce
See provided snack link for reproducible issue (note that the types aren't working in the snack for some reason but that code is enough to see the issue locally)
This is a copy of the example from the docs: https://v1.gluestack.io/ui/docs/components/overlay/menu#selection.
The typescript error is:
Adding an extra check to ensure that "keys" isn't
"all"
then leads to the following typescript error:gluestack-ui Version
1.1.42
Platform
Other Platform
No response
Additional Information
The type for the "keys" argument appears to be resolving to: https://github.com/adobe/react-spectrum/blob/8ee84717884461e0646236b77c9e43c5d14e3533/packages/%40react-types/shared/src/selection.d.ts#L28
However the actual keys object type looks like it should be using: https://github.com/adobe/react-spectrum/blob/8ee84717884461e0646236b77c9e43c5d14e3533/packages/%40react-stately/selection/src/Selection.ts#L19.