Skip to content

Commit 1c0b49a

Browse files
committed
fix(docs): update documentation
1 parent a391a59 commit 1c0b49a

File tree

10 files changed

+95
-58
lines changed

10 files changed

+95
-58
lines changed

docs/docs/docs/api-reference/brownfield-navigation.mdx/javascript-usage.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Rerun codegen if any of these change:
4848
- Method return types
4949

5050
```bash
51-
yarn brownfield:navigation-codegen
51+
npx brownfield navigation:codegen
5252
```
5353

5454
## Common errors

docs/docs/docs/api-reference/brownie/codegen.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ The generated struct:
5454
- Conforms to `BrownieStoreProtocol` with auto-generated `storeName`
5555
- Uses mutable `var` properties
5656

57-
5857
## How It Works
5958

6059
1. CLI recursively finds all `*.brownie.ts` files

docs/docs/docs/api-reference/react-native-brownfield/java.mdx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,11 @@ ReactNativeBrownfield.getShared()
158158

159159
Creates a React Native view with a given module name. It automatically uses an instance of React Native created in `initialize` method. This is useful when embedding React Native views directly in your native layouts.
160160

161-
| Param | Required | Type | Description |
162-
| ------------- | -------- | ------------------ | ---------------------------------------------------------- |
163-
| context | Yes | `Context` | Android context to create the view |
164-
| activity | No | `FragmentActivity` | Activity hosting the view, used for lifecycle management |
165-
| moduleName | Yes | `String` | Name of React Native component registered to `AppRegistry` |
166-
| launchOptions | No | `Bundle` | Initial properties to be passed to React Native component |
161+
| Param | Required | Type | Description |
162+
| ------------- | -------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
163+
| activity | No | `FragmentActivity` | Activity hosting the view, used for lifecycle management. Required for proper lifecycle; may be null only when using a custom `ReactDelegateWrapper`. |
164+
| moduleName | Yes | `String` | Name of React Native component registered to `AppRegistry` |
165+
| launchOptions | No | `Bundle` | Initial properties to be passed to React Native component |
167166

168167
Returns: `FrameLayout` - A view containing the React Native component.
169168

@@ -172,13 +171,25 @@ Returns: `FrameLayout` - A view containing the React Native component.
172171
```java
173172
// In a Fragment or Activity
174173
FrameLayout reactView = ReactNativeBrownfield.getShared().createView(
175-
context,
176174
activity,
177175
"ReactNative"
178176
);
179177
container.addView(reactView);
180178
```
181179

180+
```java
181+
// With initial properties
182+
Bundle props = new Bundle();
183+
props.putInt("score", 12);
184+
FrameLayout reactView = ReactNativeBrownfield.getShared().createView(
185+
activity,
186+
"ReactNative",
187+
null,
188+
props
189+
);
190+
container.addView(reactView);
191+
```
192+
182193
##### `postMessage`
183194

184195
Send a JSON string to the React Native JS layer. The message is delivered as a `brownfieldMessage` DeviceEventEmitter event and can be received using `ReactNativeBrownfield.onMessage()` on the JS side.

docs/docs/docs/api-reference/react-native-brownfield/javascript.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ ReactNativeBrownfield.setNativeBackGestureAndButtonEnabled(true);
3737
A method to pop to native screen used to push React Native experience.
3838

3939
```ts
40-
ReactNativeBrownfield.popToNative(animated: boolean);
40+
ReactNativeBrownfield.popToNative(animated?: boolean);
4141
```
4242

4343
**Parameters:**
4444

45-
| Param | Type | Description |
46-
| -------- | --------- | -------------------------------------------- |
47-
| animated | `boolean` | Whether to animate the transition (iOS only) |
45+
| Param | Type | Description |
46+
| -------- | --------- | --------------------------------------------------------------------------------------- |
47+
| animated | `boolean` | Optional. Whether to animate the transition (iOS only). Defaults to `false` on Android. |
4848

4949
**Example:**
5050

docs/docs/docs/api-reference/react-native-brownfield/kotlin.mdx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,11 @@ ReactNativeBrownfield.shared
137137

