react-native-wheel-scrollview-picker
react-native-wheel-scrollview-picker copied to clipboard
'ScrollPicker' cannot be used as a JSX component.
Getting typescript error but picker is working fine
'ScrollPicker' cannot be used as a JSX component.
Its return type 'ReactNode' is not a valid JSX element.
Type 'undefined' is not assignable to type 'Element | null'.ts(2786)
We're facing this issue too. Will follow to see if there is any resolution
Came across this article that explains this Typescript error: https://www.totaltypescript.com/jsx-element-vs-react-reactnode#whenshouldntwe-usereactreactnode. The article implies this may in fact be fixed in Typescript 5.1.
I am also getting a TS typo error in below line not sure if this one is related
onValueChange?: (value: ItemT, index: number) => void;
So I resolved it by adding a patch with below value
onValueChange?: (value: ItemT | undefined, index: number) => void;
Hope it will get fixed soon. Thanks for this library the output is great.
Hello @rajangargsmartdata
Thank you for finding solution for this, can you raise a PR with your patch fix?
I will resolve this issue once submitted.
Sure @rheng001 , I'll do this over the weekend and will raise the PR.
hi @rajangargsmartdata thanks, I have created PR for the same @rheng001, please review and merge the changes if require.
Thanks everyone released a new version with the fix here https://github.com/rheng001/react-native-wheel-scrollview-picker/pull/30