@brightlayer-ui/react-native-template-routing-typescript 2.0.0-beta.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/CHANGELOG.md +50 -0
- package/README.md +27 -0
- package/dependencies.json +23 -0
- package/fonts/OpenSans-Bold.ttf +0 -0
- package/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/fonts/OpenSans-Light.ttf +0 -0
- package/fonts/OpenSans-Regular.ttf +0 -0
- package/fonts/OpenSans-SemiBold.ttf +0 -0
- package/images/Logo.svg +11 -0
- package/package.json +27 -0
- package/template/App.tsx +22 -0
- package/template/__mocks__/svgMock.js +8 -0
- package/template/jestSetupFile.js +15 -0
- package/template/metro.config.js +29 -0
- package/template/react-native.config.js +3 -0
- package/template/src/navigation/index.tsx +40 -0
- package/template/src/navigation/navigation-drawer.tsx +55 -0
- package/template/src/screens/home.tsx +161 -0
- package/template/src/screens/index.tsx +3 -0
- package/template/src/screens/pageOne.tsx +53 -0
- package/template/src/screens/pageTwo.tsx +53 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v2.0.0 (Not yet published)
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Changed package namespace from `@pxblue` to `@brightlayer-ui`.
|
|
8
|
+
|
|
9
|
+
## Package Migration Notice
|
|
10
|
+
|
|
11
|
+
Previous versions listed after this indicator refer to our deprecated `@pxblue` packages.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## v2.0.0 (November 3, 2021)
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Updated to use latest APIs from `@pxblue/react-native-components`.
|
|
20
|
+
|
|
21
|
+
## v1.3.1 (October 1, 2021)
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Added dependency for `@pxblue/react-native-vector-icons`
|
|
26
|
+
|
|
27
|
+
## v1.3.0 (September 30, 2021)
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- Upgrade PX Blue packages
|
|
31
|
+
- Changed default drawer width to 300.
|
|
32
|
+
|
|
33
|
+
## v1.2.0 (July 26, 2021)
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- Updated version of react-native-modal dependency to 12.0.2
|
|
37
|
+
|
|
38
|
+
## v1.1.0 (March 31, 2021)
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
- Updated dependencies to use latest packages.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
- Jest configuration allows default tests to pass.
|
|
45
|
+
|
|
46
|
+
## v1.0.0 (March 1, 2021)
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- Initial routing template for TypeScript projects
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Routing Template (TypeScript)
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
This is an official Brightlayer UI template used internally by the [Brightlayer UI CLI](https://www.npmjs.com/package/@brightlayer-ui/cli).
|
|
6
|
+
|
|
7
|
+
This template includes the installation and initial setup of routing using [React Navigation](https://reactnavigation.org/). It includes several placeholder routes/screens and a [Drawer](https://brightlayer-ui-components.github.io/react-native/?path=/info/components-documentation--drawer) navigator from the Brightlayer UI [React Native Component Library](https://www.npmjs.com/package/@brightlayer-ui/react-native-components).
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
This template can be used with the Brightlayer UI CLI:
|
|
11
|
+
```sh
|
|
12
|
+
npx -p @brightlayer-ui/cli blui new react-native --name=myapp --cli=rnc --language=ts --template=routing
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Project Structure
|
|
16
|
+
Projects created using this template will start out with the following file structure:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
|── /ios // ios project folder
|
|
20
|
+
|── /android // android project folder
|
|
21
|
+
|── /assets // fonts and images used by the application
|
|
22
|
+
|── App.tsx // app entry point
|
|
23
|
+
|── /pages // sample application pages
|
|
24
|
+
└── /router
|
|
25
|
+
|── index.tsx // sets up routing
|
|
26
|
+
└── navigation-drawer.tsx // sets up Drawer
|
|
27
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": [
|
|
3
|
+
"@brightlayer-ui/react-native-themes@^6.0.0",
|
|
4
|
+
"@brightlayer-ui/colors@^3.0.1",
|
|
5
|
+
"@brightlayer-ui/react-native-components@^6.0.1",
|
|
6
|
+
"@brightlayer-ui/react-native-vector-icons@^1.4.0",
|
|
7
|
+
"react-native-modal@^12.0.2",
|
|
8
|
+
"react-native-paper@^4.7.2",
|
|
9
|
+
"@brightlayer-ui/icons-svg@^1.8.0",
|
|
10
|
+
"react-native-vector-icons@^8.0.0",
|
|
11
|
+
"react-native-svg@^12.1.0",
|
|
12
|
+
"react-native-svg-transformer@^0.14.3",
|
|
13
|
+
"react-native-safe-area-context@^3.2.0",
|
|
14
|
+
"@react-native-community/masked-view@^0.1.10",
|
|
15
|
+
"@react-navigation/drawer@^5.12.3",
|
|
16
|
+
"@react-navigation/native@^5.9.3",
|
|
17
|
+
"@react-navigation/stack@^5.14.3",
|
|
18
|
+
"react-native-gesture-handler@^1.10.3",
|
|
19
|
+
"react-native-reanimated@^1.0.0",
|
|
20
|
+
"react-native-screens@^3.0.0"
|
|
21
|
+
],
|
|
22
|
+
"devDependencies": ["@types/react-native-vector-icons", "jest-transform-stub"]
|
|
23
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/images/Logo.svg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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>
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@brightlayer-ui/react-native-template-routing-typescript",
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
|
+
"author": "brightlayer-ui <brightlayer-ui@eaton.com>",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react native",
|
|
7
|
+
"template",
|
|
8
|
+
"brightlayer-ui",
|
|
9
|
+
"cli"
|
|
10
|
+
],
|
|
11
|
+
"description": "A template with pre-configured routing for React Native projects created with the Brightlayer UI CLI.",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/brightlayer-ui/react-native-cli-templates.git"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"publish:package": "set npm_config_yes=true && npx -p @brightlayer-ui/publish blui-publish",
|
|
18
|
+
"tag:package": "set npm_config_yes=true && npx -p @brightlayer-ui/tag blui-tag"
|
|
19
|
+
},
|
|
20
|
+
"license": "BSD-3-Clause",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=10"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/brightlayer-ui/react-native-cli-templates/issues"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/template/App.tsx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
**/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Provider as ThemeProvider } from 'react-native-paper';
|
|
10
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
11
|
+
import * as BLUIThemes from '@brightlayer-ui/react-native-themes';
|
|
12
|
+
import { MainRouter } from './src/navigation';
|
|
13
|
+
|
|
14
|
+
export const App = (): JSX.Element => (
|
|
15
|
+
<ThemeProvider theme={BLUIThemes.blue}>
|
|
16
|
+
<SafeAreaProvider>
|
|
17
|
+
<MainRouter />
|
|
18
|
+
</SafeAreaProvider>
|
|
19
|
+
</ThemeProvider>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default App;
|
|
@@ -0,0 +1,8 @@
|
|
|
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';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import 'react-native-gesture-handler/jestSetup';
|
|
2
|
+
|
|
3
|
+
jest.useFakeTimers();
|
|
4
|
+
jest.mock('react-native-reanimated', () => {
|
|
5
|
+
const Reanimated = require('react-native-reanimated/mock');
|
|
6
|
+
|
|
7
|
+
// The mock for `call` immediately calls the callback which is incorrect
|
|
8
|
+
// So we override it with a no-op
|
|
9
|
+
Reanimated.default.call = () => {};
|
|
10
|
+
|
|
11
|
+
return Reanimated;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
|
|
15
|
+
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metro configuration for React Native
|
|
3
|
+
* https://github.com/facebook/react-native
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
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
|
+
})();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { NavigationContainer } from '@react-navigation/native';
|
|
3
|
+
import { createDrawerNavigator } from '@react-navigation/drawer';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { NavDrawerProps, 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
|
+
|
|
11
|
+
const Drawer = createDrawerNavigator();
|
|
12
|
+
|
|
13
|
+
export type RootStackParamList = {
|
|
14
|
+
Home: undefined;
|
|
15
|
+
PageOne: undefined;
|
|
16
|
+
PageTwo: undefined;
|
|
17
|
+
NavigationDrawer: undefined;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const RootStack = createStackNavigator<RootStackParamList>();
|
|
21
|
+
|
|
22
|
+
const CustomDrawerContent = (props: any): any => (
|
|
23
|
+
<View style={{ height: '100%' }}>
|
|
24
|
+
<NavigationDrawer {...props} />
|
|
25
|
+
</View>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const MainRouter = (): any => (
|
|
29
|
+
<NavigationContainer>
|
|
30
|
+
<Drawer.Navigator
|
|
31
|
+
initialRouteName="Home"
|
|
32
|
+
drawerStyle={{ backgroundColor: 'transparent', width: 300, maxWidth: '80%' }}
|
|
33
|
+
drawerContent={(props: NavDrawerProps): ReactNode => <CustomDrawerContent {...props} />}
|
|
34
|
+
>
|
|
35
|
+
<RootStack.Screen name="Home" component={Home} />
|
|
36
|
+
<RootStack.Screen name="PageOne" component={PageOne} />
|
|
37
|
+
<RootStack.Screen name="PageTwo" component={PageTwo} />
|
|
38
|
+
</Drawer.Navigator>
|
|
39
|
+
</NavigationContainer>
|
|
40
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
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';
|
|
5
|
+
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
|
+
];
|
|
24
|
+
|
|
25
|
+
export type NavDrawerProps = {
|
|
26
|
+
navigation: StackNavigationProp<RootStackParamList, 'NavigationDrawer'>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const NavigationDrawer: React.FC<NavDrawerProps> = ({ navigation }) => {
|
|
30
|
+
const [selected, setSelected] = useState('Home');
|
|
31
|
+
const selectItem = useCallback(
|
|
32
|
+
(id) => {
|
|
33
|
+
navigation.navigate(id);
|
|
34
|
+
setSelected(id);
|
|
35
|
+
},
|
|
36
|
+
[navigation]
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Drawer activeItem={selected} onItemSelect={(id: string): void => selectItem(id)}>
|
|
41
|
+
<DrawerHeader
|
|
42
|
+
title={'Brightlayer UI'}
|
|
43
|
+
subtitle={'React Native Project'}
|
|
44
|
+
fontColor={Colors.white[50]}
|
|
45
|
+
icon={{ name: 'menu' }}
|
|
46
|
+
onIconPress={(): void => {
|
|
47
|
+
navigation.closeDrawer();
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
<DrawerBody>
|
|
51
|
+
<DrawerNavGroup items={navGroupItems} hidePadding={false} />
|
|
52
|
+
</DrawerBody>
|
|
53
|
+
</Drawer>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
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 { 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';
|
|
17
|
+
import { StackNavigationProp } from '@react-navigation/stack';
|
|
18
|
+
import { RootStackParamList } from '../navigation';
|
|
19
|
+
|
|
20
|
+
const MenuIcon: IconFamily = { name: 'menu', direction: 'ltr' };
|
|
21
|
+
|
|
22
|
+
const styles = (
|
|
23
|
+
theme: Theme
|
|
24
|
+
): StyleSheet.NamedStyles<{
|
|
25
|
+
content: ViewStyle;
|
|
26
|
+
pxbLogoWrapper: ViewStyle;
|
|
27
|
+
pxbLogo: ViewStyle;
|
|
28
|
+
title: TextStyle;
|
|
29
|
+
subtitle: TextStyle;
|
|
30
|
+
bold: TextStyle;
|
|
31
|
+
divider: ViewStyle;
|
|
32
|
+
openURLButtonText: TextStyle;
|
|
33
|
+
}> =>
|
|
34
|
+
StyleSheet.create({
|
|
35
|
+
content: {
|
|
36
|
+
flex: 1,
|
|
37
|
+
},
|
|
38
|
+
pxbLogoWrapper: {
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
marginTop: 16,
|
|
41
|
+
},
|
|
42
|
+
pxbLogo: {
|
|
43
|
+
alignSelf: 'center',
|
|
44
|
+
height: 100,
|
|
45
|
+
width: 100,
|
|
46
|
+
},
|
|
47
|
+
title: {
|
|
48
|
+
textAlign: 'center',
|
|
49
|
+
marginBottom: 16,
|
|
50
|
+
},
|
|
51
|
+
subtitle: {
|
|
52
|
+
textAlign: 'center',
|
|
53
|
+
},
|
|
54
|
+
bold: {
|
|
55
|
+
fontWeight: 'bold',
|
|
56
|
+
},
|
|
57
|
+
divider: {
|
|
58
|
+
marginVertical: 24,
|
|
59
|
+
},
|
|
60
|
+
openURLButtonText: {
|
|
61
|
+
color: theme.colors.text,
|
|
62
|
+
padding: 8,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const OpenURLButton = (props: any): JSX.Element => {
|
|
67
|
+
const { url, title } = props;
|
|
68
|
+
const theme = useTheme();
|
|
69
|
+
const defaultStyles = styles(theme);
|
|
70
|
+
|
|
71
|
+
const handlePress = useCallback(async () => {
|
|
72
|
+
await Linking.openURL(url);
|
|
73
|
+
}, [url]);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Button
|
|
77
|
+
onPress={(): Promise<void> => handlePress()}
|
|
78
|
+
labelStyle={defaultStyles.openURLButtonText}
|
|
79
|
+
uppercase={false}
|
|
80
|
+
>
|
|
81
|
+
{title}
|
|
82
|
+
</Button>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
type AppProps = {
|
|
87
|
+
navigation: StackNavigationProp<RootStackParamList, 'Home'>;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const Home: React.FC<AppProps> = ({ navigation }): JSX.Element => {
|
|
91
|
+
const theme = useTheme();
|
|
92
|
+
const defaultStyles = styles(theme);
|
|
93
|
+
const spinValue = new Animated.Value(0);
|
|
94
|
+
|
|
95
|
+
Animated.loop(
|
|
96
|
+
Animated.timing(spinValue, {
|
|
97
|
+
toValue: 1,
|
|
98
|
+
duration: 2500,
|
|
99
|
+
easing: Easing.linear,
|
|
100
|
+
useNativeDriver: true,
|
|
101
|
+
})
|
|
102
|
+
).start();
|
|
103
|
+
|
|
104
|
+
const spin = spinValue.interpolate({
|
|
105
|
+
inputRange: [0, 1],
|
|
106
|
+
outputRange: ['0deg', '360deg'],
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
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/brightlayer-ui'} />
|
|
146
|
+
<OpenURLButton
|
|
147
|
+
title={'Design Pattern Source on GitHub'}
|
|
148
|
+
url={'https://github.com/brightlayer-ui/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
|
+
</>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export default Home;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SafeAreaView, ScrollView, StyleSheet, ViewStyle } from 'react-native';
|
|
3
|
+
import { EmptyState, Header, IconFamily } from '@brightlayer-ui/react-native-components';
|
|
4
|
+
import { StackNavigationProp } from '@react-navigation/stack';
|
|
5
|
+
import { RootStackParamList } from '../navigation';
|
|
6
|
+
const Event: IconFamily = { name: 'event', direction: 'rtl' };
|
|
7
|
+
const MenuIcon: IconFamily = { name: 'menu', direction: 'ltr' };
|
|
8
|
+
|
|
9
|
+
const styles = (): StyleSheet.NamedStyles<{
|
|
10
|
+
content: ViewStyle;
|
|
11
|
+
scrollViewContent: ViewStyle;
|
|
12
|
+
}> =>
|
|
13
|
+
StyleSheet.create({
|
|
14
|
+
content: {
|
|
15
|
+
flex: 1,
|
|
16
|
+
},
|
|
17
|
+
scrollViewContent: {
|
|
18
|
+
flex: 1,
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
type AppProps = {
|
|
25
|
+
navigation: StackNavigationProp<RootStackParamList, 'PageOne'>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const PageOne: React.FC<AppProps> = ({ navigation }): JSX.Element => {
|
|
29
|
+
const defaultStyles = styles();
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Header
|
|
34
|
+
title={'Page One'}
|
|
35
|
+
icon={MenuIcon}
|
|
36
|
+
onIconPress={(): void => {
|
|
37
|
+
navigation.openDrawer();
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
<SafeAreaView style={defaultStyles.content}>
|
|
41
|
+
<ScrollView contentContainerStyle={defaultStyles.scrollViewContent}>
|
|
42
|
+
<EmptyState
|
|
43
|
+
icon={Event}
|
|
44
|
+
title={'Coming Soon'}
|
|
45
|
+
description={'Replace this page with your own content'}
|
|
46
|
+
/>
|
|
47
|
+
</ScrollView>
|
|
48
|
+
</SafeAreaView>
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default PageOne;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SafeAreaView, ScrollView, StyleSheet, ViewStyle } from 'react-native';
|
|
3
|
+
import { EmptyState, Header, IconFamily } from '@brightlayer-ui/react-native-components';
|
|
4
|
+
import { StackNavigationProp } from '@react-navigation/stack';
|
|
5
|
+
import { RootStackParamList } from '../navigation';
|
|
6
|
+
const Event: IconFamily = { name: 'event', direction: 'rtl' };
|
|
7
|
+
const MenuIcon: IconFamily = { name: 'menu', direction: 'ltr' };
|
|
8
|
+
|
|
9
|
+
const styles = (): StyleSheet.NamedStyles<{
|
|
10
|
+
content: ViewStyle;
|
|
11
|
+
scrollViewContent: ViewStyle;
|
|
12
|
+
}> =>
|
|
13
|
+
StyleSheet.create({
|
|
14
|
+
content: {
|
|
15
|
+
flex: 1,
|
|
16
|
+
},
|
|
17
|
+
scrollViewContent: {
|
|
18
|
+
flex: 1,
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
type AppProps = {
|
|
25
|
+
navigation: StackNavigationProp<RootStackParamList, 'PageTwo'>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const PageTwo: React.FC<AppProps> = ({ navigation }): JSX.Element => {
|
|
29
|
+
const defaultStyles = styles();
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Header
|
|
34
|
+
title={'Page Two'}
|
|
35
|
+
icon={MenuIcon}
|
|
36
|
+
onIconPress={(): void => {
|
|
37
|
+
navigation.openDrawer();
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
<SafeAreaView style={defaultStyles.content}>
|
|
41
|
+
<ScrollView contentContainerStyle={defaultStyles.scrollViewContent}>
|
|
42
|
+
<EmptyState
|
|
43
|
+
icon={Event}
|
|
44
|
+
title={'Coming Soon'}
|
|
45
|
+
description={'Replace this page with your own content'}
|
|
46
|
+
/>
|
|
47
|
+
</ScrollView>
|
|
48
|
+
</SafeAreaView>
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default PageTwo;
|