Various files, including the app entrypoints, build configurations or some other configuration files are created based on the templates from
Some of the values used by the file templates cannot be predefined as they depend on the plugin configuration resolved during the prebuild and are interpolated during the file generation. Interpolated variables are prefixed by ${{ and end with }}, everything between the characters is a case-sensitive variable name e.g.:
// Expects variable `packageId` to be present during file generation
package ${{packageId}}
If you're overwriting any of the templates please pay attention if the default template for the file uses any of the inerpolated values. Variables used in each template and their references can be found in the tables below
To overwrite any of the templates listed in the below tables create a .brownfield-templates directory at the root of your Expo project and make sure it includes the templates which you want to overwrite. The names of the overwritten templates have to exactly match the names of the original templates.
Note: .brownfield-templates supports both flat and per-platform directory structure:
# Flat structure
.brownfield-templates/
|__ ExpoApp.swift
|__ build.gradle.kts
# Per-platform structure
.brownfield-templates/
|__ ios/
|__ ExpoApp.swift
|__ android/
|__ build.gradle.kts
| File | Default template | Description | Interpolated variable |
|---|---|---|---|
| AndroidManifest.xml | AndroidManifest.xml | Simple Android manifest for the brownfield library | - |
| build.gradle.kts | build.gradle.kts | Gradle build settings for the brownfield library | ${{packageId}}, ${{groupId}}, ${{artifactId}} |
| consumer-rules.pro | consumer-rules.pro | Empty consumer-rules file | - |
| proguard-rules.pro | proguard-rules.pro | Default set of Proguard rules for the brownfield library | - |
| ReactNativeHostManager.kt | ReactNativeHostManager.kt | React Native host manager used to initialize and intergrate RN app with the native app lifecycle | ${{packageId}} |
| ReactNativeViewFactory.kt | ReactNativeViewFactory.kt | React Native view factory used to create views hosting the React Native app | ${{packageId}} |
| ReactNativeFragment.kt | ReactNativeFragment.kt | Android fragment used to display the React Native app | ${{packageId}} |
| Variable | Description | Example value |
|---|---|---|
| packageId | Java/Kotlin package identifier. Aligned with the directory structure of the brownfield library | com.swmansion.brownfield-project.brownfield |
| groupId | Package identifier stripped of the last component. Used for publihsing artifacts to Maven | com.swmansion.brownfield-project |
| artifactId | Artifact identifier. Last component of the package identifier. Used for publihsing artifacts to Maven | brownfield |
| File | Default template | Description | Interpolated variable |
|---|---|---|---|
| ExpoApp.swift | ExpoApp.swift | React Native host manager used to initialize and integrate RN app with the native app lifecycle. Also used for loading the view hosting the React Native app | - |
| Info.plist | Info.plist | Contains native target metadata and settings. Required by Xcode | ${{bundleIdentifier}}, ${{targetName}} |
| patch-expo.sh | patch-expo.sh | Script embedded within the build steps of the brownfield target. Used to patch Expo Modules | ${{projectName}}, ${{targetName}} |
| ReactNativeView.swift | ReactNativeView.swift | Brownfield entrypoint for SwiftUI apps | - |
| <target-name>.entitlements | Target.entitlements | The .entitlements configuration file for the brownfield target. The name is dynamically set to match the brownfield target name |
- |
| ReactNativeViewController.swift | ReactNativeViewController.swift | View controller for rendering React Native app in a UIKit application | - |
| Variable | Description | Example value |
|---|---|---|
| bundleIdentifier | Bundle identifier of the native target for brownfield | com.swmansion.brownfield-project.brownfield |
| targetName | The name of the native target, scheme and directory for the brownfield framework | MyBrownfield |
| projectName | The name of the native project | brownfieldproject |