Skip to content

Commit 0d04227

Browse files
authored
Merge pull request #228 from BlueBaseJS/fix/unmount-issues
2 parents bc57946 + b0dc61b commit 0d04227

26 files changed

Lines changed: 772 additions & 275 deletions

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# [1.1.0](https://github.com/BlueBaseJS/plugin-react-navigation/compare/v1.0.2...v1.1.0) (2020-02-10)
2+
3+
### Bug Fixes
4+
5+
- **TabNavigator:** Fixed broken tabs ([0b097ed](https://github.com/BlueBaseJS/plugin-react-navigation/commit/0b097edf1b018dad183952e6b9e9085d02f5d492))
6+
7+
### Features
8+
9+
- Uses dynamic version ([46fb630](https://github.com/BlueBaseJS/plugin-react-navigation/commit/46fb630d899f7bcdd07730e1561cdccf2fa73352))
10+
11+
## [1.0.2](https://github.com/BlueBaseJS/plugin-react-navigation/compare/v1.0.1...v1.0.2) (2020-02-10)
12+
13+
### Bug Fixes
14+
15+
- **release:** Fix semantic-release ([#121](https://github.com/BlueBaseJS/plugin-react-navigation/issues/121)) ([d824943](https://github.com/BlueBaseJS/plugin-react-navigation/commit/d824943e3cfe2bc6cf4b5de431c2ea6f14eb88da))
16+
17+
# 1.0.0 (2020-02-08)
18+
19+
### Features
20+
21+
- **Navigator:** Use presentation modal on iOS by default ([0774731](https://github.com/BlueBaseJS/plugin-react-navigation/commit/0774731b3ccb5fb34c66a83ba5871c611f6cd3f9))
22+
- **SwitchNavigator:** Added SwitchNavigator ([#117](https://github.com/BlueBaseJS/plugin-react-navigation/issues/117)) ([b16a5e9](https://github.com/BlueBaseJS/plugin-react-navigation/commit/b16a5e908b968700d4a12b91fd9bb72cd6d8dfc5))
23+
- Rewrote Plugin for React Navigation 5 ([#109](https://github.com/BlueBaseJS/plugin-react-navigation/issues/109)) ([5b70a1f](https://github.com/BlueBaseJS/plugin-react-navigation/commit/5b70a1feb7d7c33b3b7fc69f92904d9db75be007))
24+
25+
# 1.0.0 (2020-02-07)
26+
27+
### Features
28+
29+
- **SwitchNavigator:** Added SwitchNavigator ([#117](https://github.com/BlueBaseJS/plugin-react-navigation/issues/117)) ([b16a5e9](https://github.com/BlueBaseJS/plugin-react-navigation/commit/b16a5e908b968700d4a12b91fd9bb72cd6d8dfc5))
30+
- Rewrote Plugin for React Navigation 5 ([#109](https://github.com/BlueBaseJS/plugin-react-navigation/issues/109)) ([5b70a1f](https://github.com/BlueBaseJS/plugin-react-navigation/commit/5b70a1feb7d7c33b3b7fc69f92904d9db75be007))

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<h1>
44
React Navigation
55
</h1>
6-
<p>Use React Navigation in BlueBase apps!</p>
7-
</div>
6+
<p>Use React Navigation in BlueBase apps</p>
7+
</div>
88

99
<hr />
1010

bluebase/expo/apps/plugin-settings-app/Screens/Home.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import { Divider, List } from '@bluebase/components';
33
import { ScrollView, View } from 'react-native';
44

55
import React from 'react';
6-
import { useTheme } from '@bluebase/core';
6+
import { ThemeMode } from '../components/ThemeMode';
77

88
// tslint:disable: jsx-no-lambda
99

1010
export const HomeScreen = (props: any) => {
11-
const { changeTheme, theme } = useTheme();
1211

1312
const navigate = (route?: any, params?: any) => () => props.navigation.navigate(route, params);
1413
const push = (route?: any, params?: any) => () => props.navigation.push(route, params);
@@ -17,13 +16,7 @@ export const HomeScreen = (props: any) => {
1716
<View style={{ flex: 1 }}>
1817
<ScrollView style={{ flex: 1 }}>
1918
<List.Subheader>Settings</List.Subheader>
20-
<List.Item
21-
title="Mode"
22-
description={theme.mode === 'light' ? 'Light' : 'Dark'}
23-
onPress={() =>
24-
theme.mode === 'light' ? changeTheme('bluebase-dark') : changeTheme('bluebase-light')
25-
}
26-
/>
19+
<ThemeMode />
2720
<Divider />
2821
<List.Subheader>Demos</List.Subheader>
2922
<List.Item

bluebase/expo/apps/plugin-settings-app/Screens/Settings.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import { Body1, NavigationActions } from '@bluebase/components';
22
import { Button, View } from 'react-native';
33

44
import React from 'react';
5+
import { ThemeMode } from '../components/ThemeMode';
56

67
export class SettingsScreen extends React.Component {
78
static navigationOptions: any = {
89
title: 'Static Nav Opts Title',
910
};
1011
render() {
1112
return (
12-
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
13-
<Body1>Settings Screen</Body1>
13+
<View style={{ flexGrow: 1, justifyContent: 'center' }}>
14+
<ThemeMode />
1415
<NavigationActions>
1516
{({ navigate }: any) => (
1617
<Button

bluebase/expo/apps/plugin-settings-app/Screens/SettingsDetail.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { Button, Text, View } from 'react-native';
22

33
import { NavigationActions } from '@bluebase/components';
44
import React from 'react';
5+
import { ThemeMode } from '../components/ThemeMode';
56

67
export class SettingsDetailScreen extends React.Component {
78
render() {
8-
console.log('settings details screen props', this.props);
9+
// console.log('settings details screen props', this.props);
910
return (
1011
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
1112
<Text>Settings Details Screen</Text>
@@ -18,6 +19,7 @@ export class SettingsDetailScreen extends React.Component {
1819
/>
1920
)}
2021
</NavigationActions>
22+
<ThemeMode />
2123
</View>
2224
);
2325
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* eslint-disable react/jsx-no-bind */
2+
import { List } from '@bluebase/components';
3+
import React from 'react';
4+
import { useTheme } from '@bluebase/core';
5+
6+
// tslint:disable: jsx-no-lambda
7+
8+
export const ThemeMode = () => {
9+
const { changeTheme, theme } = useTheme();
10+
11+
return (
12+
<List.Item
13+
title="Theme Mode"
14+
description={theme.mode === 'light' ? 'Light' : 'Dark'}
15+
onPress={() =>
16+
theme.mode === 'light' ? changeTheme('bluebase-dark') : changeTheme('bluebase-light')
17+
}
18+
/>
19+
);
20+
};

package.json

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@bluebase/plugin-react-navigation",
33
"description": "Use React Navigation in BlueBase apps!",
44
"author": "BlueEast Team <code@blueeast.com>",
5-
"version": "0.0.1-alpha.24",
5+
"version": "1.1.0",
66
"main": "dist/index.js",
77
"typings": "dist/index.d.ts",
88
"module": "dist/index.js",
@@ -69,55 +69,57 @@
6969
},
7070
"dependencies": {
7171
"@react-native-community/masked-view": "^0.1.6",
72-
"@react-navigation/bottom-tabs": "^5.0.0-alpha.45",
73-
"@react-navigation/compat": "^5.0.0-alpha.34",
74-
"@react-navigation/core": "^3.5.2",
75-
"@react-navigation/drawer": "^5.0.0-alpha.47",
76-
"@react-navigation/material-bottom-tabs": "^5.0.0-alpha.42",
77-
"@react-navigation/material-top-tabs": "^5.0.0-alpha.41",
78-
"@react-navigation/native": "^5.0.0-alpha.29",
79-
"@react-navigation/native-stack": "^5.0.0-alpha.35",
80-
"@react-navigation/stack": "^5.0.0-alpha.70",
72+
"@react-navigation/bottom-tabs": "^5.0.1",
73+
"@react-navigation/compat": "^5.0.1",
74+
"@react-navigation/core": "^5.1.0",
75+
"@react-navigation/drawer": "^5.0.1",
76+
"@react-navigation/material-bottom-tabs": "^5.0.1",
77+
"@react-navigation/material-top-tabs": "^5.0.1",
78+
"@react-navigation/native": "^5.0.1",
79+
"@react-navigation/native-stack": "^5.0.1",
80+
"@react-navigation/stack": "^5.0.1",
8181
"@react-navigation/web": "^1.0.0-alpha.9",
8282
"expo": "^36.0.2",
8383
"react-native": "^0.61.5",
8484
"react-native-reanimated": "^1.7.0",
85-
"react-native-safe-area-context": "^0.6.4",
86-
"react-native-screens": "^2.0.0-beta.1",
85+
"react-native-safe-area-context": "^0.7.2",
86+
"react-native-screens": "^2.0.0-beta.2",
8787
"react-native-tab-view": "^2.13.0",
88-
"tslib": "^1.10.0"
88+
"tslib": "^2.0.0"
8989
},
9090
"devDependencies": {
9191
"@babel/cli": "^7.8.4",
9292
"@babel/core": "^7.8.4",
9393
"@babel/plugin-transform-flow-strip-types": "^7.8.3",
94-
"@bluebase/code-standards": "^2.4.2",
95-
"@bluebase/components": "^5.22.0",
96-
"@bluebase/core": "^5.11.0",
94+
"@bluebase/code-standards": "^2.5.0",
95+
"@bluebase/components": "^5.24.1",
96+
"@bluebase/core": "^5.11.1",
9797
"@bluebase/plugin-launcher": "^1.2.0",
98-
"@bluebase/plugin-react-native-paper": "^2.3.3",
98+
"@bluebase/plugin-react-native-paper": "^2.4.0",
9999
"@bluebase/plugin-responsive-grid": "^0.0.7",
100100
"@bluebase/plugin-vector-icons": "^0.2.0",
101101
"@bluebase/storybook-addon": "^3.0.0",
102-
"@types/enzyme": "^3.10.4",
103-
"@types/enzyme-adapter-react-16": "^1.0.5",
102+
"@types/enzyme": "^3.10.5",
103+
"@types/enzyme-adapter-react-16": "^1.0.6",
104104
"@types/enzyme-async-helpers": "^0.9.1",
105-
"@types/jest": "^25.1.1",
105+
"@types/jest": "^25.1.2",
106106
"@types/react": "^16.9.19",
107107
"@types/react-dom": "^16.9.5",
108-
"@types/react-native": "^0.61.10",
108+
"@types/react-native": "^0.61.12",
109109
"@types/react-test-renderer": "^16.9.2",
110110
"babel-core": "^7.0.0-bridge.0",
111111
"babel-jest": "^25.1.0",
112-
"babel-loader": "^8.0.6",
113-
"babel-preset-expo": "^8.0.0",
112+
"babel-loader": "^8.1.0",
113+
"babel-preset-expo": "^8.2.3",
114114
"codacy-coverage": "^3.4.0",
115-
"codecov": "^3.6.4",
115+
"codecov": "^3.6.5",
116116
"enzyme": "^3.11.0",
117117
"enzyme-adapter-react-16": "^1.15.2",
118118
"enzyme-async-helpers": "^0.9.1",
119119
"eslint": "^6.8.0",
120+
"eslint-plugin-import": "^2.22.0",
120121
"eslint-plugin-prettier": "^3.1.2",
122+
"eslint-plugin-react": "^7.20.3",
121123
"jest": "^25.1.0",
122124
"jest-enzyme": "^7.1.2",
123125
"jest-expo": "^36.0.1",
@@ -136,12 +138,15 @@
136138
"trash-cli": "^3.0.0",
137139
"ts-jest": "^25.2.0",
138140
"typedoc": "^0.16.9",
139-
"typescript": "3.7.5"
141+
"typescript": "3.9.7"
140142
},
141143
"peerDependencies": {
142144
"@bluebase/core": "^5.11.0",
143145
"react": "^16.8.0"
144146
},
147+
"resolutions": {
148+
"react-native-vector-icons": "6.6.0"
149+
},
145150
"prettier": {
146151
"singleQuote": true,
147152
"useTabs": true,

src/__tests__/index.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { BlueBase } from '@bluebase/core';
22
import Plugin from '../index';
3-
// import console = require('console');
43

54
test('Plugin should be correctly registered', async () => {
65
const BB = new BlueBase();
76
await BB.Plugins.register(Plugin);
8-
// console.log(BB);
97

108
expect(BB.Plugins.has('@bluebase/plugin-react-navigation')).toBeTruthy();
119
});

src/components/Navigation/Navigation.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useComponent, useTheme } from '@bluebase/core';
22

3-
import { NavigationNativeContainer } from '@react-navigation/native';
3+
import { NavigationContainer } from '@react-navigation/native';
44
import { NavigationProps } from '@bluebase/components';
55
import React from 'react';
66

@@ -11,12 +11,11 @@ import React from 'react';
1111
*/
1212
export const Navigation = (props: NavigationProps) => {
1313
const { navigator, ...rest } = props;
14-
15-
const Navigator = useComponent('Navigator');
1614
const { theme } = useTheme();
15+
const Navigator = useComponent('Navigator');
1716

1817
return (
19-
<NavigationNativeContainer
18+
<NavigationContainer
2019
theme={{
2120
dark: theme.mode === 'dark',
2221

@@ -31,6 +30,6 @@ export const Navigation = (props: NavigationProps) => {
3130
{...rest}
3231
>
3332
<Navigator {...navigator} />
34-
</NavigationNativeContainer>
33+
</NavigationContainer>
3534
);
3635
};

src/components/Navigation/__tests__/Navigation.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { waitForElement } from 'enzyme-async-helpers';
88
describe('Navigation tests', () => {
99
it('should check props', async () => {
1010
const wrapper = mount(<BlueBaseApp plugins={[Plugin]} />);
11-
await waitForElement(wrapper, Navigation);
11+
await waitForElement(wrapper as any, Navigation);
1212
expect(wrapper.find(Navigation).exists()).toBe(true);
1313
});
1414
});

0 commit comments

Comments
 (0)