Skip to content

Commit ba2fee0

Browse files
committed
chore: update demo code from RN repo
1 parent d3bc330 commit ba2fee0

32 files changed

+660
-948
lines changed

examples/build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Build the app with:
106106
- TypeScript with strict mode enabled
107107
- OneSignal brand colors and a consistent stylesheet-based theme
108108
- App name: "OneSignal Demo"
109-
- Top navigation header: centered title with OneSignal logo SVG + "Sample App" text
109+
- Top navigation header: centered title with OneSignal logo SVG + "Expo" text
110110
- Support for both Android and iOS
111111
- Android package name: com.onesignal.example
112112
- iOS bundle identifier: com.onesignal.example

examples/demo/App.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import LogManager from './src/services/LogManager';
2424
import OneSignalApiService from './src/services/OneSignalApiService';
2525
import PreferencesService from './src/services/PreferencesService';
2626
import TooltipHelper from './src/services/TooltipHelper';
27-
import { Colors } from './src/theme';
27+
import { AppColors } from './src/theme';
2828

2929
const Stack = createNativeStackNavigator();
3030
const log = LogManager.getInstance();
@@ -136,16 +136,17 @@ function App() {
136136
return (
137137
<SafeAreaProvider>
138138
<StatusBar
139-
backgroundColor={Colors.oneSignalRed}
139+
backgroundColor={AppColors.osPrimary}
140140
barStyle="light-content"
141141
/>
142142
<AppContextProvider>
143143
<NavigationContainer>
144144
<Stack.Navigator
145145
screenOptions={{
146-
headerStyle: { backgroundColor: Colors.oneSignalRed },
147-
headerTintColor: Colors.white,
146+
headerStyle: { backgroundColor: AppColors.osPrimary },
147+
headerTintColor: AppColors.white,
148148
headerTitleAlign: 'center',
149+
headerShadowVisible: false,
149150
}}
150151
>
151152
<Stack.Screen
@@ -159,7 +160,7 @@ function App() {
159160
width={99}
160161
style={headerStyles.logo}
161162
/>
162-
<Text style={headerStyles.subtitle}>Sample App</Text>
163+
<Text style={headerStyles.subtitle}>Expo</Text>
163164
</View>
164165
),
165166
}}
@@ -188,8 +189,7 @@ const headerStyles = StyleSheet.create({
188189
subtitle: {
189190
fontSize: 14,
190191
fontWeight: '400',
191-
color: Colors.white,
192-
opacity: 0.9,
192+
color: AppColors.white,
193193
},
194194
});
195195

examples/demo/src/components/ActionButton.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
View,
77
ActivityIndicator,
88
} from 'react-native';
9-
import { Colors, Spacing } from '../theme';
9+
import { AppColors, AppSpacing } from '../theme';
1010

