I am learning react native. i need to access to android and ios files so i can add maps to my app, but i cant find them!
i tried looking inside assets file, node modules
You’ve created your app with Expo
.
Expo
abstracts away the native code, meaning that you don’t have to deal with it. So this means that no matter how hard you look inside an Expo
app you won’t find any native code.
This can be beneficial if you don’t have access to a Mac for iOS development. It also means that you only need to write in Javascript and not worry about writing code in java or objective-c.
However, Expo
has access to maps in it. Check out MapView
it uses Apple and Google maps to display maps in your app, so you don’t need to add another dependency.
https://docs.expo.io/versions/v32.0.0/sdk/map-view/
It’s very straight forward to use. You don’t have to install anything you can just import from Expo
here is a sample
import React from 'react';
import { MapView } from 'expo';
export default class App extends React.Component {
render() {
return (
<MapView
style={{ flex: 1 }}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
/>
);
}
}
If you want to have access to the native code you either have to create your app using react-native init YourAppName
or you can eject your Expo
To eject your app run expo eject
in the terminal.
You can read more about it here : https://docs.expo.io/versions/latest/expokit/eject/
There are pros and cons for ejecting. But if you need access to native code then you will have to eject.