@brightlayer-ui/react-native-template-routing-typescript 2.2.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.
Files changed (89) hide show
  1. package/README.md +7 -17
  2. package/package.json +1 -1
  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 +1 -2
  8. package/template/Gemfile +9 -0
  9. package/template/Gemfile.lock +105 -0
  10. package/template/README.md +79 -0
  11. package/template/__tests__/App.test.tsx +17 -0
  12. package/template/android/app/build.gradle +120 -0
  13. package/template/android/app/debug.keystore +0 -0
  14. package/template/android/app/proguard-rules.pro +10 -0
  15. package/template/android/app/src/debug/AndroidManifest.xml +9 -0
  16. package/template/android/app/src/main/AndroidManifest.xml +25 -0
  17. package/template/android/app/src/main/java/com/routingtemplate/MainActivity.kt +28 -0
  18. package/template/android/app/src/main/java/com/routingtemplate/MainApplication.kt +43 -0
  19. package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  20. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  21. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  22. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  23. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  24. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  25. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  26. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  27. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  28. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  29. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  30. package/template/android/app/src/main/res/values/strings.xml +3 -0
  31. package/template/android/app/src/main/res/values/styles.xml +9 -0
  32. package/template/android/build.gradle +21 -0
  33. package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  34. package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  35. package/template/android/gradle.properties +41 -0
  36. package/template/android/gradlew +249 -0
  37. package/template/android/gradlew.bat +92 -0
  38. package/template/android/link-assets-manifest.json +25 -0
  39. package/template/android/settings.gradle +4 -0
  40. package/template/app.json +4 -0
  41. package/template/assets/fonts/OpenSans-Bold.ttf +0 -0
  42. package/template/assets/fonts/OpenSans-ExtraBold.ttf +0 -0
  43. package/template/assets/fonts/OpenSans-Light.ttf +0 -0
  44. package/template/assets/fonts/OpenSans-Regular.ttf +0 -0
  45. package/template/assets/fonts/OpenSans-SemiBold.ttf +0 -0
  46. package/template/assets/images/Logo.png +0 -0
  47. package/template/babel.config.js +1 -2
  48. package/template/eslint.config.mjs +10 -0
  49. package/template/index.js +10 -0
  50. package/template/ios/.xcode.env +11 -0
  51. package/template/ios/Podfile +40 -0
  52. package/template/ios/Podfile.lock +1496 -0
  53. package/template/ios/blankTemplate/AppDelegate.h +6 -0
  54. package/template/ios/blankTemplate/AppDelegate.mm +31 -0
  55. package/template/ios/blankTemplate/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  56. package/template/ios/blankTemplate/Images.xcassets/Contents.json +6 -0
  57. package/template/ios/blankTemplate/Info.plist +75 -0
  58. package/template/ios/blankTemplate/LaunchScreen.storyboard +47 -0
  59. package/template/ios/blankTemplate/PrivacyInfo.xcprivacy +37 -0
  60. package/template/ios/blankTemplate/main.m +10 -0
  61. package/template/ios/blankTemplate.xcodeproj/project.pbxproj +741 -0
  62. package/template/ios/blankTemplate.xcodeproj/xcshareddata/xcschemes/blankTemplate.xcscheme +88 -0
  63. package/template/ios/blankTemplate.xcworkspace/contents.xcworkspacedata +10 -0
  64. package/template/ios/blankTemplate.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  65. package/template/ios/blankTemplateTests/Info.plist +24 -0
  66. package/template/ios/blankTemplateTests/blankTemplateTests.m +66 -0
  67. package/template/ios/link-assets-manifest.json +25 -0
  68. package/template/jest.config.js +3 -0
  69. package/template/metro.config.js +7 -25
  70. package/template/package.json +61 -0
  71. package/template/src/navigation/index.tsx +14 -14
  72. package/template/src/navigation/navigation-drawer.tsx +1 -2
  73. package/template/src/screens/home.tsx +77 -58
  74. package/template/src/screens/pageOne.tsx +3 -5
  75. package/template/src/screens/pageTwo.tsx +3 -5
  76. package/template/tsconfig.json +60 -0
  77. package/template/yarn.lock +7255 -0
  78. package/template.config.js +4 -0
  79. package/CHANGELOG.md +0 -62
  80. package/dependencies.json +0 -23
  81. package/images/Logo.svg +0 -11
  82. package/template/__mocks__/svgMock.js +0 -8
  83. package/template/jestSetupFile.js +0 -15
  84. package/template/react-native.config.js +0 -3
  85. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Bold.ttf +0 -0
  86. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-ExtraBold.ttf +0 -0
  87. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Light.ttf +0 -0
  88. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Regular.ttf +0 -0
  89. /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-SemiBold.ttf +0 -0
