@zezosoft/zezo-ott-react-native-ui-kit 0.1.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.
Files changed (202) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +32 -0
  3. package/lib/module/assets/animations/135037-payment-processing-error.json +1 -0
  4. package/lib/module/assets/animations/7227-vui-animation.json +1 -0
  5. package/lib/module/assets/animations/succesfull-payment.json +1 -0
  6. package/lib/module/assets/animations/voice-icon.json +1 -0
  7. package/lib/module/assets/img/back.png +0 -0
  8. package/lib/module/assets/img/bottom-panel.png +0 -0
  9. package/lib/module/assets/img/camera.png +0 -0
  10. package/lib/module/assets/img/camera2.png +0 -0
  11. package/lib/module/assets/img/h.svg +4 -0
  12. package/lib/module/assets/img/home.png +0 -0
  13. package/lib/module/assets/img/lock.png +0 -0
  14. package/lib/module/assets/img/play.png +0 -0
  15. package/lib/module/assets/img/profile.png +0 -0
  16. package/lib/module/assets/img/qr-code.png +0 -0
  17. package/lib/module/assets/img/shadow.png +0 -0
  18. package/lib/module/assets/img/shadow2.png +0 -0
  19. package/lib/module/assets/img/user.png +0 -0
  20. package/lib/module/assets/svg/content-error.svg +28 -0
  21. package/lib/module/assets/svg/download.svg +3 -0
  22. package/lib/module/assets/svg/favorites.svg +3 -0
  23. package/lib/module/assets/svg/home.svg +5 -0
  24. package/lib/module/assets/svg/menu-bar.svg +4 -0
  25. package/lib/module/assets/svg/my-space.svg +14 -0
  26. package/lib/module/assets/svg/play-icon-with-bg.svg +5 -0
  27. package/lib/module/assets/svg/search.svg +5 -0
  28. package/lib/module/assets/svg/server-error.svg +139 -0
  29. package/lib/module/components/Button/Button.js +22 -0
  30. package/lib/module/components/Button/Button.js.map +1 -0
  31. package/lib/module/components/Button/styles.js +23 -0
  32. package/lib/module/components/Button/styles.js.map +1 -0
  33. package/lib/module/components/Headers/One.js +101 -0
  34. package/lib/module/components/Headers/One.js.map +1 -0
  35. package/lib/module/components/Headers/Three.js +62 -0
  36. package/lib/module/components/Headers/Three.js.map +1 -0
  37. package/lib/module/components/Headers/Two.js +77 -0
  38. package/lib/module/components/Headers/Two.js.map +1 -0
  39. package/lib/module/components/Headers/index.js +17 -0
  40. package/lib/module/components/Headers/index.js.map +1 -0
  41. package/lib/module/components/Icons/AlertIcon.js +33 -0
  42. package/lib/module/components/Icons/AlertIcon.js.map +1 -0
  43. package/lib/module/components/Icons/DeviceIcon.js +25 -0
  44. package/lib/module/components/Icons/DeviceIcon.js.map +1 -0
  45. package/lib/module/components/Icons/DoneIcon/DoneIcon.js +23 -0
  46. package/lib/module/components/Icons/DoneIcon/DoneIcon.js.map +1 -0
  47. package/lib/module/components/Icons/ForgotPasswordMessageIcon.js +65 -0
  48. package/lib/module/components/Icons/ForgotPasswordMessageIcon.js.map +1 -0
  49. package/lib/module/components/Icons/ForgotPasswordMessageIconTwo.js +56 -0
  50. package/lib/module/components/Icons/ForgotPasswordMessageIconTwo.js.map +1 -0
  51. package/lib/module/components/Icons/NewIndex.js +24 -0
  52. package/lib/module/components/Icons/NewIndex.js.map +1 -0
  53. package/lib/module/components/Icons/ResendOTP.js +21 -0
  54. package/lib/module/components/Icons/ResendOTP.js.map +1 -0
  55. package/lib/module/components/Loader/Loader.js +35 -0
  56. package/lib/module/components/Loader/Loader.js.map +1 -0
  57. package/lib/module/components/Logo/Logo.js +41 -0
  58. package/lib/module/components/Logo/Logo.js.map +1 -0
  59. package/lib/module/components/Section/Card/Sliders/Styles/One.js +123 -0
  60. package/lib/module/components/Section/Card/Sliders/Styles/One.js.map +1 -0
  61. package/lib/module/components/Section/Card/Sliders/index.js +14 -0
  62. package/lib/module/components/Section/Card/Sliders/index.js.map +1 -0
  63. package/lib/module/components/Section/Card/Styles/One.js +92 -0
  64. package/lib/module/components/Section/Card/Styles/One.js.map +1 -0
  65. package/lib/module/components/Section/Card/index.js +14 -0
  66. package/lib/module/components/Section/Card/index.js.map +1 -0
  67. package/lib/module/components/Section/SectionType.js +98 -0
  68. package/lib/module/components/Section/SectionType.js.map +1 -0
  69. package/lib/module/components/Section/Sections.js +72 -0
  70. package/lib/module/components/Section/Sections.js.map +1 -0
  71. package/lib/module/components/index.js +13 -0
  72. package/lib/module/components/index.js.map +1 -0
  73. package/lib/module/index.js +9 -0
  74. package/lib/module/index.js.map +1 -0
  75. package/lib/module/package.json +1 -0
  76. package/lib/module/sample.test.js +8 -0
  77. package/lib/module/sample.test.js.map +1 -0
  78. package/lib/module/theme/themes.js +118 -0
  79. package/lib/module/theme/themes.js.map +1 -0
  80. package/lib/module/theme/useAppTheme.js +14 -0
  81. package/lib/module/theme/useAppTheme.js.map +1 -0
  82. package/lib/module/types/content.types.js +2 -0
  83. package/lib/module/types/content.types.js.map +1 -0
  84. package/lib/module/types/index.js +5 -0
  85. package/lib/module/types/index.js.map +1 -0
  86. package/lib/module/types/sections.types.js +4 -0
  87. package/lib/module/types/sections.types.js.map +1 -0
  88. package/lib/typescript/package.json +1 -0
  89. package/lib/typescript/src/components/Button/Button.d.ts +9 -0
  90. package/lib/typescript/src/components/Button/Button.d.ts.map +1 -0
  91. package/lib/typescript/src/components/Button/styles.d.ts +20 -0
  92. package/lib/typescript/src/components/Button/styles.d.ts.map +1 -0
  93. package/lib/typescript/src/components/Headers/One.d.ts +25 -0
  94. package/lib/typescript/src/components/Headers/One.d.ts.map +1 -0
  95. package/lib/typescript/src/components/Headers/Three.d.ts +14 -0
  96. package/lib/typescript/src/components/Headers/Three.d.ts.map +1 -0
  97. package/lib/typescript/src/components/Headers/Two.d.ts +19 -0
  98. package/lib/typescript/src/components/Headers/Two.d.ts.map +1 -0
  99. package/lib/typescript/src/components/Headers/index.d.ts +11 -0
  100. package/lib/typescript/src/components/Headers/index.d.ts.map +1 -0
  101. package/lib/typescript/src/components/Icons/AlertIcon.d.ts +7 -0
  102. package/lib/typescript/src/components/Icons/AlertIcon.d.ts.map +1 -0
  103. package/lib/typescript/src/components/Icons/DeviceIcon.d.ts +7 -0
  104. package/lib/typescript/src/components/Icons/DeviceIcon.d.ts.map +1 -0
  105. package/lib/typescript/src/components/Icons/DoneIcon/DoneIcon.d.ts +6 -0
  106. package/lib/typescript/src/components/Icons/DoneIcon/DoneIcon.d.ts.map +1 -0
  107. package/lib/typescript/src/components/Icons/ForgotPasswordMessageIcon.d.ts +3 -0
  108. package/lib/typescript/src/components/Icons/ForgotPasswordMessageIcon.d.ts.map +1 -0
  109. package/lib/typescript/src/components/Icons/ForgotPasswordMessageIconTwo.d.ts +3 -0
  110. package/lib/typescript/src/components/Icons/ForgotPasswordMessageIconTwo.d.ts.map +1 -0
  111. package/lib/typescript/src/components/Icons/NewIndex.d.ts +13 -0
  112. package/lib/typescript/src/components/Icons/NewIndex.d.ts.map +1 -0
  113. package/lib/typescript/src/components/Icons/ResendOTP.d.ts +7 -0
  114. package/lib/typescript/src/components/Icons/ResendOTP.d.ts.map +1 -0
  115. package/lib/typescript/src/components/Loader/Loader.d.ts +11 -0
  116. package/lib/typescript/src/components/Loader/Loader.d.ts.map +1 -0
  117. package/lib/typescript/src/components/Logo/Logo.d.ts +19 -0
  118. package/lib/typescript/src/components/Logo/Logo.d.ts.map +1 -0
  119. package/lib/typescript/src/components/Section/Card/Sliders/Styles/One.d.ts +18 -0
  120. package/lib/typescript/src/components/Section/Card/Sliders/Styles/One.d.ts.map +1 -0
  121. package/lib/typescript/src/components/Section/Card/Sliders/index.d.ts +7 -0
  122. package/lib/typescript/src/components/Section/Card/Sliders/index.d.ts.map +1 -0
  123. package/lib/typescript/src/components/Section/Card/Styles/One.d.ts +19 -0
  124. package/lib/typescript/src/components/Section/Card/Styles/One.d.ts.map +1 -0
  125. package/lib/typescript/src/components/Section/Card/index.d.ts +7 -0
  126. package/lib/typescript/src/components/Section/Card/index.d.ts.map +1 -0
  127. package/lib/typescript/src/components/Section/SectionType.d.ts +26 -0
  128. package/lib/typescript/src/components/Section/SectionType.d.ts.map +1 -0
  129. package/lib/typescript/src/components/Section/Sections.d.ts +27 -0
  130. package/lib/typescript/src/components/Section/Sections.d.ts.map +1 -0
  131. package/lib/typescript/src/components/index.d.ts +10 -0
  132. package/lib/typescript/src/components/index.d.ts.map +1 -0
  133. package/lib/typescript/src/index.d.ts +7 -0
  134. package/lib/typescript/src/index.d.ts.map +1 -0
  135. package/lib/typescript/src/sample.test.d.ts +1 -0
  136. package/lib/typescript/src/sample.test.d.ts.map +1 -0
  137. package/lib/typescript/src/theme/themes.d.ts +57 -0
  138. package/lib/typescript/src/theme/themes.d.ts.map +1 -0
  139. package/lib/typescript/src/theme/useAppTheme.d.ts +46 -0
  140. package/lib/typescript/src/theme/useAppTheme.d.ts.map +1 -0
  141. package/lib/typescript/src/types/content.types.d.ts +154 -0
  142. package/lib/typescript/src/types/content.types.d.ts.map +1 -0
  143. package/lib/typescript/src/types/index.d.ts +3 -0
  144. package/lib/typescript/src/types/index.d.ts.map +1 -0
  145. package/lib/typescript/src/types/sections.types.d.ts +41 -0
  146. package/lib/typescript/src/types/sections.types.d.ts.map +1 -0
  147. package/package.json +168 -0
  148. package/src/assets/animations/135037-payment-processing-error.json +1 -0
  149. package/src/assets/animations/7227-vui-animation.json +1 -0
  150. package/src/assets/animations/succesfull-payment.json +1 -0
  151. package/src/assets/animations/voice-icon.json +1 -0
  152. package/src/assets/img/back.png +0 -0
  153. package/src/assets/img/bottom-panel.png +0 -0
  154. package/src/assets/img/camera.png +0 -0
  155. package/src/assets/img/camera2.png +0 -0
  156. package/src/assets/img/h.svg +4 -0
  157. package/src/assets/img/home.png +0 -0
  158. package/src/assets/img/lock.png +0 -0
  159. package/src/assets/img/play.png +0 -0
  160. package/src/assets/img/profile.png +0 -0
  161. package/src/assets/img/qr-code.png +0 -0
  162. package/src/assets/img/shadow.png +0 -0
  163. package/src/assets/img/shadow2.png +0 -0
  164. package/src/assets/img/user.png +0 -0
  165. package/src/assets/svg/content-error.svg +28 -0
  166. package/src/assets/svg/download.svg +3 -0
  167. package/src/assets/svg/favorites.svg +3 -0
  168. package/src/assets/svg/home.svg +5 -0
  169. package/src/assets/svg/menu-bar.svg +4 -0
  170. package/src/assets/svg/my-space.svg +14 -0
  171. package/src/assets/svg/play-icon-with-bg.svg +5 -0
  172. package/src/assets/svg/search.svg +5 -0
  173. package/src/assets/svg/server-error.svg +139 -0
  174. package/src/components/Button/Button.tsx +32 -0
  175. package/src/components/Button/styles.ts +21 -0
  176. package/src/components/Headers/One.tsx +100 -0
  177. package/src/components/Headers/Three.tsx +63 -0
  178. package/src/components/Headers/Two.tsx +75 -0
  179. package/src/components/Headers/index.ts +16 -0
  180. package/src/components/Icons/AlertIcon.tsx +29 -0
  181. package/src/components/Icons/DeviceIcon.tsx +24 -0
  182. package/src/components/Icons/DoneIcon/DoneIcon.tsx +17 -0
  183. package/src/components/Icons/ForgotPasswordMessageIcon.tsx +55 -0
  184. package/src/components/Icons/ForgotPasswordMessageIconTwo.tsx +46 -0
  185. package/src/components/Icons/NewIndex.ts +23 -0
  186. package/src/components/Icons/ResendOTP.tsx +23 -0
  187. package/src/components/Loader/Loader.tsx +33 -0
  188. package/src/components/Logo/Logo.tsx +60 -0
  189. package/src/components/Section/Card/Sliders/Styles/One.tsx +147 -0
  190. package/src/components/Section/Card/Sliders/index.ts +13 -0
  191. package/src/components/Section/Card/Styles/One.tsx +112 -0
  192. package/src/components/Section/Card/index.ts +13 -0
  193. package/src/components/Section/SectionType.tsx +127 -0
  194. package/src/components/Section/Sections.tsx +120 -0
  195. package/src/components/index.ts +10 -0
  196. package/src/index.ts +6 -0
  197. package/src/sample.test.ts +5 -0
  198. package/src/theme/themes.ts +198 -0
  199. package/src/theme/useAppTheme.ts +13 -0
  200. package/src/types/content.types.ts +167 -0
  201. package/src/types/index.ts +2 -0
  202. package/src/types/sections.types.ts +56 -0
