This project provides a collection of custom Expo config plugins to integrate Google Maps, React Native Firebase, and additional Android permissions (such as usesClearTextTraffic
) into an Expo-managed project.
Expo Config Plugins enable you to customize and extend the native behavior of an Expo project without ejecting. These plugins automatically modify native files during the build process, allowing you to integrate native modules that require additional configurations.
- Google Maps Integration
- Camera uses-feature on Android
- Enabling usesClearTextTraffic (Android)
To use these plugins in your Expo project, follow the steps below:
You need to install Expo config plugins to utilize the custom plugins.
npm install expo-config-plugins
In your project's app.json
or app.config.js
, add the respective plugin configurations:
{
"expo": {
"plugins": [
[
"@osenco/expo-config-plugins/lib/with-google-maps",
{
"apiKey": "YOUR_GOOGLE_MAPS_API_KEY"
}
]
]
}
}
Replace YOUR_GOOGLE_MAPS_API_KEY
with your actual Google Maps API key.
{
"expo": {
"plugins": [
"expo-config-plugins/lib/with-react-native-firebase"
]
}
}
{
"expo": {
"plugins": [
"expo-config-plugins/lib/with-uses-cleartext-traffic"
]
}
}
This will allow Android apps to use cleartext network traffic.
Once the plugins are added to your configuration, Expo will automatically apply the necessary changes to the native project files during the build process.
After setting up the configuration, run the following command to build your app:
eas build -p android|ios
This will generate and modify the native files required for the integrations to work.
- iOS: Adds Google Maps dependencies to the
Podfile
and updatesAppDelegate.mm
to configure the API key. - Android: Adds the Google Maps API key to the
AndroidManifest.xml
.
- iOS: Configures Firebase to be used as a static framework and modifies
AppDelegate.mm
to initialize Firebase.
Note: The Android configuration for Firebase has been commented out in the code. You can enable it by uncommenting the relevant parts in
src/with-react-native-firebase.ts
if needed.
- Android: Enables cleartext traffic by setting
android:usesCleartextTraffic
totrue
in theAndroidManifest.xml
.
You can modify these plugins to fit your own project needs. Each plugin is located in the src
directory:
- Google Maps:
src/with-google-maps.ts
- React Native Firebase:
src/with-react-native-firebase.ts
- Cleartext Traffic:
src/with-uses-cleartext-traffic.ts
If you need to further customize the way the plugins modify native files, you can adjust the mergeContentsAndSaveAsync
utility and the plugin logic directly.
This project is licensed under the MIT License.