138138
Creates a React Native view with a given module name. It automatically uses an instance of React Native created in `initialize` method. This is useful when embedding React Native views directly in your native layouts or Jetpack Compose UI.
139139

140-
| Param | Required | Type | Description |
141-
| ------------- | -------- | ------------------ | ---------------------------------------------------------- |
142-
| context | Yes | `Context` | Android context to create the view |
143-
| activity | No | `FragmentActivity` | Activity hosting the view, used for lifecycle management |
144-
| moduleName | Yes | `String` | Name of React Native component registered to `AppRegistry` |
145-
| launchOptions | No | `Bundle` | Initial properties to be passed to React Native component |
140+
| Param | Required | Type | Description |
141+
| ------------- | -------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
142+
| activity | No | `FragmentActivity` | Activity hosting the view, used for lifecycle management. Required for proper lifecycle; may be null only when using a custom `ReactDelegateWrapper`. |
143+
| moduleName | Yes | `String` | Name of React Native component registered to `AppRegistry` |
144+
| launchOptions | No | `Bundle` | Initial properties to be passed to React Native component |
146145

147146
Returns: `FrameLayout` - A view containing the React Native component.
148147

@@ -151,18 +150,28 @@ Returns: `FrameLayout` - A view containing the React Native component.
151150
```kotlin
152151
// In a Fragment or Activity
153152
val reactView = ReactNativeBrownfield.shared.createView(
154-
context,
155153
activity,
156154
"ReactNative"
157155
)
158156
container.addView(reactView)
159157
```
160158

