@brightlayer-ui/react-native-template-authentication-typescript 2.1.0 → 3.0.0-alpha.1

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 (120) hide show
  1. package/README.md +22 -17
  2. package/package.json +3 -3
  3. package/template/.bundle/config +2 -0
  4. package/template/.eslintrc.js +57 -0
  5. package/template/.prettierrc.js +7 -0
  6. package/template/.watchmanconfig +1 -0
  7. package/template/App.tsx +85 -47
  8. package/template/Gemfile +9 -0
  9. package/template/Gemfile.lock +107 -0
  10. package/template/README.md +79 -0
  11. package/template/__tests__/App.test.tsx +17 -0
  12. package/template/_gitignore +74 -0
  13. package/template/android/app/build.gradle +120 -0
  14. package/template/android/app/debug.keystore +0 -0
  15. package/template/android/app/proguard-rules.pro +10 -0
  16. package/template/android/app/src/debug/AndroidManifest.xml +9 -0
  17. package/template/android/app/src/main/AndroidManifest.xml +25 -0
  18. package/template/android/app/src/main/java/com/workflow/MainActivity.kt +28 -0
  19. package/template/android/app/src/main/java/com/workflow/MainApplication.kt +43 -0
  20. package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  21. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  22. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  23. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  24. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  25. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  26. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  27. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  28. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  29. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  30. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  31. package/template/android/app/src/main/res/values/strings.xml +3 -0
  32. package/template/android/app/src/main/res/values/styles.xml +9 -0
  33. package/template/android/build.gradle +21 -0
  34. package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  35. package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  36. package/template/android/gradle.properties +41 -0
  37. package/template/android/gradlew +249 -0
  38. package/template/android/gradlew.bat +92 -0
  39. package/template/android/link-assets-manifest.json +25 -0
  40. package/template/android/settings.gradle +4 -0
  41. package/template/app.json +4 -0
  42. package/template/assets/fonts/OpenSans-Bold.ttf +0 -0
  43. package/template/assets/fonts/OpenSans-ExtraBold.ttf +0 -0
  44. package/template/assets/fonts/OpenSans-Light.ttf +0 -0
  45. package/template/assets/fonts/OpenSans-Regular.ttf +0 -0
  46. package/template/assets/fonts/OpenSans-SemiBold.ttf +0 -0
  47. package/template/assets/images/Logo.png +0 -0
  48. package/template/babel.config.js +1 -2
  49. package/template/eslint.config.mjs +10 -0
  50. package/template/index.js +11 -0
  51. package/template/ios/.xcode.env +11 -0
  52. package/template/ios/Podfile +40 -0
  53. package/template/ios/Podfile.lock +1496 -0
  54. package/template/ios/blankTemplate/AppDelegate.h +6 -0
  55. package/template/ios/blankTemplate/AppDelegate.mm +31 -0
  56. package/template/ios/blankTemplate/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  57. package/template/ios/blankTemplate/Images.xcassets/Contents.json +6 -0
  58. package/template/ios/blankTemplate/Info.plist +75 -0
  59. package/template/ios/blankTemplate/LaunchScreen.storyboard +47 -0
  60. package/template/ios/blankTemplate/PrivacyInfo.xcprivacy +37 -0
  61. package/template/ios/blankTemplate/main.m +10 -0
  62. package/template/ios/blankTemplate.xcodeproj/project.pbxproj +741 -0
  63. package/template/ios/blankTemplate.xcodeproj/xcshareddata/xcschemes/blankTemplate.xcscheme +88 -0
  64. package/template/ios/blankTemplate.xcworkspace/contents.xcworkspacedata +10 -0
  65. package/template/ios/blankTemplate.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  66. package/template/ios/blankTemplateTests/Info.plist +24 -0
  67. package/template/ios/blankTemplateTests/blankTemplateTests.m +66 -0
  68. package/template/ios/link-assets-manifest.json +25 -0
  69. package/template/jest.config.js +12 -0
  70. package/template/jestSetupFile.js +31 -10
  71. package/template/metro.config.js +7 -25
  72. package/template/package.json +71 -0
  73. package/template/src/actions/AuthUIActions.tsx +10 -11
  74. package/template/src/actions/RegistrationUIActions.tsx +37 -30
  75. package/template/src/assets/images/eaton_stacked_logo.png +0 -0
  76. package/template/src/components/AuthCustomScreen.tsx +50 -0
  77. package/template/src/components/CustomScreen.tsx +77 -0
  78. package/template/src/components/DebugComponent.tsx +49 -0
  79. package/template/src/components/ForgotPasswordScreenBaseExample.tsx +42 -0
  80. package/template/src/components/ResetPasswordScreenBaseExample.tsx +41 -0
  81. package/template/src/components/UserMenuExample.tsx +117 -0
  82. package/template/src/contexts/AppContextProvider.tsx +28 -0
  83. package/template/src/contexts/ThemeContext.ts +15 -0
  84. package/template/src/navigation/index.tsx +205 -22
  85. package/template/src/navigation/navigation-drawer.tsx +44 -26
  86. package/template/src/screens/ChangePassword.tsx +15 -0
  87. package/template/src/screens/Dashboard.tsx +137 -0
  88. package/template/src/screens/Homepage.tsx +135 -0
  89. package/template/src/screens/Locations.tsx +137 -0
  90. package/template/src/screens/Login.tsx +17 -0
  91. package/template/src/screens/Registration.tsx +4 -0
  92. package/template/src/screens/RegistrationInvite.tsx +5 -0
  93. package/template/src/screens/index.ts +12 -0
  94. package/template/src/store/local-storage.ts +4 -4
  95. package/template/translations/dictionary/chinese.ts +29 -0
  96. package/template/translations/dictionary/english.ts +29 -0
  97. package/template/translations/dictionary/french.ts +29 -0
  98. package/template/translations/dictionary/index.ts +19 -0
  99. package/template/translations/dictionary/portuguese.ts +29 -0
  100. package/template/translations/dictionary/spanish.ts +29 -0
  101. package/template/translations/dictionary/types.ts +27 -0
  102. package/template/translations/i18n.ts +58 -0
  103. package/template/tsconfig.json +60 -0
  104. package/template/yarn.lock +7346 -0
  105. package/template.config.js +4 -0
  106. package/CHANGELOG.md +0 -69
  107. package/dependencies.json +0 -31
  108. package/images/Logo.svg +0 -11
  109. package/template/__mocks__/svgMock.js +0 -8
  110. package/template/react-native.config.js +0 -3
  111. package/template/src/navigation/DeepLinking.ts +0 -62
  112. package/template/src/screens/home.tsx +0 -198
  113. package/template/src/screens/index.tsx +0 -3
  114. package/template/src/screens/pageOne.tsx +0 -91
  115. package/template/src/screens/pageTwo.tsx +0 -92
  116. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Bold.ttf +0 -0
  117. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-ExtraBold.ttf +0 -0
  118. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Light.ttf +0 -0
  119. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Regular.ttf +0 -0
  120. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-SemiBold.ttf +0 -0
