Conversation
…nto feat/brownie-android
.changeset/funky-hairs-change.md
Outdated
| '@callstack/brownie': minor | ||
| '@callstack/brownfield-cli': minor |
There was a problem hiding this comment.
Should we go with a major release instead? However, then it will not align with react-native-brownfield version as that would still be v3
There was a problem hiding this comment.
We can do it in a point release, no need for major (it’s a new thing). Should align
There was a problem hiding this comment.
Bumped all minors to align.
There was a problem hiding this comment.
Pull request overview
Adds Android support to the @callstack/brownie package by introducing an Android runtime (Kotlin facade + JNI bridge) and updating CLI/docs/examples so stores can be used from Kotlin as well as Swift/JS.
Changes:
- Enable Kotlin codegen (and default to Swift + Kotlin generation) in the CLI.
- Add
packages/brownie/androidimplementation: KotlinStore/StoreManager, JNI bridge, and RN TurboModule package/module. - Update docs and example apps to show Android usage and wire up counters.
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/brownie/commands/codegen.ts | Default codegen now targets Swift + Kotlin. |
| packages/brownie/react-native.config.js | Removes Android-disable config to allow autolinking. |
| packages/brownie/package.json | Publishes Android sources in npm package and excludes Android build artifacts. |
| packages/brownie/cpp/BrownieStore.cpp | Calls change callback outside mutex to reduce lock contention. |
| packages/brownie/android/src/main/java/com/callstack/brownie/StoreManager.kt | Adds process-wide store registry for Kotlin stores. |
| packages/brownie/android/src/main/java/com/callstack/brownie/Store.kt | Adds Kotlin typed store wrapper syncing with native snapshot + subscriptions. |
| packages/brownie/android/src/main/java/com/callstack/brownie/BrownieStoreRegistration.kt | Adds registration helpers including “register once” convenience API. |
| packages/brownie/android/src/main/java/com/callstack/brownie/BrownieStoreDefinition.kt | Adds serializer/definition APIs with Gson default implementation. |
| packages/brownie/android/src/main/java/com/callstack/brownie/BrownieStoreBridge.kt | Adds Kotlin/JNI bridge to C++ runtime and change listener fanout. |
| packages/brownie/android/src/main/java/com/callstack/brownie/BrowniePackage.kt | Registers Android TurboModule package. |
| packages/brownie/android/src/main/java/com/callstack/brownie/BrownieModule.kt | Android TurboModule: installs JSI + forwards store-change events to JS. |
| packages/brownie/android/src/main/cpp/JNIBrownieStoreBridge.cpp | JNI glue for store operations + store-change emission into Kotlin. |
| packages/brownie/android/src/main/cpp/CMakeLists.txt | Builds Android libbrownie.so and links ReactAndroid/fbjni/folly. |
| packages/brownie/android/src/main/AndroidManifest.xml | Declares Android package manifest for the library. |
| packages/brownie/android/build.gradle | Android library Gradle config (SDKs, CMake, dependencies). |
| packages/brownie/.gitignore | Ignores Android build output for the package. |
| docs/docs/docs/api-reference/brownie/swift-usage.mdx | Updates Swift page to link to separate Android docs. |
| docs/docs/docs/api-reference/brownie/overview.mdx | Marks Android as supported and links Android usage docs. |
| docs/docs/docs/api-reference/brownie/getting-started.mdx | Adds Android setup + packaging/publishing steps. |
| docs/docs/docs/api-reference/brownie/android-usage.mdx | New Android API guide (easy + advanced serialization paths). |
| docs/docs/docs/api-reference/brownie/_meta.json | Adds Android usage page to docs nav. |
| apps/RNApp/src/components/counter/index.tsx | Switches to shared counter using useStore and an increment button. |
| apps/RNApp/src/components/counter/index.ios.tsx | Removes iOS-specific counter component (now shared). |
| apps/RNApp/package.json | Adds Brownie Kotlin codegen config. |
| apps/ExpoApp/package.json | Adds Brownie Kotlin codegen config. |
| apps/ExpoApp/components/counter/index.tsx | Switches to shared counter using useStore and an increment button. |
| apps/ExpoApp/components/counter/index.ios.tsx | Removes iOS-specific counter component (now shared). |
| apps/AndroidApp/app/src/vanilla/java/com/callstack/brownfield/android/example/BrownfieldStore.kt | Adds typealiases to generated store types for the vanilla flavor. |
| apps/AndroidApp/app/src/main/java/com/callstack/brownfield/android/example/components/GreetingCard.kt | Wires Compose UI to Brownie store updates and increment action. |
| apps/AndroidApp/app/src/main/java/com/callstack/brownfield/android/example/MainActivity.kt | Registers store once during app startup. |
| apps/AndroidApp/app/src/expo/java/com/callstack/brownfield/android/example/BrownfieldStore.kt | Adds typealiases to generated store types for the expo flavor. |
| apps/AndroidApp/app/build.gradle.kts | Bumps JVM target to 17 and adds Gson dependency. |
| .changeset/red-llamas-love.md | Publishes minor bumps for impacted packages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/brownie/android/src/main/java/com/callstack/brownie/BrownieStoreRegistration.kt
Outdated
Show resolved
Hide resolved
packages/brownie/android/src/main/java/com/callstack/brownie/StoreManager.kt
Show resolved
Hide resolved
packages/brownie/android/src/main/java/com/callstack/brownie/BrownieStoreBridge.kt
Show resolved
Hide resolved
packages/brownie/android/src/main/java/com/callstack/brownie/BrowniePackage.kt
Show resolved
Hide resolved
artus9033
left a comment
There was a problem hiding this comment.
LGTM! We can address full reuse of the C++ code in CXX modules in the future, as discussed
Summary
This adds support for android to the
browniepackage. The usage is as simple as after creating thebrownfieldstore.brownie.ts:Test plan
Screen.Recording.2026-02-26.at.5.18.47.PM.mov