159+
```kotlin
160+
// With initial properties
161+
val props = Bundle().apply { putInt("score", 12) }
162+
val reactView = ReactNativeBrownfield.shared.createView(
163+
activity,
164+
"ReactNative",
165+
launchOptions = props
166+
)
167+
container.addView(reactView)
168+
```
169+
161170
```kotlin
162171
// With Jetpack Compose
163172
AndroidView(
164-
factory = { context ->
165-
ReactNativeBrownfield.shared.createView(context, fragmentActivity, "ReactNative")
173+
factory = {
174+
ReactNativeBrownfield.shared.createView(fragmentActivity, "ReactNative")
166175
},
167176
modifier = Modifier.fillMaxSize()
168177
)

docs/docs/docs/api-reference/react-native-brownfield/objective-c.mdx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ A singleton that keeps an instance of `ReactNativeBrownfield` object.
2828

2929
#### Properties
3030

31-
| Property | Type | Default | Description |
32-
| ------------------ | ---------- | --------------- | --------------------------------------------------------- |
33-
| `entryFile` | `NSString` | `index` | Path to JavaScript root. |
34-
| `fallbackResource` | `NSString` | `nil` | Path to bundle fallback resource. |
35-
| `bundlePath` | `NSString` | `main.jsbundle` | Path to bundle fallback resource. |
36-
| `bundle` | `NSBundle` | `Bundle.main` | Bundle instance to lookup the JavaScript bundle resource. |
31+
| Property | Type | Default | Description |
32+
| ------------------- | ------------------ | --------------- | ------------------------------------------------------------------------------ |
33+
| `entryFile` | `NSString` | `index` | Path to JavaScript root. |
34+
| `bundlePath` | `NSString` | `main.jsbundle` | Path to JavaScript bundle file. |
35+
| `bundle` | `NSBundle` | `Bundle.main` | Bundle instance to lookup the JavaScript bundle resource. |
36+
| `bundleURLOverride` | `NSURL *(^)(void)` | `nil` | Dynamic bundle URL provider. When set, overrides default bundle load behavior. |
3737

3838
---
3939

@@ -43,10 +43,9 @@ A singleton that keeps an instance of `ReactNativeBrownfield` object.
4343

4444
Starts React Native, produces an instance of React Native. You can use it to initialize React Native in your app.
4545

46-
| Param | Required | Type | Description |
47-
| ---------------- | -------- | --------------- | -------------------------------------------------- |
48-
| `onBundleLoaded` | No | `void(^)(void)` | Callback invoked after JS bundle is fully loaded. |
49-
| `launchOptions` | No | `NSDictionary` | Launch options, typically passed from AppDelegate. |
46+
| Param | Required | Type | Description |
47+
| ---------------- | -------- | --------------- | ------------------------------------------------- |
48+
| `onBundleLoaded` | No | `void(^)(void)` | Callback invoked after JS bundle is fully loaded. |
5049

5150
**Examples:**
5251

@@ -60,12 +59,6 @@ Starts React Native, produces an instance of React Native. You can use it to ini
6059
}];
6160
```
6261
63-
```objc
64-
[[ReactNativeBrownfield shared] startReactNative:^(void){
65-
NSLog(@"React Native started");
66-
}, launchOptions];
67-
```
68-
6962
##### `view`
7063
7164
Creates a React Native view for the specified module name.
@@ -82,6 +75,17 @@ Creates a React Native view for the specified module name.
8275
UIView *view = [[ReactNativeBrownfield shared] viewWithModuleName:@"ReactNative" initialProps:@{@"score": @12}];
8376
```
8477

78+
##### `application:didFinishLaunchingWithOptions:`
79+
80+
Mirrors the host runtime app delegate API. Call this from your `AppDelegate` if you need to forward launch options to the brownfield runtime (e.g. when using Expo).
81+
82+
| Param | Required | Type | Description |
83+
| --------------- | -------- | ----------------- | -------------------------- |
84+
| `application` | Yes | `UIApplication *` | The application instance. |
85+
| `launchOptions` | No | `NSDictionary *` | Launch options dictionary. |
86+
87+
Returns: `BOOL` – return value is passed through from the runtime.
88+
8589
##### `postMessage`
8690

8791
Send a JSON string to the React Native JS layer. The message is delivered as a `brownfieldMessage` DeviceEventEmitter event.

docs/docs/docs/api-reference/react-native-brownfield/swift.mdx

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ ReactNativeBrownfield.shared
3131
| Property | Type | Default | Description |
3232
| ------------------- | --------------- | --------------- | ---------------------------------------------------------------------------------------------- |
3333
| `entryFile` | `String` | `index` | Path to JavaScript root. |
34-
| `fallbackResource` | `String?` | `nil` | Path to bundle fallback resource. |
35-
| `bundlePath` | `String` | `main.jsbundle` | Path to bundle fallback resource. |
34+
| `bundlePath` | `String` | `main.jsbundle` | Path to JavaScript bundle file. |
3635
| `bundle` | `Bundle` | `Bundle.main` | Bundle instance to lookup the JavaScript bundle resource. |
3736
| `bundleURLOverride` | `(() -> URL?)?` | `nil` | Dynamic bundle URL provider called on every bundle load. When set, overrides default behavior. |
3837

@@ -44,10 +43,9 @@ ReactNativeBrownfield.shared
4443

4544
Starts React Native. You can use it to initialize React Native in your app.
4645

47-
| Param | Required | Type | Description |
48-
| ---------------- | -------- | --------------------- | -------------------------------------------------- |
49-
| `onBundleLoaded` | No | `(() -> Void)?` | Callback invoked after JS bundle is fully loaded. |
50-
| `launchOptions` | No | `[AnyHashable: Any]?` | Launch options, typically passed from AppDelegate. |
46+
| Param | Required | Type | Description |
47+
| ---------------- | -------- | --------------- | ------------------------------------------------- |
48+
| `onBundleLoaded` | No | `(() -> Void)?` | Callback invoked after JS bundle is fully loaded. |
5149

5250
**Examples:**
5351

@@ -61,12 +59,6 @@ ReactNativeBrownfield.shared.startReactNative(onBundleLoaded: {
6159
})
6260
```
6361

64-
```swift
65-
ReactNativeBrownfield.shared.startReactNative(onBundleLoaded: {
66-
print("React Native started")
67-
}, launchOptions: launchOptions)
68-
```
69-
7062
##### `view`
7163

