Hello,
I’m having 2 issues when converting my react-native/expo app to typescript. Searched google for help but no luck. First, I get a crash with Marker in typescript only. Works just fine in JS. I know my coords are properly set.
return (
<MapView
style={{ flex: 1 }}
provider={PROVIDER_GOOGLE}
initialRegion={{
latitude: this.props.curLoc.loc.coords.latitude,
longitude: this.props.curLoc.loc.coords.longitude,
latitudeDelta: 0.005,
longitudeDelta: 0.005,
}}
>
<Marker coordinate={this.props.curLoc.loc.coords} />
</MapView>
);
The error is:
Invariant Violation: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it’s defined in, or you might have mixed up default and named imports.
Second problem, I can’t find the types for TaskManager. I made my own but if some exists, I would rather use that,
My versions:
"dependencies": {
"@expo/samples": "2.1.1",
"expo": "^32.0.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-elements": "^1.1.0",
"react-navigation": "^3.0.9",
"react-redux": "^6.0.0",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@expo/vector-icons": "^8.1.0",
"@types/expo": "^32.0.13",
"@types/expo__vector-icons": "^9.0.1",
"@types/react-native": "^0.57.60",
"@types/react-redux": "^7.0.9",
"babel-preset-expo": "^5.0.0",
"jest-expo": "^32.0.0",
"typescript": "^3.5.1"
},
Cheers!