@tima2025/react-native-timalender 1.1.1 → 1.1.3

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.
Files changed (36) hide show
  1. package/lib/commonjs/components/Navigation/AppNavigator.js +1 -1
  2. package/lib/commonjs/components/Navigation/AppNavigator.js.flow +34 -12
  3. package/lib/commonjs/components/Navigation/AppNavigator.js.map +1 -1
  4. package/lib/commonjs/components/Navigation/index.js +1 -1
  5. package/lib/commonjs/components/Navigation/index.js.flow +1 -107
  6. package/lib/commonjs/components/Navigation/index.js.map +1 -1
  7. package/lib/commonjs/screens/Intro/index.js +1 -1
  8. package/lib/commonjs/screens/Intro/index.js.flow +11 -71
  9. package/lib/commonjs/screens/Intro/index.js.map +1 -1
  10. package/lib/commonjs/screens/Optional/index.js +1 -1
  11. package/lib/commonjs/screens/Optional/index.js.flow +46 -48
  12. package/lib/commonjs/screens/Optional/index.js.map +1 -1
  13. package/lib/commonjs/screens/Sign-in/index.js +1 -1
  14. package/lib/commonjs/screens/Sign-in/index.js.flow +1 -2
  15. package/lib/commonjs/screens/Sign-in/index.js.map +1 -1
  16. package/lib/module/components/Navigation/AppNavigator.js +1 -1
  17. package/lib/module/components/Navigation/AppNavigator.js.map +1 -1
  18. package/lib/module/components/Navigation/index.js +1 -1
  19. package/lib/module/components/Navigation/index.js.map +1 -1
  20. package/lib/module/screens/Intro/index.js +1 -1
  21. package/lib/module/screens/Intro/index.js.map +1 -1
  22. package/lib/module/screens/Optional/index.js +1 -1
  23. package/lib/module/screens/Optional/index.js.map +1 -1
  24. package/lib/module/screens/Sign-in/index.js +1 -1
  25. package/lib/module/screens/Sign-in/index.js.map +1 -1
  26. package/lib/typescript/src/components/Navigation/AppNavigator.d.ts.map +1 -1
  27. package/lib/typescript/src/components/Navigation/index.d.ts.map +1 -1
  28. package/lib/typescript/src/screens/Intro/index.d.ts.map +1 -1
  29. package/lib/typescript/src/screens/Optional/index.d.ts.map +1 -1
  30. package/lib/typescript/src/screens/Sign-in/index.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/components/Navigation/AppNavigator.tsx +34 -12
  33. package/src/components/Navigation/index.tsx +1 -107
  34. package/src/screens/Intro/index.tsx +11 -71
  35. package/src/screens/Optional/index.tsx +46 -48
  36. package/src/screens/Sign-in/index.tsx +1 -2
@@ -1,113 +1,7 @@
1
1
  //@ts-nocheck
2
- import React, { useEffect } from 'react';
3
- import { showMessage } from 'react-native-flash-message';
4
- import { useDispatch, useSelector } from 'react-redux';
5
- import Colors from '../../common/Colors';
6
- import {
7
- ChangeToken,
8
- logOut,
9
- setUserLogin,
10
- } from '../../components/Features/user/userSlice';
11
- import Screens from '../../components/Navigation/Screens';
12
- import { AppDispatch } from '../../components/Redux/store';
13
- import { setClientToken } from '../../controllers/Client';
14
- import Users from '../../controllers/Users';
15
- import { userInfor } from '../Redux/selector';
2
+ import React from 'react';
16
3
  import AppNavigator from './AppNavigator';