@@ -0,0 +1,88 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1210"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
18
+ BuildableName = "blankTemplate.app"
19
+ BlueprintName = "blankTemplate"
20
+ ReferencedContainer = "container:blankTemplate.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ buildConfiguration = "Debug"
27
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+ shouldUseLaunchSchemeArgsEnv = "YES">
30
+ <Testables>
31
+ <TestableReference
32
+ skipped = "NO">
33
+ <BuildableReference
34
+ BuildableIdentifier = "primary"
35
+ BlueprintIdentifier = "00E356ED1AD99517003FC87E"
36
+ BuildableName = "blankTemplateTests.xctest"
37
+ BlueprintName = "blankTemplateTests"
38
+ ReferencedContainer = "container:blankTemplate.xcodeproj">
39
+ </BuildableReference>
40
+ </TestableReference>
41
+ </Testables>
42
+ </TestAction>
43
+ <LaunchAction
44
+ buildConfiguration = "Debug"
45
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47
+ launchStyle = "0"
48
+ useCustomWorkingDirectory = "NO"
49
+ ignoresPersistentStateOnLaunch = "NO"
50
+ debugDocumentVersioning = "YES"
51
+ debugServiceExtension = "internal"
52
+ allowLocationSimulation = "YES">
53
+ <BuildableProductRunnable
54
+ runnableDebuggingMode = "0">
55
+ <BuildableReference
56
+ BuildableIdentifier = "primary"
57
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
58
+ BuildableName = "blankTemplate.app"
59
+ BlueprintName = "blankTemplate"
60
+ ReferencedContainer = "container:blankTemplate.xcodeproj">
61
+ </BuildableReference>
62
+ </BuildableProductRunnable>
63
+ </LaunchAction>
64
+ <ProfileAction
65
+ buildConfiguration = "Release"
66
+ shouldUseLaunchSchemeArgsEnv = "YES"
67
+ savedToolIdentifier = ""
68
+ useCustomWorkingDirectory = "NO"
69
+ debugDocumentVersioning = "YES">
70
+ <BuildableProductRunnable
71
+ runnableDebuggingMode = "0">
72
+ <BuildableReference
73
+ BuildableIdentifier = "primary"
74
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
75
+ BuildableName = "blankTemplate.app"
76
+ BlueprintName = "blankTemplate"
77
+ ReferencedContainer = "container:blankTemplate.xcodeproj">
78
+ </BuildableReference>
79
+ </BuildableProductRunnable>
80
+ </ProfileAction>
81
+ <AnalyzeAction
82
+ buildConfiguration = "Debug">
83
+ </AnalyzeAction>
84
+ <ArchiveAction
85
+ buildConfiguration = "Release"
86
+ revealArchiveInOrganizer = "YES">
87
+ </ArchiveAction>
88
+ </Scheme>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "group:blankTemplate.xcodeproj">
6
+ </FileRef>
7
+ <FileRef
8
+ location = "group:Pods/Pods.xcodeproj">
9
+ </FileRef>
10
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>BNDL</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1</string>
23
+ </dict>
24
+ </plist>
@@ -0,0 +1,66 @@
1
+ #import <UIKit/UIKit.h>
2
+ #import <XCTest/XCTest.h>
3
+
4
+ #import <React/RCTLog.h>
5
+ #import <React/RCTRootView.h>
6
+
7
+ #define TIMEOUT_SECONDS 600
8
+ #define TEXT_TO_LOOK_FOR @"Welcome to React"
9
+
10
+ @interface blankTemplateTests : XCTestCase
11
+
12
+ @end
13
+
14
+ @implementation blankTemplateTests
15
+
16
+ - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17
+ {
18
+ if (test(view)) {
19
+ return YES;
20
+ }
21
+ for (UIView *subview in [view subviews]) {
22
+ if ([self findSubviewInView:subview matching:test]) {
23
+ return YES;
24
+ }
25
+ }
26
+ return NO;
27
+ }
28
+
29
+ - (void)testRendersWelcomeScreen
30
+ {
31
+ UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32
+ NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33
+ BOOL foundElement = NO;
34
+
35
+ __block NSString *redboxError = nil;
36
+ #ifdef DEBUG
37
+ RCTSetLogFunction(
38
+ ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39
+ if (level >= RCTLogLevelError) {
40
+ redboxError = message;
41
+ }
42
+ });
43
+ #endif
44
+
45
+ while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46
+ [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47
+ [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48
+
49
+ foundElement = [self findSubviewInView:vc.view
50
+ matching:^BOOL(UIView *view) {
51
+ if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52
+ return YES;
53
+ }
54
+ return NO;
55
+ }];
56
+ }
57
+
58
+ #ifdef DEBUG
59
+ RCTSetLogFunction(RCTDefaultLogFunction);
60
+ #endif
61
+
62
+ XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63
+ XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64
+ }
65
+
66
+ @end
@@ -0,0 +1,25 @@
1
+ {
2
+ "migIndex": 1,
3
+ "data": [
4
+ {
5
+ "path": "assets/fonts/OpenSans-Bold.ttf",
6
+ "sha1": "1e3704ee48b5ff7e582488ead87b05249f14dc1c"
7
+ },
8
+ {
9
+ "path": "assets/fonts/OpenSans-ExtraBold.ttf",
10
+ "sha1": "5acb1de2513aca9ce4fcf5d1e1e49aad86f1888c"
11
+ },
12
+ {
13
+ "path": "assets/fonts/OpenSans-Light.ttf",
14
+ "sha1": "bf0d133b628259eca01049d30fa6316094d00bcf"
15
+ },
16
+ {
17
+ "path": "assets/fonts/OpenSans-Regular.ttf",
18
+ "sha1": "babe8dce93a3e48b6c3c79720a0c048e88dd1fe7"
19
+ },
20
+ {
21
+ "path": "assets/fonts/OpenSans-SemiBold.ttf",
22
+ "sha1": "e256f8391718ef61f253dfb4e95bbeb3c5857afc"
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ preset: 'react-native',
3
+ };
@@ -1,29 +1,11 @@
1
+ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2
+
1
3
  /**
2
- * Metro configuration for React Native
3
- * https://github.com/facebook/react-native
4
+ * Metro configuration
5
+ * https://reactnative.dev/docs/metro
4
6
  *
5
- * @format
7
+ * @type {import('metro-config').MetroConfig}
6
8
  */
9
+ const config = {};
7
10
 
8
- const { getDefaultConfig } = require('metro-config');
9
-
10
- module.exports = (async () => {
11
- const {
12
- resolver: { sourceExts, assetExts },
13
- } = await getDefaultConfig();
14
- return {
15
- transformer: {
16
- babelTransformerPath: require.resolve('react-native-svg-transformer'),
17
- getTransformOptions: async () => ({
18
- transform: {
19
- experimentalImportSupport: false,
20
- inlineRequires: true,
21
- },
22
- }),
23
- },
24
- resolver: {
25
- assetExts: assetExts.filter((ext) => ext !== 'svg'),
26
- sourceExts: [...sourceExts, 'svg'],
27
- },
28
- };
29
- })();
11
+ module.exports = mergeConfig(getDefaultConfig(__dirname), config);
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "blank-template",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "scripts": {
6
+ "android": "react-native run-android",
7
+ "ios": "react-native run-ios",
8
+ "lint": "eslint ",
9
+ "lint:fix": "eslint \"src/**/**.ts\" --fix",
10
+ "prettier": "prettier \"**/**.{tsx,ts,js,json}\" --write",
11
+ "start": "react-native start",
12
+ "test": "jest"
13
+ },
14
+ "dependencies": {
15
+ "@brightlayer-ui/react-native-components": "^8.0.2",
16
+ "@brightlayer-ui/react-native-themes": "^7.0.0",
17
+ "@brightlayer-ui/react-native-vector-icons": "^2.2.0",
18
+ "@react-navigation/drawer": "^6.6.15",
19
+ "@react-navigation/native": "^6.1.17",
20
+ "@react-navigation/stack": "^6.3.29",
21
+ "react": "18.2.0",
22
+ "react-native": "0.74.1",
23
+ "react-native-gesture-handler": "^2.16.2",
24
+ "react-native-paper": "^5.0.0",
25
+ "react-native-reanimated": "^3.11.0",
26
+ "react-native-safe-area-context": "^4.0.0",
27
+ "react-native-screens": "^3.31.1",
28
+ "react-native-vector-icons": "^9.2.0"
29
+ },
30
+ "devDependencies": {
31
+ "@babel/core": "^7.20.0",
32
+ "@babel/preset-env": "^7.20.0",
33
+ "@babel/runtime": "^7.20.0",
34
+ "@brightlayer-ui/eslint-config": "^3.0.1",
35
+ "@brightlayer-ui/prettier-config": "^1.0.3",
36
+ "@eslint/js": "^9.2.0",
37
+ "@react-native/babel-preset": "0.74.83",
38
+ "@react-native/eslint-config": "0.74.83",
39
+ "@react-native/metro-config": "0.74.83",
40
+ "@react-native/typescript-config": "0.74.83",
41
+ "@types/react": "^18.2.6",
42
+ "@types/react-test-renderer": "^18.0.0",
43
+ "@typescript-eslint/eslint-plugin": "^7.8.0",
44
+ "@typescript-eslint/parser": "^7.8.0",
45
+ "babel-jest": "^29.6.3",
46
+ "eslint": "8.56.0",
47
+ "eslint-config-prettier": "^9.1.0",
48
+ "eslint-plugin-react": "^7.34.1",
49
+ "eslint-plugin-react-hooks": "^4.6.2",
50
+ "globals": "^15.1.0",
51
+ "jest": "^29.6.3",
52
+ "prettier": "2.8.8",
53
+ "react-test-renderer": "18.2.0",
54
+ "typescript": "5.0.4",
55
+ "typescript-eslint": "^7.8.0"
56
+ },
57
+ "engines": {
58
+ "node": ">=18"
59
+ },
60
+ "prettier": "@brightlayer-ui/prettier-config"
61
+ }
@@ -2,41 +2,41 @@ import React, { ReactNode } from 'react';
2
2
  import { NavigationContainer } from '@react-navigation/native';
3
3
  import { createDrawerNavigator } from '@react-navigation/drawer';
4
4
  import { View } from 'react-native';
5
+ // Your Three Pages (replace with your actual page components)
6
+ import Home from '../screens/home'; // Replace with your Home screen component path
7
+ import PageOne from '../screens/pageOne'; // Replace with your PageOne screen component path
8
+ import PageTwo from '../screens/pageTwo'; // Replace with your PageTwo screen component path
5
9
  import { NavigationDrawer } from './navigation-drawer';
6
- import { createStackNavigator } from '@react-navigation/stack';
7
- import Home from '../screens/home';
8
- import PageOne from '../screens/pageOne';
9
- import PageTwo from '../screens/pageTwo';
10
10
 
11
11
  const Drawer = createDrawerNavigator();
12
12
 
13
+ // Type definitions for navigation parameters (optional)
13
14
  export type RootStackParamList = {
14
15
  Home: undefined;
15
16
  PageOne: undefined;
16
17
  PageTwo: undefined;
17
- NavigationDrawer: undefined;
18
18
  };
19
-
20
- const RootStack = createStackNavigator<RootStackParamList>();
21
-
22
19
  const CustomDrawerContent = (props: any): any => (
23
20
  <View style={{ height: '100%' }}>
24
21
  <NavigationDrawer {...props} />
25
22
  </View>
26
23
  );
27
-
28
- export const MainRouter = (): any => (
24
+ const MainRouter = (): ReactNode => (
29
25
  <NavigationContainer>
30
26
  <Drawer.Navigator
31
27
  initialRouteName="Home"
32
28
  screenOptions={{
33
29
  headerShown: false,
30
+ drawerType: 'front',
31
+ drawerStyle: { backgroundColor: 'transparent' },
34
32
  }}
35
- drawerContent={(props: any): ReactNode => <CustomDrawerContent {...props} />}
33
+ drawerContent={(props) => <CustomDrawerContent {...props} />}
36
34
  >
37
- <RootStack.Screen name="Home" component={Home} />
38
- <RootStack.Screen name="PageOne" component={PageOne} />
39
- <RootStack.Screen name="PageTwo" component={PageTwo} />
35
+ <Drawer.Screen name="Home" component={Home} />
36
+ <Drawer.Screen name="PageOne" component={PageOne} />
37
+ <Drawer.Screen name="PageTwo" component={PageTwo} />
40
38
  </Drawer.Navigator>
41
39
  </NavigationContainer>
42
40
  );
41
+
42
+ export default MainRouter;
@@ -1,6 +1,5 @@
1
1
  import { Drawer, DrawerBody, DrawerHeader, DrawerNavGroup, NavItem } from '@brightlayer-ui/react-native-components';
2
2
  import React, { useState, useCallback } from 'react';
3
- import * as Colors from '@brightlayer-ui/colors';
4
3
  import { StackNavigationProp } from '@react-navigation/stack';
5
4
  import { RootStackParamList } from './index';
6
5
  import { DrawerActions } from '@react-navigation/native';
@@ -42,7 +41,7 @@ export const NavigationDrawer: React.FC<NavDrawerProps> = ({ navigation }) => {
42
41
  <DrawerHeader
43
42
  title={'Brightlayer UI'}
44
43
  subtitle={'React Native Project'}
45
- fontColor={Colors.white[50]}
44
+ // fontColor={}
46
45
  icon={{ name: 'menu' }}
47
46
  onIconPress={(): void => {
48
47
  navigation.dispatch(DrawerActions.closeDrawer());
@@ -1,3 +1,10 @@
1
+ /**
2
+ Copyright (c) 2021-present, Eaton
3
+
4
+ All rights reserved.
5
+
6
+ This code is licensed under the BSD-3 license found in the LICENSE file in the root directory of this source tree and at https://opensource.org/licenses/BSD-3-Clause.
7
+ **/
1
8
  import React, { useCallback } from 'react';
2
9
  import {
3
10
  SafeAreaView,
@@ -9,18 +16,17 @@ import {
9
16
  View,
10
17
  Animated,
11
18
  Easing,
19
+ Image,
12
20
  } from 'react-native';
13
- import { Button, Divider, useTheme } from 'react-native-paper';
14
- import { Body1, H4, Header, IconFamily } from '@brightlayer-ui/react-native-components';
15
- import { Theme } from 'react-native-paper/lib/typescript/types';
16
- import Logo from '../../assets/images/Logo.svg';
21
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
22
+ import { Button, Divider, Text, Provider as ThemeProvider } from 'react-native-paper';
23
+ import { ExtendedTheme, useExtendedTheme, blue } from '@brightlayer-ui/react-native-themes';
24
+ import { Header } from '@brightlayer-ui/react-native-components';
17
25
  import { StackNavigationProp } from '@react-navigation/stack';
18
26
  import { RootStackParamList } from '../navigation';
19
27
 
20
- const MenuIcon: IconFamily = { name: 'menu', direction: 'ltr' };
21
-
22
28
  const styles = (
23
- theme: Theme
29
+ theme: ExtendedTheme
24
30
  ): StyleSheet.NamedStyles<{
25
31
  content: ViewStyle;
26
32
  pxbLogoWrapper: ViewStyle;
@@ -58,14 +64,14 @@ const styles = (
58
64
  marginVertical: 24,
59
65
  },
60
66
  openURLButtonText: {
61
- color: theme.colors.text,
67
+ color: theme.colors.primary,
62
68
  padding: 8,
63
69
  },
64
70
  });
65
71
 
66
72
  const OpenURLButton = (props: any): JSX.Element => {
67
73
  const { url, title } = props;
68
- const theme = useTheme();
74
+ const theme = useExtendedTheme();
69
75
  const defaultStyles = styles(theme);
70
76
 
71
77
  const handlePress = useCallback(async () => {
@@ -88,7 +94,7 @@ type AppProps = {
88
94
  };
89
95
 
90
96
  const Home: React.FC<AppProps> = ({ navigation }): JSX.Element => {
91
- const theme = useTheme();
97
+ const theme = useExtendedTheme();
92
98
  const defaultStyles = styles(theme);
93
99
  const spinValue = new Animated.Value(0);
94
100
 
@@ -107,54 +113,67 @@ const Home: React.FC<AppProps> = ({ navigation }): JSX.Element => {
107
113
  });
108
114
 
109
115
  return (
110
- <>
111
- <Header
112
- title={'Home Page'}
113
- icon={MenuIcon}
114
- onIconPress={(): void => {
115
- navigation.openDrawer();
116
- }}
117
- />
118
- <SafeAreaView style={defaultStyles.content}>
119
- <ScrollView>
120
- <View style={defaultStyles.pxbLogoWrapper}>
121
- <Animated.View style={[defaultStyles.pxbLogo, { transform: [{ rotate: spin }] }]}>
122
- <Logo height={100} width={100} fill={'#007bc1'} />
123
- </Animated.View>
124
- </View>
125
- <H4 style={defaultStyles.title}>
126
- Welcome to Brightlayer <H4 color={'primary'}>UI</H4>.
127
- </H4>
128
- <Body1 style={defaultStyles.subtitle}>
129
- Edit <Body1 style={defaultStyles.bold}>screens/home.tsx</Body1> and save to reload.
130
- </Body1>
131
- <Divider style={defaultStyles.divider} />
132
- <OpenURLButton title={'Brightlayer UI Documentation'} url={'https://brightlayer-ui.github.io/'} />
133
- <OpenURLButton
134
- title={'React Native Getting Started Guide'}
135
- url={'https://brightlayer-ui.github.io/development/frameworks-mobile/react-native'}
136
- />
137
- <OpenURLButton
138
- title={'Design Pattern Descriptions'}
139
- url={'https://brightlayer-ui.github.io/patterns'}
140
- />
141
- <OpenURLButton
142
- title={'React Native Component Library'}
143
- url={'https://brightlayer-ui-components.github.io/react-native/'}
144
- />
145
- <OpenURLButton title={'Visit Us on GitHub'} url={'https://github.com/etn-ccis?q=blui'} />
146
- <OpenURLButton
147
- title={'Design Pattern Source on GitHub'}
148
- url={'https://github.com/etn-ccis/blui-react-native-design-patterns'}
149
- />
150
- <OpenURLButton title={'Release Roadmap'} url={'https://brightlayer-ui.github.io/roadmap'} />
151
- <OpenURLButton
152
- title={'Send Feedback or Suggestions'}
153
- url={'https://brightlayer-ui.github.io/community/contactus'}
154
- />
155
- </ScrollView>
156
- </SafeAreaView>
157
- </>
116
+ <ThemeProvider theme={blue}>
117
+ <SafeAreaProvider>
118
+ <Header
119
+ title={'Home Page'}
120
+ icon={{ name: 'menu' }}
121
+ onIconPress={(): void => {
122
+ navigation.openDrawer();
123
+ }}
124
+ />
125
+ <SafeAreaView style={defaultStyles.content}>
126
+ <ScrollView>
127
+ <View style={defaultStyles.pxbLogoWrapper}>
128
+ <Animated.View style={[defaultStyles.pxbLogo, { transform: [{ rotate: spin }] }]}>
129
+ <Image source={require('../../assets/images/Logo.png')} />
130
+ </Animated.View>
131
+ </View>
132
+ <Text variant={'headlineLarge'} style={defaultStyles.title}>
133
+ Welcome to Brightlayer{' '}
134
+ <Text variant={'headlineLarge'} style={{ fontSize: 34, color: theme.colors.primary }}>
135
+ UI
136
+ </Text>
137
+ .
138
+ </Text>
139
+ <Text variant={'bodyLarge'} style={defaultStyles.subtitle}>
140
+ Edit{' '}
141
+ <Text variant={'bodyLarge'} style={defaultStyles.bold}>
142
+ ./src/screen/home.tsx
143
+ </Text>{' '}
144
+ and save to reload.
145
+ </Text>
146
+ <Divider style={defaultStyles.divider} />
147
+ <OpenURLButton
148
+ title={'Brightlayer UI Documentation'}
149
+ url={'https://brightlayer-ui.github.io/'}
150
+ />
151
+ <OpenURLButton
152
+ title={'React Native Getting Started Guide'}
153
+ url={'https://brightlayer-ui.github.io/development/frameworks-mobile/react-native'}
154
+ />
155
+ <OpenURLButton
156
+ title={'Design Pattern Descriptions'}
157
+ url={'https://brightlayer-ui.github.io/patterns'}
158
+ />
159
+ <OpenURLButton
160
+ title={'React Native Component Library'}
161
+ url={'https://brightlayer-ui-components.github.io/react-native/'}
162
+ />
163
+ <OpenURLButton title={'Visit Us on GitHub'} url={'https://github.com/etn-ccis?q=blui'} />
164
+ <OpenURLButton
165
+ title={'Design Pattern Source on GitHub'}
166
+ url={'https://github.com/etn-ccis/blui-react-native-design-patterns'}
167
+ />
168
+ <OpenURLButton title={'Release Roadmap'} url={'https://brightlayer-ui.github.io/roadmap'} />
169
+ <OpenURLButton
170
+ title={'Send Feedback or Suggestions'}
171
+ url={'https://brightlayer-ui.github.io/community/contactus'}
172
+ />
173
+ </ScrollView>
174
+ </SafeAreaView>
175
+ </SafeAreaProvider>
176
+ </ThemeProvider>
158
177
  );
159
178
  };
160
179
 
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
2
  import { SafeAreaView, ScrollView, StyleSheet, ViewStyle } from 'react-native';
3
- import { EmptyState, Header, IconFamily } from '@brightlayer-ui/react-native-components';
3
+ import { EmptyState, Header } from '@brightlayer-ui/react-native-components';
4
4
  import { StackNavigationProp } from '@react-navigation/stack';
5
5
  import { RootStackParamList } from '../navigation';
6
- const Event: IconFamily = { name: 'event', direction: 'rtl' };
7
- const MenuIcon: IconFamily = { name: 'menu', direction: 'ltr' };
8
6
 
9
7
  const styles = (): StyleSheet.NamedStyles<{
10
8
  content: ViewStyle;
@@ -32,7 +30,7 @@ const PageOne: React.FC<AppProps> = ({ navigation }): JSX.Element => {
32
30
  <>
33
31
  <Header
34
32
  title={'Page One'}
35
- icon={MenuIcon}
33
+ icon={{ name: 'menu' }}
36
34
  onIconPress={(): void => {
37
35
  navigation.openDrawer();
38
36
  }}
@@ -40,7 +38,7 @@ const PageOne: React.FC<AppProps> = ({ navigation }): JSX.Element => {
40
38
  <SafeAreaView style={defaultStyles.content}>
41
39
  <ScrollView contentContainerStyle={defaultStyles.scrollViewContent}>
42
40
  <EmptyState
43
- icon={Event}
41
+ icon={{ family: 'material', name: 'event', direction: 'ltr' }}
44
42
  title={'Coming Soon'}
45
43
  description={'Replace this page with your own content'}
46
44
  />
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
2
  import { SafeAreaView, ScrollView, StyleSheet, ViewStyle } from 'react-native';
3
- import { EmptyState, Header, IconFamily } from '@brightlayer-ui/react-native-components';
3
+ import { EmptyState, Header } from '@brightlayer-ui/react-native-components';
4
4
  import { StackNavigationProp } from '@react-navigation/stack';
5
5
  import { RootStackParamList } from '../navigation';
6
- const Event: IconFamily = { name: 'event', direction: 'rtl' };
7
- const MenuIcon: IconFamily = { name: 'menu', direction: 'ltr' };
8
6
 
9
7
  const styles = (): StyleSheet.NamedStyles<{
10
8
  content: ViewStyle;
@@ -32,7 +30,7 @@ const PageTwo: React.FC<AppProps> = ({ navigation }): JSX.Element => {
32
30
  <>
33
31
  <Header
34
32
  title={'Page Two'}
35
- icon={MenuIcon}
33
+ icon={{ name: 'menu' }}
36
34
  onIconPress={(): void => {
37
35
  navigation.openDrawer();
38
36
  }}
@@ -40,7 +38,7 @@ const PageTwo: React.FC<AppProps> = ({ navigation }): JSX.Element => {
40
38
  <SafeAreaView style={defaultStyles.content}>
41
39
  <ScrollView contentContainerStyle={defaultStyles.scrollViewContent}>
42
40
  <EmptyState
43
- icon={Event}
41
+ icon={{ name: 'event' }}
44
42
  title={'Coming Soon'}
45
43
  description={'Replace this page with your own content'}
46
44
  />