@propel-nsl/propel-react-native-sdk 1.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/assets/fonts/Lexend-Black.ttf +0 -0
- package/assets/fonts/Lexend-Bold.ttf +0 -0
- package/assets/fonts/Lexend-ExtraBold.ttf +0 -0
- package/assets/fonts/Lexend-ExtraLight.ttf +0 -0
- package/assets/fonts/Lexend-Light.ttf +0 -0
- package/assets/fonts/Lexend-Medium.ttf +0 -0
- package/assets/fonts/Lexend-Regular.ttf +0 -0
- package/assets/fonts/Lexend-SemiBold.ttf +0 -0
- package/assets/fonts/Lexend-Thin.ttf +0 -0
- package/assets/images/HomeGoods.png +0 -0
- package/assets/images/accessories.png +0 -0
- package/assets/images/amazon.png +0 -0
- package/assets/images/apnaClubLogo.png +0 -0
- package/assets/images/apparel.png +0 -0
- package/assets/images/backgroundblue.png +0 -0
- package/assets/images/bannerCard.png +0 -0
- package/assets/images/bottomWave.png +0 -0
- package/assets/images/coin_1_1.png +0 -0
- package/assets/images/flipkart.png +0 -0
- package/assets/images/frame_1171278967.png +0 -0
- package/assets/images/gift.png +0 -0
- package/assets/images/herobanner.png +0 -0
- package/assets/images/hinduPencilsLogo.png +0 -0
- package/assets/images/icons/addwhiteicon.png +0 -0
- package/assets/images/icons/arrow-back.png +0 -0
- package/assets/images/icons/arrowgreen.png +0 -0
- package/assets/images/icons/arrowred.png +0 -0
- package/assets/images/icons/arrowright.png +0 -0
- package/assets/images/icons/arrowup.png +0 -0
- package/assets/images/icons/blackarrowdown.png +0 -0
- package/assets/images/icons/blackarrowup.png +0 -0
- package/assets/images/icons/blackcross.png +0 -0
- package/assets/images/icons/call.png +0 -0
- package/assets/images/icons/camera.png +0 -0
- package/assets/images/icons/cart.png +0 -0
- package/assets/images/icons/chat.png +0 -0
- package/assets/images/icons/circleblack.png +0 -0
- package/assets/images/icons/copy.png +0 -0
- package/assets/images/icons/cross.png +0 -0
- package/assets/images/icons/delete.png +0 -0
- package/assets/images/icons/delivery.png +0 -0
- package/assets/images/icons/eVoucher.png +0 -0
- package/assets/images/icons/editIcon.png +0 -0
- package/assets/images/icons/email.png +0 -0
- package/assets/images/icons/eye.png +0 -0
- package/assets/images/icons/faq.png +0 -0
- package/assets/images/icons/filtericon.png +0 -0
- package/assets/images/icons/greyDownArrow.png +0 -0
- package/assets/images/icons/help.png +0 -0
- package/assets/images/icons/home.png +0 -0
- package/assets/images/icons/homeinactive.png +0 -0
- package/assets/images/icons/i_blackicon.png +0 -0
- package/assets/images/icons/i_icon.png +0 -0
- package/assets/images/icons/location.png +0 -0
- package/assets/images/icons/logout.png +0 -0
- package/assets/images/icons/minus.png +0 -0
- package/assets/images/icons/myOrders.png +0 -0
- package/assets/images/icons/orders.png +0 -0
- package/assets/images/icons/pencillogo.png +0 -0
- package/assets/images/icons/pending.png +0 -0
- package/assets/images/icons/plus.png +0 -0
- package/assets/images/icons/redCross.png +0 -0
- package/assets/images/icons/redCrossicon.png +0 -0
- package/assets/images/icons/redWarningicon.png +0 -0
- package/assets/images/icons/redeem.png +0 -0
- package/assets/images/icons/redeemactive.png +0 -0
- package/assets/images/icons/redemptionHistory.png +0 -0
- package/assets/images/icons/redhelpicon.png +0 -0
- package/assets/images/icons/search.png +0 -0
- package/assets/images/icons/stopwatch.png +0 -0
- package/assets/images/icons/successTick.gif +0 -0
- package/assets/images/icons/tick.png +0 -0
- package/assets/images/icons/tnc.png +0 -0
- package/assets/images/icons/user.png +0 -0
- package/assets/images/icons/userredicon.png +0 -0
- package/assets/images/icons/wavecorner.png +0 -0
- package/assets/images/logo.png +0 -0
- package/assets/images/myntra_copy.png +0 -0
- package/assets/images/nike.png +0 -0
- package/assets/images/oq3p0u0_1.png +0 -0
- package/assets/images/profileicon.png +0 -0
- package/assets/images/topWave.png +0 -0
- package/assets/images/zagglePropelLogo.png +0 -0
- package/index.ts +23 -0
- package/lib/index.ts +25 -0
- package/package.json +70 -0
- package/src/PropelSDKScreen.tsx +98 -0
- package/src/SDKApp.tsx +540 -0
- package/src/bridge/SDKBridge.ts +104 -0
- package/src/bridge/index.ts +3 -0
- package/src/components/SDKBackHandler.tsx +187 -0
- package/src/components/SDKProfile.tsx +87 -0
- package/src/components/SDKProfileWrapper.tsx +51 -0
- package/src/constants.ts +10 -0
- package/src/contexts/SDKContext.tsx +72 -0
- package/src/hooks/useSDKBackNavigation.ts +61 -0
- package/src/navigation/SDKMainTabNavigator.tsx +315 -0
- package/src/navigation/SDKNavigator.tsx +41 -0
- package/src/redux/store.ts +32 -0
- package/src/screens/Dashboard/index.tsx +531 -0
- package/src/screens/Dashboard/styles.ts +512 -0
- package/src/screens/DeliveryAddress/index.tsx +221 -0
- package/src/screens/DeliveryAddress/styles.ts +122 -0
- package/src/screens/E-Vouchers/index.tsx +157 -0
- package/src/screens/E-Vouchers/styles.ts +106 -0
- package/src/screens/Faq/Faq.constants.ts +164 -0
- package/src/screens/Faq/index.tsx +114 -0
- package/src/screens/Faq/styles.ts +131 -0
- package/src/screens/Help/index.tsx +128 -0
- package/src/screens/Help/styles.ts +121 -0
- package/src/screens/Login/index.tsx +215 -0
- package/src/screens/Login/styles.ts +134 -0
- package/src/screens/MyCart/MyCart.constants.ts +13 -0
- package/src/screens/MyCart/index.tsx +318 -0
- package/src/screens/MyCart/styles.ts +249 -0
- package/src/screens/MyOrders/index.tsx +87 -0
- package/src/screens/MyOrders/styles.ts +281 -0
- package/src/screens/MyProfile/index.tsx +72 -0
- package/src/screens/MyProfile/styles.ts +47 -0
- package/src/screens/NewDeliveryAddress/index.tsx +360 -0
- package/src/screens/NewDeliveryAddress/styles.ts +68 -0
- package/src/screens/Onboarding/index.tsx +57 -0
- package/src/screens/Onboarding/styles.ts +60 -0
- package/src/screens/OrdersDetails/index.tsx +333 -0
- package/src/screens/OrdersDetails/styles.ts +262 -0
- package/src/screens/OtpVerification/index.tsx +283 -0
- package/src/screens/OtpVerification/styles.ts +197 -0
- package/src/screens/PaymentMethod/index.tsx +389 -0
- package/src/screens/PaymentMethod/styles.ts +246 -0
- package/src/screens/PointsLog/index.tsx +286 -0
- package/src/screens/PointsLog/styles.ts +156 -0
- package/src/screens/ProductDetails/index.tsx +682 -0
- package/src/screens/ProductDetails/styles.ts +372 -0
- package/src/screens/Profile/index.tsx +368 -0
- package/src/screens/Profile/styles.ts +158 -0
- package/src/screens/RedemptionHistory/RedemptionHistory.constants.ts +4 -0
- package/src/screens/RedemptionHistory/index.tsx +304 -0
- package/src/screens/RedemptionHistory/styles.ts +84 -0
- package/src/screens/Reedem/index.tsx +345 -0
- package/src/screens/Reedem/styles.ts +269 -0
- package/src/screens/TnC/TnC.constants.ts +169 -0
- package/src/screens/TnC/index.tsx +83 -0
- package/src/screens/TnC/styles.ts +88 -0
- package/src/screens/TransactionSuccessful/index.tsx +77 -0
- package/src/screens/TransactionSuccessful/styles.ts +77 -0
- package/src/screens/Verification/index.tsx +58 -0
- package/src/screens/Verification/styles.ts +74 -0
- package/src/screens/index.ts +23 -0
- package/src/types/index.ts +46 -0
- package/src-app/components/AmountBreakDownModal/index.tsx +86 -0
- package/src-app/components/AmountBreakDownModal/styles.ts +110 -0
- package/src-app/components/BottomNavIcons.tsx +125 -0
- package/src-app/components/Button.tsx +120 -0
- package/src-app/components/Card.tsx +47 -0
- package/src-app/components/ConfirmPopup/ConfirmPopup.constants.ts +25 -0
- package/src-app/components/ConfirmPopup/index.tsx +48 -0
- package/src-app/components/ConfirmPopup/styles.ts +167 -0
- package/src-app/components/CustomButton/index.tsx +67 -0
- package/src-app/components/CustomButton/styles.ts +44 -0
- package/src-app/components/CustomCard/index.tsx +221 -0
- package/src-app/components/CustomCard/styles.ts +184 -0
- package/src-app/components/CustomError/index.tsx +54 -0
- package/src-app/components/CustomError/styles.ts +41 -0
- package/src-app/components/CustomImage/index.tsx +37 -0
- package/src-app/components/CustomImage/styles.ts +5 -0
- package/src-app/components/CustomLoader/index.tsx +45 -0
- package/src-app/components/CustomLoader/styles.ts +35 -0
- package/src-app/components/CustomMessagePopUp/index.tsx +51 -0
- package/src-app/components/CustomMessagePopUp/styles.ts +74 -0
- package/src-app/components/CustomProductCard/index.tsx +13 -0
- package/src-app/components/CustomProductCard/styles.ts +5 -0
- package/src-app/components/FilterModal.tsx +372 -0
- package/src-app/components/Footer/index.tsx +23 -0
- package/src-app/components/Footer/styles.ts +37 -0
- package/src-app/components/Icon.tsx +80 -0
- package/src-app/components/Logout/index.tsx +82 -0
- package/src-app/components/Logout/styles.ts +116 -0
- package/src-app/components/MobileHeader.tsx +141 -0
- package/src-app/components/NoDataFound/index.tsx +18 -0
- package/src-app/components/NoDataFound/styles.ts +26 -0
- package/src-app/components/OTPModal.tsx +747 -0
- package/src-app/components/ProfileField.tsx +47 -0
- package/src-app/components/QuantityModal/index.tsx +113 -0
- package/src-app/components/QuantityModal/styles.ts +84 -0
- package/src-app/components/TabBarIcons.tsx +110 -0
- package/src-app/components/TextInput.tsx +79 -0
- package/src-app/components/ToastConfig.tsx +60 -0
- package/src-app/components/index.ts +18 -0
- package/src-app/config/env.ts +22 -0
- package/src-app/constants/Fonts.ts +12 -0
- package/src-app/constants/Formatter.ts +39 -0
- package/src-app/constants/HtmlSanitization.ts +46 -0
- package/src-app/constants/Images.ts +81 -0
- package/src-app/constants/Labels.ts +8 -0
- package/src-app/constants/Messages.ts +108 -0
- package/src-app/constants/Routes.ts +17 -0
- package/src-app/constants/Scaling.ts +5 -0
- package/src-app/constants/Text.ts +8 -0
- package/src-app/constants/offSets.ts +18 -0
- package/src-app/hooks/useAppDispatch.ts +4 -0
- package/src-app/hooks/useAppSelector.ts +4 -0
- package/src-app/hooks/useBackHandler.ts +47 -0
- package/src-app/hooks/useScreenBackHandler.ts +91 -0
- package/src-app/navigation/AppNavigator.tsx +34 -0
- package/src-app/navigation/MainTabNavigator.tsx +294 -0
- package/src-app/redux/authSaga.ts +605 -0
- package/src-app/redux/authSlice.ts +754 -0
- package/src-app/redux/rootSaga.ts +6 -0
- package/src-app/redux/store.ts +25 -0
- package/src-app/services/api.ts +14 -0
- package/src-app/services/endpoints.ts +33 -0
- package/src-app/services/index.ts +574 -0
- package/src-app/services/sdkCredentials.ts +44 -0
- package/src-app/styles/colors.ts +85 -0
- package/src-app/styles/shared.ts +112 -0
- package/src-app/types/authTypes.ts +155 -0
- package/src-app/types/navigation.ts +99 -0
- package/src-app/utils/Validation.ts +48 -0
- package/src-app/utils/filterPins.ts +29 -0
- package/src-app/utils/navigationUtils.ts +43 -0
- package/src-app/utils/useHardwareBack.ts +21 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
TextInput,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
TouchableWithoutFeedback,
|
|
8
|
+
Keyboard,
|
|
9
|
+
Platform,
|
|
10
|
+
} from "react-native";
|
|
11
|
+
import { StackNavigationProp } from "@react-navigation/stack";
|
|
12
|
+
import { RouteProp } from "@react-navigation/native";
|
|
13
|
+
import { RootStackParamList } from "../../../src-app/types/navigation";
|
|
14
|
+
import styles from "./styles";
|
|
15
|
+
import { useDispatch } from "react-redux";
|
|
16
|
+
import {
|
|
17
|
+
generateOtpRequest,
|
|
18
|
+
resetAuthState,
|
|
19
|
+
updateAuthData,
|
|
20
|
+
verifyMobileOtpRequest,
|
|
21
|
+
} from "../../../src-app/redux/authSlice";
|
|
22
|
+
import { useAppSelector } from "../../../src-app/hooks/useAppSelector";
|
|
23
|
+
import { RootState } from "../../../src-app/redux/store";
|
|
24
|
+
import DeviceInfo from "react-native-device-info";
|
|
25
|
+
import {
|
|
26
|
+
CustomButton,
|
|
27
|
+
CustomImage,
|
|
28
|
+
CustomLoader,
|
|
29
|
+
CustomMessagePopUp,
|
|
30
|
+
Footer,
|
|
31
|
+
} from "../../../src-app/components";
|
|
32
|
+
import Images from "../../../src-app/constants/Images";
|
|
33
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
34
|
+
import { ENTER_4_DIGIT_CODE, OTP_VERIFY_LOADER } from "../../../src-app/constants/Messages";
|
|
35
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
36
|
+
|
|
37
|
+
type OTPVerificationNavigationProp = StackNavigationProp<
|
|
38
|
+
RootStackParamList,
|
|
39
|
+
"OTPVerification"
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
type OTPVerificationRouteProp = RouteProp<
|
|
43
|
+
RootStackParamList,
|
|
44
|
+
"OTPVerification"
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
interface Props {
|
|
48
|
+
navigation: OTPVerificationNavigationProp;
|
|
49
|
+
route: OTPVerificationRouteProp;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const OTPVerification: React.FC<Props> = ({ navigation, route }) => {
|
|
53
|
+
const { phoneNumber } = route.params;
|
|
54
|
+
const [otpInput, setOtpInput] = useState("");
|
|
55
|
+
const [timeLeft, setTimeLeft] = useState(45);
|
|
56
|
+
const [showError, setShowError] = useState(false);
|
|
57
|
+
const [messagepopUpVisible, setMessagepopUpVisible] = useState(false);
|
|
58
|
+
const dispatch = useDispatch();
|
|
59
|
+
const [deviceId, setDeviceId] = useState<string>("");
|
|
60
|
+
|
|
61
|
+
const otpToken = useAppSelector((state: RootState) => state.auth.otpToken);
|
|
62
|
+
const flag = useAppSelector((state: RootState) => state.auth.flag);
|
|
63
|
+
const verifyOtpSuccessMessage = useAppSelector(
|
|
64
|
+
(state: RootState) => state.auth.verifyOtpSuccessMessage
|
|
65
|
+
);
|
|
66
|
+
const verifyOtpError = useAppSelector(
|
|
67
|
+
(state: RootState) => state.auth.verifyOtpError
|
|
68
|
+
);
|
|
69
|
+
const verifyOtpLoading = useAppSelector(
|
|
70
|
+
(state: RootState) => state.auth.verifyOtpLoading
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const wasPhoneAlreadyVerified = useAppSelector(
|
|
74
|
+
(state: RootState) => !!state.auth.generateOtpData?.is_phone_verified
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const hasNavigated = useRef(false);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (verifyOtpError) {
|
|
81
|
+
setMessagepopUpVisible(true);
|
|
82
|
+
}
|
|
83
|
+
}, [verifyOtpError]);
|
|
84
|
+
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (
|
|
87
|
+
verifyOtpSuccessMessage &&
|
|
88
|
+
!hasNavigated.current
|
|
89
|
+
// !hasNavigated.current
|
|
90
|
+
) {
|
|
91
|
+
hasNavigated.current = true;
|
|
92
|
+
|
|
93
|
+
AsyncStorage.setItem("HAS_LOGGED_IN_ONCE", "true").catch(() => {});
|
|
94
|
+
|
|
95
|
+
if (wasPhoneAlreadyVerified) {
|
|
96
|
+
navigation.replace("MainTabs");
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (flag) {
|
|
101
|
+
navigation.replace("MainTabs");
|
|
102
|
+
} else {
|
|
103
|
+
dispatch(updateAuthData({ key: "flag", value: true }));
|
|
104
|
+
navigation.replace("MyProfile");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, [verifyOtpSuccessMessage, wasPhoneAlreadyVerified, flag, dispatch, navigation]);
|
|
108
|
+
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (timeLeft > 0) {
|
|
111
|
+
const timer = setTimeout(() => setTimeLeft((prev) => prev - 1), 1000);
|
|
112
|
+
return () => clearTimeout(timer);
|
|
113
|
+
}
|
|
114
|
+
}, [timeLeft]);
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
const getDeviceId = async () => {
|
|
118
|
+
try {
|
|
119
|
+
const id = await DeviceInfo.getUniqueId();
|
|
120
|
+
const device_id = String(id);
|
|
121
|
+
setDeviceId(device_id);
|
|
122
|
+
console.log("device_id", device_id);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.log("Error getting device ID:", error);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
getDeviceId();
|
|
129
|
+
}, []);
|
|
130
|
+
|
|
131
|
+
const handleVerify = async () => {
|
|
132
|
+
dispatch(
|
|
133
|
+
verifyMobileOtpRequest({
|
|
134
|
+
client_key: "mobile_app",
|
|
135
|
+
client_name: "AndroidApp",
|
|
136
|
+
client_series: "1930",
|
|
137
|
+
client_type: "propel_platform",
|
|
138
|
+
client_version: "17.2",
|
|
139
|
+
device_id: deviceId,
|
|
140
|
+
fcm_token: "",
|
|
141
|
+
otp: otpInput,
|
|
142
|
+
username: phoneNumber,
|
|
143
|
+
is_hppl_login: true,
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const handleResendOTP = () => {
|
|
149
|
+
setTimeLeft(45);
|
|
150
|
+
setOtpInput("");
|
|
151
|
+
setShowError(false);
|
|
152
|
+
dispatch(
|
|
153
|
+
generateOtpRequest({
|
|
154
|
+
client_name: "iOSApp",
|
|
155
|
+
client_series: "1930",
|
|
156
|
+
client_version: "17.2",
|
|
157
|
+
device_id: deviceId,
|
|
158
|
+
username: phoneNumber,
|
|
159
|
+
is_hppl_login: true,
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const maskPhoneNumber = (phone: string) => {
|
|
165
|
+
const clean = phone.replace(/\D/g, "");
|
|
166
|
+
const first2 = clean.slice(0, 2);
|
|
167
|
+
const last2 = clean.slice(-2);
|
|
168
|
+
const masked = "*".repeat(clean.length - 4);
|
|
169
|
+
return `${first2}${masked}${last2}`;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const inputRef = useRef<TextInput>(null);
|
|
173
|
+
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
const delay = Platform.OS === 'android' ? 100 : 0;
|
|
176
|
+
const timer = setTimeout(() => {
|
|
177
|
+
inputRef.current?.focus();
|
|
178
|
+
}, delay);
|
|
179
|
+
|
|
180
|
+
return () => clearTimeout(timer);
|
|
181
|
+
}, []);
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<SafeAreaView style={styles.container} edges={["top", "bottom"]}>
|
|
186
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
|
187
|
+
<View style={styles.content}>
|
|
188
|
+
<TouchableOpacity
|
|
189
|
+
activeOpacity={0.7}
|
|
190
|
+
onPress={() => navigation.goBack()}
|
|
191
|
+
style={styles.backButton}
|
|
192
|
+
>
|
|
193
|
+
<CustomImage source={Images.arrowBack} imgStyle={styles.backIcon} />
|
|
194
|
+
</TouchableOpacity>
|
|
195
|
+
<CustomImage source={Images.topWave} imgStyle={styles.topShape} />
|
|
196
|
+
<CustomImage
|
|
197
|
+
source={Images.bottomWave}
|
|
198
|
+
imgStyle={styles.bottomShape}
|
|
199
|
+
/>
|
|
200
|
+
<CustomImage source={Images?.logo} imgStyle={styles.logoSection} />
|
|
201
|
+
|
|
202
|
+
<View style={styles.formSection}>
|
|
203
|
+
<View style={styles.formHeader}>
|
|
204
|
+
<Text style={styles.formTitle}>{ENTER_4_DIGIT_CODE}</Text>
|
|
205
|
+
<Text style={styles.formSubtitle}>
|
|
206
|
+
OTP has been sent to {maskPhoneNumber(phoneNumber)}
|
|
207
|
+
</Text>
|
|
208
|
+
</View>
|
|
209
|
+
|
|
210
|
+
{showError && (
|
|
211
|
+
<View style={styles.errorAlert}>
|
|
212
|
+
<View style={styles.errorIcon}>
|
|
213
|
+
<Text style={styles.errorIconText}>!</Text>
|
|
214
|
+
</View>
|
|
215
|
+
<Text style={styles.errorText}>Wrong OTP Entered</Text>
|
|
216
|
+
<TouchableOpacity onPress={() => setShowError(false)}>
|
|
217
|
+
<Text style={styles.errorClose}>×</Text>
|
|
218
|
+
</TouchableOpacity>
|
|
219
|
+
</View>
|
|
220
|
+
)}
|
|
221
|
+
|
|
222
|
+
<View style={styles.inputContainer}>
|
|
223
|
+
<TextInput
|
|
224
|
+
ref={inputRef} // <-- attach ref so focus works
|
|
225
|
+
style={styles.phoneInput}
|
|
226
|
+
placeholder="Enter OTP"
|
|
227
|
+
placeholderTextColor="#6B7280"
|
|
228
|
+
value={otpInput}
|
|
229
|
+
onChangeText={setOtpInput}
|
|
230
|
+
keyboardType="number-pad"
|
|
231
|
+
maxLength={4}
|
|
232
|
+
multiline={false} // <-- single line input
|
|
233
|
+
/>
|
|
234
|
+
</View>
|
|
235
|
+
|
|
236
|
+
<View style={styles.resendContainer}>
|
|
237
|
+
<Text style={styles.resendText}>Didn't Receive OTP?</Text>
|
|
238
|
+
<TouchableOpacity
|
|
239
|
+
disabled={timeLeft > 0}
|
|
240
|
+
onPress={handleResendOTP}
|
|
241
|
+
>
|
|
242
|
+
<Text style={[styles.resendLink, timeLeft > 0 && styles.resendLinkDisabled,]}>Resend OTP</Text>
|
|
243
|
+
</TouchableOpacity>
|
|
244
|
+
</View>
|
|
245
|
+
</View>
|
|
246
|
+
|
|
247
|
+
<View style={styles.timerContainer}>
|
|
248
|
+
<View style={styles.timerCircle}>
|
|
249
|
+
<Text style={styles.timerText}>
|
|
250
|
+
00:{timeLeft.toString().padStart(2, "0")}
|
|
251
|
+
</Text>
|
|
252
|
+
<Text style={styles.timerLabel}>Sec</Text>
|
|
253
|
+
</View>
|
|
254
|
+
</View>
|
|
255
|
+
|
|
256
|
+
<CustomButton
|
|
257
|
+
title="Verify"
|
|
258
|
+
onPress={handleVerify}
|
|
259
|
+
disabled={otpInput.length < 4}
|
|
260
|
+
customButtonContainerStyle={styles.buttonContainer}
|
|
261
|
+
/>
|
|
262
|
+
|
|
263
|
+
<Footer />
|
|
264
|
+
|
|
265
|
+
<CustomMessagePopUp
|
|
266
|
+
title="Error"
|
|
267
|
+
message={verifyOtpError || ""}
|
|
268
|
+
visible={messagepopUpVisible}
|
|
269
|
+
onClose={() => {
|
|
270
|
+
setMessagepopUpVisible(false);
|
|
271
|
+
dispatch(resetAuthState("verifyOtpError"));
|
|
272
|
+
}}
|
|
273
|
+
icon={Images.pendingIcon}
|
|
274
|
+
/>
|
|
275
|
+
</View>
|
|
276
|
+
</TouchableWithoutFeedback>
|
|
277
|
+
<CustomLoader loading={!!verifyOtpLoading} text={OTP_VERIFY_LOADER} fullScreen />
|
|
278
|
+
|
|
279
|
+
</SafeAreaView>
|
|
280
|
+
);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export default OTPVerification;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { Dimensions, Platform, StyleSheet } from 'react-native';
|
|
2
|
+
import { borderRadius, spacing, typography } from '../../../src-app/styles/shared';
|
|
3
|
+
import { VSCALE, SCALE } from '../../../src-app/constants/Scaling';
|
|
4
|
+
import FontFamily from '../../../src-app/constants/Fonts';
|
|
5
|
+
import { colors } from '../../../src-app/styles/colors';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const { height: screenHeight } = Dimensions.get('window');
|
|
9
|
+
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
container: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
backgroundColor: colors.background,
|
|
14
|
+
},
|
|
15
|
+
content: {
|
|
16
|
+
flex: 1,
|
|
17
|
+
position: 'relative',
|
|
18
|
+
},
|
|
19
|
+
topShape: {
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
width: '100%',
|
|
22
|
+
height: VSCALE(200),
|
|
23
|
+
left: SCALE(90),
|
|
24
|
+
top: 0,
|
|
25
|
+
zIndex: -1,
|
|
26
|
+
},
|
|
27
|
+
bottomShape: {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
width: '100%',
|
|
30
|
+
height: VSCALE(200),
|
|
31
|
+
left: SCALE(-50),
|
|
32
|
+
bottom: VSCALE(0),
|
|
33
|
+
zIndex: -1,
|
|
34
|
+
},
|
|
35
|
+
logoSection: {
|
|
36
|
+
width: SCALE(177),
|
|
37
|
+
height: VSCALE(182),
|
|
38
|
+
resizeMode: 'contain',
|
|
39
|
+
alignSelf: 'center',
|
|
40
|
+
marginTop: screenHeight > 700 ? VSCALE(70) : VSCALE(70),
|
|
41
|
+
},
|
|
42
|
+
formContainer: {
|
|
43
|
+
paddingHorizontal: SCALE(20),
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
marginTop: VSCALE(10),
|
|
46
|
+
},
|
|
47
|
+
formHeader: {
|
|
48
|
+
gap: VSCALE(spacing.sm),
|
|
49
|
+
marginBottom: VSCALE(spacing.md),
|
|
50
|
+
},
|
|
51
|
+
formTitle: {
|
|
52
|
+
...typography.bodySmall,
|
|
53
|
+
color: colors.onSurface,
|
|
54
|
+
fontWeight: '500',
|
|
55
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
56
|
+
},
|
|
57
|
+
formSubtitle: {
|
|
58
|
+
...typography.caption,
|
|
59
|
+
color: colors.onSurfaceVariant,
|
|
60
|
+
lineHeight: VSCALE(18),
|
|
61
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
62
|
+
},
|
|
63
|
+
errorAlert: {
|
|
64
|
+
flexDirection: 'row',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
backgroundColor: colors.errorAlertColor,
|
|
67
|
+
borderWidth: 1,
|
|
68
|
+
borderColor: colors.error,
|
|
69
|
+
borderRadius: borderRadius.md,
|
|
70
|
+
padding: VSCALE(spacing.md),
|
|
71
|
+
marginBottom: VSCALE(spacing.lg),
|
|
72
|
+
gap: SCALE(spacing.md),
|
|
73
|
+
},
|
|
74
|
+
errorIcon: {
|
|
75
|
+
width: VSCALE(20),
|
|
76
|
+
height: VSCALE(20),
|
|
77
|
+
backgroundColor: colors.error,
|
|
78
|
+
borderRadius: VSCALE(10),
|
|
79
|
+
justifyContent: 'center',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
},
|
|
82
|
+
errorIconText: {
|
|
83
|
+
color: 'white',
|
|
84
|
+
fontSize: SCALE(12),
|
|
85
|
+
fontWeight: 'bold',
|
|
86
|
+
},
|
|
87
|
+
errorText: {
|
|
88
|
+
...typography.caption,
|
|
89
|
+
color: colors.error,
|
|
90
|
+
flex: 1,
|
|
91
|
+
},
|
|
92
|
+
errorClose: {
|
|
93
|
+
color: colors.error,
|
|
94
|
+
fontSize: SCALE(16),
|
|
95
|
+
fontWeight: 'bold',
|
|
96
|
+
},
|
|
97
|
+
resendContainer: {
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
justifyContent: 'flex-end',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
gap: SCALE(spacing.sm),
|
|
102
|
+
marginTop: VSCALE(10),
|
|
103
|
+
},
|
|
104
|
+
resendText: {
|
|
105
|
+
...typography.caption,
|
|
106
|
+
color: colors.onSurface,
|
|
107
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
108
|
+
},
|
|
109
|
+
resendLink: {
|
|
110
|
+
...typography.caption,
|
|
111
|
+
color: colors.primary,
|
|
112
|
+
textDecorationLine: 'underline',
|
|
113
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
114
|
+
},
|
|
115
|
+
timerContainer: {
|
|
116
|
+
alignItems: 'center',
|
|
117
|
+
marginTop: VSCALE(spacing.md),
|
|
118
|
+
height: VSCALE(120),
|
|
119
|
+
},
|
|
120
|
+
timerCircle: {
|
|
121
|
+
width: VSCALE(100),
|
|
122
|
+
height: VSCALE(100),
|
|
123
|
+
borderRadius: VSCALE(50),
|
|
124
|
+
borderWidth: 4,
|
|
125
|
+
borderColor: colors.secondary,
|
|
126
|
+
justifyContent: 'center',
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
},
|
|
129
|
+
timerText: {
|
|
130
|
+
...typography.body,
|
|
131
|
+
color: colors.onSurface,
|
|
132
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
133
|
+
},
|
|
134
|
+
timerLabel: {
|
|
135
|
+
...typography.caption,
|
|
136
|
+
color: colors.onSurfaceVariant,
|
|
137
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
138
|
+
},
|
|
139
|
+
apnaClubLogo: {
|
|
140
|
+
width: SCALE(124),
|
|
141
|
+
height: VSCALE(115),
|
|
142
|
+
},
|
|
143
|
+
hindustanPencilsLogo: {
|
|
144
|
+
width: SCALE(180),
|
|
145
|
+
height: VSCALE(60),
|
|
146
|
+
},
|
|
147
|
+
inputContainer: {
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
alignItems: 'center',
|
|
150
|
+
borderWidth: 1,
|
|
151
|
+
borderColor: colors.outline,
|
|
152
|
+
borderRadius: SCALE(12),
|
|
153
|
+
backgroundColor: colors.background,
|
|
154
|
+
height: VSCALE(55),
|
|
155
|
+
paddingHorizontal: SCALE(20),
|
|
156
|
+
},
|
|
157
|
+
phoneInput: {
|
|
158
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
159
|
+
fontSize: SCALE(14),
|
|
160
|
+
color: colors.black,
|
|
161
|
+
textAlign: 'center',
|
|
162
|
+
width: '100%',
|
|
163
|
+
},
|
|
164
|
+
contentView: {
|
|
165
|
+
flex: 1,
|
|
166
|
+
},
|
|
167
|
+
footer: {
|
|
168
|
+
paddingBottom: Platform.OS === 'ios' ? VSCALE(0) : VSCALE(0),
|
|
169
|
+
paddingTop: VSCALE(10),
|
|
170
|
+
alignItems: 'center',
|
|
171
|
+
},
|
|
172
|
+
buttonContainer: {
|
|
173
|
+
paddingHorizontal: SCALE(20),
|
|
174
|
+
marginBottom: VSCALE(20),
|
|
175
|
+
},
|
|
176
|
+
formSection: {
|
|
177
|
+
paddingHorizontal: SCALE(20),
|
|
178
|
+
justifyContent: 'center',
|
|
179
|
+
},
|
|
180
|
+
backIcon: {
|
|
181
|
+
height: VSCALE(13),
|
|
182
|
+
width: SCALE(16),
|
|
183
|
+
resizeMode: 'contain',
|
|
184
|
+
},
|
|
185
|
+
backButton: {
|
|
186
|
+
padding: SCALE(12),
|
|
187
|
+
position: 'absolute',
|
|
188
|
+
left: SCALE(20),
|
|
189
|
+
top: SCALE(10),
|
|
190
|
+
},
|
|
191
|
+
resendLinkDisabled: {
|
|
192
|
+
color: colors.onSurfaceVariant,
|
|
193
|
+
textDecorationLine: 'none',
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
export default styles;
|