Skip to content

Commit 0320a78

Browse files
committed
chore(example): update example
1 parent f2b897d commit 0320a78

File tree

5 files changed

+94
-6
lines changed

5 files changed

+94
-6
lines changed

example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,7 +2474,7 @@ PODS:
24742474
- ReactCommon/turbomodule/core
24752475
- SocketRocket
24762476
- Yoga
2477-
- RNGoogleMapsPlus (1.1.0-dev.5):
2477+
- RNGoogleMapsPlus (1.2.0):
24782478
- boost
24792479
- DoubleConversion
24802480
- fast_float
@@ -3086,14 +3086,14 @@ SPEC CHECKSUMS:
30863086
ReactCodegen: 3873d7ac09960375f7845384ff47d53e478462dc
30873087
ReactCommon: f5527f5d97a9957ab46eb5db78875d3579e03b97
30883088
RNGestureHandler: e1cc4de7646eb557ad62d1271d8eac73c304a896
3089-
RNGoogleMapsPlus: cdea400ea1e69740d91e07dbb5882d93be4c0a77
3089+
RNGoogleMapsPlus: 43e90cbedb2f3deec67a3a0a14fb5065f608ea3c
30903090
RNReanimated: 8f0185df21f0dea34ee8c9611ba88c17a290ed9a
30913091
RNScreens: 2e9c41cd099b1ca50136af8d57c3594214d0086a
30923092
RNWorklets: ab618bf7d1c7fd2cb793b9f0f39c3e29274b3ebf
30933093
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
30943094
SVGKit: 1ad7513f8c74d9652f94ed64ddecda1a23864dea
30953095
Yoga: ce55ebb197c21e22b6700cd36e3f36b7ec26e6f8
30963096

3097-
PODFILE CHECKSUM: 246331f3f9b61838ac0bd43aa0f04db450c4bd52
3097+
PODFILE CHECKSUM: 18d25340bc263a2eab86e2d8e5cfd9ad55ef6458
30983098

30993099
COCOAPODS: 1.15.2

example/src/App.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ import CustomStyleScreen from './screens/CustomStyleScreen';
1919
import StressTestScreen from './screens/StressTestScreen';
2020
import { GestureHandlerRootView } from 'react-native-gesture-handler';
2121
import { useColorScheme } from 'react-native';
22+
import BlankScreen from './screens/BlankScreen';
23+
import type { RootStackParamList } from './types/navigation';
2224

23-
const Stack = createStackNavigator();
25+
const Stack = createStackNavigator<RootStackParamList>();
2426

2527
export default function App() {
2628
const scheme = useColorScheme();
@@ -42,7 +44,11 @@ export default function App() {
4244
component={HomeScreen}
4345
options={{ title: 'Google Maps Examples' }}
4446
/>
45-
47+
<Stack.Screen
48+
name="Blank"
49+
component={BlankScreen}
50+
options={{ title: 'Blank Screen' }}
51+
/>
4652
<Stack.Screen
4753
name="BasicMap"
4854
component={BasicMapScreen}

example/src/components/ControlPanel.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import Animated, {
1515
} from 'react-native-reanimated';
1616
import type { GoogleMapsViewRef } from 'react-native-google-maps-plus';
1717
import { useAppTheme } from '../theme';
18+
import { useNavigation } from '@react-navigation/native';
19+
import type { RootNavigationProp } from '../types/navigation';
1820

1921
export type ButtonItem = { title: string; onPress: () => void };
2022

@@ -25,6 +27,7 @@ type Props = {
2527

2628
export default function ControlPanel({ mapRef, buttons }: Props) {
2729
const theme = useAppTheme();
30+
const navigation = useNavigation<RootNavigationProp>();
2831
const progress = useSharedValue(0);
2932

3033
const toggle = () => {
@@ -36,6 +39,10 @@ export default function ControlPanel({ mapRef, buttons }: Props) {
3639
const finalButtons = useMemo(
3740
() => [
3841
...buttons,
42+
{
43+
title: `Navigate to blank screen`,
44+
onPress: () => navigation.navigate('Blank'),
45+
},
3946
{
4047
title: 'Request location permission',
4148
onPress: async () => {
@@ -57,7 +64,7 @@ export default function ControlPanel({ mapRef, buttons }: Props) {
5764
console.log(mapRef.current?.isGooglePlayServicesAvailable()),
5865
},
5966
],
60-
[buttons, mapRef]
67+
[buttons, mapRef, navigation]
6168
);
6269

6370
const buttonHeight = 52;
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import React from 'react';
2+
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
3+
import { useNavigation, useTheme } from '@react-navigation/native';
4+
import type { RootNavigationProp } from '../types/navigation';
5+
6+
export default function BlankScreen() {
7+
const navigation = useNavigation<RootNavigationProp>();
8+
const { colors } = useTheme();
9+
10+
return (
11+
<View style={[styles.container, { backgroundColor: colors.background }]}>
12+
<Text style={[styles.title, { color: colors.text }]}>Blank Screen</Text>
13+
14+
<Text style={[styles.subtitle, { color: colors.text }]}>
15+
This is an empty placeholder screen.
16+
</Text>
17+
18+
<TouchableOpacity
19+
style={[styles.button, { backgroundColor: colors.card }]}
20+
activeOpacity={0.8}
21+
onPress={() => navigation.goBack()}
22+
>
23+
<Text style={[styles.buttonText, { color: colors.text }]}>
24+
← Go Back
25+
</Text>
26+
</TouchableOpacity>
27+
</View>
28+
);
29+
}
30+
31+
const styles = StyleSheet.create({
32+
container: {
33+
flex: 1,
34+
justifyContent: 'center',
35+
alignItems: 'center',
36+
padding: 24,
37+
},
38+
title: {
39+
fontSize: 24,
40+
fontWeight: '700',
41+
marginBottom: 8,
42+
},
43+
subtitle: {
44+
fontSize: 16,
45+
opacity: 0.8,
46+
marginBottom: 32,
47+
},
48+
button: {
49+
paddingHorizontal: 24,
50+
paddingVertical: 12,
51+
borderRadius: 10,
52+
},
53+
buttonText: {
54+
fontSize: 16,
55+
fontWeight: '500',
56+
},
57+
});

example/src/types/navigation.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export type RootStackParamList = {
2+
Home: undefined;
3+
Blank: undefined;
4+
BasicMap: undefined;
5+
Markers: undefined;
6+
Polygons: undefined;
7+
Polylines: undefined;
8+
Circles: undefined;
9+
Heatmap: undefined;
10+
KmlLayer: undefined;
11+
Location: undefined;
12+
CustomStyle: undefined;
13+
StressTest: undefined;
14+
};
15+
16+
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
17+
18+
export type RootNavigationProp = NativeStackNavigationProp<RootStackParamList>;

0 commit comments

Comments
 (0)