17
-
18
4
  const Navigation = (props: any) => {
19
- const navigation = props?.navigation;
20
- const dispatch = useDispatch<AppDispatch>();
21
-
22
- const userData = useSelector(userInfor);
23
- // if (userData && !access_token) {
24
- // setClientToken(userData?.accessToken);
25
- // }
26
-
27
- const changeToken = async (shop: any) => {
28
- const resp: any = await dispatch(ChangeToken({ shop_id: shop?.shopId }));
29
- console.log('resp change token---', resp);
30
- switch (resp.payload.meta.errCode) {
31
- case 403:
32
- // WToastShowError('Bạn không có quyền truy cập');
33
- showMessage({
34
- message: 'Thông báo',
35
- description: 'Bạn không có quyền truy cập',
36
- type: 'danger',
37
- icon: 'warning',
38
- backgroundColor: Colors.DANGER,
39
- });
40
- break;
41
- case 401:
42
- // WToastShowError('Vui lòng đăng nhập lại');
43
- showMessage({
44
- message: 'Thông báo',
45
- description: 'Vui lòng đăng nhập lại',
46
- type: 'danger',
47
- icon: 'warning',
48
- backgroundColor: Colors.DANGER,
49
- });
50
- break;
51
- case 200:
52
- dataShop.accessToken = resp.payload.data;
53
- dataShop.regFromApp = shop.regFromApp;
54
- dataShop.shop = shop;
55
- dispatch(setUserLogin(dataShop));
56
- break;
57
- default:
58
- break;
59
- }
60
- };
61
-
62
- const validateToken = async () => {
63
- try {
64
- console.log('token:::', props.route?.params?.token);
65
- const res = await Users.ValidateToken();
66
- console.log('ValidateToken: ', JSON.stringify(res));
67
- const data = JSON.parse(res);
68
-
69
- switch (data.meta.errCode) {
70
- case 200:
71
- dispatch(setUserLogin(data?.data));
72
- if (data.data.shops !== undefined && data.data.shops !== null) {
73
- if (data.data.shops.length > 0) {
74
- setClientToken(data.data.accessToken);
75
- // setDataShop(data?.data);
76
- changeToken(data?.data?.shops[0]);
77
- // data.data.shop = data?.data.shops[0];
78
- // navigation.replace(Screens.MainTab);
79
- return;
80
- }
81
- }
82
- break;
83
- case 222:
84
- // WToastShowError('Có lỗi xảy ra,vui lòng thử lại sau!');
85
- showMessage({
86
- message: 'Thông báo',
87
- description: 'Có lỗi xảy ra,vui lòng thử lại sau!',
88
- type: 'danger',
89
- icon: 'warning',
90
- backgroundColor: Colors.DANGER,
91
- });
92
- break;
93
- }
94
- navigation.replace(Screens.SignUp);
95
- } catch (e) {
96
- console.log(e);
97
- }
98
- };
99
-
100
- useEffect(() => {
101
- dispatch(setUserLogin({}));
102
- setClientToken(props.route?.params?.token);
103
- validateToken();
104
-
105
- return () => {
106
- console.log('logout');
107
- dispatch(logOut());
108
- };
109
- }, []);
110
5
  return <AppNavigator {...props} />;
111
6
  };
112
-
113
7
  export default Navigation;
@@ -1,78 +1,18 @@
1
1
  /* eslint-disable react-native/no-inline-styles */
2
- import React from 'react';
3
- import {
4
- ImageBackground,
5
- SafeAreaView,
6
- TouchableOpacity,
7
- View,
8
- } from 'react-native';
2
+ import React, { useEffect } from 'react';
3
+ import { ImageBackground } from 'react-native';
9
4
  import IntroImages from '../../assets/images/Splash';
10
- import BSubmit from '../../common/BSubmit/BSubmit';
11
- import Colors from '../../common/Colors';
12
- import FlexRow from '../../common/FlexRow';
13
- import { actuatedNormalize } from '../../common/Metrics';
14
- import RText from '../../common/RText';
15
5
  import Screens from '../../components/Navigation/Screens';
