gluestack-ui icon indicating copy to clipboard operation
gluestack-ui copied to clipboard

Don't force select item value to be a string

Open erdemkeren opened this issue 1 year ago • 2 comments

Description

number accepted as a select item value

CodeSandbox/Snack link

No response

Steps to reproduce

type item = {
    id: number
}

<SelectItem
    key={item.id}
    label={item.name}
    value={item.id}
/>

Should be valid. Helps when using with zod validation + hook forms as suggested by the pro package.

gluestack-ui Version

1.1.3

Platform

  • [X] Expo
  • [ ] React Native CLI
  • [ ] Next
  • [ ] Web
  • [ ] Android
  • [ ] iOS

Other Platform

No response

Additional Information

No response

erdemkeren avatar Feb 07 '24 00:02 erdemkeren

Hello @erdemkeren, The value props of the select item should accept a string. Could you please use the .toString() function. Thank you!

RishabhSahu24 avatar Feb 12 '24 10:02 RishabhSahu24

Bump. Could SelectItem accept ReactNode as option label? So I can use more complex options utilizing eg. HStack/VStack

artfb avatar Feb 22 '24 10:02 artfb

Hey @artfb , Currently this is not supported for the Select API , this will be a separate component combobox.

sra1kumar-NULL avatar Sep 24 '24 08:09 sra1kumar-NULL