picker icon indicating copy to clipboard operation
picker copied to clipboard

Support React 18 Types

Open Tony-Starkus opened this issue 2 years ago • 12 comments

So, after upgrading my React Native project to version 0.69.1 with React 18, the component Picker.Item started raise error.

'Picker.Item' cannot be used as a JSX component.
  Its element type 'ReactElement<any, any> | Component<PickerItemProps<T>, any, any> | null' is not a valid JSX element.
    Type 'Component<PickerItemProps<T>, any, any>' is not assignable to type 'Element | ElementClass | null'.
      Type 'Component<PickerItemProps<T>, any, any>' is not assignable to type 'ElementClass'.
        The types returned by 'render()' are incompatible between these types.
          Type 'React.ReactNode' is not assignable to type 'import("/home/thalisson/Documents/Git/CryptoView/frontend/node_modules/@types/styled-components/node_modules/@types/react/index").ReactNode'.ts(2786)

Tony-Starkus avatar Jul 16 '22 16:07 Tony-Starkus

This one is pretty critical as Expo 46 upgraded to a react-native version without its own picker, but also needs React 18 so you can't install react-native-picker/picker.

jameswilddev avatar Sep 02 '22 11:09 jameswilddev

bump, how is this one going? tried to use npm i --force but bound to meet with further issues ahead

serfgy avatar Sep 19 '22 07:09 serfgy

Same. Updated to Expo 46 and get peer dependency issues with the test renderer.

Borduhh avatar Sep 23 '22 20:09 Borduhh

looks really nice but wont install with latest version of expo installed w/ React 18.

xpario avatar Oct 18 '22 18:10 xpario

just to share my workaround, am using expo 46

in my package.json i used npm 8 new function 'overrides'

"overrides": { "@react-native-picker/picker": { "react-native-webview": "^11.23.0" }, },

installation and runtime turned out fine

serfgy avatar Oct 19 '22 01:10 serfgy

Can i pay someone to please fix this? We have wasted a week trying to build our own picker for expo 46.

xpario avatar Oct 22 '22 16:10 xpario

I'm having the same issue. Any estimate when this might get fixed?

juanoi avatar Oct 24 '22 19:10 juanoi

@xpario

  • Uninstall the library
  • Reinstall it with the command 'npm install @react-native-picker/picker --legacy-peer-deps'

This will allow you to continue using this lib while they're updating it to React 18. Keep in mind that you'll need to add this flag everytime you 'npm install' because it will need to be reminded that this library should be allowed to use React 17.

MaxwellDG avatar Oct 26 '22 16:10 MaxwellDG

just to share my workaround, am using expo 46

in my package.json i used npm 8 new function 'overrides'

"overrides": { "@react-native-picker/picker": { "react-native-webview": "^11.23.0" }, },

installation and runtime turned out fine

This isn't working for me.

parK-dev avatar Oct 27 '22 01:10 parK-dev

Any update on this?

sungsong88 avatar Oct 28 '22 07:10 sungsong88

I was having a similar issue with my project and i find the following solution with help of my terminal:

Some dependencies are incompatible with the installed expo version: @react-native-picker/[email protected] - expected version: 2.4.2 Your project may not work correctly until you install the correct versions of the packages. Install individual packages by running npx expo install @react-native-picker/[email protected]

However the npx expo install @react-native-picker/[email protected] wouldn't solve. I manage to find the solution via another issue page thanks to @amandeepmittal. Here

Writing this has solved my problem: npm install @react-native-picker/[email protected] --legacy-peer-deps

emirhansemercioglu avatar Oct 30 '22 17:10 emirhansemercioglu

You can add it in a .npmrc file that will be used during the build by Expo, with the following : legacy-peer-deps=true

YoannBuzenet avatar Oct 31 '22 08:10 YoannBuzenet