Flag Inversion
Flag inversion lets you flip a flag’s default value for specific native builds based on their bundle ID. This is useful when you have multiple app variants (e.g. internal vs. public) and want different default flag states per variant.
How it works
Section titled “How it works”The invertFor.bundleId matcher compares against the ios.bundleIdentifier and android.package values in your Expo config. If there’s a match, the flag value is inverted during expo prebuild.
Example
Section titled “Example”mergePath: src/constants/buildFlags.tsflags: internalTools: value: false invertFor: bundleId: - com.mycompany.app.internalWith this configuration:
| Build variant | Bundle ID | internalTools value |
|---|---|---|
| Public | com.mycompany.app | false (default) |
| Internal | com.mycompany.app.internal | true (inverted) |
The inversion happens at prebuild time when the Expo config plugin runs. It reads the bundle identifier from your Expo config and checks it against the bundleId list.
When to use this
Section titled “When to use this”- You maintain multiple app variants with different bundle identifiers
- Certain features should be on by default for internal builds but off for public builds (or vice versa)
- You want this to be declarative in
flags.ymlrather than managed through environment variables
- Inversion only applies during native builds via
expo prebuild. It does not affectbuild-flags overrideduring local development. Use the CLI+/-syntax to toggle flags locally. - Both iOS
bundleIdentifierand Androidpackageare checked.