nx-react-native-cli 2.7.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +43 -43
- package/package.json +1 -1
- package/templates/19.7.0/apps/mobile/android/app/src/main/java/com/appsmobile/MainActivity.kt +5 -1
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/AppDelegate.mm +6 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x~ipad.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@3x.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-20~ipad.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x~ipad.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@3x.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29~ipad.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x~ipad.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@3x.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-40~ipad.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-60@2x~car.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-60@3x~car.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-83.5@2x~ipad.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon@2x.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon@2x~ipad.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon@3x.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon~ipad.png +0 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/Contents.json +134 -0
- package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/Contents.json +6 -0
- package/templates/21.2.2/apps/mobile/android/app/src/main/java/com/mobile/MainActivity.kt +5 -1
- package/templates/21.2.2/apps/mobile/ios/Mobile/AppDelegate.mm +6 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x~ipad.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@3x.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-20~ipad.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x~ipad.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@3x.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29~ipad.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x~ipad.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@3x.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-40~ipad.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-60@2x~car.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-60@3x~car.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-83.5@2x~ipad.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon@2x.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon@2x~ipad.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon@3x.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon~ipad.png +0 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/Contents.json +134 -0
- package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/Contents.json +6 -0
- package/templates/shared/apps/mobile/android/app/src/main/AndroidManifest.xml +28 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png +0 -0
- package/templates/shared/apps/mobile/android/app/src/main/res/styles.xml +14 -0
- package/templates/shared/apps/mobile/run-android.sh +2 -1
- package/templates/shared/apps/mobile/scripts/setup-ios-dev-scheme.rb +101 -1
- package/templates/shared/apps/mobile/src/app/index.tsx +16 -47
- package/templates/shared/apps/mobile/src/app/query-client.ts +40 -0
- package/templates/shared/apps/mobile/src/assets/images/logo.png +0 -0
- package/templates/shared/apps/mobile/src/components/atoms/AlertManager/alert-manager.component.tsx +134 -0
- package/templates/shared/apps/mobile/src/components/atoms/AlertManager/alert-manager.types.ts +18 -0
- package/templates/shared/apps/mobile/src/components/atoms/AlertManager/alert.service.ts +27 -0
- package/templates/shared/apps/mobile/src/components/atoms/AlertManager/index.ts +3 -0
- package/templates/shared/apps/mobile/src/components/atoms/BottomSheet/bottom-sheet.component.tsx +14 -8
- package/templates/shared/apps/mobile/src/components/atoms/Button/button.component.tsx +1 -1
- package/templates/shared/apps/mobile/src/components/atoms/DateModalInput/date-modal-input.component.tsx +69 -0
- package/templates/shared/apps/mobile/src/components/atoms/DateModalInput/index.ts +1 -0
- package/templates/shared/apps/mobile/src/components/atoms/DatePicker/date-picker.component.tsx +44 -0
- package/templates/shared/apps/mobile/src/components/atoms/DatePicker/index.ts +1 -0
- package/templates/shared/apps/mobile/src/components/atoms/DateTextInput/date-text-input.component.tsx +218 -0
- package/templates/shared/apps/mobile/src/components/atoms/DateTextInput/index.ts +1 -0
- package/templates/shared/apps/mobile/src/components/atoms/Divider/divider-component.tsx +1 -1
- package/templates/shared/apps/mobile/src/components/atoms/GradientBackground/gradient-background.component.tsx +45 -0
- package/templates/shared/apps/mobile/src/components/atoms/GradientBackground/index.ts +1 -0
- package/templates/shared/apps/mobile/src/components/atoms/InputLayout/input-layout.component.tsx +12 -4
- package/templates/shared/apps/mobile/src/components/atoms/KeyboardAccessory/keyboard-accessory.component.tsx +6 -3
- package/templates/shared/apps/mobile/src/components/atoms/KeyboardAwareScrollView/keyboard-aware-scroll-view.component.tsx +1 -0
- package/templates/shared/apps/mobile/src/components/atoms/Modal/modal.component.tsx +2 -0
- package/templates/shared/apps/mobile/src/components/atoms/ScreenLoader/screen-loader.component.tsx +6 -1
- package/templates/shared/apps/mobile/src/components/atoms/SelectDropdown/index.ts +1 -0
- package/templates/shared/apps/mobile/src/components/atoms/SelectDropdown/select-dropdown.component.tsx +223 -0
- package/templates/shared/apps/mobile/src/components/atoms/Skeleton/skeleton.component.tsx +1 -1
- package/templates/shared/apps/mobile/src/components/atoms/TextInput/bottom-sheet-text-input.component.tsx +4 -3
- package/templates/shared/apps/mobile/src/components/atoms/TextInput/text-input.component.tsx +8 -4
- package/templates/shared/apps/mobile/src/components/atoms/ThemeManager/index.ts +1 -0
- package/templates/shared/apps/mobile/src/components/atoms/ThemeManager/theme-manager.component.tsx +27 -0
- package/templates/shared/apps/mobile/src/components/atoms/ToastManager/index.ts +3 -0
- package/templates/shared/apps/mobile/src/components/atoms/ToastManager/toast-manager.component.tsx +109 -0
- package/templates/shared/apps/mobile/src/components/atoms/ToastManager/toast-manager.types.ts +10 -0
- package/templates/shared/apps/mobile/src/components/atoms/ToastManager/toast.service.ts +27 -0
- package/templates/shared/apps/mobile/src/components/atoms/Typography/typography.component.tsx +1 -1
- package/templates/shared/apps/mobile/src/components/atoms/index.ts +8 -0
- package/templates/shared/apps/mobile/src/components/molecules/BackButton/back-button.component.tsx +1 -1
- package/templates/shared/apps/mobile/src/components/molecules/ScreenContainer/screen-container.component.tsx +4 -24
- package/templates/shared/apps/mobile/src/components/molecules/ScreenHeader/screen-header.component.tsx +2 -2
- package/templates/shared/apps/mobile/src/hooks/index.ts +1 -0
- package/templates/shared/apps/mobile/src/hooks/usePushNotifications.hook.ts +104 -0
- package/templates/shared/apps/mobile/src/hooks/useToggleDarkMode.hook.tsx +24 -2
- package/templates/shared/apps/mobile/src/icons/alert-triangle.svg +5 -0
- package/templates/shared/apps/mobile/src/icons/check-circle.svg +4 -0
- package/templates/shared/apps/mobile/src/icons/chevron-down.svg +1 -0
- package/templates/shared/apps/mobile/src/icons/chevron-right.svg +1 -0
- package/templates/shared/apps/mobile/src/icons/index.ts +18 -1
- package/templates/shared/apps/mobile/src/icons/info.svg +5 -0
- package/templates/shared/apps/mobile/src/icons/x-circle.svg +5 -0
- package/templates/shared/apps/mobile/src/routes/index.tsx +26 -15
- package/templates/shared/apps/mobile/src/screens/LandingScreen/landing.screen.tsx +232 -8
- package/templates/shared/apps/mobile/src/stores/local-storage.store.ts +9 -5
- package/templates/shared/apps/mobile/src/stores/theme.slice.ts +15 -0
- package/templates/shared/apps/mobile/src/stores/user.slice.ts +5 -1
- package/templates/shared/apps/mobile/src/tailwind/index.ts +3 -3
- package/templates/shared/apps/mobile/tailwind.config.js +14 -0
- package/templates/shared/patches/react-native-animatable+1.4.0.patch +71 -0
- package/templates/shared/apps/mobile/src/assets/images/.gitkeep +0 -0
|
@@ -1,17 +1,241 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Image, View } from 'react-native';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Alert,
|
|
6
|
+
BottomSheet,
|
|
7
|
+
Button,
|
|
8
|
+
DateModalInput,
|
|
9
|
+
DateTextInput,
|
|
10
|
+
Divider,
|
|
11
|
+
InputLayout,
|
|
12
|
+
Modal,
|
|
13
|
+
OutlinedButton,
|
|
14
|
+
ScreenContainer,
|
|
15
|
+
ScreenHeader,
|
|
16
|
+
SelectDropdown,
|
|
17
|
+
Skeleton,
|
|
18
|
+
TextInput,
|
|
19
|
+
Toast,
|
|
20
|
+
Typography,
|
|
21
|
+
useBottomSheet,
|
|
22
|
+
useModal,
|
|
23
|
+
} from '@/components';
|
|
24
|
+
import { requestPushNotification, useToggleDarkMode } from '@/hooks';
|
|
4
25
|
import { PublicScreenProps, Screens } from '@/routes';
|
|
5
|
-
import {
|
|
26
|
+
import { tw } from '@/tailwind';
|
|
6
27
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
28
|
+
const DROPDOWN_OPTIONS = [
|
|
29
|
+
{ id: '1', label: 'React Native' },
|
|
30
|
+
{ id: '2', label: 'Flutter' },
|
|
31
|
+
{ id: '3', label: 'SwiftUI' },
|
|
32
|
+
{ id: '4', label: 'Jetpack Compose' },
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
function SectionTitle({ title }: { title: string }) {
|
|
36
|
+
return <Typography style={tw`mb-2 mt-6 text-lg font-semibold`}>{title}</Typography>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function LandingScreen(_props: PublicScreenProps<Screens.LANDING>) {
|
|
40
|
+
const [textValue, setTextValue] = useState('');
|
|
41
|
+
const [dateModalValue, setDateModalValue] = useState<Date | undefined>();
|
|
42
|
+
const [dateTextValue, setDateTextValue] = useState<Date | undefined>();
|
|
43
|
+
const [selectedDropdown, setSelectedDropdown] = useState<string | undefined>();
|
|
44
|
+
const { hideModal, isVisible: isModalVisible, showModal } = useModal();
|
|
45
|
+
const { closeSheet, expandSheet, sheetRef } = useBottomSheet();
|
|
46
|
+
const { colorScheme, toggleColorScheme } = useToggleDarkMode();
|
|
47
|
+
const isDark = colorScheme === 'dark';
|
|
11
48
|
|
|
12
49
|
return (
|
|
13
50
|
<ScreenContainer>
|
|
14
|
-
<ScreenHeader title="
|
|
51
|
+
<ScreenHeader hasBackButton={false} title="Component Showcase" />
|
|
52
|
+
<View style={tw`px-4 pb-8`}>
|
|
53
|
+
{/* Logo */}
|
|
54
|
+
<View style={tw`mt-4 items-center`}>
|
|
55
|
+
<Image source={require('@/assets/images/logo.png')} style={{ height: 80, width: 80 }} />
|
|
56
|
+
</View>
|
|
57
|
+
|
|
58
|
+
{/* Theme Toggle */}
|
|
59
|
+
<SectionTitle title="Theme" />
|
|
60
|
+
<Button
|
|
61
|
+
title={isDark ? 'Switch to Light Mode' : 'Switch to Dark Mode'}
|
|
62
|
+
onPress={toggleColorScheme}
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<Button
|
|
66
|
+
style={tw`mt-3`}
|
|
67
|
+
title="Request Push Notifications"
|
|
68
|
+
onPress={() => requestPushNotification()}
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<Divider style={tw`mt-4`} />
|
|
72
|
+
|
|
73
|
+
{/* Typography */}
|
|
74
|
+
<SectionTitle title="Typography" />
|
|
75
|
+
<Typography style={tw`text-2xl font-bold`}>Heading Bold</Typography>
|
|
76
|
+
<Typography style={tw`text-lg font-semibold`}>Subheading Semibold</Typography>
|
|
77
|
+
<Typography style={tw`text-base`}>Body text regular</Typography>
|
|
78
|
+
<Typography style={tw`text-sm text-gray-500`}>Caption text</Typography>
|
|
79
|
+
|
|
80
|
+
<Divider style={tw`mt-4`} />
|
|
81
|
+
|
|
82
|
+
{/* Buttons */}
|
|
83
|
+
<SectionTitle title="Buttons" />
|
|
84
|
+
<View style={tw`gap-3`}>
|
|
85
|
+
<Button title="Primary Button" onPress={() => {}} />
|
|
86
|
+
<Button isLoading title="Loading Button" onPress={() => {}} />
|
|
87
|
+
<Button isDisabled title="Disabled Button" onPress={() => {}} />
|
|
88
|
+
<OutlinedButton title="Outlined Button" onPress={() => {}} />
|
|
89
|
+
</View>
|
|
90
|
+
|
|
91
|
+
<Divider style={tw`mt-4`} />
|
|
92
|
+
|
|
93
|
+
{/* TextInput */}
|
|
94
|
+
<SectionTitle title="Text Input" />
|
|
95
|
+
<View style={tw`gap-3`}>
|
|
96
|
+
<InputLayout isRequired label="Name">
|
|
97
|
+
<TextInput
|
|
98
|
+
placeholder="Enter your name"
|
|
99
|
+
value={textValue}
|
|
100
|
+
onChangeText={setTextValue}
|
|
101
|
+
/>
|
|
102
|
+
</InputLayout>
|
|
103
|
+
<InputLayout error="This field is required" label="With Error">
|
|
104
|
+
<TextInput placeholder="Something went wrong" value="" onChangeText={() => {}} />
|
|
105
|
+
</InputLayout>
|
|
106
|
+
</View>
|
|
107
|
+
|
|
108
|
+
<Divider style={tw`mt-4`} />
|
|
109
|
+
|
|
110
|
+
{/* Select Dropdown */}
|
|
111
|
+
<SectionTitle title="Select Dropdown" />
|
|
112
|
+
<InputLayout label="Framework">
|
|
113
|
+
<SelectDropdown
|
|
114
|
+
options={DROPDOWN_OPTIONS}
|
|
115
|
+
placeholder="Choose a framework"
|
|
116
|
+
selectedId={selectedDropdown}
|
|
117
|
+
onSelect={setSelectedDropdown}
|
|
118
|
+
/>
|
|
119
|
+
</InputLayout>
|
|
120
|
+
|
|
121
|
+
<Divider style={tw`mt-4`} />
|
|
122
|
+
|
|
123
|
+
{/* Date Inputs */}
|
|
124
|
+
<SectionTitle title="Date Modal Input" />
|
|
125
|
+
<InputLayout label="Birthday">
|
|
126
|
+
<DateModalInput
|
|
127
|
+
maximumDate={new Date()}
|
|
128
|
+
placeholder="Pick a date"
|
|
129
|
+
value={dateModalValue}
|
|
130
|
+
onChange={setDateModalValue}
|
|
131
|
+
/>
|
|
132
|
+
</InputLayout>
|
|
133
|
+
|
|
134
|
+
<SectionTitle title="Date Text Input" />
|
|
135
|
+
<InputLayout label="Date of Birth">
|
|
136
|
+
<DateTextInput value={dateTextValue} onChange={setDateTextValue} />
|
|
137
|
+
</InputLayout>
|
|
138
|
+
|
|
139
|
+
<Divider style={tw`mt-4`} />
|
|
140
|
+
|
|
141
|
+
{/* Skeleton */}
|
|
142
|
+
<SectionTitle title="Skeleton" />
|
|
143
|
+
<View style={tw`gap-2`}>
|
|
144
|
+
<Skeleton isLoading>
|
|
145
|
+
<View style={tw`h-5 w-3/4 rounded`} />
|
|
146
|
+
</Skeleton>
|
|
147
|
+
<Skeleton isLoading>
|
|
148
|
+
<View style={tw`h-5 w-1/2 rounded`} />
|
|
149
|
+
</Skeleton>
|
|
150
|
+
<Skeleton isLoading>
|
|
151
|
+
<View style={tw`h-10 w-full rounded-xl`} />
|
|
152
|
+
</Skeleton>
|
|
153
|
+
</View>
|
|
154
|
+
|
|
155
|
+
<Divider style={tw`mt-4`} />
|
|
156
|
+
|
|
157
|
+
{/* Alert */}
|
|
158
|
+
<SectionTitle title="Alerts" />
|
|
159
|
+
<View style={tw`gap-3`}>
|
|
160
|
+
<Button
|
|
161
|
+
title="Show Error Alert"
|
|
162
|
+
onPress={() =>
|
|
163
|
+
Alert.error({
|
|
164
|
+
message: 'Something went wrong. Please try again.',
|
|
165
|
+
title: 'Request Failed',
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
/>
|
|
169
|
+
<Button
|
|
170
|
+
title="Show Success Alert"
|
|
171
|
+
onPress={() =>
|
|
172
|
+
Alert.success({
|
|
173
|
+
title: 'Profile Updated',
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
/>
|
|
177
|
+
<Button
|
|
178
|
+
title="Show Warning Alert"
|
|
179
|
+
onPress={() =>
|
|
180
|
+
Alert.warning({
|
|
181
|
+
actions: [
|
|
182
|
+
{ label: 'Cancel', variant: 'cancel' },
|
|
183
|
+
{ label: 'Delete', onPress: () => {} },
|
|
184
|
+
],
|
|
185
|
+
message: 'This action cannot be undone.',
|
|
186
|
+
title: 'Delete Account',
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
/>
|
|
190
|
+
</View>
|
|
191
|
+
|
|
192
|
+
<Divider style={tw`mt-4`} />
|
|
193
|
+
|
|
194
|
+
{/* Toast */}
|
|
195
|
+
<SectionTitle title="Toasts" />
|
|
196
|
+
<View style={tw`gap-3`}>
|
|
197
|
+
<Button title="Success Toast" onPress={() => Toast.success('Profile saved')} />
|
|
198
|
+
<Button title="Error Toast" onPress={() => Toast.error('Something went wrong')} />
|
|
199
|
+
<Button title="Info Toast" onPress={() => Toast.info('New version available')} />
|
|
200
|
+
<Button title="Warning Toast" onPress={() => Toast.warning('Check your connection')} />
|
|
201
|
+
</View>
|
|
202
|
+
|
|
203
|
+
<Divider style={tw`mt-4`} />
|
|
204
|
+
|
|
205
|
+
{/* Modal */}
|
|
206
|
+
<SectionTitle title="Modal" />
|
|
207
|
+
<Button title="Open Modal" onPress={showModal} />
|
|
208
|
+
<Modal isVisible={isModalVisible} onBackButtonPress={hideModal} onBackdropPress={hideModal}>
|
|
209
|
+
<View pointerEvents="box-none" style={tw`flex-1 items-center justify-center`}>
|
|
210
|
+
<View style={tw`dark:bg-sheet mx-8 w-[85%] rounded-2xl bg-white p-6`}>
|
|
211
|
+
<Typography style={tw`text-lg font-semibold`}>Modal Title</Typography>
|
|
212
|
+
<Typography style={tw`dark:text-subtitle mt-2 text-sm text-gray-500`}>
|
|
213
|
+
This is a custom modal with any content you want.
|
|
214
|
+
</Typography>
|
|
215
|
+
<Button style={tw`mt-4`} title="Close" onPress={hideModal} />
|
|
216
|
+
</View>
|
|
217
|
+
</View>
|
|
218
|
+
</Modal>
|
|
219
|
+
|
|
220
|
+
<Divider style={tw`mt-4`} />
|
|
221
|
+
|
|
222
|
+
{/* Bottom Sheet */}
|
|
223
|
+
<SectionTitle title="Bottom Sheet" />
|
|
224
|
+
<Button title="Open Bottom Sheet" onPress={expandSheet} />
|
|
225
|
+
<BottomSheet
|
|
226
|
+
backgroundStyle={tw`dark:bg-sheet bg-white`}
|
|
227
|
+
sheetRef={sheetRef}
|
|
228
|
+
snapPoints={['40%']}
|
|
229
|
+
>
|
|
230
|
+
<View style={tw`p-6`}>
|
|
231
|
+
<Typography style={tw`text-lg font-semibold`}>Bottom Sheet</Typography>
|
|
232
|
+
<Typography style={tw`dark:text-subtitle mt-2 text-sm text-gray-500`}>
|
|
233
|
+
Swipe down or tap the backdrop to dismiss.
|
|
234
|
+
</Typography>
|
|
235
|
+
<Button style={tw`mt-4`} title="Close" onPress={closeSheet} />
|
|
236
|
+
</View>
|
|
237
|
+
</BottomSheet>
|
|
238
|
+
</View>
|
|
15
239
|
</ScreenContainer>
|
|
16
240
|
);
|
|
17
241
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { StateCreator, create } from 'zustand';
|
|
2
2
|
import { PersistOptions, createJSONStorage, persist } from 'zustand/middleware';
|
|
3
3
|
|
|
4
|
+
import { createThemeSlice, ThemeSlice } from './theme.slice';
|
|
4
5
|
import { createUserSlice, UserSlice } from './user.slice';
|
|
5
6
|
|
|
6
7
|
import { MmkvStorage } from '@/stores/mmkvStorage';
|
|
7
8
|
|
|
8
|
-
export type LocalStorageStore = UserSlice &
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export type LocalStorageStore = UserSlice &
|
|
10
|
+
ThemeSlice & {
|
|
11
|
+
_hasHydrated: boolean;
|
|
12
|
+
setHasHydrated: (hasHydrated: boolean) => void;
|
|
13
|
+
clear: () => void;
|
|
14
|
+
};
|
|
13
15
|
|
|
14
16
|
type MyPersist = (
|
|
15
17
|
config: StateCreator<LocalStorageStore>,
|
|
@@ -21,9 +23,11 @@ export const useLocalStorageStore = create<LocalStorageStore, []>(
|
|
|
21
23
|
(set, get, store) =>
|
|
22
24
|
(() => {
|
|
23
25
|
const userSlice = createUserSlice(set, get, store);
|
|
26
|
+
const themeSlice = createThemeSlice(set, get, store);
|
|
24
27
|
|
|
25
28
|
return {
|
|
26
29
|
...userSlice,
|
|
30
|
+
...themeSlice,
|
|
27
31
|
_hasHydrated: false,
|
|
28
32
|
clear: () => {
|
|
29
33
|
userSlice.signOut();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StateCreator } from 'zustand';
|
|
2
|
+
|
|
3
|
+
export type ColorScheme = 'light' | 'dark';
|
|
4
|
+
|
|
5
|
+
export type ThemeSlice = {
|
|
6
|
+
colorScheme: ColorScheme;
|
|
7
|
+
setColorScheme: (scheme: ColorScheme) => void;
|
|
8
|
+
toggleColorScheme: () => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const createThemeSlice: StateCreator<ThemeSlice> = (set, get) => ({
|
|
12
|
+
colorScheme: 'light',
|
|
13
|
+
setColorScheme: (scheme: ColorScheme) => set({ colorScheme: scheme }),
|
|
14
|
+
toggleColorScheme: () => set({ colorScheme: get().colorScheme === 'light' ? 'dark' : 'light' }),
|
|
15
|
+
});
|
|
@@ -9,14 +9,18 @@ export type User = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export type UserSlice = {
|
|
12
|
+
pushNotificationsEnabled: boolean;
|
|
12
13
|
setUser: (user: User | null) => void;
|
|
14
|
+
setPushNotificationsEnabled: (value: boolean) => void;
|
|
13
15
|
signOut: () => void;
|
|
14
16
|
user: User | null;
|
|
15
17
|
clear: () => void;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export const createUserSlice: StateCreator<UserSlice> = (set) => ({
|
|
19
|
-
clear: () => set({ user: null }),
|
|
21
|
+
clear: () => set({ pushNotificationsEnabled: true, user: null }),
|
|
22
|
+
pushNotificationsEnabled: true,
|
|
23
|
+
setPushNotificationsEnabled: (value: boolean) => set({ pushNotificationsEnabled: value }),
|
|
20
24
|
setUser: (user: User | null) => set({ user }),
|
|
21
25
|
signOut: () => set({ user: null }),
|
|
22
26
|
user: null,
|
|
@@ -60,13 +60,13 @@ export const errorContainerStyle = (err: boolean) => err && tw`border-red-600`;
|
|
|
60
60
|
|
|
61
61
|
export const disabledInputStyle = (isDisabled: boolean) => isDisabled && tw`opacity-50`;
|
|
62
62
|
|
|
63
|
-
export const focusedInputStyle = (isFocused: boolean) => isFocused && tw
|
|
63
|
+
export const focusedInputStyle = (isFocused: boolean) => isFocused && tw`border-primary-400`;
|
|
64
64
|
|
|
65
65
|
export const errorTextStyle = (err: boolean) => err && tw`text-red-600`;
|
|
66
66
|
|
|
67
|
-
export const defaultInputContainerStyle = tw`ios:px-4 ios:py-3.5 android:py-1 android:px-3 android:min-h-[50px] flex-row rounded-xl border border-
|
|
67
|
+
export const defaultInputContainerStyle = tw`ios:px-4 ios:py-3.5 android:py-1 android:px-3 android:min-h-[50px] flex-row rounded-xl border border-gray-300 bg-white`;
|
|
68
68
|
export const defaultInputTextStyle = [
|
|
69
|
-
tw`flex-1 font-normal text-
|
|
69
|
+
tw`flex-1 font-normal text-gray-900`,
|
|
70
70
|
CONFIG.IS_ANDROID ? { textAlignVertical: 'center' } : null,
|
|
71
71
|
];
|
|
72
72
|
|
|
@@ -39,6 +39,20 @@ module.exports = {
|
|
|
39
39
|
2: '2 2 0%',
|
|
40
40
|
},
|
|
41
41
|
colors: {
|
|
42
|
+
white: '#ffffff',
|
|
43
|
+
background: '#0f1419',
|
|
44
|
+
disabled: '#6b7280',
|
|
45
|
+
divider: '#3a4556',
|
|
46
|
+
error: '#ef4444',
|
|
47
|
+
foreground: '#f8f9fa',
|
|
48
|
+
muted: '#e1e4e8',
|
|
49
|
+
overlay: '#1e2d3d',
|
|
50
|
+
placeholder: '#8b92a0',
|
|
51
|
+
sheet: '#1a2332',
|
|
52
|
+
subtitle: '#8b92a0',
|
|
53
|
+
success: '#22c55e',
|
|
54
|
+
surface: '#2a3544',
|
|
55
|
+
underlay: '#131a26',
|
|
42
56
|
// https://uicolors.app/create
|
|
43
57
|
gray: {
|
|
44
58
|
50: '#f7f8f8',
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
diff --git a/node_modules/react-native-animatable/createAnimatableComponent.js b/node_modules/react-native-animatable/createAnimatableComponent.js
|
|
2
|
+
index 7be96ea..e8fd51a 100644
|
|
3
|
+
--- a/node_modules/react-native-animatable/createAnimatableComponent.js
|
|
4
|
+
+++ b/node_modules/react-native-animatable/createAnimatableComponent.js
|
|
5
|
+
@@ -31,6 +31,9 @@ const INTERPOLATION_STYLE_PROPERTIES = [
|
|
6
|
+
'textDecorationColor',
|
|
7
|
+
// Image styles
|
|
8
|
+
'tintColor',
|
|
9
|
+
+ // 'width', 'height'
|
|
10
|
+
+ 'width',
|
|
11
|
+
+ 'height'
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const ZERO_CLAMPED_STYLE_PROPERTIES = ['width', 'height'];
|
|
15
|
+
@@ -241,10 +244,7 @@ export default function createAnimatableComponent(WrappedComponent) {
|
|
16
|
+
);
|
|
17
|
+
Object.keys(currentTransitionValues).forEach((key) => {
|
|
18
|
+
const value = currentTransitionValues[key];
|
|
19
|
+
- if (
|
|
20
|
+
- INTERPOLATION_STYLE_PROPERTIES.indexOf(key) !== -1 ||
|
|
21
|
+
- typeof value !== 'number'
|
|
22
|
+
- ) {
|
|
23
|
+
+ if (INTERPOLATION_STYLE_PROPERTIES.indexOf(key) !== -1) {
|
|
24
|
+
transitionValues[key] = new Animated.Value(0);
|
|
25
|
+
styleValues[key] = value;
|
|
26
|
+
} else {
|
|
27
|
+
@@ -454,30 +454,18 @@ export default function createAnimatableComponent(WrappedComponent) {
|
|
28
|
+
if (!transitionValue) {
|
|
29
|
+
transitionValue = new Animated.Value(0);
|
|
30
|
+
}
|
|
31
|
+
- const needsInterpolation =
|
|
32
|
+
- INTERPOLATION_STYLE_PROPERTIES.indexOf(property) !== -1 ||
|
|
33
|
+
- typeof value !== 'number';
|
|
34
|
+
- const needsZeroClamping =
|
|
35
|
+
- ZERO_CLAMPED_STYLE_PROPERTIES.indexOf(property) !== -1;
|
|
36
|
+
+ const needsInterpolation = INTERPOLATION_STYLE_PROPERTIES.indexOf(property) !== -1;
|
|
37
|
+
+ const needsZeroClamping = ZERO_CLAMPED_STYLE_PROPERTIES.indexOf(property) !== -1;
|
|
38
|
+
if (needsInterpolation) {
|
|
39
|
+
transitionValue.setValue(0);
|
|
40
|
+
transitionStyle[property] = transitionValue.interpolate({
|
|
41
|
+
inputRange: [0, 1],
|
|
42
|
+
outputRange: [fromValue, toValue],
|
|
43
|
+
+ extrapolateLeft: needsZeroClamping ? 'clamp' : 'extend'
|
|
44
|
+
});
|
|
45
|
+
currentTransitionValues[property] = toValue;
|
|
46
|
+
toValuesFlat[property] = 1;
|
|
47
|
+
} else {
|
|
48
|
+
- if (needsZeroClamping) {
|
|
49
|
+
- transitionStyle[property] = transitionValue.interpolate({
|
|
50
|
+
- inputRange: [0, 1],
|
|
51
|
+
- outputRange: [0, 1],
|
|
52
|
+
- extrapolateLeft: 'clamp',
|
|
53
|
+
- });
|
|
54
|
+
- currentTransitionValues[property] = toValue;
|
|
55
|
+
- } else {
|
|
56
|
+
- transitionStyle[property] = transitionValue;
|
|
57
|
+
- }
|
|
58
|
+
transitionValue.setValue(fromValue);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
@@ -504,9 +492,7 @@ export default function createAnimatableComponent(WrappedComponent) {
|
|
62
|
+
|
|
63
|
+
Object.keys(toValuesFlat).forEach((property) => {
|
|
64
|
+
const toValue = toValuesFlat[property];
|
|
65
|
+
- const needsInterpolation =
|
|
66
|
+
- INTERPOLATION_STYLE_PROPERTIES.indexOf(property) !== -1 ||
|
|
67
|
+
- typeof value !== 'number';
|
|
68
|
+
+ const needsInterpolation = INTERPOLATION_STYLE_PROPERTIES.indexOf(property) !== -1;
|
|
69
|
+
const needsZeroClamping =
|
|
70
|
+
ZERO_CLAMPED_STYLE_PROPERTIES.indexOf(property) !== -1;
|
|
71
|
+
const transitionStyle = this.state.transitionStyle[property];
|
|
File without changes
|