@brightlayer-ui/react-native-template-authentication-typescript 2.1.0 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -17
- package/package.json +3 -3
- package/template/.bundle/config +2 -0
- package/template/.eslintrc.js +57 -0
- package/template/.prettierrc.js +7 -0
- package/template/.watchmanconfig +1 -0
- package/template/App.tsx +85 -47
- package/template/Gemfile +9 -0
- package/template/Gemfile.lock +105 -0
- package/template/README.md +79 -0
- package/template/__tests__/App.test.tsx +17 -0
- package/template/android/app/build.gradle +120 -0
- package/template/android/app/debug.keystore +0 -0
- package/template/android/app/proguard-rules.pro +10 -0
- package/template/android/app/src/debug/AndroidManifest.xml +9 -0
- package/template/android/app/src/main/AndroidManifest.xml +25 -0
- package/template/android/app/src/main/java/com/workflow/MainActivity.kt +28 -0
- package/template/android/app/src/main/java/com/workflow/MainApplication.kt +43 -0
- package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/values/strings.xml +3 -0
- package/template/android/app/src/main/res/values/styles.xml +9 -0
- package/template/android/build.gradle +21 -0
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/template/android/gradle.properties +41 -0
- package/template/android/gradlew +249 -0
- package/template/android/gradlew.bat +92 -0
- package/template/android/link-assets-manifest.json +25 -0
- package/template/android/settings.gradle +4 -0
- package/template/app.json +4 -0
- package/template/assets/fonts/OpenSans-Bold.ttf +0 -0
- package/template/assets/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/template/assets/fonts/OpenSans-Light.ttf +0 -0
- package/template/assets/fonts/OpenSans-Regular.ttf +0 -0
- package/template/assets/fonts/OpenSans-SemiBold.ttf +0 -0
- package/template/assets/images/Logo.png +0 -0
- package/template/babel.config.js +1 -2
- package/template/eslint.config.mjs +10 -0
- package/template/index.js +11 -0
- package/template/ios/.xcode.env +11 -0
- package/template/ios/Podfile +40 -0
- package/template/ios/Podfile.lock +1496 -0
- package/template/ios/blankTemplate/AppDelegate.h +6 -0
- package/template/ios/blankTemplate/AppDelegate.mm +31 -0
- package/template/ios/blankTemplate/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/template/ios/blankTemplate/Images.xcassets/Contents.json +6 -0
- package/template/ios/blankTemplate/Info.plist +75 -0
- package/template/ios/blankTemplate/LaunchScreen.storyboard +47 -0
- package/template/ios/blankTemplate/PrivacyInfo.xcprivacy +37 -0
- package/template/ios/blankTemplate/main.m +10 -0
- package/template/ios/blankTemplate.xcodeproj/project.pbxproj +741 -0
- package/template/ios/blankTemplate.xcodeproj/xcshareddata/xcschemes/blankTemplate.xcscheme +88 -0
- package/template/ios/blankTemplate.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/blankTemplate.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/template/ios/blankTemplateTests/Info.plist +24 -0
- package/template/ios/blankTemplateTests/blankTemplateTests.m +66 -0
- package/template/ios/link-assets-manifest.json +25 -0
- package/template/jest.config.js +3 -0
- package/template/metro.config.js +7 -25
- package/template/package.json +70 -0
- package/template/src/actions/AuthUIActions.tsx +10 -11
- package/template/src/actions/RegistrationUIActions.tsx +37 -30
- package/template/src/assets/images/eaton_stacked_logo.png +0 -0
- package/template/src/components/AuthCustomScreen.tsx +50 -0
- package/template/src/components/CustomScreen.tsx +77 -0
- package/template/src/components/DebugComponent.tsx +49 -0
- package/template/src/components/ForgotPasswordScreenBaseExample.tsx +42 -0
- package/template/src/components/ResetPasswordScreenBaseExample.tsx +41 -0
- package/template/src/components/UserMenuExample.tsx +117 -0
- package/template/src/contexts/AppContextProvider.tsx +28 -0
- package/template/src/contexts/ThemeContext.ts +15 -0
- package/template/src/navigation/index.tsx +205 -22
- package/template/src/navigation/navigation-drawer.tsx +38 -25
- package/template/src/screens/ChangePassword.tsx +15 -0
- package/template/src/screens/Dashboard.tsx +137 -0
- package/template/src/screens/Homepage.tsx +135 -0
- package/template/src/screens/Locations.tsx +137 -0
- package/template/src/screens/Login.tsx +17 -0
- package/template/src/screens/Registration.tsx +4 -0
- package/template/src/screens/RegistrationInvite.tsx +5 -0
- package/template/src/screens/index.ts +12 -0
- package/template/src/store/local-storage.ts +4 -4
- package/template/translations/dictionary/chinese.ts +29 -0
- package/template/translations/dictionary/english.ts +29 -0
- package/template/translations/dictionary/french.ts +29 -0
- package/template/translations/dictionary/index.ts +19 -0
- package/template/translations/dictionary/portuguese.ts +29 -0
- package/template/translations/dictionary/spanish.ts +29 -0
- package/template/translations/dictionary/types.ts +27 -0
- package/template/translations/i18n.ts +58 -0
- package/template/tsconfig.json +60 -0
- package/template/yarn.lock +7341 -0
- package/template.config.js +4 -0
- package/CHANGELOG.md +0 -69
- package/dependencies.json +0 -31
- package/images/Logo.svg +0 -11
- package/template/__mocks__/svgMock.js +0 -8
- package/template/jestSetupFile.js +0 -17
- package/template/react-native.config.js +0 -3
- package/template/src/navigation/DeepLinking.ts +0 -62
- package/template/src/screens/home.tsx +0 -198
- package/template/src/screens/index.tsx +0 -3
- package/template/src/screens/pageOne.tsx +0 -91
- package/template/src/screens/pageTwo.tsx +0 -92
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Bold.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-ExtraBold.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Light.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Regular.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-SemiBold.ttf +0 -0
package/CHANGELOG.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## v2.1.0 (November 1, 2022)
|
|
4
|
-
|
|
5
|
-
### Changed
|
|
6
|
-
|
|
7
|
-
- Update to build with React Native 0.70.
|
|
8
|
-
|
|
9
|
-
## v2.0.0 (December 16, 2021)
|
|
10
|
-
|
|
11
|
-
### Changed
|
|
12
|
-
|
|
13
|
-
- Changed package namespace from `@pxblue` to `@brightlayer-ui`.
|
|
14
|
-
|
|
15
|
-
## Package Migration Notice
|
|
16
|
-
|
|
17
|
-
Previous versions listed after this indicator refer to our deprecated `@pxblue` packages.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## v2.0.0 (November 3, 2021)
|
|
22
|
-
|
|
23
|
-
### Changed
|
|
24
|
-
|
|
25
|
-
- Updated to use latest APIs from `@pxblue/react-native-components`.
|
|
26
|
-
|
|
27
|
-
## v1.3.2 (October 1, 2021)
|
|
28
|
-
|
|
29
|
-
### Fixed
|
|
30
|
-
|
|
31
|
-
- Added dependency for `@pxblue/react-native-vector-icons`
|
|
32
|
-
|
|
33
|
-
## v1.3.1 (October 1, 2021)
|
|
34
|
-
|
|
35
|
-
### Fixed
|
|
36
|
-
|
|
37
|
-
- Issue with template using the wrong dependency for `@pxblue/react-native-auth-workflow`
|
|
38
|
-
|
|
39
|
-
## v1.3.0 (September 30, 2021)
|
|
40
|
-
|
|
41
|
-
### Changed
|
|
42
|
-
- Upgrade PX Blue packages
|
|
43
|
-
- Changed default drawer width to 300.
|
|
44
|
-
|
|
45
|
-
## v1.2.0 (July 26, 2021)
|
|
46
|
-
|
|
47
|
-
### Changed
|
|
48
|
-
- Updated version of react-native-modal dependency to 12.0.2
|
|
49
|
-
|
|
50
|
-
## v1.1.1 (June 30, 2021)
|
|
51
|
-
|
|
52
|
-
### Changed
|
|
53
|
-
- Dropped version of react-native-webview peerDependency to match requirements of @pxblue/react-native-auth-workflow.
|
|
54
|
-
|
|
55
|
-
## v1.1.0 (March 31, 2021)
|
|
56
|
-
|
|
57
|
-
### Changed
|
|
58
|
-
- Updated dependencies to use latest packages.
|
|
59
|
-
- Reorganized folder structure
|
|
60
|
-
|
|
61
|
-
### Fixed
|
|
62
|
-
- Jest configuration allows default tests to pass.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
## v1.0.0 (March 1, 2021)
|
|
66
|
-
|
|
67
|
-
### Added
|
|
68
|
-
|
|
69
|
-
- Initial authentication template for TypeScript projects
|
package/dependencies.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"dependencies": [
|
|
3
|
-
"@brightlayer-ui/colors@^3.0.1",
|
|
4
|
-
"@brightlayer-ui/icons-svg@^1.8.0",
|
|
5
|
-
"@brightlayer-ui/react-native-auth-workflow@5.0.0",
|
|
6
|
-
"@brightlayer-ui/react-native-components@7.0.0",
|
|
7
|
-
"@brightlayer-ui/react-native-themes@^6.0.0",
|
|
8
|
-
"@brightlayer-ui/react-native-vector-icons@2.0.0",
|
|
9
|
-
"@react-native-async-storage/async-storage@^1.14.1",
|
|
10
|
-
"@react-native-community/masked-view@^0.1.10",
|
|
11
|
-
"@react-navigation/drawer@^5.12.3",
|
|
12
|
-
"@react-navigation/native@^5.9.3",
|
|
13
|
-
"@react-navigation/stack@^5.14.3",
|
|
14
|
-
"date-fns@^2.19.0",
|
|
15
|
-
"i18next@^20.0.0",
|
|
16
|
-
"react-i18next@^11.8.7",
|
|
17
|
-
"react-native-gesture-handler@^1.10.3",
|
|
18
|
-
"react-native-keyboard-aware-scroll-view@^0.9.3",
|
|
19
|
-
"react-native-modal@^12.0.2",
|
|
20
|
-
"react-native-pager-view@^5.0.0",
|
|
21
|
-
"react-native-paper@^4.7.2",
|
|
22
|
-
"react-native-reanimated@^2.0.0",
|
|
23
|
-
"react-native-safe-area-context@^3.2.0",
|
|
24
|
-
"react-native-screens@^3.0.0",
|
|
25
|
-
"react-native-svg@^12.1.0",
|
|
26
|
-
"react-native-svg-transformer@^0.14.3",
|
|
27
|
-
"react-native-vector-icons@^9.2.0",
|
|
28
|
-
"react-native-webview@^11.23.1"
|
|
29
|
-
],
|
|
30
|
-
"devDependencies": ["@types/react-native-vector-icons", "jest-transform-stub"]
|
|
31
|
-
}
|
package/images/Logo.svg
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 82 82" width='82' height='82'>
|
|
3
|
-
|
|
4
|
-
<ellipse cx="41" cy="41" rx="11.2" ry="11.1"/>
|
|
5
|
-
<path d="M72.7,33.9c2.4,10.9-0.8,22.1-8.7,30C51.4,76.6,30.8,76.6,18.2,64S5.4,30.8,18,18.1c5-5,11.4-8.2,18.4-9.2
|
|
6
|
-
c0.3,0.9,0.8,1.8,1.5,2.5c2.3,2.3,6.1,2.3,8.4,0c0.9-0.9,1.5-2.1,1.7-3.5l0,0c0.2-1.8-0.4-3.6-1.7-4.9c-2.3-2.3-6.1-2.3-8.4,0
|
|
7
|
-
c-0.9,0.9-1.5,2.1-1.7,3.3c-7.6,1-14.6,4.6-20,10C2.6,30,2.7,52.2,16.3,65.8s35.9,13.6,49.5-0.1c8.4-8.5,11.9-20.5,9.4-32.2l0,0
|
|
8
|
-
c-1.4-6.4-4.8-12.1-9.5-16.8l0,0C65.7,16.7,71.2,23.3,72.7,33.9z M37.4,7.5L37.4,7.5L37.4,7.5L37.4,7.5z M45.5,7.6
|
|
9
|
-
c-0.1,0.8-0.4,1.5-1,2.1c-1.4,1.4-3.6,1.4-4.9,0c-0.6-0.6-1-1.4-1-2.3l0,0c-0.1-1,0.3-2,1-2.7c1.4-1.4,3.6-1.4,4.9,0
|
|
10
|
-
C45.3,5.5,45.7,6.6,45.5,7.6z"/>
|
|
11
|
-
</svg>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SVG setup to mock react components transformed into images from SVGs
|
|
3
|
-
* Place this file in your project's root __mocks__ directory.
|
|
4
|
-
* https://github.com/kristerkari/react-native-svg-transformer#usage-with-jest
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = 'SvgMock';
|
|
8
|
-
module.exports.ReactComponent = 'SvgMock';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import 'react-native-gesture-handler/jestSetup';
|
|
2
|
-
import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock';
|
|
3
|
-
|
|
4
|
-
jest.useFakeTimers();
|
|
5
|
-
jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage);
|
|
6
|
-
jest.mock('react-native-reanimated', () => {
|
|
7
|
-
const Reanimated = require('react-native-reanimated/mock');
|
|
8
|
-
|
|
9
|
-
// The mock for `call` immediately calls the callback which is incorrect
|
|
10
|
-
// So we override it with a no-op
|
|
11
|
-
Reanimated.default.call = () => {};
|
|
12
|
-
|
|
13
|
-
return Reanimated;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
|
|
17
|
-
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { LinkingOptions } from '@react-navigation/native/lib/typescript/src/types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Map a Deep Link or Universal link to a screen in the application
|
|
5
|
-
* https://reactnavigation.org/docs/deep-linking
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const authLinkMapping: LinkingOptions = {
|
|
9
|
-
prefixes: ['https://authui.com', 'authui://'],
|
|
10
|
-
config: {
|
|
11
|
-
screens: {
|
|
12
|
-
Login: 'login',
|
|
13
|
-
PasswordResetInitiation: {
|
|
14
|
-
initialRouteName: 'Login',
|
|
15
|
-
path: 'password/reset/initiate',
|
|
16
|
-
},
|
|
17
|
-
PasswordResetCompletion: {
|
|
18
|
-
initialRouteName: 'Login',
|
|
19
|
-
// email can be passed in as parameter if needed for the api
|
|
20
|
-
path: 'password/reset/:code',
|
|
21
|
-
},
|
|
22
|
-
RegistrationInvite: {
|
|
23
|
-
initialRouteName: 'Login',
|
|
24
|
-
// email can be passed in as parameter if needed for the api
|
|
25
|
-
path: 'invite/:code',
|
|
26
|
-
},
|
|
27
|
-
Registration: {
|
|
28
|
-
initialRouteName: 'Login',
|
|
29
|
-
// email can be passed in as parameter if needed for the api
|
|
30
|
-
path: 'register/:code',
|
|
31
|
-
},
|
|
32
|
-
SupportContact: {
|
|
33
|
-
initialRouteName: 'Login',
|
|
34
|
-
path: 'support',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* React Native boilerplate to get the initial state from open link, or fail after 150ms
|
|
42
|
-
* @param getInitialState
|
|
43
|
-
* @param setInitialState
|
|
44
|
-
*/
|
|
45
|
-
export const resolveInitialState = (getInitialState: () => any, setInitialState: (state: any) => void): void => {
|
|
46
|
-
Promise.race([
|
|
47
|
-
getInitialState(),
|
|
48
|
-
new Promise((resolve) =>
|
|
49
|
-
// Timeout in 150ms if `getInitialState` doesn't resolve
|
|
50
|
-
// Workaround for https://github.com/facebook/react-native/issues/25675
|
|
51
|
-
setTimeout(resolve, 150)
|
|
52
|
-
),
|
|
53
|
-
])
|
|
54
|
-
.then((state) => {
|
|
55
|
-
if (state !== undefined) {
|
|
56
|
-
setInitialState(state);
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
.catch((e) => {
|
|
60
|
-
console.error(e);
|
|
61
|
-
});
|
|
62
|
-
};
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
SafeAreaView,
|
|
4
|
-
ScrollView,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
Linking,
|
|
7
|
-
TextStyle,
|
|
8
|
-
ViewStyle,
|
|
9
|
-
View,
|
|
10
|
-
Animated,
|
|
11
|
-
Easing,
|
|
12
|
-
} from 'react-native';
|
|
13
|
-
import { Avatar, Button, Divider, useTheme } from 'react-native-paper';
|
|
14
|
-
import { Body1, H4, Header, IconFamily, InfoListItemProps, UserMenu } from '@brightlayer-ui/react-native-components';
|
|
15
|
-
import { Theme } from 'react-native-paper/lib/typescript/types';
|
|
16
|
-
import Logo from '../../assets/images/Logo.svg';
|
|
17
|
-
import { StackNavigationProp } from '@react-navigation/stack';
|
|
18
|
-
import { RootStackParamList } from '../navigation';
|
|
19
|
-
import { useSecurityActions } from '@brightlayer-ui/react-native-auth-workflow';
|
|
20
|
-
import { LocalStorage } from '../store/local-storage';
|
|
21
|
-
import * as Colors from '@brightlayer-ui/colors';
|
|
22
|
-
|
|
23
|
-
const MenuIcon: IconFamily = { name: 'menu', direction: 'ltr' };
|
|
24
|
-
const LockIcon: IconFamily = { name: 'lock', direction: 'ltr' };
|
|
25
|
-
const ExitToAppIcon: IconFamily = { name: 'exit-to-app', direction: 'ltr' };
|
|
26
|
-
|
|
27
|
-
const styles = (
|
|
28
|
-
theme: Theme
|
|
29
|
-
): StyleSheet.NamedStyles<{
|
|
30
|
-
content: ViewStyle;
|
|
31
|
-
pxbLogoWrapper: ViewStyle;
|
|
32
|
-
pxbLogo: ViewStyle;
|
|
33
|
-
title: TextStyle;
|
|
34
|
-
subtitle: TextStyle;
|
|
35
|
-
bold: TextStyle;
|
|
36
|
-
divider: ViewStyle;
|
|
37
|
-
openURLButtonText: TextStyle;
|
|
38
|
-
}> =>
|
|
39
|
-
StyleSheet.create({
|
|
40
|
-
content: {
|
|
41
|
-
flex: 1,
|
|
42
|
-
},
|
|
43
|
-
pxbLogoWrapper: {
|
|
44
|
-
justifyContent: 'center',
|
|
45
|
-
marginTop: 16,
|
|
46
|
-
},
|
|
47
|
-
pxbLogo: {
|
|
48
|
-
alignSelf: 'center',
|
|
49
|
-
height: 100,
|
|
50
|
-
width: 100,
|
|
51
|
-
},
|
|
52
|
-
title: {
|
|
53
|
-
textAlign: 'center',
|
|
54
|
-
marginBottom: 16,
|
|
55
|
-
},
|
|
56
|
-
subtitle: {
|
|
57
|
-
textAlign: 'center',
|
|
58
|
-
},
|
|
59
|
-
bold: {
|
|
60
|
-
fontWeight: 'bold',
|
|
61
|
-
},
|
|
62
|
-
divider: {
|
|
63
|
-
marginVertical: 24,
|
|
64
|
-
},
|
|
65
|
-
openURLButtonText: {
|
|
66
|
-
color: theme.colors.text,
|
|
67
|
-
padding: 8,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const OpenURLButton = (props: any): JSX.Element => {
|
|
72
|
-
const { url, title } = props;
|
|
73
|
-
const theme = useTheme();
|
|
74
|
-
const defaultStyles = styles(theme);
|
|
75
|
-
|
|
76
|
-
const handlePress = useCallback(async () => {
|
|
77
|
-
await Linking.openURL(url);
|
|
78
|
-
}, [url]);
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<Button
|
|
82
|
-
onPress={(): Promise<void> => handlePress()}
|
|
83
|
-
labelStyle={defaultStyles.openURLButtonText}
|
|
84
|
-
uppercase={false}
|
|
85
|
-
>
|
|
86
|
-
{title}
|
|
87
|
-
</Button>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
type AppProps = {
|
|
92
|
-
navigation: StackNavigationProp<RootStackParamList, 'Home'>;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const Home: React.FC<AppProps> = ({ navigation }): JSX.Element => {
|
|
96
|
-
const theme = useTheme();
|
|
97
|
-
const defaultStyles = styles(theme);
|
|
98
|
-
const spinValue = new Animated.Value(0);
|
|
99
|
-
const securityHelper = useSecurityActions();
|
|
100
|
-
|
|
101
|
-
Animated.loop(
|
|
102
|
-
Animated.timing(spinValue, {
|
|
103
|
-
toValue: 1,
|
|
104
|
-
duration: 2500,
|
|
105
|
-
easing: Easing.linear,
|
|
106
|
-
useNativeDriver: true,
|
|
107
|
-
})
|
|
108
|
-
).start();
|
|
109
|
-
|
|
110
|
-
const spin = spinValue.interpolate({
|
|
111
|
-
inputRange: [0, 1],
|
|
112
|
-
outputRange: ['0deg', '360deg'],
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
const changePassword = (): void => {
|
|
116
|
-
securityHelper.showChangePassword();
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const logOut = (): void => {
|
|
120
|
-
LocalStorage.clearAuthCredentials();
|
|
121
|
-
securityHelper.onUserNotAuthenticated();
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const menuItems: InfoListItemProps[] = [
|
|
125
|
-
{ title: 'Change Password', icon: LockIcon, onPress: (): void => changePassword() },
|
|
126
|
-
{ title: 'Log Out', icon: ExitToAppIcon, onPress: (): void => logOut() },
|
|
127
|
-
];
|
|
128
|
-
|
|
129
|
-
return (
|
|
130
|
-
<>
|
|
131
|
-
<Header
|
|
132
|
-
title={'Home Page'}
|
|
133
|
-
icon={MenuIcon}
|
|
134
|
-
onIconPress={(): void => {
|
|
135
|
-
navigation.openDrawer();
|
|
136
|
-
}}
|
|
137
|
-
actionItems={[
|
|
138
|
-
{
|
|
139
|
-
component: (
|
|
140
|
-
<UserMenu
|
|
141
|
-
menuItems={menuItems}
|
|
142
|
-
avatar={
|
|
143
|
-
<Avatar.Text
|
|
144
|
-
label="UN"
|
|
145
|
-
size={40}
|
|
146
|
-
color={Colors.blue[500]}
|
|
147
|
-
style={{ backgroundColor: Colors.blue[50] }}
|
|
148
|
-
/>
|
|
149
|
-
}
|
|
150
|
-
/>
|
|
151
|
-
),
|
|
152
|
-
},
|
|
153
|
-
]}
|
|
154
|
-
/>
|
|
155
|
-
<SafeAreaView style={defaultStyles.content}>
|
|
156
|
-
<ScrollView>
|
|
157
|
-
<View style={defaultStyles.pxbLogoWrapper}>
|
|
158
|
-
<Animated.View style={[defaultStyles.pxbLogo, { transform: [{ rotate: spin }] }]}>
|
|
159
|
-
<Logo height={100} width={100} fill={'#007bc1'} />
|
|
160
|
-
</Animated.View>
|
|
161
|
-
</View>
|
|
162
|
-
<H4 style={defaultStyles.title}>
|
|
163
|
-
Welcome to Brightlayer <H4 color={'primary'}>UI</H4>.
|
|
164
|
-
</H4>
|
|
165
|
-
<Body1 style={defaultStyles.subtitle}>
|
|
166
|
-
Edit <Body1 style={defaultStyles.bold}>screens/home.tsx</Body1> and save to reload.
|
|
167
|
-
</Body1>
|
|
168
|
-
<Divider style={defaultStyles.divider} />
|
|
169
|
-
<OpenURLButton title={'Brightlayer UI Documentation'} url={'https://brightlayer-ui.github.io/'} />
|
|
170
|
-
<OpenURLButton
|
|
171
|
-
title={'React Native Getting Started Guide'}
|
|
172
|
-
url={'https://brightlayer-ui.github.io/development/frameworks-mobile/react-native'}
|
|
173
|
-
/>
|
|
174
|
-
<OpenURLButton
|
|
175
|
-
title={'Design Pattern Descriptions'}
|
|
176
|
-
url={'https://brightlayer-ui.github.io/patterns'}
|
|
177
|
-
/>
|
|
178
|
-
<OpenURLButton
|
|
179
|
-
title={'React Native Component Library'}
|
|
180
|
-
url={'https://brightlayer-ui-components.github.io/react-native/'}
|
|
181
|
-
/>
|
|
182
|
-
<OpenURLButton title={'Visit Us on GitHub'} url={'https://github.com/brightlayer-ui'} />
|
|
183
|
-
<OpenURLButton
|
|
184
|
-
title={'Design Pattern Source on GitHub'}
|
|
185
|
-
url={'https://github.com/brightlayer-ui/react-native-design-patterns'}
|
|
186
|
-
/>
|
|
187
|
-
<OpenURLButton title={'Release Roadmap'} url={'https://brightlayer-ui.github.io/roadmap'} />
|
|
188
|
-
<OpenURLButton
|
|
189
|
-
title={'Send Feedback or Suggestions'}
|
|
190
|
-
url={'https://brightlayer-ui.github.io/community/contactus'}
|
|
191
|
-
/>
|
|
192
|
-
</ScrollView>
|
|
193
|
-
</SafeAreaView>
|
|
194
|
-
</>
|
|
195
|
-
);
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export default Home;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SafeAreaView, ScrollView, StyleSheet, ViewStyle } from 'react-native';
|
|
3
|
-
import { EmptyState, Header, IconFamily, InfoListItemProps, UserMenu } from '@brightlayer-ui/react-native-components';
|
|
4
|
-
import { StackNavigationProp } from '@react-navigation/stack';
|
|
5
|
-
import { RootStackParamList } from '../navigation';
|
|
6
|
-
import { Avatar } from 'react-native-paper';
|
|
7
|
-
import { LocalStorage } from '../store/local-storage';
|
|
8
|
-
import { useSecurityActions } from '@brightlayer-ui/react-native-auth-workflow';
|
|
9
|
-
import * as Colors from '@brightlayer-ui/colors';
|
|
10
|
-
|
|
11
|
-
const Event: IconFamily = { name: 'event', direction: 'rtl' };
|
|
12
|
-
const MenuIcon: IconFamily = { name: 'menu', direction: 'ltr' };
|
|
13
|
-
const LockIcon: IconFamily = { name: 'lock', direction: 'ltr' };
|
|
14
|
-
const ExitToAppIcon: IconFamily = { name: 'exit-to-app', direction: 'ltr' };
|
|
15
|
-
const styles = (): StyleSheet.NamedStyles<{
|
|
16
|
-
content: ViewStyle;
|
|
17
|
-
scrollViewContent: ViewStyle;
|
|
18
|
-
}> =>
|
|
19
|
-
StyleSheet.create({
|
|
20
|
-
content: {
|
|
21
|
-
flex: 1,
|
|
22
|
-
},
|
|
23
|
-
scrollViewContent: {
|
|
24
|
-
flex: 1,
|
|
25
|
-
justifyContent: 'center',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
type AppProps = {
|
|
31
|
-
navigation: StackNavigationProp<RootStackParamList, 'PageOne'>;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const PageOne: React.FC<AppProps> = ({ navigation }): JSX.Element => {
|
|
35
|
-
const defaultStyles = styles();
|
|
36
|
-
const securityHelper = useSecurityActions();
|
|
37
|
-
|
|
38
|
-
const changePassword = (): void => {
|
|
39
|
-
securityHelper.showChangePassword();
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const logOut = (): void => {
|
|
43
|
-
LocalStorage.clearAuthCredentials();
|
|
44
|
-
securityHelper.onUserNotAuthenticated();
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const menuItems: InfoListItemProps[] = [
|
|
48
|
-
{ title: 'Change Password', icon: LockIcon, onPress: (): void => changePassword() },
|
|
49
|
-
{ title: 'Log Out', icon: ExitToAppIcon, onPress: (): void => logOut() },
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<>
|
|
54
|
-
<Header
|
|
55
|
-
title={'Page One'}
|
|
56
|
-
icon={MenuIcon}
|
|
57
|
-
onIconPress={(): void => {
|
|
58
|
-
navigation.openDrawer();
|
|
59
|
-
}}
|
|
60
|
-
actionItems={[
|
|
61
|
-
{
|
|
62
|
-
component: (
|
|
63
|
-
<UserMenu
|
|
64
|
-
menuItems={menuItems}
|
|
65
|
-
avatar={
|
|
66
|
-
<Avatar.Text
|
|
67
|
-
label="UN"
|
|
68
|
-
size={40}
|
|
69
|
-
color={Colors.blue[500]}
|
|
70
|
-
style={{ backgroundColor: Colors.blue[50] }}
|
|
71
|
-
/>
|
|
72
|
-
}
|
|
73
|
-
/>
|
|
74
|
-
),
|
|
75
|
-
},
|
|
76
|
-
]}
|
|
77
|
-
/>
|
|
78
|
-
<SafeAreaView style={defaultStyles.content}>
|
|
79
|
-
<ScrollView contentContainerStyle={defaultStyles.scrollViewContent}>
|
|
80
|
-
<EmptyState
|
|
81
|
-
icon={Event}
|
|
82
|
-
title={'Coming Soon'}
|
|
83
|
-
description={'Replace this page with your own content'}
|
|
84
|
-
/>
|
|
85
|
-
</ScrollView>
|
|
86
|
-
</SafeAreaView>
|
|
87
|
-
</>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default PageOne;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SafeAreaView, ScrollView, StyleSheet, ViewStyle } from 'react-native';
|
|
3
|
-
import { EmptyState, Header, IconFamily, InfoListItemProps, UserMenu } from '@brightlayer-ui/react-native-components';
|
|
4
|
-
import { StackNavigationProp } from '@react-navigation/stack';
|
|
5
|
-
import { RootStackParamList } from '../navigation';
|
|
6
|
-
import { useSecurityActions } from '@brightlayer-ui/react-native-auth-workflow';
|
|
7
|
-
import { LocalStorage } from '../store/local-storage';
|
|
8
|
-
import { Avatar } from 'react-native-paper';
|
|
9
|
-
import * as Colors from '@brightlayer-ui/colors';
|
|
10
|
-
|
|
11
|
-
const Event: IconFamily = { name: 'event', direction: 'rtl' };
|
|
12
|
-
const MenuIcon: IconFamily = { name: 'menu', direction: 'ltr' };
|
|
13
|
-
const LockIcon: IconFamily = { name: 'lock', direction: 'ltr' };
|
|
14
|
-
const ExitToAppIcon: IconFamily = { name: 'exit-to-app', direction: 'ltr' };
|
|
15
|
-
|
|
16
|
-
const styles = (): StyleSheet.NamedStyles<{
|
|
17
|
-
content: ViewStyle;
|
|
18
|
-
scrollViewContent: ViewStyle;
|
|
19
|
-
}> =>
|
|
20
|
-
StyleSheet.create({
|
|
21
|
-
content: {
|
|
22
|
-
flex: 1,
|
|
23
|
-
},
|
|
24
|
-
scrollViewContent: {
|
|
25
|
-
flex: 1,
|
|
26
|
-
justifyContent: 'center',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
type AppProps = {
|
|
32
|
-
navigation: StackNavigationProp<RootStackParamList, 'PageTwo'>;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const PageTwo: React.FC<AppProps> = ({ navigation }): JSX.Element => {
|
|
36
|
-
const defaultStyles = styles();
|
|
37
|
-
const securityHelper = useSecurityActions();
|
|
38
|
-
|
|
39
|
-
const changePassword = (): void => {
|
|
40
|
-
securityHelper.showChangePassword();
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const logOut = (): void => {
|
|
44
|
-
LocalStorage.clearAuthCredentials();
|
|
45
|
-
securityHelper.onUserNotAuthenticated();
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const menuItems: InfoListItemProps[] = [
|
|
49
|
-
{ title: 'Change Password', icon: LockIcon, onPress: (): void => changePassword() },
|
|
50
|
-
{ title: 'Log Out', icon: ExitToAppIcon, onPress: (): void => logOut() },
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<>
|
|
55
|
-
<Header
|
|
56
|
-
title={'Page Two'}
|
|
57
|
-
icon={MenuIcon}
|
|
58
|
-
onIconPress={(): void => {
|
|
59
|
-
navigation.openDrawer();
|
|
60
|
-
}}
|
|
61
|
-
actionItems={[
|
|
62
|
-
{
|
|
63
|
-
component: (
|
|
64
|
-
<UserMenu
|
|
65
|
-
menuItems={menuItems}
|
|
66
|
-
avatar={
|
|
67
|
-
<Avatar.Text
|
|
68
|
-
label="UN"
|
|
69
|
-
size={40}
|
|
70
|
-
color={Colors.blue[500]}
|
|
71
|
-
style={{ backgroundColor: Colors.blue[50] }}
|
|
72
|
-
/>
|
|
73
|
-
}
|
|
74
|
-
/>
|
|
75
|
-
),
|
|
76
|
-
},
|
|
77
|
-
]}
|
|
78
|
-
/>
|
|
79
|
-
<SafeAreaView style={defaultStyles.content}>
|
|
80
|
-
<ScrollView contentContainerStyle={defaultStyles.scrollViewContent}>
|
|
81
|
-
<EmptyState
|
|
82
|
-
icon={Event}
|
|
83
|
-
title={'Coming Soon'}
|
|
84
|
-
description={'Replace this page with your own content'}
|
|
85
|
-
/>
|
|
86
|
-
</ScrollView>
|
|
87
|
-
</SafeAreaView>
|
|
88
|
-
</>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export default PageTwo;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|