react-native-wheel-scrollview-picker icon indicating copy to clipboard operation
react-native-wheel-scrollview-picker copied to clipboard

'ScrollPicker' cannot be used as a JSX component.

Open anniewey opened this issue 1 year ago • 2 comments

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)

anniewey avatar Jan 12 '24 08:01 anniewey

We're facing this issue too. Will follow to see if there is any resolution

GearoidCollins avatar Jan 12 '24 20:01 GearoidCollins

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.

tfuda avatar Feb 25 '24 15:02 tfuda

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.

rajangargsmartdata avatar Aug 29 '24 05:08 rajangargsmartdata

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.

rheng001 avatar Aug 29 '24 19:08 rheng001

Sure @rheng001 , I'll do this over the weekend and will raise the PR.

rajangargsmartdata avatar Aug 30 '24 10:08 rajangargsmartdata

hi @rajangargsmartdata thanks, I have created PR for the same @rheng001, please review and merge the changes if require.

thakkur avatar Sep 11 '24 10:09 thakkur

Thanks everyone released a new version with the fix here https://github.com/rheng001/react-native-wheel-scrollview-picker/pull/30

rheng001 avatar Sep 12 '24 04:09 rheng001