16
- import { save } from '../../components/Storage/storage';
17
-
18
6
  export const Intro = ({ navigation }: any) => {
19
- // const isLogin = route?.params?.isLogin || false;
20
-
21
- // const handleGoHome = () => {
22
- // isLogin ? navigation.goBack() : navigation.navigate(Screens.SignIn);
23
- // save('next_intro', 'true');
24
- // };
25
-
26
- const onNavigate = async () => {
27
- await save('next_intro', 'true');
28
- navigation.navigate(Screens.SignUp);
29
- };
30
-
31
- const onLogin = async () => {
32
- await save('next_intro', 'true');
33
- navigation.navigate(Screens.SignIn);
34
- };
35
-
7
+ useEffect(() => {
8
+ setTimeout(() => {
9
+ navigation.navigate(Screens.MainTab);
10
+ }, 800);
11
+ }, []);
36
12
  return (
37
- <ImageBackground source={IntroImages.bg_intro} style={{ flex: 1 }}>
38
- <SafeAreaView
39
- style={{
40
- flex: 1,
41
- justifyContent: 'flex-end',
42
- }}
43
- >
44
- <View>
45
- <BSubmit
46
- text={'Nhận tư vấn đầu tư'}
47
- onPress={onNavigate}
48
- buttonStyle={{
49
- alignSelf: 'center',
50
- width: '90%',
51
- }}
52
- />
53
-
54
- <FlexRow
55
- style={{ alignSelf: 'center', marginBottom: 24, marginTop: 16 }}
56
- >
57
- <RText>Bạn đã có tài khoản ?</RText>
58
- <TouchableOpacity
59
- onPress={onLogin}
60
- style={{
61
- marginLeft: 6,
62
- }}
63
- >
64
- <RText
65
- textStyle={{
66
- color: Colors.ORANGE,
67
- fontSize: actuatedNormalize(18),
68
- }}
69
- >
70
- Đăng nhập
71
- </RText>
72
- </TouchableOpacity>
73
- </FlexRow>
74
- </View>
75
- </SafeAreaView>
76
- </ImageBackground>
13
+ <ImageBackground
14
+ source={IntroImages.bg_intro}
15
+ style={{ flex: 1 }}
16
+ ></ImageBackground>
77
17
  );
78
18
  };
@@ -31,11 +31,7 @@ import { load, save } from '../../components/Storage/storage';
31
31
  import { setClientToken } from '../../controllers/Client';
32
32
  import useGetUser from '../../hooks/useGetUser';
33
33
  import { Option } from '../../interface/index';
34
- import {
35
- checkPermission,
36
- subscribeTopicNotification,
37
- unSubscribeTopicFCM,
38
- } from '../../utils/notification';
34
+ import { checkPermission } from '../../utils/notification';
39
35
  import styles from './styles';
40
36
 
41
37
  const options: Option[] = [
@@ -105,31 +101,31 @@ const options: Option[] = [
105
101
  title: 'Hướng dẫn',
106
102
  icon: imageOptions.guide,
107
103
  },
108
- {
109
- id: 6,
110
- title: 'Đổi mật khẩu',
111
- icon: imageOptions.password,
112
- },
104
+ // {
105
+ // id: 6,
106
+ // title: 'Đổi mật khẩu',
107
+ // icon: imageOptions.password,
108
+ // },
113
109
  // {
114
110
  // id: 7,
115
111
  // title: 'Kiểm tra bản cập nhật',
116
112
  // icon: imageOptions.refresh,
117
113
  // },
118
- {
119
- id: 8,
120
- title: 'Đăng xuất',
121
- icon: imageOptions.logout,
122
- },
114
+ // {
115
+ // id: 8,
116
+ // title: 'Đăng xuất',
117
+ // icon: imageOptions.logout,
118
+ // },
123
119
  ];
124
120
 
