Skip to content

Commit dadd7e6

Browse files
committed
feat: expo 55 demo app parity with 54 demo app
1 parent f78e74a commit dadd7e6

9 files changed

Lines changed: 82 additions & 4 deletions

File tree

apps/ExpoApp54/RNApp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { SafeAreaView } from 'react-native-safe-area-context';
22
import { Button, StyleSheet, Text, View } from 'react-native';
3-
import Counter from './components/counter';
43
import BrownfieldNavigation from '@callstack/brownfield-navigation';
54

5+
import Counter from './components/counter';
6+
67
export default function RNApp() {
78
return (
89
<SafeAreaView style={styles.container}>

apps/ExpoApp54/app/(tabs)/postMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ThemedText } from '@/components/themed-text';
99
import type { Message } from '@/components/postMessage/Message';
1010
import { MessageBubble } from '@/components/postMessage/MessageBubble';
1111

12-
export default function HomeScreen() {
12+
export default function PostMessageTab() {
1313
const [messages, setMessages] = useState<Message[]>([]);
1414
const flatListRef = useRef<FlatList<Message>>(null);
1515

apps/ExpoApp55/RNApp.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { SafeAreaView } from 'react-native-safe-area-context';
2-
import { StyleSheet, Text, View } from 'react-native';
2+
import { Button, StyleSheet, Text, View } from 'react-native';
3+
import BrownfieldNavigation from '@callstack/brownfield-navigation';
4+
35
import Counter from './components/counter';
46

57
export default function RNApp() {
@@ -9,6 +11,15 @@ export default function RNApp() {
911

1012
<View style={styles.content}>
1113
<Counter />
14+
15+
<Button
16+
title="Navigate to Settings"
17+
onPress={() => BrownfieldNavigation.navigateToSettings()}
18+
/>
19+
<Button
20+
title="Navigate to Referrals"
21+
onPress={() => BrownfieldNavigation.navigateToReferrals('123')}
22+
/>
1223
</View>
1324
</SafeAreaView>
1425
);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export interface BrownfieldNavigationSpec {
2+
/**
3+
* Navigate to the native settings screen
4+
*/
5+
navigateToSettings(): void;
6+
7+
/**
8+
* Navigate to the native referrals screen
9+
* @param userId - The user's unique identifier
10+
*/
11+
navigateToReferrals(userId: string): void;
12+
}

apps/ExpoApp55/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"brownfield:package:ios": "brownfield package:ios --scheme BrownfieldLib --configuration Release"
1616
},
1717
"dependencies": {
18+
"@callstack/brownfield-navigation": "workspace:^",
1819
"@callstack/brownie": "workspace:^",
1920
"@callstack/react-native-brownfield": "workspace:^",
2021
"@expo/vector-icons": "^15.0.2",

apps/ExpoApp55/src/app/postMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ThemedText } from '@/components/themed-text';
99
import type { Message } from '@/components/postMessage/Message';
1010
import { MessageBubble } from '@/components/postMessage/MessageBubble';
1111

12-
export default function HomeScreen() {
12+
export default function PostMessageTab() {
1313
const [messages, setMessages] = useState<Message[]>([]);
1414
const flatListRef = useRef<FlatList<Message>>(null);
1515

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { StyleSheet, Text, Button } from 'react-native';
2+
import { useStore } from '@callstack/brownie';
3+
4+
const Counter = () => {
5+
const [counter, setState] = useStore('BrownfieldStore', (s) => s.counter);
6+
7+
return (
8+
<>
9+
<Text style={styles.text}>Count: {counter}</Text>
10+
11+
<Button
12+
onPress={() => setState((prev) => ({ counter: prev.counter + 1 }))}
13+
title="Increment"
14+
/>
15+
</>
16+
);
17+
};
18+
19+
export default Counter;
20+
21+
const styles = StyleSheet.create({
22+
container: {
23+
flex: 1,
24+
justifyContent: 'center',
25+
alignItems: 'center',
26+
padding: 20,
27+
},
28+
text: {
29+
fontSize: 30,
30+
fontWeight: 'bold',
31+
margin: 10,
32+
},
33+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { StyleSheet, Text } from 'react-native';
2+
3+
const Counter = () => {
4+
return (
5+
<>
6+
<Text style={styles.text}>Brownie: To be implemented</Text>
7+
</>
8+
);
9+
};
10+
11+
export default Counter;
12+
13+
const styles = StyleSheet.create({
14+
text: {
15+
fontSize: 18,
16+
fontWeight: 'bold',
17+
margin: 10,
18+
},
19+
});

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,6 +2402,7 @@ __metadata:
24022402
version: 0.0.0-use.local
24032403
resolution: "@callstack/brownfield-example-expo-app-55@workspace:apps/ExpoApp55"
24042404
dependencies:
2405+
"@callstack/brownfield-navigation": "workspace:^"
24052406
"@callstack/brownie": "workspace:^"
24062407
"@callstack/react-native-brownfield": "workspace:^"
24072408
"@expo/vector-icons": "npm:^15.0.2"

0 commit comments

Comments
 (0)