0

Regarding react-native + expo, I would like to use latest @type/react in order to resolve typing issues (i.e. 'MaterialIcons' cannot be used as a JSX component), but expo start always require I install the typescript libraries and then proceeds to insist they be an older version (17.0.21). Why? How can I either ignore this behaviour (btw. answering with 'n' ends the startup and directs to either install the typescript requirements or clean the config of typescript refs -- ok expo thanks for nothing!)

The problem that I was resolving with @types/react is detailed here: 'Stack.Navigator' cannot be used as a JSX component

Adam Cox
  • 3,341
  • 1
  • 36
  • 46

2 Answers2

0

update to "@types/react": "~18.0.12" ( fix for eslint ) but you cant run project

hatajie
  • 31
  • 1
  • 4
0

Bumped into this and after some research I found this github comment from the expo repo. Which made think about this resolutions fix.

In my yarn.lock I have two versions 17.0.21 and 17.0.47, and in my package.json I point to 17.0.21

resolutions": {
    "@types/react": "~17.0.21"
  },
  • Ran yarn once again
  • Opened the VSCode Command Palette -> Typescript: Reload project

No problems with eslint and was able to run the project.

carlos-ss
  • 11
  • 2