1111
interface Props {
1212
label: string;
@@ -31,19 +31,17 @@ export default function ActionButton({
3131
iconPosition = 'left',
3232
leftAligned,
3333
}: Props) {
34-
const bgColor =
35-
variant === 'primary'
36-
? Colors.oneSignalRed
37-
: variant === 'destructive'
38-
? Colors.destructiveRed
39-
: 'transparent';
34+
const bgColor = variant === 'primary' ? AppColors.osPrimary : 'transparent';
4035

4136
const borderStyle =
42-
variant === 'outlined'
43-
? { borderWidth: 1, borderColor: Colors.oneSignalRed }
37+
variant === 'outlined' || variant === 'destructive'
38+
? { borderWidth: 1, borderColor: AppColors.osPrimary }
4439
: {};
4540

46-
const textColor = variant === 'outlined' ? Colors.oneSignalRed : Colors.white;
41+
const textColor =
42+
variant === 'outlined' || variant === 'destructive'
43+
? AppColors.osPrimary
44+
: AppColors.white;
4745

4846
return (
4947
<TouchableOpacity
@@ -78,10 +76,11 @@ export default function ActionButton({
7876
const styles = StyleSheet.create({
7977
button: {
8078
borderRadius: 8,
81-
paddingVertical: 14,
79+
height: 48,
80+
justifyContent: 'center',
8281
paddingHorizontal: 16,
8382
width: '100%',
84-
marginBottom: Spacing.cardGap,
83+
marginBottom: AppSpacing.gap,
8584
},
8685
inner: {
8786
flexDirection: 'row',
@@ -94,8 +93,6 @@ const styles = StyleSheet.create({
9493
text: {
9594
fontSize: 14,
9695
fontWeight: '600',
97-
letterSpacing: 0.5,
98-
textTransform: 'uppercase',
9996
},
10097
iconLeft: {
10198
marginRight: 8,

examples/demo/src/components/ListWidgets.tsx

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from 'react';
22
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
33
import { MaterialIcons as Icon } from '@expo/vector-icons';
4-
import { Colors, AppTheme } from '../theme';
4+
import { AppColors, AppTextStyles, AppTheme } from '../theme';
55

66
// PairItem
77
interface PairItemProps {
@@ -46,7 +46,7 @@ export function PairItem({
4646
onPress={onDelete}
4747
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
4848
>
49-
<Icon name="close" size={18} color={Colors.textSecondary} />
49+
<Icon name="close" size={18} color={AppColors.osPrimary} />
5050
</TouchableOpacity>
5151
)}
5252
</View>
@@ -71,7 +71,7 @@ export function SingleItem({ value, onDelete, testID }: SingleItemProps) {
7171
onPress={onDelete}
7272
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
7373
>
74-
<Icon name="close" size={18} color={Colors.textSecondary} />
74+
<Icon name="close" size={18} color={AppColors.osPrimary} />
7575
</TouchableOpacity>
7676
)}
7777
</View>
@@ -187,69 +187,68 @@ const styles = StyleSheet.create({
187187
pairRow: {
188188
flexDirection: 'row',
189189
alignItems: 'center',
190-
paddingVertical: 8,
190+
paddingVertical: 4,
191+
paddingHorizontal: 4,
191192
},
192193
pairStackedContent: {
193194
flex: 1,
194195
marginRight: 8,
195196
},
196197
pairStackedKey: {
197-
fontSize: 15,
198-
color: Colors.textPrimary,
199-
fontWeight: '500',
198+
...AppTextStyles.bodyMedium,
200199
marginBottom: 2,
201200
},
202201
pairStackedValue: {
203-
fontSize: 14,
204-
color: Colors.textSecondary,
202+
...AppTextStyles.bodySmall,
203+
color: AppColors.osGrey600,
205204
},
206205
pairKey: {
206+
...AppTextStyles.bodyMedium,
207207
flex: 1,
208-
fontSize: 14,
209-
color: Colors.textSecondary,
208+
color: AppColors.osGrey600,
210209
},
211210
pairSeparator: {
212211
fontSize: 14,
213-
color: Colors.dividerColor,
212+
color: AppColors.osDivider,
214213
marginHorizontal: 8,
215214
},
216215
pairValue: {
216+
...AppTextStyles.bodyMedium,
217217
flex: 1,
218-
fontSize: 14,
219-
color: Colors.textPrimary,
218+
color: AppColors.osGrey700,
220219
textAlign: 'right',
221220
marginRight: 8,
222221
},
223222
singleRow: {
224223
flexDirection: 'row',
225224
alignItems: 'center',
226-
paddingVertical: 8,
225+
paddingVertical: 4,
226+
paddingHorizontal: 4,
227227
},
228228
singleValue: {
229+
...AppTextStyles.bodyMedium,
229230
flex: 1,
230-
fontSize: 14,
231-
color: Colors.textPrimary,
231+
color: AppColors.osGrey700,
232232
},
233233
emptyContainer: {
234-
paddingVertical: 8,
234+
paddingVertical: 12,
235235
alignItems: 'center',
236236
},
237237
emptyText: {
238-
fontSize: 14,
239-
color: Colors.textSecondary,
240-
fontStyle: 'italic',
238+
...AppTextStyles.bodyMedium,
239+
color: AppColors.osGrey600,
241240
},
242241
divider: {
243242
height: 1,
244-
backgroundColor: Colors.dividerColor,
243+
backgroundColor: AppColors.osDivider,
245244
},
246245
moreButton: {
247-
paddingVertical: 8,
246+
paddingVertical: 4,
248247
alignItems: 'center',
249248
},
250249
moreText: {
251-
fontSize: 13,
252-
color: Colors.oneSignalRed,
250+
fontSize: 14,
251+
color: AppColors.osPrimary,
253252
fontWeight: '500',
254253
},
255254
});

examples/demo/src/components/LoadingOverlay.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { View, ActivityIndicator, StyleSheet } from 'react-native';
3-
import { Colors } from '../theme';
3+
import { AppColors } from '../theme';
44

55
interface Props {
66
visible: boolean;
@@ -12,15 +12,15 @@ export default function LoadingOverlay({ visible }: Props) {
1212
}
1313
return (
1414
<View style={styles.overlay}>
15-
<ActivityIndicator size="large" color={Colors.oneSignalRed} />
15+
<ActivityIndicator size="large" color={AppColors.osPrimary} />
1616
</View>
1717
);
1818
}
1919

2020
const styles = StyleSheet.create({
2121
overlay: {
2222
...StyleSheet.absoluteFillObject,
23-
backgroundColor: 'rgba(0,0,0,0.3)',
23+
backgroundColor: AppColors.osBackdrop,
2424
alignItems: 'center',
2525
justifyContent: 'center',
2626
zIndex: 999,

0 commit comments

Comments
 (0)