@@ -0,0 +1,112 @@
1
+ /**
2
+ * @author Pukhraj Dhamu
3
+ * @LastModified Sat 21 Sep 2024 at 03:26 PM
4
+ */
5
+
6
+ import { StyleSheet, View, TouchableOpacity, FlatList } from 'react-native';
7
+ import React, { memo } from 'react';
8
+ import SkeletonPlaceholder from 'react-native-skeleton-placeholder';
9
+ import {
10
+ moderateScale,
11
+ moderateVerticalScale,
12
+ verticalScale,
13
+ } from 'react-native-size-matters';
14
+ import FastImage from 'react-native-fast-image';
15
+ import { IContentData } from '../../../../types';
16
+ import { AppTheme } from '../../../../theme/themes';
17
+
18
+ export interface IProps {
19
+ theme: AppTheme;
20
+ data?: IContentData[];
21
+ isLoading?: boolean;
22
+ title: string;
23
+ onEndReached?: () => void;
24
+ section_id: string;
25
+ showNavigateToMore?: boolean;
26
+ }
27
+
28
+ const MovieCard: React.FC<IProps> = ({
29
+ data = [],
30
+ onEndReached,
31
+ isLoading = false,
32
+ }) => {
33
+ const renderItem = ({
34
+ item,
35
+ index,
36
+ }: {
37
+ item: IContentData;
38
+ index: number;
39
+ }) => (
40
+ <TouchableOpacity key={index} style={styles.item}>
41
+ <FastImage
42
+ source={{ uri: item.poster, priority: FastImage.priority.normal }}
43
+ style={styles.image}
44
+ />
45
+ </TouchableOpacity>
46
+ );
47
+
48
+ return (
49
+ <View style={styles.root}>
50
+ {isLoading ? (
51
+ <SkeletonPlaceholder>
52
+ <>
53
+ <View style={styles.title} />
54
+ <View style={styles.SkeletonPlaceholder}>
55
+ {[1, 2, 3].map((_, index) => (
56
+ <View key={index} style={styles.item}>
57
+ <View style={styles.image} />
58
+ </View>
59
+ ))}
60
+ </View>
61
+ </>
62
+ </SkeletonPlaceholder>
63
+ ) : (
64
+ <>
65
+ {/* {showNavigateToMore && data.length > 0 && (
66
+ <NavigateToMore title={title} onPress={navigateToMore} />
67
+ )} */}
68
+ <FlatList
69
+ horizontal
70
+ showsHorizontalScrollIndicator={false}
71
+ data={data}
72
+ onEndReached={onEndReached}
73
+ onEndReachedThreshold={0.5}
74
+ keyExtractor={(item, index) => item._id || index.toString()}
75
+ contentContainerStyle={{ paddingRight: moderateScale(15) }}
76
+ renderItem={renderItem}
77
+ />
78
+ </>
79
+ )}
80
+ </View>
81
+ );
82
+ };
83
+
84
+ export default memo(MovieCard);
85
+
86
+ const styles = StyleSheet.create({
87
+ root: {
88
+ marginTop: verticalScale(10),
89
+ },
90
+ item: {
91
+ marginLeft: moderateScale(12),
92
+ },
93
+ image: {
94
+ width: moderateScale(105),
95
+ height: moderateScale(150),
96
+ borderRadius: moderateScale(5),
97
+ backgroundColor: '#D9D9D9',
98
+ },
99
+ title: {
100
+ marginHorizontal: moderateScale(15),
101
+ marginVertical: moderateScale(5),
102
+ width: moderateScale(100),
103
+ height: moderateScale(20),
104
+ borderRadius: moderateScale(4),
105
+ backgroundColor: '#D9D9D9',
106
+ },
107
+ SkeletonPlaceholder: {
108
+ flexDirection: 'row',
109
+ alignItems: 'center',
110
+ marginVertical: moderateVerticalScale(5),
111
+ },
112
+ });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author Naresh Dhamu
3
+ * @LastModified Sun 08 Jun 2025 at 03:49 PM
4
+ */
5
+ import StyleOne from './Styles/One';
6
+
7
+ const Cards = {
8
+ Styles: {
9
+ One: StyleOne,
10
+ },
11
+ };
12
+
13
+ export default Cards;
@@ -0,0 +1,127 @@
1
+ /**
2
+ * @author Pukhraj Dhamu
3
+ * @lastModified Sat 21 Sep 2024 at 07:51 PM
4
+ */
5
+ import React from 'react';
6
+ // import Sliders from './Card/Sliders';
7
+
8
+ import { IContentData, IGetSectionData, IGetSectionMeta } from '../../types';
9
+ import { AppTheme } from '../../theme/themes';
10
+ import Sliders from './Card/Sliders';
11
+ export interface ICustomComponentsForSections {
12
+ type: string;
13
+ component: React.ReactElement;
14
+ }
15
+ export interface IProps {
16
+ type: IGetSectionData['type'];
17
+ data: {
18
+ data: IContentData[];
19
+ meta: IGetSectionMeta;
20
+ };
21
+ name: string;
22
+ customComponents?: ICustomComponentsForSections[];
23
+ theme?: AppTheme;
24
+ index: number;
25
+ section_id: string;
26
+ }
27
+
28
+ const defaultComponentMap = (
29
+ type: string,
30
+ props: Omit<IProps, 'customComponents' | 'type' | 'theme'> & {
31
+ theme?: AppTheme;
32
+ }
33
+ ): React.ReactNode => {
34
+ const commonProps = {
35
+ theme: props.theme,
36
+ title: props.name,
37
+ section_id: props.section_id,
38
+ data: props.data,
39
+ index: props.index,
40
+ };
41
+
42
+ switch (type) {
43
+ case 'slider':
44
+ return <Sliders.Styles.One {...commonProps} />;
45
+ // case 'slider_style_2':
46
+ // return <Sliders.Styles.Two {...commonProps} />;
47
+ // case 'continue_watching':
48
+ // return <NowWatching {...commonProps} />;
49
+ // case 'new_releases':
50
+ // case 'normal':
51
+ // return <Cards.Styles.One {...commonProps} />;
52
+ // case 'card_style_2':
53
+ // return <Cards.Styles.Two {...commonProps} />;
54
+ // case 'card_style_3':
55
+ // return <Cards.Styles.Three {...commonProps} />;
56
+ // case 'card_style_4':
57
+ // return <Cards.Styles.Four {...commonProps} />;
58
+ // case 'card_style_5':
59
+ // return <Cards.Styles.Five {...commonProps} />;
60
+ // case 'card_style_6':
61
+ // return <Cards.Styles.Six {...commonProps} />;
62
+ // case 'card_rotate_in_out':
63
+ // return <Cards.Styles.RotateInOut {...commonProps} />;
64
+ // case 'top_10':
65
+ // return <Cards.Styles.TopTen {...commonProps} />;
66
+ default:
67
+ return null;
68
+ }
69
+ };
70
+
71
+ const SectionType: React.FC<IProps> = ({
72
+ type: sectionType,
73
+ data,
74
+ name,
75
+ customComponents = [],
76
+ theme,
77
+ index,
78
+ section_id,
79
+ }) => {
80
+ const commonProps = { data, title: name };
81
+
82
+ const customComponent = customComponents.find(
83
+ (component) => component.type === sectionType
84
+ );
85
+
86
+ if (customComponent) {
87
+ return React.cloneElement(customComponent.component, {
88
+ ...(customComponent?.component?.props || {}),
89
+ ...commonProps,
90
+ });
91
+ }
92
+
93
+ const defaultComponent = defaultComponentMap(sectionType, {
94
+ data,
95
+ name,
96
+ section_id,
97
+ index,
98
+ theme,
99
+ });
100
+
101
+ if (defaultComponent) return defaultComponent;
102
+
103
+ return (
104
+ <>
105
+ {customComponents
106
+ .filter(
107
+ ({ type: customType }) =>
108
+ defaultComponentMap(customType, {
109
+ data,
110
+ name,
111
+ section_id,
112
+ index,
113
+ theme,
114
+ }) === null
115
+ )
116
+ .map(({ component, type }) =>
117
+ React.cloneElement(component, {
118
+ ...(component?.props || {}),
119
+ key: type,
120
+ ...commonProps,
121
+ })
122
+ )}
123
+ </>
124
+ );
125
+ };
126
+
127
+ export default SectionType;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @author Naresh Dhamu
3
+ * @lastModified Sun 08 Jun 2025 at 03:50 PM
4
+ */
5
+
6
+ import React, { useMemo } from 'react';
7
+ import {
8
+ type FlatListProps,
9
+ FlatList,
10
+ type NativeScrollEvent,
11
+ type NativeSyntheticEvent,
12
+ type StyleProp,
13
+ type ViewStyle,
14
+ } from 'react-native';
15
+ import { scale } from 'react-native-size-matters';
16
+ import Animated, {
17
+ type AnimatedStyle,
18
+ type SharedValue,
19
+ } from 'react-native-reanimated';
20
+
21
+ import SectionType from './SectionType';
22
+ import { Loader } from '../Loader/Loader';
23
+ import type { IGetSectionData } from '../../types';
24
+ import { AppTheme } from '../../theme/themes';
25
+
26
+ export interface ICustomComponentsForSections {
27
+ type: string;
28
+ component: React.ReactElement;
29
+ }
30
+
31
+ export interface ISectionsProps {
32
+ category?: string;
33
+ customComponents?: ICustomComponentsForSections[];
34
+ LoaderComponent?: React.ReactNode;
35
+ ErrorComponent?: React.ReactNode;
36
+ InfiniteScrollLoaderComponent?: React.ReactNode;
37
+ onScroll?:
38
+ | ((event: NativeSyntheticEvent<NativeScrollEvent>) => void)
39
+ | SharedValue<
40
+ ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined
41
+ >;
42
+ contentContainerStyle?:
43
+ | StyleProp<ViewStyle>
44
+ | AnimatedStyle<StyleProp<ViewStyle>>;
45
+ data?: IGetSectionData[];
46
+ onEndReached?: () => void;
47
+ theme?: AppTheme;
48
+ }
49
+
50
+ // 👇 Type-safe animated FlatList
51
+ const AnimatedFlatList = Animated.createAnimatedComponent(
52
+ FlatList as React.ComponentType<FlatListProps<IGetSectionData>>
53
+ );
54
+
55
+ export const Sections: React.FC<ISectionsProps> = ({
56
+ customComponents,
57
+ LoaderComponent = <Loader />,
58
+ ErrorComponent,
59
+ onScroll,
60
+ contentContainerStyle,
61
+ data,
62
+ onEndReached,
63
+ theme,
64
+ }) => {
65
+ const sectionData = useMemo(() => data, [data]);
66
+
67
+ const onEndReachedHandler = () => {
68
+ if (onEndReached) onEndReached();
69
+ };
70
+
71
+ const renderItem = ({
72
+ item,
73
+ index,
74
+ }: {
75
+ item: IGetSectionData;
76
+ index: number;
77
+ }) => {
78
+ if (!item) return null;
79
+
80
+ return (
81
+ <SectionType
82
+ key={index}
83
+ index={index}
84
+ type={item.type || 'normal'}
85
+ data={item.content}
86
+ name={item.name}
87
+ theme={theme}
88
+ customComponents={customComponents}
89
+ section_id={item._id}
90
+ />
91
+ );
92
+ };
93
+
94
+ if (!data) {
95
+ if (LoaderComponent) return <>{LoaderComponent}</>;
96
+ if (ErrorComponent) return <>{ErrorComponent}</>;
97
+ return null;
98
+ }
99
+
100
+ return (
101
+ <AnimatedFlatList
102
+ initialNumToRender={5}
103
+ showsVerticalScrollIndicator={false}
104
+ removeClippedSubviews
105
+ onScroll={onScroll as any} // casting to avoid SharedValue type issues
106
+ scrollEventThrottle={16}
107
+ data={sectionData}
108
+ renderItem={renderItem}
109
+ keyExtractor={(_item, index) => index.toString()}
110
+ onEndReached={onEndReachedHandler}
111
+ onEndReachedThreshold={0.7}
112
+ contentContainerStyle={[
113
+ {
114
+ paddingBottom: scale(100),
115
+ },
116
+ contentContainerStyle,
117
+ ]}
118
+ />
119
+ );
120
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author Naresh Dhamu
3
+ * @lastModified Sun 08 Jun 2025 at 03:23 PM
4
+ */
5
+
6
+ export * from './Button/Button';
7
+ export * from './Loader/Loader';
8
+ export * from './Headers';
9
+ export * from './Section/Sections';
10
+ export * from './Logo/Logo';
package/src/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @author Naresh Dhamu
3
+ * @lastModified Sun 08 Jun 2025 at 03:23 PM
4
+ */
5
+ export * from './components';
6
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ describe('Sample Test', () => {
2
+ it('should pass', () => {
3
+ expect(1 + 1).toBe(2);
4
+ });
5
+ });
@@ -0,0 +1,198 @@
1
+ /**
2
+ * @author Naresh Dhamu
3
+ * @lastModified Mon 09 Jun 2025 at 04:45 PM
4
+ */
5
+
6
+ import { MD3DarkTheme, DefaultTheme } from 'react-native-paper';
7
+ import type {
8
+ MD3ElevationColors,
9
+ ThemeProp,
10
+ } from 'react-native-paper/lib/typescript/types';
11
+
12
+ type BaseColors = {
13
+ primary: string;
14
+ primaryContainer: string;
15
+ secondary: string;
16
+ secondaryContainer: string;
17
+ tertiary: string;
18
+ tertiaryContainer: string;
19
+ surface: string;
20
+ surfaceVariant: string;
21
+ surfaceDisabled: string;
22
+ background: string;
23
+ error: string;
24
+ errorContainer: string;
25
+ onPrimary: string;
26
+ onPrimaryContainer: string;
27
+ onSecondary: string;
28
+ onSecondaryContainer: string;
29
+ onTertiary: string;
30
+ onTertiaryContainer: string;
31
+ onSurface: string;
32
+ onSurfaceVariant: string;
33
+ onSurfaceDisabled: string;
34
+ onError: string;
35
+ onErrorContainer: string;
36
+ onBackground: string;
37
+ outline: string;
38
+ outlineVariant: string;
39
+ inverseSurface: string;
40
+ inverseOnSurface: string;
41
+ inversePrimary: string;
42
+ shadow: string;
43
+ scrim: string;
44
+ backdrop: string;
45
+ elevation: MD3ElevationColors;
46
+
47
+ // custom colors
48
+ CustomPrimary: string;
49
+ CustomSecondary: string;
50
+ CustomText: string;
51
+ CustomWhiteColor: string;
52
+ CustomBlackColor: string;
53
+ CustomTransparentColor: string;
54
+ };
55
+
56
+ export interface ITheme
57
+ extends Pick<
58
+ ThemeProp,
59
+ 'version' | 'dark' | 'mode' | 'animation' | 'fonts' | 'isV3' | 'roundness'
60
+ > {
61
+ colors: BaseColors; // ✅ required
62
+ }
63
+
64
+ // ✅ AppTheme allows partial override
65
+ export type AppTheme = Omit<ITheme, 'colors'> & {
66
+ dark?: boolean;
67
+ colors?: Partial<BaseColors>;
68
+ };
69
+
70
+ export const LightTheme: ITheme = {
71
+ ...DefaultTheme,
72
+ dark: false,
73
+ colors: {
74
+ primary: '#3B82F6',
75
+ onPrimary: '#FFFFFF',
76
+ primaryContainer: '#DBEAFE',
77
+ onPrimaryContainer: '#1E40AF',
78
+
79
+ secondary: '#2563EB',
80
+ onSecondary: '#FFFFFF',
81
+ secondaryContainer: '#E0E7FF',
82
+ onSecondaryContainer: '#1E40AF',
83
+
84
+ tertiary: '#FBBF24',
85
+ onTertiary: '#92400E',
86
+ tertiaryContainer: '#FEF3C7',
87
+ onTertiaryContainer: '#92400E',
88
+
89
+ surface: '#FFFFFF',
90
+ onSurface: '#1F2937',
91
+ surfaceVariant: '#F3F4F6',
92
+ onSurfaceVariant: '#6B7280',
93
+
94
+ background: '#F9FAFB',
95
+ onBackground: '#111827',
96
+
97
+ error: '#DC2626',
98
+ onError: '#FFFFFF',
99
+ errorContainer: '#FEE2E2',
100
+ onErrorContainer: '#DC2626',
101
+
102
+ outline: '#D1D5DB',
103
+ outlineVariant: '#E5E7EB',
104
+
105
+ shadow: 'rgba(0, 0, 0, 0.1)',
106
+ scrim: 'rgba(0, 0, 0, 0.2)',
107
+ backdrop: 'rgba(243, 244, 246, 0.7)',
108
+
109
+ inverseSurface: '#1F2937',
110
+ inverseOnSurface: '#F9FAFB',
111
+ inversePrimary: '#2563EB',
112
+
113
+ elevation: {
114
+ level0: 'transparent',
115
+ level1: '#F3F4F6',
116
+ level2: '#E5E7EB',
117
+ level3: '#D1D5DB',
118
+ level4: '#9CA3AF',
119
+ level5: '#6B7280',
120
+ },
121
+
122
+ surfaceDisabled: 'rgba(31, 41, 55, 0.12)',
123
+ onSurfaceDisabled: 'rgba(31, 41, 55, 0.38)',
124
+
125
+ // custom
126
+ CustomPrimary: '#3B82F6',
127
+ CustomSecondary: '#2563EB',
128
+ CustomText: '#111827',
129
+ CustomWhiteColor: '#FFFFFF',
130
+ CustomBlackColor: '#000000',
131
+ CustomTransparentColor: 'rgba(0,0,0,0)',
132
+ },
133
+ };
134
+
135
+ export const DarkTheme: ITheme = {
136
+ ...MD3DarkTheme,
137
+ dark: true,
138
+ colors: {
139
+ primary: '#60A5FA',
140
+ onPrimary: '#1E40AF',
141
+ primaryContainer: '#1E40AF',
142
+ onPrimaryContainer: '#DBEAFE',
143
+
144
+ secondary: '#3B82F6',
145
+ onSecondary: '#DBEAFE',
146
+ secondaryContainer: '#2563EB',
147
+ onSecondaryContainer: '#DBEAFE',
148
+
149
+ tertiary: '#FBBF24',
150
+ onTertiary: '#78350F',
151
+ tertiaryContainer: '#92400E',
152
+ onTertiaryContainer: '#78350F',
153
+
154
+ surface: '#111827',
155
+ onSurface: '#F9FAFB',
156
+ surfaceVariant: '#374151',
157
+ onSurfaceVariant: '#D1D5DB',
158
+
159
+ background: '#0F172A',
160
+ onBackground: '#F9FAFB',
161
+
162
+ error: '#EF4444',
163
+ onError: '#FFFFFF',
164
+ errorContainer: '#B91C1C',
165
+ onErrorContainer: '#EF4444',
166
+
167
+ outline: '#4B5563',
168
+ outlineVariant: '#374151',
169
+
170
+ shadow: 'rgba(0, 0, 0, 0.7)',
171
+ scrim: 'rgba(0, 0, 0, 0.7)',
172
+ backdrop: 'rgba(15, 23, 42, 0.7)',
173
+
174
+ inverseSurface: '#F9FAFB',
175
+ inverseOnSurface: '#1F2937',
176
+ inversePrimary: '#2563EB',
177
+
178
+ elevation: {
179
+ level0: 'transparent',
180
+ level1: '#1F2937',
181
+ level2: '#111827',
182
+ level3: '#0F172A',
183
+ level4: '#0B1120',
184
+ level5: '#090E1A',
185
+ },
186
+
187
+ surfaceDisabled: 'rgba(249, 250, 251, 0.12)',
188
+ onSurfaceDisabled: 'rgba(249, 250, 251, 0.38)',
189
+
190
+ // custom
191
+ CustomPrimary: '#3B82F6',
192
+ CustomSecondary: '#2563EB',
193
+ CustomText: '#F9FAFB',
194
+ CustomWhiteColor: '#F9FAFB',
195
+ CustomBlackColor: '#000000',
196
+ CustomTransparentColor: 'rgba(0,0,0,0)',
197
+ },
198
+ };
@@ -0,0 +1,13 @@
1
+ import { useColorScheme } from 'react-native';
2
+ import type { AppTheme } from './themes';
3
+ import { LightTheme, DarkTheme } from './themes';
4
+
5
+ export function useAppTheme(externalTheme?: AppTheme) {
6
+ const colorScheme = useColorScheme();
7
+ const isDarkAllowed = externalTheme?.dark === true && colorScheme === 'dark';
8
+ const appliedTheme = isDarkAllowed ? DarkTheme : LightTheme;
9
+ return {
10
+ colors: appliedTheme.colors,
11
+ isDarkMode: appliedTheme.dark ?? false,
12
+ };
13
+ }