Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-trains-track.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@callstack/react-native-brownfield': patch
---

fix: publish dependencies of community libraries (e.g. react-native-screens, lottie-react-native) embedded in Expo brownfield AARs; the published POM now lists them, previously host apps could crash with NoClassDefFoundError
1 change: 1 addition & 0 deletions apps/ExpoApp57/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"expo-system-ui": "~57.0.0",
"expo-updates": "^57.0.6",
"expo-web-browser": "~57.0.0",
"lottie-react-native": "~7.3.8",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-native": "0.86.0",
Expand Down
7 changes: 7 additions & 0 deletions apps/ExpoApp57/src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Device from 'expo-device';
import LottieView from 'lottie-react-native';
import { Button, Platform, StyleSheet } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { brownfieldE2ETestIds } from '@callstack/brownfield-example-shared-tests/e2eTestIds';
Expand Down Expand Up @@ -37,6 +38,12 @@ export default function HomeScreen() {
style={styles.container}
>
<SafeAreaView style={styles.safeArea}>
{/* Community library with its own Android dependency: the host crashes if it's missing from the POM. */}
<LottieView
source={{ v: '5.7.4', fr: 30, ip: 0, op: 1, w: 1, h: 1, layers: [] }}
style={{ position: 'absolute', width: 1, height: 1 }}
/>

<ThemedView style={styles.heroSection}>
<AnimatedIcon />
<ThemedText
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/docs/guides/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The brownfield Gradle plugin adds both directories to the source sets, potential

Installed third-party packages like `react-native-screens` or others may rely on transitive dependencies in their `build.gradle` file. For bare React Native apps, `brownfield-gradle-plugin` auto resolves these by default via the (experimental) `experimentalIncludeTransitiveDependencies` option — see [Configure Maven Publishing](/docs/getting-started/android#6-configure-maven-publishing) for details.

For Expo apps, this works out of the box unconditionally.
For Expo apps, dependencies of Expo modules are always resolved, and dependencies of other native libraries follow the same `experimentalIncludeTransitiveDependencies` option.

Upgrading an existing app requires no changes on your side — in particular, you do not need to remove the hand-written `tasks.register("removeDependenciesFromModuleFile")` block if you have one, since the plugin's own task is named differently and the two do not conflict. Be aware of two behaviour changes once this is enabled: dependencies your embedded modules need will start appearing in the published POM, and a version you pinned yourself may be **raised** (never lowered) if an embedded module requires a higher one.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ class RNBrownfieldPlugin : Plugin<Project> {
}
transitiveDeps.addAll(expoTransitiveDeps)
}
// Never on Expo: the path above already covers every embedded module there, and the RNC
// discoverer doesn't filter by the Expo blacklist, so running both leaks Expo coordinates.
if (!isExpoProject && extension.experimentalIncludeTransitiveDependencies) {
// Also on Expo: the path above only covers Expo modules, not community libraries.
if (extension.experimentalIncludeTransitiveDependencies) {
val rncDiscovery = RncTransitiveDependencyDiscoverer(project).discover(artifacts)
Logging.log(
"Merged ${rncDiscovery.dependencies.size} transitive dependencies discovered by the RNC discoverer",
Expand All @@ -134,7 +133,8 @@ class RNBrownfieldPlugin : Plugin<Project> {
// (replacing a stale entry) and so must not be dropped here.
val hardExcludePredicate: (String, String) -> Boolean = { groupId, artifactId ->
(expoPublishingHelper?.shouldExcludeDependency(groupId, artifactId) ?: (groupId == project.rootProject.name)) ||
artifacts.any { it.moduleGroup == groupId && it.moduleName == artifactId }
artifacts.any { it.moduleGroup == groupId && it.moduleName == artifactId } ||
expoProjects.any { it.publication?.groupId == groupId && it.publication?.artifactId == artifactId }
}
dropHardExcludedDependencies(transitiveDeps, hardExcludePredicate)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ open class Extension {
* Whether to publish embedded native modules' third-party dependencies into the generated POM
* and Gradle Module Metadata, so consuming apps resolve them instead of declaring them by hand.
*
* Experimental; behavior may still change. Applies to non-Expo (RNC CLI) projects only — Expo
* gets this unconditionally. Set to `false` to hand-declare them instead.
* Experimental; behavior may still change. On Expo projects, Expo modules' dependencies are
* published regardless; this covers the other native modules. Set to `false` to hand-declare them instead.
*
* Default is `true`.
*/
Expand Down
18 changes: 18 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,7 @@ __metadata:
expo-system-ui: "npm:~57.0.0"
expo-updates: "npm:^57.0.6"
expo-web-browser: "npm:~57.0.0"
lottie-react-native: "npm:~7.3.8"
react: "npm:19.2.3"
react-dom: "npm:19.2.3"
react-native: "npm:0.86.0"
Expand Down Expand Up @@ -16152,6 +16153,23 @@ __metadata:
languageName: node
linkType: hard

"lottie-react-native@npm:~7.3.8":
version: 7.3.8
resolution: "lottie-react-native@npm:7.3.8"
peerDependencies:
"@lottiefiles/dotlottie-react": ^0.13.5
react: "*"
react-native: ">=0.46"
react-native-windows: ">=0.63.x"
peerDependenciesMeta:
"@lottiefiles/dotlottie-react":
optional: true
react-native-windows:
optional: true
checksum: 10/050154a675de4aeff10d629ca48743806818ebe4c79d041e0983ff278a59e2d59f4e88b559a6d681e49d7d82b253ad969909d9cde9a887bc22c8a2ebf05c2538
languageName: node
linkType: hard

"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0":
version: 10.4.3
resolution: "lru-cache@npm:10.4.3"
Expand Down
Loading