@fadyshawky/react-native-magic 2.2.0 → 2.3.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 (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -55
  3. package/index.js +4 -0
  4. package/package.json +9 -3
  5. package/scripts/askPackageName.js +10 -5
  6. package/template/.env.development +8 -6
  7. package/template/.env.example +15 -5
  8. package/template/.env.production +8 -6
  9. package/template/.env.staging +8 -6
  10. package/template/.eslintrc.js +14 -0
  11. package/template/.husky/pre-commit +1 -0
  12. package/template/App.tsx +47 -16
  13. package/template/__tests__/App.test.tsx +28 -10
  14. package/template/babel.config.js +20 -1
  15. package/template/docs/ARCHITECTURE.md +40 -10
  16. package/template/docs/BEST_PRACTICES.md +10 -1
  17. package/template/docs/CUSTOMIZATION.md +118 -5
  18. package/template/docs/design-system.html +1164 -0
  19. package/template/docs/wireframes.html +411 -0
  20. package/template/index.js +10 -0
  21. package/template/jest.config.js +16 -1
  22. package/template/jest.setup.js +61 -0
  23. package/template/package-lock.json +12178 -8293
  24. package/template/package.json +53 -19
  25. package/template/react-native.config.js +3 -0
  26. package/template/resources/fonts/.gitkeep +0 -0
  27. package/template/scripts/ci-sync-env.cjs +71 -0
  28. package/template/src/assets/brand/logo-mark.svg +8 -0
  29. package/template/src/assets/brand/logo-mono.svg +9 -0
  30. package/template/src/assets/brand/logo-primary.svg +15 -0
  31. package/template/src/assets/brand/wordmark-dark.svg +18 -0
  32. package/template/src/common/components/AppBottomSheet.tsx +87 -0
  33. package/template/src/common/components/AppSwitch.tsx +75 -0
  34. package/template/src/common/components/AppTextInput.tsx +161 -0
  35. package/template/src/common/components/Avatar.tsx +75 -0
  36. package/template/src/common/components/Badge.tsx +66 -0
  37. package/template/src/common/components/CardScroller.tsx +58 -0
  38. package/template/src/common/components/Cards.tsx +13 -7
  39. package/template/src/common/components/Carousel.tsx +196 -0
  40. package/template/src/common/components/Checkbox.tsx +85 -0
  41. package/template/src/common/components/Chip.tsx +55 -0
  42. package/template/src/common/components/Dropdown.tsx +202 -0
  43. package/template/src/common/components/ErrorBoundary.tsx +82 -0
  44. package/template/src/common/components/FlatListWrapper.tsx +8 -8
  45. package/template/src/common/components/ListItem.tsx +90 -0
  46. package/template/src/common/components/LoadingComponent.tsx +8 -2
  47. package/template/src/common/components/Logo.tsx +77 -0
  48. package/template/src/common/components/ModalDialog.tsx +141 -0
  49. package/template/src/common/components/NetworkBanner.tsx +47 -0
  50. package/template/src/common/components/OTPInput.tsx +0 -1
  51. package/template/src/common/components/PrimaryButton.tsx +0 -14
  52. package/template/src/common/components/PrimaryTextInput.tsx +66 -130
  53. package/template/src/common/components/RadioGroup.tsx +95 -0
  54. package/template/src/common/components/SafeText.tsx +4 -3
  55. package/template/src/common/components/SearchBar.tsx +7 -5
  56. package/template/src/common/components/SegmentedControl.tsx +77 -0
  57. package/template/src/common/components/Skeleton.tsx +47 -0
  58. package/template/src/common/components/TryAgain.tsx +4 -2
  59. package/template/src/common/helpers/arrayHelpers.ts +2 -2
  60. package/template/src/common/helpers/defaultKeyIdExtractor.ts +1 -1
  61. package/template/src/common/helpers/regexHelpers.ts +1 -2
  62. package/template/src/common/helpers/stringsHelpers.ts +0 -1
  63. package/template/src/common/hooks/useBackHandler.ts +5 -2
  64. package/template/src/common/hooks/useEventRegister.ts +1 -1
  65. package/template/src/common/hooks/useFlatListActions.ts +1 -1
  66. package/template/src/common/hooks/useWhyDidYouUpdate.ts +1 -1
  67. package/template/src/common/localization/LocalizationProvider.tsx +1 -1
  68. package/template/src/common/localization/RTLInitializer.tsx +1 -1
  69. package/template/src/common/localization/dateFormatter.ts +0 -1
  70. package/template/src/common/localization/intlFormatter.ts +0 -1
  71. package/template/src/common/localization/localization.ts +2 -2
  72. package/template/src/common/localization/translations/homeLocalization.ts +14 -0
  73. package/template/src/common/localization/translations/loginLocalization.ts +8 -0
  74. package/template/src/common/localization/translations/mainNavigationLocalization.ts +2 -0
  75. package/template/src/common/localization/translations/profileLocalization.ts +16 -0
  76. package/template/src/common/utils/index.tsx +0 -6
  77. package/template/src/common/validations/commonValidations.ts +2 -2
  78. package/template/src/core/api/errorHandler.ts +1 -1
  79. package/template/src/core/api/responseHandlers.ts +1 -3
  80. package/template/src/core/api/serverHeaders.ts +61 -12
  81. package/template/src/core/notifications/notificationAuth.ts +6 -0
  82. package/template/src/core/notifications/notificationService.ts +125 -0
  83. package/template/src/core/notifications/routeFromNotificationData.ts +32 -0
  84. package/template/src/core/store/categories/categoriesActions.ts +25 -0
  85. package/template/src/core/store/categories/categoriesSlice.ts +51 -0
  86. package/template/src/core/store/categories/categoriesState.ts +19 -0
  87. package/template/src/core/store/rootReducer.ts +2 -0
  88. package/template/src/core/store/store.tsx +6 -1
  89. package/template/src/core/store/user/userActions.ts +75 -14
  90. package/template/src/core/store/user/userSlice.ts +49 -26
  91. package/template/src/core/store/user/userState.ts +6 -4
  92. package/template/src/core/theme/ThemeProvider.tsx +5 -3
  93. package/template/src/core/theme/brand.ts +50 -0
  94. package/template/src/core/theme/colors.ts +113 -99
  95. package/template/src/core/theme/commonConsts.ts +2 -2
  96. package/template/src/core/theme/commonStyles.ts +1 -1
  97. package/template/src/core/theme/themes.ts +2 -0
  98. package/template/src/core/theme/types.ts +4 -2
  99. package/template/src/core/utils/stringUtils.ts +1 -1
  100. package/template/src/design-system/index.ts +2 -0
  101. package/template/src/design-system/tokens/brand.ts +6 -0
  102. package/template/src/design-system/tokens/index.ts +3 -0
  103. package/template/src/design-system/tokens/palette.ts +4 -0
  104. package/template/src/design-system/tokens/typography-spacing.ts +2 -0
  105. package/template/src/navigation/AuthStack.tsx +1 -4
  106. package/template/src/navigation/HeaderComponents.tsx +6 -3
  107. package/template/src/navigation/MainStack.tsx +18 -6
  108. package/template/src/navigation/RootNavigation.tsx +4 -7
  109. package/template/src/navigation/TabBar.tsx +7 -6
  110. package/template/src/navigation/types.ts +10 -31
  111. package/template/src/screens/Login/Login.tsx +47 -47
  112. package/template/src/screens/OTP/OTPScreen.tsx +6 -9
  113. package/template/src/screens/components/ComponentsScreen.tsx +301 -0
  114. package/template/src/screens/home/HomeScreen.tsx +143 -1
  115. package/template/src/screens/home/hooks/useHomeData.ts +19 -5
  116. package/template/src/screens/index.tsx +1 -0
  117. package/template/src/screens/profile/Profile.tsx +139 -2
  118. package/template/src/screens/splash/Splash.tsx +44 -11
  119. package/template/src/sheetManager/sheets.tsx +1 -1
  120. package/template/tsconfig.json +14 -2
  121. package/template/types/globals.d.ts +43 -0
  122. package/template/types/index.ts +2 -6
  123. package/template/types/modules.d.ts +9 -0
  124. package/template/types/react-native-config.d.ts +0 -2
  125. package/.vscode/settings.json +0 -8
  126. package/CHANGELOG.md +0 -119
  127. package/CODE_OF_CONDUCT.md +0 -83
  128. package/CONTRIBUTING.md +0 -60
  129. package/local.properties +0 -1
  130. package/template/src/common/components/ImageCropPickerButton.tsx +0 -107
  131. package/template/src/common/components/PhotoTakingButton.tsx +0 -94
  132. package/template/src/common/helpers/imageHelpers.ts +0 -5
  133. package/template/src/common/helpers/inAppReviewHelper.ts +0 -30
  134. package/template/src/common/helpers/orientationHelpers.ts +0 -25
  135. package/template/src/common/helpers/shareHelpers.ts +0 -47
  136. package/template/src/common/utils/FeesCaalculation.tsx +0 -37
  137. package/template/src/common/utils/printData.tsx +0 -161
  138. package/template/src/common/validations/examples/TextInputWithValidation.tsx +0 -229
@@ -1,19 +1,52 @@
1
1
  import {useNavigation} from '@react-navigation/native';
2
2
  import React, {useEffect} from 'react';
3
- import {LoadingComponent} from '../../common/components/LoadingComponent';
4
- import {useAppSelector} from '../../core/store/reduxHelpers';
3
+ import {ActivityIndicator, StyleSheet, View} from 'react-native';
4
+ import {Logo} from '../../common/components/Logo';
5
+ import {RTLAwareText} from '../../common/components/RTLAwareText';
6
+ import {CommonSizes} from '../../core/theme/commonSizes';
7
+ import {useTheme} from '../../core/theme/ThemeProvider';
5
8
 
9
+ /**
10
+ * Branded splash. Only ever shown to logged-out users (the token gate in
11
+ * MainNavigation renders the app stack directly when a token exists), so it
12
+ * simply brands the launch and hands off to Login.
13
+ */
6
14
  export function Splash(): JSX.Element {
7
- const isUserLoggedIn = useAppSelector(state => state.user.accessToken);
8
- const navigation = useNavigation();
15
+ const navigation = useNavigation<any>();
16
+ const {theme} = useTheme();
9
17
 
10
18
  useEffect(() => {
11
- if (isUserLoggedIn) {
12
- navigation.navigate('Main' as never);
13
- } else {
14
- navigation.navigate('Login' as never);
15
- }
16
- }, [isUserLoggedIn]);
19
+ const id = setTimeout(() => navigation.replace('Login'), 1100);
20
+ return () => clearTimeout(id);
21
+ }, [navigation]);
17
22
 