125
- export const Optional = ({navigation}: any) => {
121
+ export const Optional = ({ navigation }: any) => {
126
122
  const dispatch = useDispatch<AppDispatch>();
127
123
  const _userInfo = useGetUser();
128
124
  const isLoading = useSelector(selectLoading);
129
125
  const userData = useSelector(userInfor);
130
126
  const [openPickShop, setOpenPickShop] = useState(false);
131
127
  const [shopName, setShopName] = useState<string>(
132
- userData?.shops[0]?.name || userData?.shop?.name,
128
+ userData?.shops[0]?.name || userData?.shop?.name
133
129
  );
134
130
  const [lenderType, setLenderType] = useState<string | null>(null);
135
131
  const [isEnabled, setIsEnabled] = useState(false);
@@ -159,9 +155,9 @@ export const Optional = ({navigation}: any) => {
159
155
  setIsEnabled(!isEnabled);
160
156
  save('enable_notifications', !isEnabled);
161
157
  if (isEnabled) {
162
- unSubscribeTopicFCM(userData?.phone);
158
+ // unSubscribeTopicFCM(userData?.phone);
163
159
  } else {
164
- subscribeTopicNotification(userData?.phone);
160
+ // subscribeTopicNotification(userData?.phone);
165
161
  }
166
162
  } else {
167
163
  // WToastShowError('Chức năng chỉ dành cho NĐT có mã "NA"');
@@ -195,25 +191,25 @@ export const Optional = ({navigation}: any) => {
195
191
  case 5:
196
192
  navigation.navigate(Screens.Guide);
197
193
  break;
198
- case 6:
199
- navigation.navigate(Screens.ChangePassword);
200
- break;
194
+ // case 6:
195
+ // navigation.navigate(Screens.ChangePassword);
196
+ // break;
201
197
  case 7:
202
198
  break;
203
- case 8:
204
- Alert.alert('Thông báo', 'Bạn có chắc chắn muốn đăng xuất?', [
205
- {
206
- text: 'Huỷ',
207
- },
208
- {
209
- text: 'Đồng ý',
210
- onPress: () => {
211
- unSubscribeTopicFCM(userData?.phone);
212
- dispatch(logOut());
213
- },
214
- },
215
- ]);
216
- break;
199
+ // case 8:
200
+ // Alert.alert('Thông báo', 'Bạn có chắc chắn muốn đăng xuất?', [
201
+ // {
202
+ // text: 'Huỷ',
203
+ // },
204
+ // {
205
+ // text: 'Đồng ý',
206
+ // onPress: () => {
207
+ // // unSubscribeTopicFCM(userData?.phone);
208
+ // dispatch(logOut());
209
+ // },
210
+ // },
211
+ // ]);
212
+ // break;
217
213
  case 9:
218
214
  navigation.navigate(Screens.Gpay);
219
215
  break;
@@ -251,8 +247,8 @@ export const Optional = ({navigation}: any) => {
251
247
  setOpenPickShop(true);
252
248
  };
253
249
 
254
- const changeToken = async (shop: {shopId: any; regFromApp: any}) => {
255
- const resp: any = await dispatch(ChangeToken({shop_id: shop?.shopId}));
250
+ const changeToken = async (shop: { shopId: any; regFromApp: any }) => {
251
+ const resp: any = await dispatch(ChangeToken({ shop_id: shop?.shopId }));
256
252
  if (resp && resp.payload && resp?.payload?.meta?.errCode === 200) {
257
253
  const obj = {
258
254
  ...userData,
@@ -272,7 +268,7 @@ export const Optional = ({navigation}: any) => {
272
268
  text: 'Đồng ý',
273
269
  onPress: () => dispatch(logOut()),
274
270
  },
275
- ],
271
+ ]
276
272
  );
277
273
  }
278
274
  };
@@ -303,7 +299,7 @@ export const Optional = ({navigation}: any) => {
303
299
  </TouchableOpacity>
304
300
  </View>
305
301
  <View style={styles.redLine} />
306
- <ScrollView style={{paddingHorizontal: actuatedNormalize(16)}}>
302
+ <ScrollView style={{ paddingHorizontal: actuatedNormalize(16) }}>
307
303
  {shopName?.includes('DT') &&
308
304
  (lenderType?.includes('Gold') ||
309
305
  lenderType?.includes('Gold Plus')) && (
@@ -311,7 +307,8 @@ export const Optional = ({navigation}: any) => {
311
307
  onPress={() => navigation.navigate(Screens.WithDraw)}
312
308
  style={{
313
309
  flex: 1,
314
- }}>
310
+ }}
311
+ >
315
312
  <View style={styles.optionItems}>
316
313
  <Image
317
314
  source={imageOptions.withdraw}
@@ -322,13 +319,13 @@ export const Optional = ({navigation}: any) => {
322
319
  resizeMode: 'contain',
323
320
  }}
324
321
  />
325
- <RText textStyle={{paddingLeft: 12}}>{'Rút tiền'}</RText>
322
+ <RText textStyle={{ paddingLeft: 12 }}>{'Rút tiền'}</RText>
326
323
  </View>
327
- <View style={{height: 1, backgroundColor: '#E5E5E5'}} />
324
+ <View style={{ height: 1, backgroundColor: '#E5E5E5' }} />
328
325
  </TouchableOpacity>
329
326
  )}
330
327
  {options
331
- .filter(item => {
328
+ .filter((item) => {
332
329
  if (
333
330
  item.id === 15 &&
334
331
  shopName?.includes('NA') &&
@@ -351,7 +348,8 @@ export const Optional = ({navigation}: any) => {
351
348
  flexDirection: 'row',
352
349
  alignItems: 'center',
353
350
  justifyContent: 'space-between',
354
- }}>
351
+ }}
352
+ >
355
353
  <View style={styles.optionItems}>
356
354
  <Image
357
355
  source={item.icon}
@@ -362,15 +360,15 @@ export const Optional = ({navigation}: any) => {
362
360
  resizeMode: 'contain',
363
361
  }}
364
362
  />
365
- <RText textStyle={{paddingLeft: 12}}>{item?.title}</RText>
363
+ <RText textStyle={{ paddingLeft: 12 }}>{item?.title}</RText>
366
364
  </View>
367
365
  {item.id === 12 && (
368
366
  <Switch
369
- trackColor={{false: '#767577', true: Colors.GRAY_5}}
367
+ trackColor={{ false: '#767577', true: Colors.GRAY_5 }}
370
368
  thumbColor={isEnabled ? Colors.ORANGE : Colors.GRAY_4}
371
369
  onValueChange={toggleSwitch}
372
370
  value={isEnabled}
373
- style={{transform: [{scaleX: 0.6}, {scaleY: 0.6}]}}
371
+ style={{ transform: [{ scaleX: 0.6 }, { scaleY: 0.6 }] }}
374
372
  />
375
373
  )}
376
374
  </TouchableOpacity>
@@ -30,7 +30,6 @@ import { AppDispatch } from '../../components/Redux/store';
30
30
  import { load, save, SECURITY } from '../../components/Storage/storage';
31
31
  import KeyboardSpacer from '../../components/keyboardspacer';
32
32
  import { setClientToken } from '../../controllers/Client';
33
- import { subscribeTopicFCM } from '../../utils/notification';
34
33
 
35
34
  export const SignIn = ({ navigation }: any) => {
36
35
  const dispatch = useDispatch<AppDispatch>();
@@ -67,7 +66,7 @@ export const SignIn = ({ navigation }: any) => {
67
66
  switch (res.payload.meta.errCode) {
68
67
  case 200:
69
68
  dispatch(setUserLogin(res?.payload?.data));
70
- subscribeTopicFCM(phone);
69
+ // subscribeTopicFCM(phone);
71
70
  // if (res?.payload?.data?.typeDisbursement === 'NA') {
72
71
  // subscribeTopicNotification(phone);
73
72
  // save('enable_notifications', true);