@@ -1,50 +1,68 @@
1
- import { Drawer, DrawerBody, DrawerHeader, DrawerNavGroup, NavItem } from '@brightlayer-ui/react-native-components';
2
- import React, { useState, useCallback } from 'react';
3
- import * as Colors from '@brightlayer-ui/colors';
4
- import { StackNavigationProp } from '@react-navigation/stack';
1
+ import { Drawer, DrawerBody, DrawerHeader, DrawerNavGroup } from '@brightlayer-ui/react-native-components';
2
+ import React, { useState, useCallback, useEffect } from 'react';
5
3
  import { RootStackParamList } from './index';
6
-
7
- export const navGroupItems: NavItem[] = [
8
- {
9
- title: 'Home Page',
10
- itemID: 'Home',
11
- icon: { name: 'home' },
12
- },
13
- {
14
- title: 'Page One',
15
- itemID: 'PageOne',
16
- icon: { name: 'looks-one' },
17
- },
18
- {
19
- title: 'Page Two',
20
- itemID: 'PageTwo',
21
- icon: { name: 'looks-two' },
22
- },
23
- ];
4
+ import { DrawerActions } from '@react-navigation/native';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { IconFamily } from '@brightlayer-ui/react-native-components/core/__types__';
7
+ import { NativeStackNavigationProp } from '@react-navigation/native-stack';
24
8
 
