@oxyhq/services 5.11.9 → 5.11.11
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/commonjs/ui/components/AnimationExample.js +213 -0
- package/lib/commonjs/ui/components/AnimationExample.js.map +1 -0
- package/lib/commonjs/ui/components/FollowButton.js +58 -47
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedItem.js +2 -1
- package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedSection.js +3 -0
- package/lib/commonjs/ui/components/GroupedSection.js.map +1 -1
- package/lib/commonjs/ui/components/Header.js +26 -12
- package/lib/commonjs/ui/components/Header.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +69 -33
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileCard.js +5 -1
- package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
- package/lib/commonjs/ui/components/StepBasedScreen.README.md +337 -0
- package/lib/commonjs/ui/components/StepBasedScreen.js +361 -0
- package/lib/commonjs/ui/components/StepBasedScreen.js.map +1 -0
- package/lib/commonjs/ui/components/icon/OxyIcon.js +3 -3
- package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/commonjs/ui/components/index.js +0 -7
- package/lib/commonjs/ui/components/index.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
- package/lib/commonjs/ui/components/internal/TextField.js +8 -4
- package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
- package/lib/commonjs/ui/components/photogrid/JustifiedPhotoGrid.js +161 -0
- package/lib/commonjs/ui/components/photogrid/JustifiedPhotoGrid.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +103 -44
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/useFollow.types.js +2 -0
- package/lib/commonjs/ui/hooks/useFollow.types.js.map +1 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js +10 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +26 -14
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +3 -3
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +64 -15
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +4 -4
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +72 -75
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +286 -126
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +322 -0
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/ProfileScreen.js +56 -56
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js +87 -219
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +176 -174
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +138 -244
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +143 -744
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +386 -0
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +25 -15
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +16 -9
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/RecoverRequestStep.js +110 -0
- package/lib/commonjs/ui/screens/steps/RecoverRequestStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/RecoverSuccessStep.js +138 -0
- package/lib/commonjs/ui/screens/steps/RecoverSuccessStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/RecoverVerifyStep.js +141 -0
- package/lib/commonjs/ui/screens/steps/RecoverVerifyStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignInPasswordStep.js +165 -0
- package/lib/commonjs/ui/screens/steps/SignInPasswordStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignInUsernameStep.js +150 -0
- package/lib/commonjs/ui/screens/steps/SignInUsernameStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignUpIdentityStep.js +171 -0
- package/lib/commonjs/ui/screens/steps/SignUpIdentityStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignUpSecurityStep.js +163 -0
- package/lib/commonjs/ui/screens/steps/SignUpSecurityStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignUpSummaryStep.js +170 -0
- package/lib/commonjs/ui/screens/steps/SignUpSummaryStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignUpWelcomeStep.js +72 -0
- package/lib/commonjs/ui/screens/steps/SignUpWelcomeStep.js.map +1 -0
- package/lib/commonjs/ui/styles/authStyles.js +1 -1
- package/lib/commonjs/ui/styles/authStyles.js.map +1 -1
- package/lib/module/ui/components/AnimationExample.js +209 -0
- package/lib/module/ui/components/AnimationExample.js.map +1 -0
- package/lib/module/ui/components/FollowButton.js +58 -47
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/GroupedItem.js +2 -1
- package/lib/module/ui/components/GroupedItem.js.map +1 -1
- package/lib/module/ui/components/GroupedSection.js +3 -0
- package/lib/module/ui/components/GroupedSection.js.map +1 -1
- package/lib/module/ui/components/Header.js +26 -12
- package/lib/module/ui/components/Header.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +70 -34
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/ProfileCard.js +5 -1
- package/lib/module/ui/components/ProfileCard.js.map +1 -1
- package/lib/module/ui/components/Section.js.map +1 -1
- package/lib/module/ui/components/SectionTitle.js.map +1 -1
- package/lib/module/ui/components/StepBasedScreen.README.md +337 -0
- package/lib/module/ui/components/StepBasedScreen.js +356 -0
- package/lib/module/ui/components/StepBasedScreen.js.map +1 -0
- package/lib/module/ui/components/icon/FAIRWalletIcon.js.map +1 -1
- package/lib/module/ui/components/icon/OxyIcon.js +3 -3
- package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/module/ui/components/index.js +0 -1
- package/lib/module/ui/components/index.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +1 -1
- package/lib/module/ui/components/internal/PinInput.js.map +1 -1
- package/lib/module/ui/components/internal/TextField.js +8 -4
- package/lib/module/ui/components/internal/TextField.js.map +1 -1
- package/lib/module/ui/components/photogrid/JustifiedPhotoGrid.js +156 -0
- package/lib/module/ui/components/photogrid/JustifiedPhotoGrid.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +103 -45
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/useFollow.types.js +2 -0
- package/lib/module/ui/hooks/useFollow.types.js.map +1 -0
- package/lib/module/ui/navigation/OxyRouter.js +10 -0
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +12 -1
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +3 -3
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +64 -15
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +4 -4
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +72 -75
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +285 -125
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +319 -0
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -0
- package/lib/module/ui/screens/ProfileScreen.js +56 -56
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/RecoverAccountScreen.js +91 -222
- package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +177 -175
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +140 -246
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/SignUpScreen.js +145 -745
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +382 -0
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -0
- package/lib/module/ui/screens/internal/SignInPasswordStep.js +23 -14
- package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInUsernameStep.js +15 -9
- package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/steps/RecoverRequestStep.js +105 -0
- package/lib/module/ui/screens/steps/RecoverRequestStep.js.map +1 -0
- package/lib/module/ui/screens/steps/RecoverSuccessStep.js +133 -0
- package/lib/module/ui/screens/steps/RecoverSuccessStep.js.map +1 -0
- package/lib/module/ui/screens/steps/RecoverVerifyStep.js +136 -0
- package/lib/module/ui/screens/steps/RecoverVerifyStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignInPasswordStep.js +160 -0
- package/lib/module/ui/screens/steps/SignInPasswordStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignInUsernameStep.js +145 -0
- package/lib/module/ui/screens/steps/SignInUsernameStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignUpIdentityStep.js +166 -0
- package/lib/module/ui/screens/steps/SignUpIdentityStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignUpSecurityStep.js +158 -0
- package/lib/module/ui/screens/steps/SignUpSecurityStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignUpSummaryStep.js +165 -0
- package/lib/module/ui/screens/steps/SignUpSummaryStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignUpWelcomeStep.js +67 -0
- package/lib/module/ui/screens/steps/SignUpWelcomeStep.js.map +1 -0
- package/lib/module/ui/styles/authStyles.js +1 -1
- package/lib/module/ui/styles/authStyles.js.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +5 -8
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/models/session.d.ts +1 -4
- package/lib/typescript/models/session.d.ts.map +1 -1
- package/lib/typescript/ui/components/AnimationExample.d.ts +4 -0
- package/lib/typescript/ui/components/AnimationExample.d.ts.map +1 -0
- package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
- package/lib/typescript/ui/components/Header.d.ts +9 -0
- package/lib/typescript/ui/components/Header.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyPayButton.d.ts +2 -2
- package/lib/typescript/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/ProfileCard.d.ts +1 -3
- package/lib/typescript/ui/components/ProfileCard.d.ts.map +1 -1
- package/lib/typescript/ui/components/Section.d.ts +2 -1
- package/lib/typescript/ui/components/Section.d.ts.map +1 -1
- package/lib/typescript/ui/components/SectionTitle.d.ts +2 -1
- package/lib/typescript/ui/components/SectionTitle.d.ts.map +1 -1
- package/lib/typescript/ui/components/StepBasedScreen.d.ts +24 -0
- package/lib/typescript/ui/components/StepBasedScreen.d.ts.map +1 -0
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts +2 -1
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts.map +1 -1
- package/lib/typescript/ui/components/icon/OxyIcon.d.ts +1 -1
- package/lib/typescript/ui/components/icon/OxyIcon.d.ts.map +1 -1
- package/lib/typescript/ui/components/index.d.ts +0 -1
- package/lib/typescript/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/PinInput.d.ts +9 -1
- package/lib/typescript/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
- package/lib/typescript/ui/components/photogrid/JustifiedPhotoGrid.d.ts +27 -0
- package/lib/typescript/ui/components/photogrid/JustifiedPhotoGrid.d.ts.map +1 -0
- package/lib/typescript/ui/context/OxyContext.d.ts +8 -3
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useFollow.types.d.ts +33 -0
- package/lib/typescript/ui/hooks/useFollow.types.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/types.d.ts +5 -0
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts +18 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/LanguageSelectorScreen.d.ts +7 -0
- package/lib/typescript/ui/screens/LanguageSelectorScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +2 -9
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/WelcomeNewUserScreen.d.ts +13 -0
- package/lib/typescript/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +5 -5
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +4 -4
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/RecoverRequestStep.d.ts +21 -0
- package/lib/typescript/ui/screens/steps/RecoverRequestStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/RecoverSuccessStep.d.ts +18 -0
- package/lib/typescript/ui/screens/steps/RecoverSuccessStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/RecoverVerifyStep.d.ts +24 -0
- package/lib/typescript/ui/screens/steps/RecoverVerifyStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignInPasswordStep.d.ts +27 -0
- package/lib/typescript/ui/screens/steps/SignInPasswordStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignInUsernameStep.d.ts +27 -0
- package/lib/typescript/ui/screens/steps/SignInUsernameStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignUpIdentityStep.d.ts +25 -0
- package/lib/typescript/ui/screens/steps/SignUpIdentityStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignUpSecurityStep.d.ts +26 -0
- package/lib/typescript/ui/screens/steps/SignUpSecurityStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignUpSummaryStep.d.ts +16 -0
- package/lib/typescript/ui/screens/steps/SignUpSummaryStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignUpWelcomeStep.d.ts +13 -0
- package/lib/typescript/ui/screens/steps/SignUpWelcomeStep.d.ts.map +1 -0
- package/lib/typescript/ui/styles/authStyles.d.ts +1 -1
- package/package.json +10 -3
- package/src/models/interfaces.ts +7 -8
- package/src/models/session.ts +1 -4
- package/src/ui/components/AnimationExample.tsx +195 -0
- package/src/ui/components/FollowButton.tsx +65 -45
- package/src/ui/components/GroupedItem.tsx +1 -0
- package/src/ui/components/GroupedSection.tsx +1 -1
- package/src/ui/components/Header.tsx +37 -13
- package/src/ui/components/OxyPayButton.tsx +2 -2
- package/src/ui/components/OxyProvider.tsx +67 -33
- package/src/ui/components/ProfileCard.tsx +6 -8
- package/src/ui/components/Section.tsx +7 -7
- package/src/ui/components/SectionTitle.tsx +2 -2
- package/src/ui/components/StepBasedScreen.README.md +337 -0
- package/src/ui/components/StepBasedScreen.tsx +417 -0
- package/src/ui/components/icon/FAIRWalletIcon.tsx +2 -2
- package/src/ui/components/icon/OxyIcon.tsx +10 -11
- package/src/ui/components/index.ts +0 -1
- package/src/ui/components/internal/PinInput.tsx +13 -4
- package/src/ui/components/internal/TextField.tsx +12 -6
- package/src/ui/components/photogrid/JustifiedPhotoGrid.tsx +158 -0
- package/src/ui/context/OxyContext.tsx +90 -59
- package/src/ui/hooks/useFollow.types.ts +33 -0
- package/src/ui/navigation/OxyRouter.tsx +10 -0
- package/src/ui/navigation/types.ts +6 -0
- package/src/ui/screens/AccountCenterScreen.tsx +13 -7
- package/src/ui/screens/AccountOverviewScreen.tsx +3 -3
- package/src/ui/screens/AccountSettingsScreen.tsx +65 -13
- package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
- package/src/ui/screens/FeedbackScreen.tsx +57 -80
- package/src/ui/screens/FileManagementScreen.tsx +278 -175
- package/src/ui/screens/LanguageSelectorScreen.tsx +322 -0
- package/src/ui/screens/PaymentGatewayScreen.tsx +2 -2
- package/src/ui/screens/ProfileScreen.tsx +60 -55
- package/src/ui/screens/RecoverAccountScreen.tsx +98 -211
- package/src/ui/screens/SessionManagementScreen.tsx +148 -151
- package/src/ui/screens/SignInScreen.tsx +148 -290
- package/src/ui/screens/SignUpScreen.tsx +147 -751
- package/src/ui/screens/WelcomeNewUserScreen.tsx +272 -0
- package/src/ui/screens/internal/SignInPasswordStep.tsx +28 -13
- package/src/ui/screens/internal/SignInUsernameStep.tsx +21 -11
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +1 -1
- package/src/ui/screens/steps/RecoverRequestStep.tsx +130 -0
- package/src/ui/screens/steps/RecoverSuccessStep.tsx +131 -0
- package/src/ui/screens/steps/RecoverVerifyStep.tsx +153 -0
- package/src/ui/screens/steps/SignInPasswordStep.tsx +172 -0
- package/src/ui/screens/steps/SignInUsernameStep.tsx +176 -0
- package/src/ui/screens/steps/SignUpIdentityStep.tsx +204 -0
- package/src/ui/screens/steps/SignUpSecurityStep.tsx +191 -0
- package/src/ui/screens/steps/SignUpSummaryStep.tsx +130 -0
- package/src/ui/screens/steps/SignUpWelcomeStep.tsx +65 -0
- package/src/ui/styles/authStyles.ts +1 -1
|
@@ -3,7 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import { TouchableOpacity, Text, View, StyleSheet, type ViewStyle, type TextStyle, type StyleProp, type LayoutChangeEvent } from 'react-native';
|
|
4
4
|
import { fontFamilies } from '../styles/fonts';
|
|
5
5
|
import { useOxy } from '../context/OxyContext';
|
|
6
|
-
import type { PaymentItem } from '../screens/PaymentGatewayScreen';
|
|
6
|
+
import type { PaymentItem, PaymentGatewayResult } from '../screens/PaymentGatewayScreen';
|
|
7
7
|
import OxyLogo from './OxyLogo';
|
|
8
8
|
|
|
9
9
|
export interface OxyPayButtonProps {
|
|
@@ -15,7 +15,7 @@ export interface OxyPayButtonProps {
|
|
|
15
15
|
currency?: string;
|
|
16
16
|
paymentItems?: PaymentItem[];
|
|
17
17
|
description?: string;
|
|
18
|
-
onPaymentResult?: (result:
|
|
18
|
+
onPaymentResult?: (result: PaymentGatewayResult) => void;
|
|
19
19
|
/**
|
|
20
20
|
* Button background color. If not provided, uses variant ('white' or 'black').
|
|
21
21
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { useCallback, useRef, useState, useEffect, useMemo } from 'react';
|
|
3
|
-
import { View, Text, StyleSheet, Dimensions, Platform, Animated, StatusBar, Keyboard, KeyboardEvent } from 'react-native';
|
|
3
|
+
import { View, Text, StyleSheet, Dimensions, Platform, Animated, StatusBar, Keyboard, KeyboardEvent, AppState } from 'react-native';
|
|
4
4
|
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
5
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
6
6
|
import type { OxyProviderProps } from '../navigation/types';
|
|
@@ -8,6 +8,7 @@ import { OxyContextProvider, useOxy } from '../context/OxyContext';
|
|
|
8
8
|
import OxyRouter from '../navigation/OxyRouter';
|
|
9
9
|
import { FontLoader, setupFonts } from './FontLoader';
|
|
10
10
|
import { Toaster } from '../../lib/sonner';
|
|
11
|
+
import { QueryClient, QueryClientProvider, focusManager } from '@tanstack/react-query';
|
|
11
12
|
|
|
12
13
|
// Import bottom sheet components directly - no longer a peer dependency
|
|
13
14
|
import { BottomSheetModal, BottomSheetBackdrop, type BottomSheetBackdropProps, BottomSheetModalProvider, BottomSheetView, BottomSheetScrollView } from '@gorhom/bottom-sheet';
|
|
@@ -38,47 +39,80 @@ const OxyProvider: React.FC<OxyProviderProps> = (props) => {
|
|
|
38
39
|
// Create internal bottom sheet ref
|
|
39
40
|
const internalBottomSheetRef = useRef<BottomSheetModalRef>(null);
|
|
40
41
|
|
|
42
|
+
// Initialize React Query Client (use provided client or create a default one once)
|
|
43
|
+
const queryClientRef = useRef<QueryClient | null>(null);
|
|
44
|
+
if (!queryClientRef.current) {
|
|
45
|
+
queryClientRef.current = props.queryClient ?? new QueryClient({
|
|
46
|
+
defaultOptions: {
|
|
47
|
+
queries: {
|
|
48
|
+
staleTime: 30_000,
|
|
49
|
+
gcTime: 5 * 60_000,
|
|
50
|
+
retry: 2,
|
|
51
|
+
refetchOnReconnect: true,
|
|
52
|
+
refetchOnWindowFocus: false,
|
|
53
|
+
},
|
|
54
|
+
mutations: {
|
|
55
|
+
retry: 1,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Hook React Query focus manager into React Native AppState
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const subscription = AppState.addEventListener('change', (state) => {
|
|
64
|
+
focusManager.setFocused(state === 'active');
|
|
65
|
+
});
|
|
66
|
+
return () => {
|
|
67
|
+
subscription.remove();
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
41
71
|
// If contextOnly is true, we just provide the context without the bottom sheet UI
|
|
42
72
|
if (contextOnly) {
|
|
43
73
|
return (
|
|
74
|
+
<QueryClientProvider client={queryClientRef.current}>
|
|
75
|
+
<OxyContextProvider
|
|
76
|
+
oxyServices={oxyServices}
|
|
77
|
+
baseURL={baseURL}
|
|
78
|
+
storageKeyPrefix={storageKeyPrefix}
|
|
79
|
+
onAuthStateChange={onAuthStateChange}
|
|
80
|
+
>
|
|
81
|
+
{children}
|
|
82
|
+
</OxyContextProvider>
|
|
83
|
+
</QueryClientProvider>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Otherwise, provide both the context and the bottom sheet UI
|
|
88
|
+
return (
|
|
89
|
+
<QueryClientProvider client={queryClientRef.current}>
|
|
44
90
|
<OxyContextProvider
|
|
45
91
|
oxyServices={oxyServices}
|
|
46
92
|
baseURL={baseURL}
|
|
47
93
|
storageKeyPrefix={storageKeyPrefix}
|
|
48
94
|
onAuthStateChange={onAuthStateChange}
|
|
95
|
+
bottomSheetRef={internalBottomSheetRef}
|
|
49
96
|
>
|
|
50
|
-
|
|
97
|
+
<FontLoader>
|
|
98
|
+
<GestureHandlerRootView style={styles.gestureHandlerRoot}>
|
|
99
|
+
<BottomSheetModalProvider>
|
|
100
|
+
<StatusBar translucent backgroundColor="transparent" />
|
|
101
|
+
<SafeAreaProvider>
|
|
102
|
+
<OxyBottomSheet {...bottomSheetProps} bottomSheetRef={internalBottomSheetRef} oxyServices={oxyServices} />
|
|
103
|
+
{children}
|
|
104
|
+
</SafeAreaProvider>
|
|
105
|
+
</BottomSheetModalProvider>
|
|
106
|
+
{/* Global Toaster for app-wide notifications outside of Modal contexts - only show if internal toaster is disabled */}
|
|
107
|
+
{!showInternalToaster && (
|
|
108
|
+
<View style={styles.toasterContainer}>
|
|
109
|
+
<Toaster position="top-center" swipeToDismissDirection="left" offset={15} />
|
|
110
|
+
</View>
|
|
111
|
+
)}
|
|
112
|
+
</GestureHandlerRootView>
|
|
113
|
+
</FontLoader>
|
|
51
114
|
</OxyContextProvider>
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Otherwise, provide both the context and the bottom sheet UI
|
|
56
|
-
return (
|
|
57
|
-
<OxyContextProvider
|
|
58
|
-
oxyServices={oxyServices}
|
|
59
|
-
baseURL={baseURL}
|
|
60
|
-
storageKeyPrefix={storageKeyPrefix}
|
|
61
|
-
onAuthStateChange={onAuthStateChange}
|
|
62
|
-
bottomSheetRef={internalBottomSheetRef}
|
|
63
|
-
>
|
|
64
|
-
<FontLoader>
|
|
65
|
-
<GestureHandlerRootView style={styles.gestureHandlerRoot}>
|
|
66
|
-
<BottomSheetModalProvider>
|
|
67
|
-
<StatusBar translucent backgroundColor="transparent" />
|
|
68
|
-
<SafeAreaProvider>
|
|
69
|
-
<OxyBottomSheet {...bottomSheetProps} bottomSheetRef={internalBottomSheetRef} oxyServices={oxyServices} />
|
|
70
|
-
{children}
|
|
71
|
-
</SafeAreaProvider>
|
|
72
|
-
</BottomSheetModalProvider>
|
|
73
|
-
{/* Global Toaster for app-wide notifications outside of Modal contexts - only show if internal toaster is disabled */}
|
|
74
|
-
{!showInternalToaster && (
|
|
75
|
-
<View style={styles.toasterContainer}>
|
|
76
|
-
<Toaster position="top-center" swipeToDismissDirection="left" offset={15} />
|
|
77
|
-
</View>
|
|
78
|
-
)}
|
|
79
|
-
</GestureHandlerRootView>
|
|
80
|
-
</FontLoader>
|
|
81
|
-
</OxyContextProvider>
|
|
115
|
+
</QueryClientProvider>
|
|
82
116
|
);
|
|
83
117
|
};
|
|
84
118
|
|
|
@@ -108,7 +142,7 @@ const OxyBottomSheet: React.FC<OxyProviderProps> = ({
|
|
|
108
142
|
const oxyServices = providedOxyServices || contextOxy?.oxyServices;
|
|
109
143
|
// Use the internal ref (which is passed as a prop from OxyProvider)
|
|
110
144
|
const modalRef = useRef<BottomSheetModalRef>(null);
|
|
111
|
-
const navigationRef = useRef<((screen: string, props?: Record<string,
|
|
145
|
+
const navigationRef = useRef<((screen: string, props?: Record<string, unknown>) => void) | null>(null);
|
|
112
146
|
// Remove contentHeight, containerWidth, and snap point state/logic
|
|
113
147
|
// Animation values - keep for content fade/slide
|
|
114
148
|
const fadeAnim = useRef(new Animated.Value(Platform.OS === 'android' ? 1 : 0)).current;
|
|
@@ -2,18 +2,15 @@ import type React from 'react';
|
|
|
2
2
|
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
3
|
import { Ionicons } from '@expo/vector-icons';
|
|
4
4
|
import Avatar from './Avatar';
|
|
5
|
+
import { useOxy } from '../context/OxyContext';
|
|
5
6
|
import { fontFamilies } from '../styles/fonts';
|
|
6
7
|
|
|
7
8
|
interface ProfileCardProps {
|
|
8
9
|
user: {
|
|
9
10
|
username: string;
|
|
10
11
|
email?: string;
|
|
11
|
-
name?: {
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
avatar?: {
|
|
15
|
-
url?: string;
|
|
16
|
-
};
|
|
12
|
+
name?: { full?: string };
|
|
13
|
+
avatar?: string; // file id
|
|
17
14
|
};
|
|
18
15
|
theme: 'light' | 'dark';
|
|
19
16
|
onEditPress?: () => void;
|
|
@@ -29,6 +26,7 @@ const ProfileCard: React.FC<ProfileCardProps> = ({
|
|
|
29
26
|
showCloseButton = false,
|
|
30
27
|
}) => {
|
|
31
28
|
const isDarkTheme = theme === 'dark';
|
|
29
|
+
const { oxyServices } = useOxy();
|
|
32
30
|
const textColor = isDarkTheme ? '#FFFFFF' : '#000000';
|
|
33
31
|
const secondaryBackgroundColor = isDarkTheme ? '#222222' : '#FFFFFF';
|
|
34
32
|
const primaryColor = '#0066CC';
|
|
@@ -43,7 +41,7 @@ const ProfileCard: React.FC<ProfileCardProps> = ({
|
|
|
43
41
|
]}>
|
|
44
42
|
<View style={styles.userProfile}>
|
|
45
43
|
<Avatar
|
|
46
|
-
uri={user?.avatar
|
|
44
|
+
uri={user?.avatar ? oxyServices.getFileDownloadUrl(user.avatar as string, 'thumb') : undefined}
|
|
47
45
|
name={user?.name?.full || user?.username}
|
|
48
46
|
size={60}
|
|
49
47
|
theme={theme}
|
|
@@ -56,7 +54,7 @@ const ProfileCard: React.FC<ProfileCardProps> = ({
|
|
|
56
54
|
</Text>
|
|
57
55
|
)}
|
|
58
56
|
{onEditPress && (
|
|
59
|
-
<TouchableOpacity
|
|
57
|
+
<TouchableOpacity
|
|
60
58
|
style={styles.editProfileButton}
|
|
61
59
|
onPress={onEditPress}
|
|
62
60
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import { View, StyleSheet } from 'react-native';
|
|
2
|
+
import { View, StyleSheet, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
3
|
import SectionTitle from './SectionTitle';
|
|
4
4
|
|
|
5
5
|
interface SectionProps {
|
|
@@ -7,15 +7,15 @@ interface SectionProps {
|
|
|
7
7
|
theme: 'light' | 'dark';
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
isFirst?: boolean;
|
|
10
|
-
style?:
|
|
10
|
+
style?: StyleProp<ViewStyle>;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const Section: React.FC<SectionProps> = ({
|
|
14
|
-
title,
|
|
15
|
-
theme,
|
|
16
|
-
children,
|
|
13
|
+
const Section: React.FC<SectionProps> = ({
|
|
14
|
+
title,
|
|
15
|
+
theme,
|
|
16
|
+
children,
|
|
17
17
|
isFirst = false,
|
|
18
|
-
style
|
|
18
|
+
style
|
|
19
19
|
}) => {
|
|
20
20
|
return (
|
|
21
21
|
<View style={[styles.section, isFirst && styles.firstSection, style]}>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import { Text, StyleSheet } from 'react-native';
|
|
2
|
+
import { Text, StyleSheet, type StyleProp, type TextStyle } from 'react-native';
|
|
3
3
|
import { fontFamilies } from '../styles/fonts';
|
|
4
4
|
|
|
5
5
|
interface SectionTitleProps {
|
|
6
6
|
title: string;
|
|
7
7
|
theme: 'light' | 'dark';
|
|
8
|
-
style?:
|
|
8
|
+
style?: StyleProp<TextStyle>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const SectionTitle: React.FC<SectionTitleProps> = ({ title, theme, style }) => {
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# StepBasedScreen Component
|
|
2
|
+
|
|
3
|
+
A reusable, production-ready React Native component for building multi-step flows with smooth animations and consistent UX patterns.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
- **Smooth Animations**: Built-in fade/slide animations using React Native Reanimated
|
|
8
|
+
- **Progress Indicators**: Automatic progress bars and step indicators
|
|
9
|
+
- **Type Safety**: Full TypeScript support with comprehensive interfaces
|
|
10
|
+
- **Flexible Configuration**: Highly customizable step definitions
|
|
11
|
+
- **Performance Optimized**: Efficient re-rendering and memory management
|
|
12
|
+
- **Accessibility**: Proper focus management and screen reader support
|
|
13
|
+
|
|
14
|
+
## 📦 Installation
|
|
15
|
+
|
|
16
|
+
The component is already integrated into your project structure. Simply import it:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import StepBasedScreen, { type StepConfig } from '../components/StepBasedScreen';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🔧 Basic Usage
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import React, { useState, useCallback } from 'react';
|
|
26
|
+
import StepBasedScreen, { type StepConfig } from './StepBasedScreen';
|
|
27
|
+
|
|
28
|
+
const MyMultiStepScreen: React.FC = () => {
|
|
29
|
+
const [formData, setFormData] = useState({ name: '', email: '' });
|
|
30
|
+
|
|
31
|
+
// Define your step components
|
|
32
|
+
const Step1: React.FC<any> = ({ nextStep }) => (
|
|
33
|
+
<View>
|
|
34
|
+
<Text>Enter your name</Text>
|
|
35
|
+
<TextInput
|
|
36
|
+
value={formData.name}
|
|
37
|
+
onChangeText={(text) => setFormData(prev => ({ ...prev, name: text }))}
|
|
38
|
+
/>
|
|
39
|
+
<Button title="Next" onPress={nextStep} />
|
|
40
|
+
</View>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const Step2: React.FC<any> = ({ prevStep, onComplete }) => (
|
|
44
|
+
<View>
|
|
45
|
+
<Text>Enter your email</Text>
|
|
46
|
+
<TextInput
|
|
47
|
+
value={formData.email}
|
|
48
|
+
onChangeText={(text) => setFormData(prev => ({ ...prev, email: text }))}
|
|
49
|
+
/>
|
|
50
|
+
<Button title="Back" onPress={prevStep} />
|
|
51
|
+
<Button title="Complete" onPress={onComplete} />
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// Configure your steps
|
|
56
|
+
const steps: StepConfig[] = [
|
|
57
|
+
{
|
|
58
|
+
id: 'name',
|
|
59
|
+
component: Step1,
|
|
60
|
+
canProceed: () => formData.name.trim().length > 0,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'email',
|
|
64
|
+
component: Step2,
|
|
65
|
+
canProceed: () => formData.email.trim().length > 0,
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const handleComplete = useCallback((stepData: any[]) => {
|
|
70
|
+
console.log('Form completed with data:', stepData);
|
|
71
|
+
// Handle completion logic here
|
|
72
|
+
}, []);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<StepBasedScreen
|
|
76
|
+
steps={steps}
|
|
77
|
+
stepData={[formData]}
|
|
78
|
+
onComplete={handleComplete}
|
|
79
|
+
showProgressIndicator={true}
|
|
80
|
+
enableAnimations={true}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 🎛️ API Reference
|
|
87
|
+
|
|
88
|
+
### StepBasedScreen Props
|
|
89
|
+
|
|
90
|
+
| Prop | Type | Default | Description |
|
|
91
|
+
|------|------|---------|-------------|
|
|
92
|
+
| `steps` | `StepConfig[]` | **Required** | Array of step configurations |
|
|
93
|
+
| `stepData` | `any[]` | `[]` | Data to pass to each step |
|
|
94
|
+
| `initialStep` | `number` | `0` | Initial step index |
|
|
95
|
+
| `onComplete` | `(stepData: any[]) => void` | - | Called when all steps are completed |
|
|
96
|
+
| `onStepChange` | `(currentStep: number, totalSteps: number) => void` | - | Called when step changes |
|
|
97
|
+
| `showProgressIndicator` | `boolean` | `true` | Show progress bar/indicator |
|
|
98
|
+
| `enableAnimations` | `boolean` | `true` | Enable step transition animations |
|
|
99
|
+
| `navigate` | `(screen: string, props?: any) => void` | **Required** | Navigation function |
|
|
100
|
+
| `goBack` | `() => void` | - | Go back function |
|
|
101
|
+
| `onAuthenticated` | `(user: any) => void` | - | Authentication callback |
|
|
102
|
+
| `theme` | `string` | **Required** | Theme ('light' or 'dark') |
|
|
103
|
+
|
|
104
|
+
### StepConfig Interface
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
interface StepConfig {
|
|
108
|
+
id: string; // Unique identifier for the step
|
|
109
|
+
component: React.ComponentType<any>; // React component to render
|
|
110
|
+
props?: Record<string, any>; // Additional props for the component
|
|
111
|
+
canProceed?: (stepData?: any) => boolean; // Validation function
|
|
112
|
+
onEnter?: () => void; // Called when entering this step
|
|
113
|
+
onExit?: () => void; // Called when exiting this step
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Step Component Props
|
|
118
|
+
|
|
119
|
+
Each step component receives these props automatically:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
interface StepComponentProps {
|
|
123
|
+
// Navigation
|
|
124
|
+
nextStep: () => void;
|
|
125
|
+
prevStep: () => void;
|
|
126
|
+
goToStep: (stepIndex: number) => void;
|
|
127
|
+
currentStep: number;
|
|
128
|
+
totalSteps: number;
|
|
129
|
+
|
|
130
|
+
// Data management
|
|
131
|
+
stepData?: any;
|
|
132
|
+
updateStepData: (data: any) => void;
|
|
133
|
+
allStepData: any[];
|
|
134
|
+
|
|
135
|
+
// State
|
|
136
|
+
isTransitioning: boolean;
|
|
137
|
+
|
|
138
|
+
// Common props
|
|
139
|
+
colors: any;
|
|
140
|
+
styles: any;
|
|
141
|
+
theme: string;
|
|
142
|
+
navigate: (screen: string, props?: any) => void;
|
|
143
|
+
goBack: () => void;
|
|
144
|
+
onAuthenticated: (user: any) => void;
|
|
145
|
+
|
|
146
|
+
// Animation refs (advanced usage)
|
|
147
|
+
fadeAnim: Animated.SharedValue<number>;
|
|
148
|
+
slideAnim: Animated.SharedValue<number>;
|
|
149
|
+
scaleAnim: Animated.SharedValue<number>;
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## 📱 Advanced Usage Examples
|
|
154
|
+
|
|
155
|
+
### Conditional Steps
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
const steps: StepConfig[] = [
|
|
159
|
+
{
|
|
160
|
+
id: 'basic-info',
|
|
161
|
+
component: BasicInfoStep,
|
|
162
|
+
canProceed: (data) => data?.name && data?.email,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: 'verification',
|
|
166
|
+
component: VerificationStep,
|
|
167
|
+
canProceed: (data) => data?.verified,
|
|
168
|
+
onEnter: () => {
|
|
169
|
+
// Send verification code
|
|
170
|
+
sendVerificationCode();
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
// Only show if user selected premium
|
|
174
|
+
...(userType === 'premium' ? [{
|
|
175
|
+
id: 'premium-setup',
|
|
176
|
+
component: PremiumSetupStep,
|
|
177
|
+
canProceed: () => true,
|
|
178
|
+
}] : []),
|
|
179
|
+
];
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Async Validation
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
const steps: StepConfig[] = [
|
|
186
|
+
{
|
|
187
|
+
id: 'username',
|
|
188
|
+
component: UsernameStep,
|
|
189
|
+
canProceed: async (data) => {
|
|
190
|
+
if (!data?.username) return false;
|
|
191
|
+
const isAvailable = await checkUsernameAvailability(data.username);
|
|
192
|
+
return isAvailable;
|
|
193
|
+
},
|
|
194
|
+
onEnter: () => {
|
|
195
|
+
// Pre-validate if username exists
|
|
196
|
+
if (existingUsername) {
|
|
197
|
+
validateUsername(existingUsername);
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
];
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Dynamic Step Data
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
const [stepData, setStepData] = useState([
|
|
208
|
+
{ name: '', email: '' }, // Step 1 data
|
|
209
|
+
{ preferences: {} }, // Step 2 data
|
|
210
|
+
{ confirmation: false }, // Step 3 data
|
|
211
|
+
]);
|
|
212
|
+
|
|
213
|
+
// Update specific step data
|
|
214
|
+
const updateStepData = (stepIndex: number, data: any) => {
|
|
215
|
+
setStepData(prev => prev.map((item, index) =>
|
|
216
|
+
index === stepIndex ? { ...item, ...data } : item
|
|
217
|
+
));
|
|
218
|
+
};
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Custom Progress Indicator
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
const CustomProgressIndicator: React.FC<{
|
|
225
|
+
currentStep: number;
|
|
226
|
+
totalSteps: number;
|
|
227
|
+
colors: any;
|
|
228
|
+
}> = ({ currentStep, totalSteps, colors }) => (
|
|
229
|
+
<View style={styles.customProgress}>
|
|
230
|
+
{Array.from({ length: totalSteps }, (_, index) => (
|
|
231
|
+
<View
|
|
232
|
+
key={index}
|
|
233
|
+
style={[
|
|
234
|
+
styles.progressDot,
|
|
235
|
+
{
|
|
236
|
+
backgroundColor: index <= currentStep ? colors.primary : colors.border,
|
|
237
|
+
transform: [{ scale: index === currentStep ? 1.2 : 1 }],
|
|
238
|
+
}
|
|
239
|
+
]}
|
|
240
|
+
/>
|
|
241
|
+
))}
|
|
242
|
+
</View>
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
// Use in your screen component
|
|
246
|
+
<StepBasedScreen
|
|
247
|
+
steps={steps}
|
|
248
|
+
showProgressIndicator={false} // Disable default indicator
|
|
249
|
+
// Add your custom indicator as a step component
|
|
250
|
+
/>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## 🎨 Styling
|
|
254
|
+
|
|
255
|
+
The component uses your existing theme system and `createAuthStyles`. All styling is consistent with your app's design system.
|
|
256
|
+
|
|
257
|
+
### Customizing Animations
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
// The component includes optimized animations by default
|
|
261
|
+
// For custom animations, access the animation refs in your step components:
|
|
262
|
+
|
|
263
|
+
const MyStepComponent: React.FC<any> = ({
|
|
264
|
+
fadeAnim,
|
|
265
|
+
slideAnim,
|
|
266
|
+
scaleAnim,
|
|
267
|
+
isTransitioning
|
|
268
|
+
}) => {
|
|
269
|
+
const customAnimatedStyle = useAnimatedStyle(() => ({
|
|
270
|
+
opacity: fadeAnim.value,
|
|
271
|
+
transform: [
|
|
272
|
+
{ translateX: slideAnim.value },
|
|
273
|
+
{ scale: scaleAnim.value },
|
|
274
|
+
// Add your custom transforms here
|
|
275
|
+
],
|
|
276
|
+
}));
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<Animated.View style={customAnimatedStyle}>
|
|
280
|
+
{/* Your step content */}
|
|
281
|
+
</Animated.View>
|
|
282
|
+
);
|
|
283
|
+
};
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## 🐛 Troubleshooting
|
|
287
|
+
|
|
288
|
+
### Common Issues
|
|
289
|
+
|
|
290
|
+
1. **Steps not advancing**: Check your `canProceed` functions return `true`
|
|
291
|
+
2. **Animations not working**: Ensure `enableAnimations` is `true` and Reanimated is properly set up
|
|
292
|
+
3. **TypeScript errors**: Make sure your step components accept the `StepComponentProps` interface
|
|
293
|
+
4. **Re-rendering issues**: Use `useCallback` for functions passed to step components
|
|
294
|
+
|
|
295
|
+
### Performance Tips
|
|
296
|
+
|
|
297
|
+
1. **Memoize step components**: Use `React.memo` for step components
|
|
298
|
+
2. **Optimize re-renders**: Only include necessary dependencies in `useMemo` and `useCallback`
|
|
299
|
+
3. **Limit step data**: Keep `stepData` as small as possible
|
|
300
|
+
4. **Use proper keys**: Ensure step components have unique keys for proper reconciliation
|
|
301
|
+
|
|
302
|
+
## 🔄 Migration from Existing Screens
|
|
303
|
+
|
|
304
|
+
### Converting SignInScreen
|
|
305
|
+
|
|
306
|
+
1. Extract step components into separate files
|
|
307
|
+
2. Define step configurations with validation logic
|
|
308
|
+
3. Replace the existing component with `StepBasedScreen`
|
|
309
|
+
4. Pass form state through `stepData`
|
|
310
|
+
|
|
311
|
+
### Converting SignUpScreen
|
|
312
|
+
|
|
313
|
+
1. Break down the 4-step flow into separate components
|
|
314
|
+
2. Implement validation logic in `canProceed` functions
|
|
315
|
+
3. Handle form state management in the parent component
|
|
316
|
+
4. Use `onEnter` and `onExit` for step-specific logic
|
|
317
|
+
|
|
318
|
+
## 📚 Related Components
|
|
319
|
+
|
|
320
|
+
- `TextField` - Input component used in steps
|
|
321
|
+
- `GroupedPillButtons` - Navigation buttons
|
|
322
|
+
- `ProgressIndicator` - Built-in progress component
|
|
323
|
+
- `AnimatedStepContainer` - Animation wrapper
|
|
324
|
+
|
|
325
|
+
## 🤝 Contributing
|
|
326
|
+
|
|
327
|
+
When adding new features to the StepBasedScreen:
|
|
328
|
+
|
|
329
|
+
1. Maintain backward compatibility
|
|
330
|
+
2. Add comprehensive TypeScript types
|
|
331
|
+
3. Include examples in the examples file
|
|
332
|
+
4. Update this documentation
|
|
333
|
+
5. Test with different step configurations
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
**Note**: This component is designed to be highly reusable across different multi-step flows in your application. It handles the common patterns of navigation, animation, and state management, allowing you to focus on the specific logic for each step.
|