18
- return <LoadingComponent />;
23
+ return (
24
+ <View
25
+ style={[styles.container, {backgroundColor: theme.colors.background_2}]}>
26
+ <Logo size={112} variant="gradient" />
27
+ <RTLAwareText
28
+ style={[
29
+ theme.text.bodySmallExtraBold,
30
+ styles.tagline,
31
+ {color: theme.colors.grayScale_200},
32
+ ]}>
33
+ REACT NATIVE MAGIC
34
+ </RTLAwareText>
35
+ <ActivityIndicator
36
+ color={theme.colors.PlatinateBlue_400}
37
+ style={styles.spinner}
38
+ />
39
+ </View>
40
+ );
19
41
  }
42
+
43
+ const styles = StyleSheet.create({
44
+ container: {
45
+ flex: 1,
46
+ alignItems: 'center',
47
+ justifyContent: 'center',
48
+ gap: CommonSizes.spacing.large,
49
+ },
50
+ tagline: {letterSpacing: 2},
51
+ spinner: {marginTop: CommonSizes.spacing.large},
52
+ });
@@ -1,6 +1,6 @@
1
1
  // We extend some of the types here to give us great intellisense
2
2
 
3
- import {registerSheet, SheetDefinition} from 'react-native-actions-sheet';
3
+ import {SheetDefinition} from 'react-native-actions-sheet';
4
4
 
5
5
  type Sheet = SheetDefinition;
6
6
 
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "extends": "@react-native/typescript-config",
3
3
  "compilerOptions": {
4
- "types": ["jest"]
4
+ "types": ["jest"],
5
+ "baseUrl": ".",
6
+ "paths": {
7
+ "@core/*": ["src/core/*"],
8
+ "@common/*": ["src/common/*"],
9
+ "@navigation/*": ["src/navigation/*"],
10
+ "@screens/*": ["src/screens/*"],
11
+ "@sheetManager/*": ["src/sheetManager/*"],
12
+ "@design-system": ["src/design-system"],
13
+ "@design-system/*": ["src/design-system/*"],
14
+ "@types/*": ["src/types/*"],
15
+ "@utils/*": ["src/utils/*"]
16
+ }
5
17
  },
6
18
  "include": ["**/*.ts", "**/*.tsx"],
7
- "exclude": ["**/node_modules", "**/Pods"]
19
+ "exclude": ["**/node_modules", "**/Pods", "e2e"]
8
20
  }
@@ -0,0 +1,43 @@
1
+ // Global type shims for the template.
2
+ //
3
+ // React 19 removed the global `JSX` namespace (it now lives at `React.JSX`).
4
+ // The codebase annotates components with `JSX.Element`, so we re-expose the
5
+ // global namespace by mapping it onto `React.JSX`.
6
+ import type * as React from 'react';
7
+
8
+ declare global {
9
+ namespace JSX {
10
+ type ElementType = React.JSX.ElementType;
11
+ interface Element extends React.JSX.Element {}
12
+ interface ElementClass extends React.JSX.ElementClass {}
13
+ interface ElementAttributesProperty
14
+ extends React.JSX.ElementAttributesProperty {}
15
+ interface ElementChildrenAttribute
16
+ extends React.JSX.ElementChildrenAttribute {}
17
+ type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<
18
+ C,
19
+ P
20
+ >;
21
+ interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
22
+ interface IntrinsicClassAttributes<T>
23
+ extends React.JSX.IntrinsicClassAttributes<T> {}
24
+ interface IntrinsicElements extends React.JSX.IntrinsicElements {}
25
+ }
26
+ }
27
+
28
+ // NOTE: bare `declare module 'x';` ambient shims for untyped packages live in
29
+ // `modules.d.ts` (a script file with no imports) — they don't work here because
30
+ // this file is a module (it has a top-level import).
31
+
32
+ // react-native-snackbar ships a default export at runtime but its bundled
33
+ // types omit it — add the default so `import Snackbar from ...` type-checks.
34
+ declare module 'react-native-snackbar' {
35
+ const Snackbar: {
36
+ LENGTH_SHORT: number;
37
+ LENGTH_LONG: number;
38
+ LENGTH_INDEFINITE: number;
39
+ show(options: {text: string; duration?: number; [key: string]: any}): void;
40
+ dismiss(): void;
41
+ };
42
+ export default Snackbar;
43
+ }
@@ -1,6 +1,5 @@
1
1
  import {ColorValue, PressableProps, TextStyle, ViewStyle} from 'react-native';
2
2
  import {RehydrateAction} from 'redux-persist';
3
- import {IconProps} from 'react-native-vector-icons/Icon';
4
3
  import {SFSymbolProps} from 'react-native-sfsymbols';
5
4
  import {RootState} from '../src/core/store/rootReducer';
6
5
  import {SFSymbols} from '../resources/symbols/SFSymbols';
@@ -14,12 +13,11 @@ export interface ICalendarSpec {
14
13
  sameElse: string;
15
14
  }
16
15
 
17
- export interface IIconPlatformProps
18
- extends Omit<IconProps, 'name' | 'color'>,
19
- Omit<SFSymbolProps, 'name'> {
16
+ export interface IIconPlatformProps extends Omit<SFSymbolProps, 'name'> {
20
17
  iosName?: SFSymbols;
21
18
  androidName?: string;
22
19
  color?: ColorValue;
20
+ size?: number;
23
21
  style?: TextStyle | ViewStyle;
24
22
  }
25
23
 
@@ -64,14 +62,12 @@ export enum ButtonType {
64
62
  outlineNegative = 'outlineNegative',
65
63
  }
66
64
 
67
- // eslint-disable-next-line import/no-unused-modules
68
65
  export interface IListState<T> {
69
66
  data: T[];
70
67
  loadState: LoadState;
71
68
  error: string | null;
72
69
  }
73
70
 
74
- // eslint-disable-next-line import/no-unused-modules
75
71
  export interface ISection<T> {
76
72
  data: T[];
77
73
  id: string;
@@ -0,0 +1,9 @@
1
+ // Ambient shims for JS packages without bundled or @types declarations.
2
+ // This file MUST stay a script (no top-level import/export) so these act as
3
+ // ambient module declarations, giving the imports an implicit `any` type.
4
+ declare module 'lodash';
5
+ declare module 'lodash/omit';
6
+ declare module 'intl';
7
+ declare module 'react-native-vector-icons/MaterialIcons';
8
+ declare module 'react-native-vector-icons/Ionicons';
9
+ declare module 'react-native-vector-icons/Icon';
@@ -10,10 +10,8 @@ declare module 'react-native-config' {
10
10
  }
11
11
 
12
12
  // @ts-ignore
13
- // eslint-disable-next-line import/no-unused-modules
14
13
  export const Config: EnvironmentVariables;
15
14
 
16
15
  // @ts-ignore
17
- // eslint-disable-next-line import/no-default-export,import/no-unused-modules
18
16
  export default Config;
19
17
  }
@@ -1,8 +0,0 @@
1
- {
2
- "workbench.colorCustomizations": {
3
- "activityBar.background": "#342D0C",
4
- "titleBar.activeBackground": "#493F10",
5
- "titleBar.activeForeground": "#FCFAF0"
6
- },
7
- "java.configuration.updateBuildConfiguration": "automatic"
8
- }
package/CHANGELOG.md DELETED
@@ -1,119 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- ## [1.0.8] - 2024-01-24
6
-
7
- ### Changed
8
- - Improved FeaturedCarousel component:
9
- - Centered carousel items on screen
10
- - Adjusted item width to 85% of screen width
11
- - Added proper item layout calculations
12
- - Enhanced snapping behavior
13
-
14
- ## [1.0.7] - 2024-12-27
15
-
16
- ### Changed
17
- - Enhanced UI components for better user experience:
18
- - Improved form input styling
19
- - Updated button states for better feedback
20
- - Refined error message displays
21
- - Added loading spinners for async actions
22
- - Standardized form layouts across authentication flows
23
-
24
- ### Added
25
- - Responsive design improvements for mobile devices
26
- - Visual feedback for form validation states
27
- - Transition animations for state changes
28
- - Consistent error message styling
29
-
30
- ## [1.0.6] - 2024-12-25
31
-
32
- ### Added
33
- - Added missing password reset handlers (`resetPasswordErrorHandler` and `resetPasswordLoadingHandler`) to user slice
34
- - Added password reset flow with the following states:
35
- - Loading state during password reset request
36
- - Error handling for failed password reset attempts
37
- - Success handling for completed password reset
38
- - Added complete user registration flow:
39
- - User input validation
40
- - Registration request handling
41
- - Success state with automatic login
42
- - Error handling for failed registration attempts
43
- - Loading states during registration process
44
-
45
- ### Fixed
46
- - Fixed password reset error handling in user slice
47
- - Resolved undefined handler errors in password reset flow
48
- - Improved registration flow error handling
49
-
50
- ## [1.0.5] - 2024-12-23
51
-
52
- ### Fixed
53
- - Resolved Android build configuration issues
54
- - Fixed package dependencies setup and initialization
55
- - Optimized Gradle build settings for Android
56
- - Fixed iOS permissions configuration
57
-
58
- ## [1.0.4] - 2024-12-22
59
-
60
- ### Fixed
61
- - Updated React Native Screens configuration for React Navigation v7 compatibility
62
- - Fixed navigation theme implementation for Poppins font family
63
-
64
- ### Changed
65
- - Simplified navigation container theme configuration
66
- - Removed deprecated font configurations
67
-
68
- ## [1.0.3] - 2024-12-21
69
-
70
- ### Added
71
- - Enhanced template structure with additional hooks and utilities
72
- - Added new dependencies:
73
- - @react-native-camera-roll/camera-roll ^7.9.0
74
- - @react-native-community/datetimepicker ^8.2.0
75
- - @react-native-community/image-editor ^4.2.1
76
- - @react-native-community/netinfo ^11.4.1
77
- - @react-native-community/slider ^4.5.5
78
- - @shopify/flash-list ^1.7.2
79
-
80
- ### Updated
81
- - Updated React Navigation to v7
82
- - Updated dependencies to latest versions:
83
- - @react-navigation/bottom-tabs ^7.2.0
84
- - @react-navigation/drawer ^7.1.1
85
- - @react-navigation/material-top-tabs ^7.1.0
86
- - @react-navigation/native ^7.0.14
87
- - @react-navigation/native-stack ^7.2.0
88
- - @reduxjs/toolkit ^2.5.0
89
-
90
- ### Changed
91
- - Improved project structure and organization
92
- - Enhanced iOS configuration
93
- - Updated Android Gradle configuration
94
-
95
- ## [1.0.2] - 2024-12-20
96
-
97
- ### Added
98
- - Initial template setup with TypeScript support
99
- - Basic navigation structure
100
- - Redux integration with persist storage
101
- - Common hooks and utilities
102
-
103
- ### Changed
104
- - Updated project dependencies
105
- - Improved documentation
106
-
107
- ## [1.0.1] - 2024-12-19
108
-
109
- ### Added
110
- - Basic React Native template structure
111
- - Essential project configuration
112
- - Initial README documentation
113
-
114
- ## [1.0.0] - 2024-12-18
115
-
116
- ### Added
117
- - Initial release
118
- - Basic project setup
119
- - Core dependencies
@@ -1,83 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
-
7
- We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
-
9
- ## Our Standards
10
-
11
- Examples of behavior that contributes to a positive environment for our community include:
12
-
13
- * Demonstrating empathy and kindness toward other people
14
- * Being respectful of differing opinions, viewpoints, and experiences
15
- * Giving and gracefully accepting constructive feedback
16
- * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
- * Focusing on what is best not just for us as individuals, but for the overall community
18
-
19
- Examples of unacceptable behavior include:
20
-
21
- * The use of sexualized language or imagery, and sexual attention or advances of any kind
22
- * Trolling, insulting or derogatory comments, and personal or political attacks
23
- * Public or private harassment
24
- * Publishing others' private information, such as a physical or email address, without their explicit permission
25
- * Other conduct which could reasonably be considered inappropriate in a professional setting
26
-
27
- ## Enforcement Responsibilities
28
-
29
- Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
-
31
- Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
-
33
- ## Scope
34
-
35
- This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
-
37
- ## Enforcement
38
-
39
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement by [opening an issue](https://github.com/fadyshawky/ReactNativeMagic/issues) (for sensitive reports, use a private channel as described in the issue template or contact the repository owner directly). All complaints will be reviewed and investigated promptly and fairly.
40
-
41
- All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
-
43
- ## Enforcement Guidelines
44
-
45
- Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
-
47
- ### 1. Correction
48
-
49
- **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50
-
51
- **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52
-
53
- ### 2. Warning
54
-
55
- **Community Impact**: A violation through a single incident or series of actions.
56
-
57
- **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
-
59
- ### 3. Temporary Ban
60
-
61
- **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
62
-
63
- **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
-
65
- ### 4. Permanent Ban
66
-
67
- **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
-
69
- **Consequence**: A permanent ban from any sort of public interaction within the community.
70
-
71
- ## Attribution
72
-
73
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
74
-
75
- Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
76
-
77
- For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
78
-
79
- [homepage]: https://www.contributor-covenant.org
80
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
81
- [Mozilla CoC]: https://github.com/mozilla/diversity
82
- [FAQ]: https://www.contributor-covenant.org/faq
83
- [translations]: https://www.contributor-covenant.org/translations
package/CONTRIBUTING.md DELETED
@@ -1,60 +0,0 @@
1
- # Contributing to ReactNativeMagic
2
-
3
- Thank you for considering contributing. Contributions help keep this template useful for everyone.
4
-
5
- This project adheres to a [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold it.
6
-
7
- ## How to contribute
8
-
9
- - **Bug reports & feature ideas** – Open an [issue](https://github.com/fadyshawky/ReactNativeMagic/issues).
10
- - **Code or docs** – Open a pull request (see below).
11
-
12
- ## Development setup
13
-
14
- 1. **Clone the repo**
15
- ```bash
16
- git clone https://github.com/fadyshawky/ReactNativeMagic.git
17
- cd ReactNativeMagic
18
- ```
19
-
20
- 2. **Work inside the template**
21
- The app that users get lives in the `template/` folder. To test changes:
22
- ```bash
23
- cd template
24
- npm install
25
- npm start # Metro
26
- npm run ios # or use an android:* script
27
- ```
28
-
29
- 3. **Test with a fresh init (recommended)**
30
- Create a new app using the local template to ensure init still works:
31
- ```bash
32
- npx @react-native-community/cli init TestApp --template file:/absolute/path/to/ReactNativeMagic
33
- cd TestApp && npm install && npm start
34
- ```
35
-
36
- ## Before submitting
37
-
38
- - **Lint** – Run `npm run lint` from the `template/` directory and fix any errors.
39
- - **Scope** – Prefer small, focused PRs (one fix or one feature).
40
- - **Docs** – If you change behavior or add options, update the README or `template/docs/` as needed.
41
-
42
- ## Pull request process
43
-
44
- 1. Fork the repo and create a branch from `main`.
45
- 2. Make your changes in `template/` (and root files like README, CONTRIBUTING, or `template.config.js` if relevant).
46
- 3. Ensure the template still runs and that a new project can be created with `--template file:...` as above.
47
- 4. Open a PR with a clear title and description. Link any related issues.
48
- 5. After review, a maintainer will merge when ready.
49
-
50
- ## What to contribute
51
-
52
- - **Bug fixes** – Crashes, wrong behavior, or broken init/build.
53
- - **Template improvements** – Dependencies, structure, theme, or docs that benefit most users.
54
- - **Documentation** – Fixes or clarifications in README, CONTRIBUTING, or `template/docs/`.
55
-
56
- If you’re unsure whether a change fits, open an issue first and we can discuss it.
57
-
58
- ## License
59
-
60
- By contributing, you agree that your contributions will be licensed under the same [MIT License](LICENSE.md) as the project.
package/local.properties DELETED
@@ -1 +0,0 @@
1
-
@@ -1,107 +0,0 @@
1
- import React, {FC, memo, useCallback} from 'react';
2
- import {ImageStyle, ImageURISource, ViewStyle} from 'react-native';
3
- import ImagePicker, {
4
- Image as CropperImage,
5
- Options,
6
- } from 'react-native-image-crop-picker';
7
- import {showActionSheet} from '../helpers/dialogsHelpers';
8
- import {localization} from '../localization/localization';
9
- import {PhotoTakingButton} from './PhotoTakingButton';
10
-
11
- interface IProps {
12
- onImagePicked: (image: CropperImage) => void;
13
- onRemoveImage: () => void;
14
- onPickerError?: (error: Error) => void;
15
- image?: ImageURISource | null;
16
- icon?: ImageURISource;
17
- style?: ViewStyle;
18
- iconStyle?: ImageStyle;
19
- imageStyle?: ImageStyle;
20
- disabled?: boolean;
21
- }
22
-
23
- export const ImageCropPickerButton: FC<IProps> = memo(
24
- ({
25
- onPickerError,
26
- onImagePicked,
27
- onRemoveImage,
28
- image,
29
- icon,
30
- style,
31
- iconStyle,
32
- imageStyle,
33
- disabled,
34
- }) => {
35
- const openGallery = useCallback(() => {
36
- ImagePicker.openPicker(pickerOptions)
37
- .then(imageResult => {
38
- onImagePicked(imageResult);
39
- })
40
- .catch(error => {
41
- onPickerError && onPickerError(error);
42
- });
43
- }, [onImagePicked, onPickerError]);
44
-
45
- const openCamera = useCallback(() => {
46
- ImagePicker.openCamera(pickerOptions)
47
- .then(imageResult => {
48
- onImagePicked(imageResult);
49
- })
50
- .catch(error => {
51
- onPickerError && onPickerError(error);
52
- });
53
- }, [onImagePicked, onPickerError]);
54
-
55
- const onPress = useCallback(() => {
56
- const options = [
57
- localization.common.cancel,
58
- localization.common.chooseFromLibrary,
59
- localization.common.takePhoto,
60
- ];
61
-
62
- if (image != null) {
63
- options.push(localization.common.delete);
64
- }
65
-
66
- showActionSheet(
67
- {
68
- title: localization.common.selectPhoto,
69
- options: options,
70
- cancelButtonIndex: 0,
71
- destructiveButtonIndex: 3,
72
- },
73
- optionIndex => {
74
- if (optionIndex == 1) {
75
- openGallery();
76
- } else if (optionIndex == 2) {
77
- openCamera();
78
- } else if (optionIndex == 3) {
79
- onRemoveImage();
80
- }
81
- },
82
- );
83
- }, [openGallery, openCamera, image, onRemoveImage]);
84
-
85
- return (
86
- <PhotoTakingButton
87
- style={style}
88
- iconStyle={iconStyle}
89
- imageStyle={imageStyle}
90
- onPressIn={onPress}
91
- backgroundImage={image}
92
- icon={icon}
93
- disabled={disabled}
94
- />
95
- );
96
- },
97
- );
98
-
99
- const pickerOptions: Options = {
100
- height: 1000,
101
- width: 1000,
102
- cropping: true,
103
- compressImageQuality: 0.5,
104
- multiple: false,
105
- mediaType: 'photo',
106
- includeBase64: true,
107
- };
@@ -1,94 +0,0 @@
1
- import React, {FC, Fragment, memo, ReactNode} from 'react';
2
- import {
3
- Image,
4
- ImageBackground,
5
- ImageStyle,
6
- ImageURISource,
7
- StyleSheet,
8
- TouchableOpacity,
9
- ViewStyle,
10
- } from 'react-native';
11
- import {Image as CropperImage} from 'react-native-image-crop-picker';
12
- import {CommonSizes} from '../../core/theme/commonSizes';
13
-
14
- interface IProps {
15
- onPress?: () => void;
16
- icon?: ImageURISource;
17
- backgroundImage?: ImageURISource | CropperImage | null;
18
- style?: ViewStyle;
19
- iconStyle?: ImageStyle;
20
- imageStyle?: ImageStyle;
21
- disabled?: boolean;
22
- }
23
-
24
- export const PhotoTakingButton: FC<IProps> = memo(
25
- ({
26
- icon,
27
- onPress,
28
- backgroundImage,
29
- style,
30
- iconStyle,
31
- imageStyle,
32
- disabled,
33
- }) => {
34
- return (
35
- <TouchableOpacity
36
- style={[styles.button, style]}
37
- onPressIn={onPress}
38
- disabled={disabled}>
39
- <BackgroundComponent image={backgroundImage} style={imageStyle}>
40
- <Image style={[styles.icon, iconStyle]} source={icon!} />
41
- </BackgroundComponent>
42
- </TouchableOpacity>
43
- );
44
- },
45
- );
46
-
47
- interface IBackgroundComponentProps {
48
- image?: ImageURISource | null;
49
- style?: ImageStyle;
50
- children?: ReactNode;
51
- }
52
-
53
- const BackgroundComponent: FC<IBackgroundComponentProps> = memo(
54
- ({image, children, style}) => {
55
- if (image != null) {
56
- return (
57
- <ImageBackground
58
- source={image}
59
- style={[styles.image, style]}
60
- imageStyle={[styles.image, style]}>
61
- {children}
62
- </ImageBackground>
63
- );
64
- } else {
65
- return <Fragment>{children}</Fragment>;
66
- }
67
- },
68
- );
69
-
70
- const styles = StyleSheet.create({
71
- button: {
72
- height: 120,
73
- width: 120,
74
- alignItems: 'center',
75
- justifyContent: 'center',
76
- borderRadius: CommonSizes.borderRadius.small,
77
- borderWidth: 1,
78
- } as ViewStyle,
79
- image: {
80
- height: 120,
81
- width: 120,
82
- resizeMode: 'contain',
83
- alignItems: 'center',
84
- justifyContent: 'center',
85
- borderRadius: CommonSizes.borderRadius.small,
86
- overflow: 'hidden',
87
- } as ImageStyle,
88
- icon: {
89
- width: 32,
90
- height: 32,
91
- resizeMode: 'contain',
92
- opacity: 0.8,
93
- } as ImageStyle,
94
- });
@@ -1,5 +0,0 @@
1
- import {Image as CropperImage} from 'react-native-image-crop-picker';
2
-
3
- export function convertCropperImageToBase64(image: CropperImage): string {
4
- return `data:${image.mime};base64,${image.data}`;
5
- }