25
9
  export type NavDrawerProps = {
26
- navigation: StackNavigationProp<RootStackParamList, 'NavigationDrawer'>;
10
+ navigation: NativeStackNavigationProp<RootStackParamList, 'NavigationDrawer'>;
27
11
  };
28
12
 
29
13
  export const NavigationDrawer: React.FC<NavDrawerProps> = ({ navigation }) => {
30
14
  const [selected, setSelected] = useState('Home');
15
+ const { t } = useTranslation();
16
+ const navigationState = navigation.getState();
17
+
18
+ const Homepage: IconFamily = { family: 'material', name: 'home', direction: 'ltr' };
19
+ const Dashboard: IconFamily = { family: 'material', name: 'dashboard', direction: 'ltr' };
20
+ const Notifications: IconFamily = { family: 'material', name: 'notifications', direction: 'ltr' };
21
+
31
22
  const selectItem = useCallback(
32
- (id) => {
23
+ (id: any) => {
33
24
  navigation.navigate(id);
34
25
  setSelected(id);
35
26
  },
36
27
  [navigation]
37
28
  );
38
29
 
30
+ const navGroupItems = React.useMemo(
31
+ () => [
32
+ {
33
+ title: `${t('TOOLBAR_MENU.HOME_PAGE')}`,
34
+ itemID: 'Homepage',
35
+ icon: Homepage,
36
+ },
37
+ {
38
+ title: `${t('DRAWER_MENU.DASHBOARD')}`,
39
+ itemID: 'Dashboard',
40
+ icon: Dashboard,
41
+ },
42
+ {
43
+ title: `${t('DRAWER_MENU.LOCATIONS')}`,
44
+ itemID: 'Locations',
45
+ icon: Notifications,
46
+ },
47
+ ], // eslint-disable-next-line react-hooks/exhaustive-deps
48
+ []
49
+ );
50
+
51
+ useEffect(() => {
52
+ const id = navGroupItems[navigationState.index]?.itemID;
53
+ if (id) {
54
+ setSelected(id);
55
+ }
56
+ }, [navigationState.index, navGroupItems]);
57
+
39
58
  return (
40
59
  <Drawer activeItem={selected} onItemSelect={(id: string): void => selectItem(id)}>
41
60
  <DrawerHeader
42
61
  title={'Brightlayer UI'}
43
62
  subtitle={'React Native Project'}
44
- fontColor={Colors.white[50]}
45
63
  icon={{ name: 'menu' }}
46
64
  onIconPress={(): void => {
47
- navigation.closeDrawer();
65
+ navigation.dispatch(DrawerActions.closeDrawer());
48
66
  }}
49
67
  />
50
68
  <DrawerBody>
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { ChangePasswordScreen } from '@brightlayer-ui/react-native-auth-workflow';
3
+ import { useApp } from '../contexts/AppContextProvider';
4
+ import { LocalStorage } from '../store/local-storage';
5
+
6
+ export const ChangePassword = (): JSX.Element => {
7
+ const app = useApp();
8
+ const logOut = (): void => {
9
+ LocalStorage.clearAuthCredentials();
10
+ app.onUserNotAuthenticated();
11
+ app.setLoginData({ email: '', rememberMe: false });
12
+ };
13
+
14
+ return <ChangePasswordScreen onFinish={(): void => logOut()} showSuccessScreen />;
15
+ };
@@ -0,0 +1,137 @@
1
+ import React from 'react';
2
+ import {
3
+ SafeAreaView,
4
+ ScrollView,
5
+ StyleSheet,
6
+ TextStyle,
7
+ ViewStyle,
8
+ Animated,
9
+ Easing,
10
+ I18nManager,
11
+ } from 'react-native';
12
+ import { EmptyState, Header } from '@brightlayer-ui/react-native-components';
13
+ import RNRestart from 'react-native-restart';
14
+ import { StackNavigationProp } from '@react-navigation/stack';
15
+ import { RootStackParamList } from '../navigation';
16
+ import { ExtendedTheme, useExtendedTheme } from '@brightlayer-ui/react-native-themes';
17
+ import { UserMenuExample } from '../components/UserMenuExample';
18
+ import { useThemeContext } from '../contexts/ThemeContext';
19
+ import { useTranslation } from 'react-i18next';
20
+ import { IconFamily } from '@brightlayer-ui/react-native-components/core/__types__';
21
+ import { DrawerActions } from '@react-navigation/native';
22
+
23
+ const styles = (
24
+ theme: ExtendedTheme
25
+ ): StyleSheet.NamedStyles<{
26
+ content: ViewStyle;
27
+ pxbLogoWrapper: ViewStyle;
28
+ pxbLogo: ViewStyle;
29
+ title: TextStyle;
30
+ subtitle: TextStyle;
31
+ bold: TextStyle;
32
+ divider: ViewStyle;
33
+ openURLButtonText: TextStyle;
34
+ }> =>
35
+ StyleSheet.create({
36
+ content: {
37
+ flex: 1,
38
+ backgroundColor: theme.colors.background,
39
+ },
40
+ pxbLogoWrapper: {
41
+ justifyContent: 'center',
42
+ marginTop: 16,
43
+ },
44
+ pxbLogo: {
45
+ alignSelf: 'center',
46
+ height: 100,
47
+ width: 100,
48
+ },
49
+ title: {
50
+ textAlign: 'center',
51
+ marginBottom: 16,
52
+ },
53
+ subtitle: {
54
+ textAlign: 'center',
55
+ },
56
+ bold: {
57
+ fontWeight: 'bold',
58
+ },
59
+ divider: {
60
+ marginVertical: 24,
61
+ },
62
+ openURLButtonText: {
63
+ color: theme.colors.primary,
64
+ padding: 8,
65
+ },
66
+ });
67
+
68
+ type AppProps = {
69
+ navigation: StackNavigationProp<RootStackParamList, 'Dashboard'>;
70
+ };
71
+
72
+ const toggleRTL = (): void => {
73
+ if (I18nManager.isRTL) {
74
+ I18nManager.forceRTL(false);
75
+ } else {
76
+ I18nManager.forceRTL(true);
77
+ }
78
+ RNRestart.Restart();
79
+ };
80
+ const Dashboard: React.FC<AppProps> = ({ navigation }): JSX.Element => {
81
+ const theme = useExtendedTheme();
82
+ const { t } = useTranslation();
83
+ const { theme: themeType, setTheme } = useThemeContext();
84
+
85
+ const defaultStyles = styles(theme);
86
+ const spinValue = new Animated.Value(0);
87
+ const Event: IconFamily = { family: 'material', name: 'event', direction: 'ltr' };
88
+ Animated.loop(
89
+ Animated.timing(spinValue, {
90
+ toValue: 1,
91
+ duration: 2500,
92
+ easing: Easing.linear,
93
+ useNativeDriver: true,
94
+ })
95
+ ).start();
96
+
97
+ return (
98
+ <>
99
+ <Header
100
+ title={`${t('DRAWER_MENU.DASHBOARD')}`}
101
+ icon={{ name: 'menu' }}
102
+ onIconPress={(): void => {
103
+ navigation.dispatch(DrawerActions.openDrawer());
104
+ }}
105
+ actionItems={[
106
+ {
107
+ icon: { name: 'more' },
108
+ onPress: (): void => {},
109
+ component: (
110
+ <UserMenuExample
111
+ onToggleRTL={toggleRTL}
112
+ onToggleTheme={(): void => setTheme(themeType === 'light' ? 'dark' : 'light')}
113
+ />
114
+ ),
115
+ },
116
+ ]}
117
+ />
118
+ <SafeAreaView style={defaultStyles.content}>
119
+ <ScrollView
120
+ contentContainerStyle={{
121
+ flex: 1,
122
+ justifyContent: 'center',
123
+ alignItems: 'center',
124
+ }}
125
+ >
126
+ <EmptyState
127
+ icon={Event}
128
+ title={`${t('DRAWER_MENU.DASHBOARD')}`}
129
+ description={`${t('PAGE_DETAILS.AUTHORISED_MESSAGE')}`}
130
+ />
131
+ </ScrollView>
132
+ </SafeAreaView>
133
+ </>
134
+ );
135
+ };
136
+
137
+ export default Dashboard;
@@ -0,0 +1,135 @@
1
+ import React from 'react';
2
+ import {
3
+ SafeAreaView,
4
+ ScrollView,
5
+ StyleSheet,
6
+ TextStyle,
7
+ ViewStyle,
8
+ Animated,
9
+ Easing,
10
+ I18nManager,
11
+ } from 'react-native';
12
+ import { EmptyState, Header } from '@brightlayer-ui/react-native-components';
13
+ import RNRestart from 'react-native-restart';
14
+ import { StackNavigationProp } from '@react-navigation/stack';
15
+ import { RootStackParamList } from '../navigation';
16
+ import { ExtendedTheme, useExtendedTheme } from '@brightlayer-ui/react-native-themes';
17
+ import { UserMenuExample } from '../components/UserMenuExample';
18
+ import { useThemeContext } from '../contexts/ThemeContext';
19
+ import { useTranslation } from 'react-i18next';
20
+ import { IconFamily } from '@brightlayer-ui/react-native-components/core/__types__';
21
+ import { DrawerActions } from '@react-navigation/native';
22
+
23
+ const styles = (
24
+ theme: ExtendedTheme
25
+ ): StyleSheet.NamedStyles<{
26
+ content: ViewStyle;
27
+ pxbLogoWrapper: ViewStyle;
28
+ pxbLogo: ViewStyle;
29
+ title: TextStyle;
30
+ subtitle: TextStyle;
31
+ bold: TextStyle;
32
+ divider: ViewStyle;
33
+ openURLButtonText: TextStyle;
34
+ }> =>
35
+ StyleSheet.create({
36
+ content: {
37
+ flex: 1,
38
+ backgroundColor: theme.colors.background,
39
+ },
40
+ pxbLogoWrapper: {
41
+ justifyContent: 'center',
42
+ marginTop: 16,
43
+ },
44
+ pxbLogo: {
45
+ alignSelf: 'center',
46
+ height: 100,
47
+ width: 100,
48
+ },
49
+ title: {
50
+ textAlign: 'center',
51
+ marginBottom: 16,
52
+ },
53
+ subtitle: {
54
+ textAlign: 'center',
55
+ },
56
+ bold: {
57
+ fontWeight: 'bold',
58
+ },
59
+ divider: {
60
+ marginVertical: 24,
61
+ },
62
+ openURLButtonText: {
63
+ color: theme.colors.primary,
64
+ padding: 8,
65
+ },
66
+ });
67
+
68
+ type AppProps = {
69
+ navigation: StackNavigationProp<RootStackParamList, 'Homepage'>;
70
+ };
71
+
72
+ const toggleRTL = (): void => {
73
+ if (I18nManager.isRTL) {
74
+ I18nManager.forceRTL(false);
75
+ } else {
76
+ I18nManager.forceRTL(true);
77
+ }
78
+ RNRestart.Restart();
79
+ };
80
+ export const Homepage: React.FC<AppProps> = ({ navigation }): JSX.Element => {
81
+ const theme = useExtendedTheme();
82
+ const { t } = useTranslation();
83
+ const { theme: themeType, setTheme } = useThemeContext();
84
+
85
+ const defaultStyles = styles(theme);
86
+ const spinValue = new Animated.Value(0);
87
+ const Event: IconFamily = { family: 'material', name: 'event', direction: 'ltr' };
88
+ Animated.loop(
89
+ Animated.timing(spinValue, {
90
+ toValue: 1,
91
+ duration: 2500,
92
+ easing: Easing.linear,
93
+ useNativeDriver: true,
94
+ })
95
+ ).start();
96
+
97
+ return (
98
+ <>
99
+ <Header
100
+ title={`${t('TOOLBAR_MENU.HOME_PAGE')}`}
101
+ icon={{ name: 'menu' }}
102
+ onIconPress={(): void => {
103
+ navigation.dispatch(DrawerActions.openDrawer());
104
+ }}
105
+ actionItems={[
106
+ {
107
+ icon: { name: 'more' },
108
+ onPress: (): void => {},
109
+ component: (
110
+ <UserMenuExample
111
+ onToggleRTL={toggleRTL}
112
+ onToggleTheme={(): void => setTheme(themeType === 'light' ? 'dark' : 'light')}
113
+ />
114
+ ),
115
+ },
116
+ ]}
117
+ />
118
+ <SafeAreaView style={defaultStyles.content}>
119
+ <ScrollView
120
+ contentContainerStyle={{
121
+ flex: 1,
122
+ justifyContent: 'center',
123
+ alignItems: 'center',
124
+ }}
125
+ >
126
+ <EmptyState
127
+ icon={Event}
128
+ title={`${t('TOOLBAR_MENU.HOME_PAGE')}`}
129
+ description={`${t('PAGE_DETAILS.AUTHORISED_MESSAGE')}`}
130
+ />
131
+ </ScrollView>
132
+ </SafeAreaView>
133
+ </>
134
+ );
135
+ };
@@ -0,0 +1,137 @@
1
+ import React from 'react';
2
+ import {
3
+ SafeAreaView,
4
+ ScrollView,
5
+ StyleSheet,
6
+ TextStyle,
7
+ ViewStyle,
8
+ Animated,
9
+ Easing,
10
+ I18nManager,
11
+ } from 'react-native';
12
+ import { EmptyState, Header } from '@brightlayer-ui/react-native-components';
13
+ import RNRestart from 'react-native-restart';
14
+ import { StackNavigationProp } from '@react-navigation/stack';
15
+ import { RootStackParamList } from '../navigation';
16
+ import { ExtendedTheme, useExtendedTheme } from '@brightlayer-ui/react-native-themes';
17
+ import { UserMenuExample } from '../components/UserMenuExample';
18
+ import { useThemeContext } from '../contexts/ThemeContext';
19
+ import { useTranslation } from 'react-i18next';
20
+ import { IconFamily } from '@brightlayer-ui/react-native-components/core/__types__';
21
+ import { DrawerActions } from '@react-navigation/native';
22
+
23
+ const styles = (
24
+ theme: ExtendedTheme
25
+ ): StyleSheet.NamedStyles<{
26
+ content: ViewStyle;
27
+ pxbLogoWrapper: ViewStyle;
28
+ pxbLogo: ViewStyle;
29
+ title: TextStyle;
30
+ subtitle: TextStyle;
31
+ bold: TextStyle;
32
+ divider: ViewStyle;
33
+ openURLButtonText: TextStyle;
34
+ }> =>
35
+ StyleSheet.create({
36
+ content: {
37
+ flex: 1,
38
+ backgroundColor: theme.colors.background,
39
+ },
40
+ pxbLogoWrapper: {
41
+ justifyContent: 'center',
42
+ marginTop: 16,
43
+ },
44
+ pxbLogo: {
45
+ alignSelf: 'center',
46
+ height: 100,
47
+ width: 100,
48
+ },
49
+ title: {
50
+ textAlign: 'center',
51
+ marginBottom: 16,
52
+ },
53
+ subtitle: {
54
+ textAlign: 'center',
55
+ },
56
+ bold: {
57
+ fontWeight: 'bold',
58
+ },
59
+ divider: {
60
+ marginVertical: 24,
61
+ },
62
+ openURLButtonText: {
63
+ color: theme.colors.primary,
64
+ padding: 8,
65
+ },
66
+ });
67
+
68
+ type AppProps = {
69
+ navigation: StackNavigationProp<RootStackParamList, 'Locations'>;
70
+ };
71
+
72
+ const toggleRTL = (): void => {
73
+ if (I18nManager.isRTL) {
74
+ I18nManager.forceRTL(false);
75
+ } else {
76
+ I18nManager.forceRTL(true);
77
+ }
78
+ RNRestart.Restart();
79
+ };
80
+ const Locations: React.FC<AppProps> = ({ navigation }): JSX.Element => {
81
+ const theme = useExtendedTheme();
82
+ const { t } = useTranslation();
83
+ const { theme: themeType, setTheme } = useThemeContext();
84
+
85
+ const defaultStyles = styles(theme);
86
+ const spinValue = new Animated.Value(0);
87
+ const Event: IconFamily = { family: 'material', name: 'event', direction: 'ltr' };
88
+ Animated.loop(
89
+ Animated.timing(spinValue, {
90
+ toValue: 1,
91
+ duration: 2500,
92
+ easing: Easing.linear,
93
+ useNativeDriver: true,
94
+ })
95
+ ).start();
96
+
97
+ return (
98
+ <>
99
+ <Header
100
+ title={`${t('DRAWER_MENU.LOCATIONS')}`}
101
+ icon={{ name: 'menu' }}
102
+ onIconPress={(): void => {
103
+ navigation.dispatch(DrawerActions.openDrawer());
104
+ }}
105
+ actionItems={[
106
+ {
107
+ icon: { name: 'more' },
108
+ onPress: (): void => {},
109
+ component: (
110
+ <UserMenuExample
111
+ onToggleRTL={toggleRTL}
112
+ onToggleTheme={(): void => setTheme(themeType === 'light' ? 'dark' : 'light')}
113
+ />
114
+ ),
115
+ },
116
+ ]}
117
+ />
118
+ <SafeAreaView style={defaultStyles.content}>
119
+ <ScrollView
120
+ contentContainerStyle={{
121
+ flex: 1,
122
+ justifyContent: 'center',
123
+ alignItems: 'center',
124
+ }}
125
+ >
126
+ <EmptyState
127
+ icon={Event}
128
+ title={`${t('DRAWER_MENU.LOCATIONS')}`}
129
+ description={`${t('PAGE_DETAILS.AUTHORISED_MESSAGE')}`}
130
+ />
131
+ </ScrollView>
132
+ </SafeAreaView>
133
+ </>
134
+ );
135
+ };
136
+
137
+ export default Locations;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { Image } from 'react-native';
3
+ import { DebugComponent } from '../components/DebugComponent';
4
+ import { LoginScreenProps, LoginScreen } from '@brightlayer-ui/react-native-auth-workflow';
5
+
6
+ export const Login: React.FC<React.PropsWithChildren<LoginScreenProps>> = () => (
7
+ <LoginScreen
8
+ projectImage={
9
+ <Image
10
+ style={{ width: '100%' }}
11
+ resizeMode="contain"
12
+ source={require('../assets/images/eaton_stacked_logo.png')}
13
+ />
14
+ }
15
+ header={<DebugComponent />}
16
+ />
17
+ );
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { RegistrationWorkflow } from '@brightlayer-ui/react-native-auth-workflow';
3
+
4
+ export const Registration: React.FC = () => <RegistrationWorkflow />;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { RegistrationWorkflow } from '@brightlayer-ui/react-native-auth-workflow';
3
+ export const RegistrationInvite: React.FC = () => (
4
+ <RegistrationWorkflow isInviteRegistration initialRegistrationParams={{ code: '123', email: 'aa@aa.aa' }} />
5
+ );
@@ -0,0 +1,12 @@
1
+ // App Screens
2
+ export * from './Homepage';
3
+ export * from './Dashboard';
4
+ export * from './Locations';
5
+
6
+ // Auth Screens
7
+ export * from './Login';
8
+ export * from './ChangePassword';
9
+
10
+ // Registration Screens
11
+ export * from './Registration';
12
+ export * from './RegistrationInvite';
@@ -30,21 +30,21 @@ async function readAuthData(): Promise<AuthData> {
30
30
  return {
31
31
  userId: userData.userId,
32
32
  email: userData.user,
33
- rememberMeData: rememberMeData,
33
+ rememberMeData,
34
34
  };
35
35
  }
36
36
 
37
37
  function saveAuthCredentials(user: string, userId: string): void {
38
38
  const userData = {
39
- user: user,
40
- userId: userId,
39
+ user,
40
+ userId,
41
41
  };
42
42
  void window.localStorage.setItem(LOCAL_USER_DATA, JSON.stringify(userData));
43
43
  }
44
44
  function saveRememberMeData(user: string, rememberMe: boolean): void {
45
45
  const RememberMeData = {
46
46
  user: rememberMe ? user : '',
47
- rememberMe: rememberMe,
47
+ rememberMe,
48
48
  };
49
49
  void window.localStorage.setItem(REMEMBER_ME_DATA, JSON.stringify(RememberMeData));
50
50
  }
@@ -0,0 +1,29 @@
1
+ import { AppTranslationsFile } from './types';
2
+
3
+ const resources: AppTranslationsFile = {
4
+ translation: {
5
+ DRAWER_MENU: {
6
+ TITLE: '標題',
7
+ DASHBOARD: '儀表板',
8
+ LOCATIONS: '地點',
9
+ },
10
+ TOOLBAR_MENU: {
11
+ HOME_PAGE: '主頁',
12
+ },
13
+ PAGE_DETAILS: {
14
+ AUTHORISED_MESSAGE: '授權留言',
15
+ },
16
+ USER_MENU: {
17
+ LOG_OUT: '登出',
18
+ CHANGE_PASSWORD: '更改密碼',
19
+ MY_ACCOUNT: '我的賬戶',
20
+ TOGGLE_RTL: '切换 RTL',
21
+ TOGGLE_THEME: '切换主题',
22
+ LANGUAGE: '语言',
23
+ },
24
+ ORGANAIZATION_DETAILS: {
25
+ NAME: '机构名称',
26
+ },
27
+ },
28
+ };
29
+ export default resources;
@@ -0,0 +1,29 @@
1
+ import { AppTranslationsFile } from './types';
2
+
3
+ const resources: AppTranslationsFile = {
4
+ translation: {
5
+ DRAWER_MENU: {
6
+ TITLE: 'Title',
7
+ DASHBOARD: 'Dashboard',
8
+ LOCATIONS: 'Locations',
9
+ },
10
+ TOOLBAR_MENU: {
11
+ HOME_PAGE: 'Home Page',
12
+ },
13
+ PAGE_DETAILS: {
14
+ AUTHORISED_MESSAGE: 'Authorised Message',
15
+ },
16
+ USER_MENU: {
17
+ LOG_OUT: 'Log out',
18
+ CHANGE_PASSWORD: 'Change Password',
19
+ MY_ACCOUNT: 'My Account',
20
+ TOGGLE_RTL: 'Toggle RTL',
21
+ TOGGLE_THEME: 'Toggle Theme',
22
+ LANGUAGE: 'Language',
23
+ },
24
+ ORGANAIZATION_DETAILS: {
25
+ NAME: 'Organisation Name',
26
+ },
27
+ },
28
+ };
29
+ export default resources;
@@ -0,0 +1,29 @@
1
+ import { AppTranslationsFile } from './types';
2
+
3
+ const resources: AppTranslationsFile = {
4
+ translation: {
5
+ DRAWER_MENU: {
6
+ TITLE: 'Titre',
7
+ DASHBOARD: 'Tableau de bord',
8
+ LOCATIONS: 'Emplacements',
9
+ },
10
+ TOOLBAR_MENU: {
11
+ HOME_PAGE: "Page d'accueil",
12
+ },
13
+ PAGE_DETAILS: {
14
+ AUTHORISED_MESSAGE: 'Authorised Message',
15
+ },
16
+ USER_MENU: {
17
+ LOG_OUT: 'Se déconnecter',
18
+ CHANGE_PASSWORD: 'changer le mot de passe',
19
+ MY_ACCOUNT: 'Mon compte',
20
+ TOGGLE_RTL: 'basculer RTL',
21
+ TOGGLE_THEME: 'basculer le thème',
22
+ LANGUAGE: 'Langue',
23
+ },
24
+ ORGANAIZATION_DETAILS: {
25
+ NAME: 'Nom de lorganisme',
26
+ },
27
+ },
28
+ };
29
+ export default resources;