Skip to content

Commit d3bc330

Browse files
committed
docs(examples): Updates theme prompt to reference shared styles
1 parent a7995a2 commit d3bc330

File tree

1 file changed

+37
-50
lines changed

1 file changed

+37
-50
lines changed

examples/build.md

Lines changed: 37 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Pay close attention to:
5050
- List item layout (stacked vs inline key-value)
5151
- Icon choices (delete, close, info, etc.)
5252
- Typography, spacing, and colors
53-
- Spacing: 12px gap between sections, 8px gap between cards/buttons within a section
53+
- Spacing and sizing should follow the shared style tokens in styles.md
5454

5555
You can also interact with the reference app to observe specific flows:
5656

@@ -453,7 +453,7 @@ App Section layout:
453453
2. Sticky guidance banner below App ID:
454454
- Text: "Add your own App ID, then rebuild to fully test all functionality."
455455
- Link text: "Get your keys at onesignal.com" (clickable, opens browser via Linking.openURL)
456-
- Light background color to stand out
456+
- Use the shared guidance-banner style token from `src/theme.ts`
457457

458458
3. Consent card with up to two toggles:
459459
a. "Consent Required" toggle (always visible):
@@ -475,7 +475,7 @@ App Section layout:
475475
- Status shows "Anonymous"
476476
- External ID shows "–" (dash)
477477
- When logged in:
478-
- Status shows "Logged In" with green styling (#2E7D32)
478+
- Status shows "Logged In" using the success text style from the shared theme
479479
- External ID shows the actual external user ID
480480

481481
5. LOGIN USER button:
@@ -523,18 +523,15 @@ In-App Messaging Section (placed right after Send Push):
523523

524524
Send In-App Message Section (placed right after In-App Messaging):
525525
- Section title: "Send In-App Message" with info icon for tooltip
526-
- Four FULL-WIDTH buttons (not a grid):
526+
- Four action buttons stacked vertically (not a grid):
527527
1. TOP BANNER - icon: arrow-up-bold-box-outline, trigger: "iam_type" = "top_banner"
528528
2. BOTTOM BANNER - icon: arrow-down-bold-box-outline, trigger: "iam_type" = "bottom_banner"
529529
3. CENTER MODAL - icon: crop-square, trigger: "iam_type" = "center_modal"
530530
4. FULL SCREEN - icon: fullscreen, trigger: "iam_type" = "full_screen"
531531
- Button styling:
532-
- RED background color (#E9444E)
533-
- WHITE text
534-
- Type-specific icon on LEFT side only (no right side icon)
535-
- Full width of the card
536-
- Left-aligned text and icon content (not centered)
537-
- UPPERCASE button text
532+
- Use theme button tokens from `src/theme.ts` mapped from `styles.md`
533+
- Type-specific icon on the left side only (no right side icon)
534+
- Keep alignment, casing, and spacing consistent with shared style tokens
538535
- On tap: adds trigger and shows Toast "Sent In-App Message: {type}"
539536
- Also upserts `iam_type` in the Triggers list immediately so UI reflects the sent IAM type
540537

@@ -644,7 +641,7 @@ Location Section:
644641

645642
Secondary Screen (launched by "Next Activity" button at bottom of main screen):
646643
- Screen title: "Secondary Activity" (set via React Navigation header options)
647-
- Screen content: centered text "Secondary Activity" using a large font style
644+
- Screen content: show "Secondary Activity" using the shared heading text style
648645
- Simple screen, no additional functionality needed
649646

650647
Naming note for Expo:
@@ -658,7 +655,7 @@ Naming note for Expo:
658655
### Prompt 3.1 - Data Loading Flow
659656

660657
Loading indicator overlay:
661-
- Full-screen semi-transparent overlay with centered ActivityIndicator
658+
- Full-screen loading overlay with ActivityIndicator, styled from shared theme tokens
662659
- isLoading flag in app state
663660
- Show/hide via absolute positioned View based on isLoading state
664661
- IMPORTANT: Add 100ms delay after populating data before dismissing loading indicator
@@ -914,46 +911,44 @@ SectionCard.tsx:
914911
- Card View with title Text and optional info TouchableOpacity
915912
- Children slot
916913
- onInfoTap callback for tooltips
917-
- Consistent padding and styling via StyleSheet
914+
- Uses shared card layout tokens from `src/theme.ts`
918915

919916
ToggleRow.tsx:
920917
- Label, optional description, Switch
921-
- Row layout with justifyContent: 'space-between'
918+
- Row layout should follow shared component spacing/alignment tokens
922919

923920
ActionButton.tsx:
924-
- PrimaryButton (filled, primary color background, TouchableOpacity)
925-
- DestructiveButton (outlined, red accent, TouchableOpacity)
926-
- Full-width buttons with width: '100%'
921+
- PrimaryButton and DestructiveButton variants using shared theme tokens
922+
- Width, alignment, and typography come from shared button style tokens
927923

928924
ListWidgets.tsx:
929925
- PairItem (key-value with optional X-icon remove TouchableOpacity)
930926
- SingleItem (single value with optional X-icon remove TouchableOpacity)
931-
- EmptyState (centered "No items" Text)
927+
- EmptyState ("No items" Text using shared empty-state style)
932928
- CollapsibleList (shows 5 items, expandable)
933929
- PairList (simple list of key-value pairs)
934930

935931
LoadingOverlay.tsx:
936-
- Semi-transparent full-screen overlay using absolute positioned View + StyleSheet
932+
- Full-screen overlay using shared loading overlay style tokens
937933
- Centered ActivityIndicator
938934
- Shown via isLoading state from app context
939935

940936
LogView.tsx:
941937
- Sticky at the top of the screen (always visible while ScrollView content scrolls below)
942-
- Full width, no horizontal margin, no rounded corners, no top margin (touches header)
943-
- Background color: #1A1B1E
938+
- Use the log container style tokens from `src/theme.ts` (mapped from `styles.md`)
944939
- Single horizontal ScrollView on the entire log list (not per-row), no text truncation
945940
- Use onLayout + minWidth so content is at least screen-wide
946-
- Vertical ScrollView + mapped entries instead of FlatList (100dp container is small)
947-
- Fixed 100dp height
941+
- Vertical ScrollView + mapped entries instead of FlatList (compact container)
942+
- Use the shared log-view height token from theme
948943
- Default expanded
949944
- Trash icon button (delete icon from @expo/vector-icons) for clearing logs
950945
- Auto-scroll to newest using scrollToEnd on ScrollView ref
951946

952947
Modals (src/components/modals/):
953-
- All modals use a full-width Modal component with padding: 16 and width: '100%' inner container
948+
- All modals use a shared modal container style from `src/theme.ts`
954949
- SingleInputModal (one TextInput)
955950
- PairInputModal (key-value TextInputs on the same row, single pair)
956-
- MultiPairInputModal (dynamic rows with dividers, X icon to delete a row, full-width, batch submit)
951+
- MultiPairInputModal (dynamic rows with dividers, X icon to delete a row, batch submit)
957952
- MultiSelectRemoveModal (Checkbox per item for batch remove)
958953
- LoginModal, OutcomeModal, TrackEventModal
959954
- CustomNotificationModal, TooltipModal
@@ -964,7 +959,7 @@ Tags, Aliases, and Triggers all share a reusable MultiPairInputModal component
964959
for adding multiple key-value pairs at once.
965960

966961
Behavior:
967-
- Modal opens full-width (width: '100%' with horizontal padding 16)
962+
- Modal uses the shared modal layout tokens from `src/theme.ts`
968963
- Starts with one empty key-value row (Key and Value TextInputs side by side)
969964
- "Add Row" TextButton below the rows adds another empty row
970965
- Dividers separate each row for visual clarity
@@ -999,28 +994,21 @@ Used by:
999994

1000995
### Prompt 8.5 - Theme
1001996

1002-
Create OneSignal theme in src/theme.ts:
997+
Create OneSignal theme in `src/theme.ts`.
1003998

1004-
Colors:
1005-
- oneSignalRed = '#E54B4D' (primary)
1006-
- oneSignalGreen = '#34A853' (success)
1007-
- oneSignalGreenLight = '#E6F4EA' (success background)
1008-
- lightBackground = '#F8F9FA'
1009-
- cardBackground = '#FFFFFF'
1010-
- dividerColor = '#E8EAED'
1011-
- warningBackground = '#FFF8E1'
999+
All colors, spacing, typography, button styles, card styles, and component
1000+
specs are defined in the shared style reference:
1001+
https://raw.githubusercontent.com/OneSignal/sdk-shared/refs/heads/main/demo/styles.md
10121002

1013-
Spacing constants:
1014-
- cardGap = 8 // gap between a card/banner and its action buttons within a section
1015-
- sectionGap = 12 // gap between sections (SectionCard wrapper marginBottom)
1003+
Implement an `AppTheme` object that maps the style reference values to Expo
1004+
and React Native primitives (`StyleSheet.create`, text style objects, reusable
1005+
view/button style tokens, and shared shadow/elevation styles for iOS/Android).
10161006

1017-
AppTheme object with:
1018-
- Reusable StyleSheet base styles for cards (borderRadius: 12, backgroundColor: cardBackground)
1019-
- Reusable button style with borderRadius: 8
1020-
- Consistent font sizes, weights, and colors exported as constants
1021-
- Shadow/elevation styles for card depth
1007+
Also define `AppColors` and `AppSpacing` convenience exports that expose the
1008+
tokens from `styles.md` as typed constants for use throughout the app.
10221009

1023-
Apply theme colors and Spacing constants consistently across all components using StyleSheet.create.
1010+
Apply these tokens consistently across all components. Avoid hardcoded visual
1011+
values in feature components unless explicitly required by the prompt.
10241012

10251013
### Prompt 8.6 - Log View (Appium-Ready)
10261014

@@ -1037,12 +1025,11 @@ LogManager Features:
10371025

10381026
LogView Features:
10391027
- STICKY at the top of the screen (always visible while ScrollView content scrolls below)
1040-
- Full width, no horizontal margin, no rounded corners, no top margin (touches header)
1041-
- Background color: #1A1B1E
1028+
- Use the shared log container style tokens from `src/theme.ts`
10421029
- Single horizontal ScrollView on the entire log list (not per-row), no text truncation
10431030
- Use onLayout + minWidth so content is at least screen-wide
1044-
- Vertical ScrollView + mapped entries instead of FlatList (100dp container is small)
1045-
- Fixed 100dp height
1031+
- Vertical ScrollView + mapped entries instead of FlatList (compact container)
1032+
- Use the shared log-view height token from theme
10461033
- Default expanded
10471034
- Trash icon button (delete icon) for clearing logs, not a text button
10481035
- Auto-scroll to newest using scrollToEnd on ScrollView ref
@@ -1095,7 +1082,7 @@ examples/demo/
10951082
├── app.json # Expo config (plugin, package IDs, extra.oneSignalAppId)
10961083
├── App.tsx # App entry, SDK init, Context setup
10971084
├── src/
1098-
│ ├── theme.ts # OneSignal theme (colors, StyleSheet constants)
1085+
│ ├── theme.ts # Shared visual tokens and reusable style objects
10991086
│ ├── models/
11001087
│ │ ├── UserData.ts # UserData interface from API
11011088
│ │ ├── NotificationType.ts # Enum with bigPicture and iosAttachments
@@ -1211,7 +1198,7 @@ If you change the identifier, you must also update these files with your own Fir
12111198
- **testID** props on interactive elements for Appium test automation
12121199
- **async/await** over raw Promise chaining for readability
12131200
- **Immutable state** updates using spread/map/filter rather than direct mutation
1214-
- **Consistent theming** via a shared theme.ts with StyleSheet constants
1201+
- **Consistent theming** via shared design tokens in `src/theme.ts`
12151202
- **Minimal re-renders** by splitting context or using useMemo/useCallback where appropriate
12161203
- **Error handling** with try/catch on all network and SDK async calls
12171204
- **Expo config plugin first** in app config plugins array (`onesignal-expo-plugin`)

0 commit comments

Comments
 (0)