Closed Farzin-Firoozi closed 2 months ago
The only workaround I found was to do this: Replace this
import IonIcon from 'react-native-vector-icons/IonIcons';
With this
const IonIcon = require('react-native-vector-icons/IonIcons').default as React.ElementType;
Any updates on this? @oblador
@Farzin-Firoozi @JimTeva Can you provide a reproducible sample repository? I can't duplicate this.
hi, Is this issue fixed?
I also have the same type error.
I fixed it with:
import _IonIcon from 'react-native-vector-icons/Ionicons';
const IonIcon = _IonIcon as React.ElementType;
@hieuminh1810 @ShivamJoker Can you provide a sample repo with this issue? I haven't been able to replicate it.
@johnf you can checkout my repo - https://github.com/ShivamJoker/SQL-Play/blob/d025925b29f119627a698bcd122e7ff9ba46e81b/src/component/ShortcutsBar.tsx#L4
I am not sure if tsconfig needs to be updated.
I experienced the same thing, it's gotta do something with @types/react.
I tried to remove node_module, yarn.lock. then update "@types/react": "18.2.39", "@types/react-native": "^0.72.7" and it work
This is a mismatch between various @types/react
versions installed by various packages.
I'm using yarn 3 and I was able to fix it by running yarn dedupe
@andreialecu has nailed this, please reopen if that doesn't solve it
In my case yarn
already executes yarn dedupe
automatically so that didn't solve the problem.
What solved the problem for me was forcing the resolution in my package.json
like so:
"resolutions": {
"@types/react": "18.2.45"
}
same for me and yarn dedupe
doesnt help
I tried to remove node_module, yarn.lock. then update "@types/react": "18.2.39", "@types/react-native": "^0.72.7" and it work
This works like a charm ✨❤️
Environment
This issue happens in code. here's an screenshot:
Description
After upgrading RN to version
0.72.5
this issue happened. here's mypackage.json
: