Skip to content

Commit 636515e

Browse files
committed
fix: add brownie config block
1 parent f3c797a commit 636515e

6 files changed

Lines changed: 41 additions & 81 deletions

File tree

apps/ExpoApp/components/counter/index.ios.tsx

Lines changed: 0 additions & 33 deletions
This file was deleted.

apps/ExpoApp/components/counter/index.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
1-
import { StyleSheet, Text } from 'react-native';
1+
import { StyleSheet, Text, Button } from 'react-native';
2+
import { useStore } from '@callstack/brownie';
23

34
const Counter = () => {
5+
const [counter, setState] = useStore('BrownfieldStore', (s) => s.counter);
6+
47
return (
58
<>
6-
<Text style={styles.text}>Brownie: To be implemented</Text>
9+
<Text style={styles.text}>Count: {counter}</Text>
10+
11+
<Button
12+
onPress={() => setState((prev) => ({ counter: prev.counter + 1 }))}
13+
title="Increment"
14+
/>
715
</>
816
);
917
};
1018

1119
export default Counter;
1220

1321
const styles = StyleSheet.create({
22+
container: {
23+
flex: 1,
24+
justifyContent: 'center',
25+
alignItems: 'center',
26+
padding: 20,
27+
},
1428
text: {
15-
fontSize: 18,
29+
fontSize: 30,
1630
fontWeight: 'bold',
1731
margin: 10,
1832
},

apps/ExpoApp/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,9 @@
4444
"eslint": "^9.25.0",
4545
"eslint-config-expo": "~10.0.0",
4646
"typescript": "~5.9.2"
47+
},
48+
"brownie": {
49+
"kotlin": "./android/brownfieldlib/src/main/java/com/callstack/rnbrownfield/demo/expoapp/Generated/",
50+
"kotlinPackageName": "com.callstack.rnbrownfield.demo.expoapp"
4751
}
4852
}

apps/RNApp/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"ios": "react-native run-ios",
88
"build:example:android-rn": "react-native build-android",
99
"build:example:ios-rn": "react-native build-ios",
10-
"brownfield:package:android": "brownfield package:android --module-name :BrownfieldLib --variant debug",
10+
"brownfield:package:android": "brownfield package:android --module-name :BrownfieldLib --variant release",
1111
"brownfield:publish:android": "brownfield publish:android --module-name :BrownfieldLib",
1212
"brownfield:package:ios": "brownfield package:ios --scheme BrownfieldLib --configuration Release",
1313
"lint": "eslint .",
@@ -45,6 +45,10 @@
4545
"react-test-renderer": "19.1.1",
4646
"typescript": "^5.9.3"
4747
},
48+
"brownie": {
49+
"kotlin": "./android/BrownfieldLib/src/main/java/com/rnapp/brownfieldlib/Generated/",
50+
"kotlinPackageName": "com.rnapp.brownfieldlib"
51+
},
4852
"engines": {
4953
"node": ">=20"
5054
}

apps/RNApp/src/components/counter/index.ios.tsx

Lines changed: 0 additions & 40 deletions
This file was deleted.

docs/docs/docs/api-reference/brownie/getting-started.mdx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,18 @@ struct CounterView: View {
148148

149149
## Android
150150

151-
### Step 4: Add gson dependency
151+
### Step 4: Add brownie configuration
152+
153+
Add the following block to your package.json:
154+
155+
```json
156+
"brownie": {
157+
"kotlin": "./android/BrownfieldLib/src/main/java/com/rnapp/brownfieldlib/Generated/",
158+
"kotlinPackageName": "com.rnapp.brownfieldlib"
159+
},
160+
```
161+
162+
### Step 5: Add gson dependency
152163

153164
Add the gson dependency to your android module for brownfield:
154165

@@ -162,7 +173,7 @@ Otherwise, you can also add it to your native App:
162173
implementation("com.google.code.gson:gson:2.13.1")
163174
```
164175

165-
### Step 5: Add AAR
176+
### Step 6: Add AAR
166177

167178
The CLI generates Kotlin types and builds AAR:
168179

@@ -180,7 +191,7 @@ npx brownfield publish:android --module-name :YourModuleName
180191
The `package:android` command automatically runs `brownfield codegen` to generate Kotlin types from your `.brownie.ts` files.
181192
:::
182193

183-
### Step 6: Register Store in Android
194+
### Step 7: Register Store in Android
184195

185196
Register once during app startup:
186197

@@ -195,7 +206,7 @@ registerStoreIfNeeded(
195206
}
196207
```
197208

198-
### Step 7: Read and Update Store from Native UI
209+
### Step 8: Read and Update Store from Native UI
199210

200211
```kotlin
201212
import com.callstack.brownie.StoreManager

0 commit comments

Comments
 (0)