7264
Creates a React Native view for the specified module name.
@@ -105,6 +97,29 @@ let json = try! JSONSerialization.data(withJSONObject: payload)
10597
ReactNativeBrownfield.shared.postMessage(String(data: json, encoding: .utf8)!)
10698
```
10799

100+
##### `application(_:didFinishLaunchingWithOptions:)`
101+
102+
Mirrors the host runtime app delegate API. Call this from your `AppDelegate` if you need to forward `application(_:didFinishLaunchingWithOptions:)` to the brownfield runtime (e.g. when using Expo).
103+
104+
| Param | Required | Type | Description |
105+
| --------------- | -------- | ---------------------------------------- | -------------------------- |
106+
| `application` | Yes | `UIApplication` | The application instance. |
107+
| `launchOptions` | No | `[UIApplication.LaunchOptionsKey: Any]?` | Launch options dictionary. |
108+
109+
Returns: `Bool` – return value is passed through from the runtime.
110+
111+
**Example:**
112+
113+
```swift
114+
func application(
115+
_ application: UIApplication,
116+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
117+
) -> Bool {
118+
ReactNativeBrownfield.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
119+
return true
120+
}
121+
```
122+
108123
##### `onMessage`
109124

110125
Subscribe to messages sent from JavaScript via `ReactNativeBrownfield.postMessage()`. Returns an observer token that can be used to unsubscribe.

docs/docs/docs/contributing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Contributing
22

33
Checkout project's [CONTRIBUTING.md](https://github.com/callstack/react-native-brownfield/blob/main/CONTRIBUTING.md) for more information.
4-

docs/docs/docs/getting-started/quick-start.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ The **Brownfield CLI automates all of this** with simple commands.
5353

5454
### What does it do?
5555

56-
| Command | Platform | Output |
57-
| ----------------------- | -------- | ---------------------------------------------------------------------------------------------------- |
58-
| **`package:ios`** | iOS | Creates an XCFramework containing your React Native app, Hermes runtime, and all native dependencies |
59-
| **`package:android`** | Android | Creates a Fat-AAR containing your React Native app bundled with all native dependencies |
60-
| **`publish:android`** | Android | Publishes the AAR to your local Maven repository for easy consumption |
56+
| Command | Platform | Output |
57+
| --------------------- | -------- | ---------------------------------------------------------------------------------------------------- |
58+
| **`package:ios`** | iOS | Creates an XCFramework containing your React Native app, Hermes runtime, and all native dependencies |
59+
| **`package:android`** | Android | Creates a Fat-AAR containing your React Native app bundled with all native dependencies |
60+
| **`publish:android`** | Android | Publishes the AAR to your local Maven repository for easy consumption |
6161

6262
### How does it make integration easier?
6363

docs/docs/docs/guides/troubleshooting.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ This section provides a troubleshooting guide for common issues encountered when
44

55
## [Android] `Error: duplicate resources` during `:app:mergeReleaseAssets`
66

7-
An error like `Error: duplicate resources` during the `:app:mergeReleaseAssets` phase may occur if you have upgraded your React Native version from a version less than `0.82.0`, to a version greater than or equal to (>=) `0.82.0`.
7+
An error like `Error: duplicate resources` during the `:app:mergeReleaseAssets` phase may occur if you have upgraded your React Native version from a version less than `0.82.0`, to a version greater than or equal to (>=) `0.82.0`.
88

9-
This is because RN 0.82.0 changed the path to which the JS bundle is written to from `build/generated/assets/createBundleReleaseJsAndAssets/` to `build/generated/assets/react/release/`, and analogously changed the path for `res/createBundleReleaseJsAndAssets/`.
9+
This is because RN 0.82.0 changed the path to which the JS bundle is written to from `build/generated/assets/createBundleReleaseJsAndAssets/` to `build/generated/assets/react/release/`, and analogously changed the path for `res/createBundleReleaseJsAndAssets/`.
1010

1111
The brownfield Gradle plugin adds both directories to the source sets, potentially causing a conflict of artifacts. To fix this, just once clean your build directory (precisely, the `app/build/` directory) and rebuild the project. All subsequent builds should work fine.
1212

0 commit comments

Comments
 (0)