import type { IconName } from '@fortawesome/fontawesome-svg-core' import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome' import React, { useState } from 'react' import { Alert, Pressable, ScrollView, StyleSheet, View } from 'react-native' import type { ViewStyle } from 'react-native' import { Avatar, AvatarGroup, Badge, Banner, BannerCollapsible, Button, ConversationAvatar, EmojiAvatar, FilterDropdown, IconAvatar, ToggleButton, Heading, Icon, IconButton, Image, Person, Spinner, Switch, Text, TextButton, TextInlineButton, ImageAttachmentPreview, } from '../components/display' import { VideoAttachmentPreview } from '../components/display/video_attachment_preview' import BannerPrimitive from '../components/primitive/banner_primitive' import BlankState from '../components/primitive/blank_state_primitive' import { useSelectedChipBackgroundColor, useTheme } from '../hooks' import { MAX_FONT_SIZE_MULTIPLIER, platformPressedOpacityStyle, platformFontWeightMedium, Haptic, } from '../utils' // ================================= // ====== Docs Utils =============== // ================================= const URL = { image: 'https://picsum.photos/seed/picsum/200', broken: 'https://broken.url', avatar: 'https://i.pravatar.cc/200?img=22', avatar_fallback: 'https://avatars.planningcenteronline.com/uploads/initials/PR.png', two_avatars: ['https://i.pravatar.cc/200?img=22', 'https://i.pravatar.cc/200?img=23'], three_avatars: [ 'https://i.pravatar.cc/200?img=22', 'https://i.pravatar.cc/200?img=23', 'https://i.pravatar.cc/200?img=24', ], four_avatars: [ 'https://i.pravatar.cc/200?img=30', 'https://i.pravatar.cc/200?img=29', 'https://i.pravatar.cc/200?img=28', 'https://i.pravatar.cc/200?img=27', ], } const personAdult = { id: 1, type: 'Member' as const, name: 'John Doe', avatar: URL.avatar, badges: [{ title: 'Conversation owner' }, { title: 'Leader' }], child: false, gender: null, } const personChild = { id: 2, type: 'Member' as const, name: 'Kid McChild', avatar: URL.two_avatars[1], badges: [], child: true, gender: null, } const buttonPress = () => Alert.alert('Button clicked') const filterDropdownOptions = [ { id: 'all', label: 'All conversations' }, { id: 'groups', label: 'Groups' }, { id: 'teams', label: 'Teams' }, { id: 'dms', label: 'DMs' }, { id: 'unread', label: 'Unread' }, ] // ================================= // ====== Component ================ // ================================= export function DesignSystemScreen() { const styles = useStyles() return ( ) } // ================================= // ====== Sections ================= // ================================= interface SectionProps { isLast?: boolean } function ThemeSection({ isLast }: SectionProps) { return ( There are four main parts to our theming system… Default theme Start at `src/utils/theme` when adding new theme values or checking what target apps have access to. The file has more instructions and examples. At a high level, it provides… Access to consuming app targets of what theme values that they can be customized. Fallback values for our components to use if the values weren't overriden. Customizing the theme Apps can override any default theme value by passing a `theme` object to our `ChatProvider` that holds a `theme` and a `colorScheme`. Currently types can be enforced by setting the parent theme object to `CreateChatThemeProps`. Example setup: `apps/sandbox/src/context/chat_context_provider.tsx` Merged theme In `src/contexts/chat_context.tsx` we merge the default theme and any custom values coming from a product target with the `useCreateChatTheme` hook. It creates a single `ChatTheme` type. Using theme values Inside of our own `chat-react-native` components we can access the merged `ChatTheme` object via our own `useTheme` hook. Example setup: `src/components/display/button.tsx` ) } function IndicatorsSection({ isLast }: SectionProps) { return ( ) } function HeadingTextSection({ isLast }: SectionProps) { const styles = useStyles() return ( Heading 1 Heading 2 Heading 3 Heading 4 Plain text Secondary Tertiary Footnote ) } function PressablesSection({ isLast }: SectionProps) { const styles = useStyles() const [filterSelected, setFilterSelected] = useState('Groups') const [dropdownSelected, setDropdownSelected] = useState('all') return (