Skip to content

Commit 8bad7a2

Browse files
committed
Add prettier and update video styling
1 parent 471350b commit 8bad7a2

File tree

287 files changed

+2056
-2006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+2056
-2006
lines changed

.github/workflows/autofix.yml

+3
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@ jobs:
2424
- name: Fix lint issues
2525
run: yarn markdownlint-cli2-fix
2626

27+
- name: Prettify code
28+
run: yarn prettier --write .
29+
2730
- name: Autofix
2831
uses: autofix-ci/action@8106fde54b877517c9af2c3d68918ddeaa7bed64

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
.yarn

.prettierrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
"tabWidth": 2,
44
"trailingComma": "es5",
55
"useTabs": false
6-
}
6+
}

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.codeActionsOnSave": ["source.organizeImports", "source.fixAll"]
3+
}

blog/2018-04-06-react-navigation-2.0-rc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ In 1.x, functions on the `navigation` were not contextual - they would be the sa
5555

5656
Given that we only exposed generic helpers (`navigate`, `goBack`) and helpers specific to the stack in 1.x, this would only impact you if you attempted to use the stack helpers from outside of a stack. For example, if you had a tab navigator with a stack in tab A and just a plain screen in tab B, then tried to `push` a route from the screen in tab B, `push` would not be available. Keep this in mind when you update your app if it follows this type of structure.
5757

58-
One of the big improvements you get from this is that you can now add your own helpers to the `navigation` prop! Read more in [RFC 6](https://github.com/react-navigation/rfcs/blob/master/text/0006-action-creators.md).
58+
One of the big improvements you get from this is that you can now add your own helpers to the `navigation` prop! Read more in [RFC 6](https://github.com/react-navigation/rfcs/blob/master/text/0006-action-creators.md).
5959

6060
## Deprecations
6161

blog/2018-05-07-react-navigation-2.0.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The following changes are considered “trivial” because you will only need ma
5151

5252
### Drawer routes have been replaced with actions
5353

54-
Rather than opening a drawer with `navigation.navigate(‘DrawerOpen’)`, you can now call `navigation.openDrawer()`. Other methods are `closeDrawer()` and `toggleDrawer()`. See [pull 3618](https://github.com/react-navigation/react-navigation/pull/3618).
54+
Rather than opening a drawer with `navigation.navigate(‘DrawerOpen’)`, you can now call `navigation.openDrawer()`. Other methods are `closeDrawer()` and `toggleDrawer()`. See [pull 3618](https://github.com/react-navigation/react-navigation/pull/3618).
5555

5656
### Navigation actions API overhaul
5757

@@ -61,7 +61,7 @@ In 1.x, functions on the `navigation` were not contextual - they would be the sa
6161

6262
Given that we only exposed generic helpers (`navigate`, `goBack`) and helpers specific to the stack in 1.x, this would only impact you if you attempted to use the stack helpers from outside of a stack. For example, if you had a tab navigator with a stack in tab A and just a plain screen in tab B, then tried to `push` a route from the screen in tab B, `push` would not be available. Keep this in mind when you update your app if it follows this type of structure.
6363

64-
One of the big improvements you get from this is that you can now add your own helpers to the `navigation` prop! Read more in [RFC 6](https://github.com/react-navigation/rfcs/blob/master/text/0006-action-creators.md) and in [pull 3392](https://github.com/react-navigation/react-navigation/pull/3392).
64+
One of the big improvements you get from this is that you can now add your own helpers to the `navigation` prop! Read more in [RFC 6](https://github.com/react-navigation/rfcs/blob/master/text/0006-action-creators.md) and in [pull 3392](https://github.com/react-navigation/react-navigation/pull/3392).
6565

6666
### NavigationActions no longer have `toString()` implementations ([related](https://github.com/react-navigation/react-navigation/issues/4072))
6767

@@ -85,24 +85,24 @@ It is worth noting additionally that `createBottomTabNavigator` is different fro
8585

8686
## Enhancements
8787

88-
* dangerouslyGetParent and dismiss helpers on navigation prop ([3669](https://github.com/react-navigation/react-navigation/pull/3669))
89-
* State persistence - automatically save state and reload it when the app restarts ([3716](https://github.com/react-navigation/react-navigation/pull/3716))
90-
* Smoothly transition header visibility in Stack ([3821](https://github.com/react-navigation/react-navigation/pull/3821))
91-
* Add initialRouteKey for StackRouter ([3540](https://github.com/react-navigation/react-navigation/pull/3540))
92-
* Make StackNavigator keyboard aware -- it hides automatically when you start to swipe back, and refocuses if you cancel the swipe back gesture ([3951](https://github.com/react-navigation/react-navigation/pull/3951))
93-
* Allow modification of SafeAreaView props in header ([3496](https://github.com/react-navigation/react-navigation/pull/3496))
94-
* Add `createMaterialBottomTabNavigator` for a material design style tab bar. (see [react-navigation-tabs](https://github.com/react-navigation/react-navigation-tabs)).
95-
* Use findIndex instead of map/indexOf in StateUtils ([commit](https://github.com/react-navigation/react-navigation/commit/47fe858d4ec339d2b1f4b96f3a5444aed8f6f900)
96-
* Warn when users have multiple stateful navigation containers ([commit](https://github.com/react-navigation/react-navigation/commit/68a2a106f370003dc1d46385fd8b5992be189ee2))
97-
* Remove almost all uses of React 16 deprecated lifecycle methods ([commit](https://github.com/react-navigation/react-navigation/commit/3f837c895e823de4d528b55fd70ee7ba167480d8))
98-
* Add `activeLabelStyle` and `inactiveLabelStyle` for `DrawerItem` ([commit](https://github.com/react-navigation/react-navigation/commit/7c488c8d4974028f85a4c5171d27209fa099170f))
88+
- dangerouslyGetParent and dismiss helpers on navigation prop ([3669](https://github.com/react-navigation/react-navigation/pull/3669))
89+
- State persistence - automatically save state and reload it when the app restarts ([3716](https://github.com/react-navigation/react-navigation/pull/3716))
90+
- Smoothly transition header visibility in Stack ([3821](https://github.com/react-navigation/react-navigation/pull/3821))
91+
- Add initialRouteKey for StackRouter ([3540](https://github.com/react-navigation/react-navigation/pull/3540))
92+
- Make StackNavigator keyboard aware -- it hides automatically when you start to swipe back, and refocuses if you cancel the swipe back gesture ([3951](https://github.com/react-navigation/react-navigation/pull/3951))
93+
- Allow modification of SafeAreaView props in header ([3496](https://github.com/react-navigation/react-navigation/pull/3496))
94+
- Add `createMaterialBottomTabNavigator` for a material design style tab bar. (see [react-navigation-tabs](https://github.com/react-navigation/react-navigation-tabs)).
95+
- Use findIndex instead of map/indexOf in StateUtils ([commit](https://github.com/react-navigation/react-navigation/commit/47fe858d4ec339d2b1f4b96f3a5444aed8f6f900)
96+
- Warn when users have multiple stateful navigation containers ([commit](https://github.com/react-navigation/react-navigation/commit/68a2a106f370003dc1d46385fd8b5992be189ee2))
97+
- Remove almost all uses of React 16 deprecated lifecycle methods ([commit](https://github.com/react-navigation/react-navigation/commit/3f837c895e823de4d528b55fd70ee7ba167480d8))
98+
- Add `activeLabelStyle` and `inactiveLabelStyle` for `DrawerItem` ([commit](https://github.com/react-navigation/react-navigation/commit/7c488c8d4974028f85a4c5171d27209fa099170f))
9999

100100
## Bugfixes
101101

102-
* Avoid unnecessary navigation completion dispatches ([3902](https://github.com/react-navigation/react-navigation/pull/3902))
103-
* Use Header.HEIGHT instead of measuring to avoid flicker ([3940](https://github.com/react-navigation/react-navigation/pull/3940))
104-
* Implement paths on `SwitchRouter` ([commit](https://github.com/react-navigation/react-navigation/commit/5e4512f3ebef587bf90e4ec4d660708b72a0a865)).
105-
* `SwitchRouter` now returns `null` on idempotent navigation ([commit](https://github.com/react-navigation/react-navigation/commit/577d99c1658ef85c061c82d55bf349c38e161e97)).
102+
- Avoid unnecessary navigation completion dispatches ([3902](https://github.com/react-navigation/react-navigation/pull/3902))
103+
- Use Header.HEIGHT instead of measuring to avoid flicker ([3940](https://github.com/react-navigation/react-navigation/pull/3940))
104+
- Implement paths on `SwitchRouter` ([commit](https://github.com/react-navigation/react-navigation/commit/5e4512f3ebef587bf90e4ec4d660708b72a0a865)).
105+
- `SwitchRouter` now returns `null` on idempotent navigation ([commit](https://github.com/react-navigation/react-navigation/commit/577d99c1658ef85c061c82d55bf349c38e161e97)).
106106

107107
## Final notes
108108

blog/2018-11-01-react-navigation-3.0-rc.md

+46-37
Original file line numberDiff line numberDiff line change
@@ -46,40 +46,46 @@ const App = createAppContainer(MainNavigator);
4646

4747
This should be an easy change - import `createAppContainer` in the root of your app and use it to wrap the root navigator.
4848

49-
> **Warning**: if you have any custom navigators, you may have used `createNavigationContainer`, you can remove this now because it’s only used at the root of the app and provided by the user.
49+
> **Warning**: if you have any custom navigators, you may have used `createNavigationContainer`, you can remove this now because it’s only used at the root of the app and provided by the user.
5050
5151
### Renamed navigationOptions in navigator configuration
5252

5353
When configuring navigators it’s often useful to pass in default navigation options for the screens inside of that navigator. For example in a stack you might want to set a background color and tint color for each screen. Previously, you would write something like this:
5454

5555
```js
56-
const Home = createStackNavigator({
57-
Feed: ExampleScreen,
58-
Profile: ExampleScreen,
59-
}, {
60-
navigationOptions: {
61-
headerTintColor: '#fff',
62-
headerStyle: {
63-
backgroundColor: '#000',
56+
const Home = createStackNavigator(
57+
{
58+
Feed: ExampleScreen,
59+
Profile: ExampleScreen,
60+
},
61+
{
62+
navigationOptions: {
63+
headerTintColor: '#fff',
64+
headerStyle: {
65+
backgroundColor: '#000',
66+
},
6467
},
6568
}
66-
});
69+
);
6770
```
6871

6972
As of this release, `navigationOptions` in navigator configuration like this has been renamed to `defaultNavigationOptions`.
7073

7174
```js
72-
const Home = createStackNavigator({
73-
Feed: ExampleScreen,
74-
Profile: ExampleScreen,
75-
}, {
76-
defaultNavigationOptions: {
77-
headerTintColor: '#fff',
78-
headerStyle: {
79-
backgroundColor: '#000',
80-
},
75+
const Home = createStackNavigator(
76+
{
77+
Feed: ExampleScreen,
78+
Profile: ExampleScreen,
8179
},
82-
});
80+
{
81+
defaultNavigationOptions: {
82+
headerTintColor: '#fff',
83+
headerStyle: {
84+
backgroundColor: '#000',
85+
},
86+
},
87+
}
88+
);
8389
```
8490

8591
Sometimes you need to configure the `navigationOptions` for a navigator itself. Typically you’d do something like this:
@@ -91,20 +97,23 @@ Home.navigationOptions = { tabBarLabel: 'Home!' };
9197
As of this release, you can use `navigationOptions` in the navigator config for this instead.
9298

9399
```js
94-
const Home = createStackNavigator({
95-
Feed: ExampleScreen,
96-
Profile: ExampleScreen,
97-
}, {
98-
defaultNavigationOptions: {
99-
headerTintColor: '#fff',
100-
headerStyle: {
101-
backgroundColor: '#000',
102-
},
100+
const Home = createStackNavigator(
101+
{
102+
Feed: ExampleScreen,
103+
Profile: ExampleScreen,
103104
},
104-
navigationOptions: {
105-
tabBarLabel: 'Home!',
106-
},
107-
});
105+
{
106+
defaultNavigationOptions: {
107+
headerTintColor: '#fff',
108+
headerStyle: {
109+
backgroundColor: '#000',
110+
},
111+
},
112+
navigationOptions: {
113+
tabBarLabel: 'Home!',
114+
},
115+
}
116+
);
108117

109118
const Tabs = createBottomTabNavigator({ Home });
110119
```
@@ -132,7 +141,7 @@ const Store = createStackNavigator({
132141

133142
- Basic support for hooks in `react-navigation-hooks`
134143
- `headerBackgroundTransitionPreset: 'toggle' | 'fade' | 'translate'` lets you choose how to transition your custom `headerBackground` components between screens.
135-
- Add options to opt in/out of the stack card overlay and shadow that are visible during transitions: `cardShadowEnabled` defaults to `true` and `cardOverlayEnabled` defaults to `false`.
144+
- Add options to opt in/out of the stack card overlay and shadow that are visible during transitions: `cardShadowEnabled` defaults to `true` and `cardOverlayEnabled` defaults to `false`.
136145
- Export `StackGestureContext` and `DrawerGestureContext` from react-navigation-stack and react-navigation-drawer, so you can use the ref from the corresponding gestures with other gesture handlers (eg: [GestureInteraction.js](https://github.com/react-navigation/react-navigation-drawer/blob/bf4bdba7f6a4fbc12192f5d5ba2285f6280431b7/example/src/GestureInteraction.js)).
137146

138147
## Assorted fixes & improvements
@@ -171,7 +180,7 @@ To keep the experience as simple as possible the `react-navigation` package will
171180

172181
Now that the core of React Navigation can be used outside of React Native, we can provide first-class web support to anyone using React.js on the web, including those who do not want to use `react-native-web`.
173182

174-
Here is an example web app which demonstrates the new `createBrowserApp` container and the built-in `Link` component:
183+
Here is an example web app which demonstrates the new `createBrowserApp` container and the built-in `Link` component:
175184

176185
```js
177186
import { createSwitchNavigator } from "@react-navigation/core";
@@ -209,10 +218,10 @@ export default App;
209218
```
210219
211220
The above `Link` tag will render to:
212-
`<a href=``"``/profile/Brent?view=photos``"``>Brent's Photos</a>`
221+
`<a href=``"``/profile/Brent?view=photos``"``>Brent's Photos</a>`
213222
214223
See a simple web app with Create React App [here](https://github.com/react-navigation/example-web). Or take a look at [this razzle app](https://github.com/react-navigation/web-server-example) for a more complicated example including server rendering.
215224
216-
----------
225+
---
217226
218227
Thanks for reading, please post any issues you encounter to [react-navigation/issues](https://github.com/react-navigation/react-navigation/issues)!

blog/2020-01-29-using-react-navigation-5-with-react-native-paper.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ const Header = ({ scene, previous, navigation }) => {
366366
options.headerTitle !== undefined
367367
? options.headerTitle
368368
: options.title !== undefined
369-
? options.title
370-
: scene.route.name;
369+
? options.title
370+
: scene.route.name;
371371

372372
return (
373373
<Appbar.Header theme={{ colors: { primary: theme.colors.surface } }}>
@@ -385,8 +385,7 @@ const Header = ({ scene, previous, navigation }) => {
385385
<Avatar.Image
386386
size={40}
387387
source={{
388-
uri:
389-
'https://pbs.twimg.com/profile_images/952545910990495744/b59hSXUd_400x400.jpg',
388+
uri: 'https://pbs.twimg.com/profile_images/952545910990495744/b59hSXUd_400x400.jpg',
390389
}}
391390
/>
392391
</TouchableOpacity>
@@ -688,7 +687,7 @@ import { Notifications } from './notifications';
688687

689688
const Tab = createMaterialBottomTabNavigator();
690689

691-
export const BottomTabs = props => {
690+
export const BottomTabs = (props) => {
692691
// Get a name of current screen
693692
const routeName = getFocusedRouteNameFromRoute(route) ?? 'Feed';
694693
const isFocused = useIsFocused();
@@ -874,7 +873,7 @@ export default function Main() {
874873

875874
function toggleTheme() {
876875
// We will pass this function to Drawer and invoke it on theme switch press
877-
setIsDarkTheme(isDark => !isDark);
876+
setIsDarkTheme((isDark) => !isDark);
878877
}
879878

880879
return (

blog/2020-02-06-react-navigation-5.0.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author_image_url: https://avatars1.githubusercontent.com/u/29647600?s=200&v=4
77
tags: [release, announcement]
88
---
99

10-
Exactly two years ago, we published the first stable version of React Navigation. Throughout this time, the library has been actively developed by adding many new features and bug fixes. The essence of React Navigation was that it was a project that was to become not only a project of individual programmers adapting it to their requirements, but a community as a whole, hence the emphasis on versatility, extensibility, and the tendency to reconsider the assumptions if there were such needs. Thanks to this, the Library has been undergoing metamorphosis of both incremental and completely reorganized shape.
10+
Exactly two years ago, we published the first stable version of React Navigation. Throughout this time, the library has been actively developed by adding many new features and bug fixes. The essence of React Navigation was that it was a project that was to become not only a project of individual programmers adapting it to their requirements, but a community as a whole, hence the emphasis on versatility, extensibility, and the tendency to reconsider the assumptions if there were such needs. Thanks to this, the Library has been undergoing metamorphosis of both incremental and completely reorganized shape.
1111

1212
<!--truncate-->
1313

@@ -68,7 +68,7 @@ navigation.setOptions({
6868
}}
6969
/>
7070
),
71-
})
71+
});
7272
```
7373

7474
It can be used for things like adding a button in the header which needs to interact with the screen state.

blog/2020-05-16-web-support.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The first step for web support is to have proper URL integration. This means:
2525
- Buttons that navigate to other screens in the app should be links, and users should be able use standard shortcuts with them
2626

2727
<video playsInline autoPlay muted loop style={{ maxWidth: '100%', marginBottom: 32 }}>
28+
2829
<source src="/assets/blog/web-support/url-integration.mp4" type="video/mp4" />
2930
</video>
3031

@@ -42,7 +43,7 @@ const linking = {
4243
Home: '',
4344
Profile: ':id/profile',
4445
Settings: ':id/blog',
45-
}
46+
},
4647
},
4748
};
4849

@@ -96,6 +97,7 @@ Phones have small screens, so it's important to maximize the use of available sc
9697
It's especially important in case of the [stack navigator](/docs/stack-navigator) because not only we have the browser's address bar, but also the header at the top which is taking vertical space. Now we'll automatically adjust the styles of the stack navigator to get this behavior without you having to write any special code.
9798
9899
<video playsInline autoPlay muted loop style={{ maxWidth: '100%' }}>
100+
99101
<source src="/assets/blog/web-support/hide-addressbar.mp4" type="video/mp4" />
100102
</video>
101103
@@ -104,6 +106,7 @@ It's especially important in case of the [stack navigator](/docs/stack-navigator
104106
Another way we can make maximum use of the available screen size is by making our UIs adapt to different screen sizes. For example, we may want to show a sidebar for navigation on large screens while switching to a drawer on smaller screens. You can now specify `drawerType` as `permanent` to show an always visible sidebar. See the [documentation for `drawerType`](/docs/drawer-navigator#drawertype) for example code on how to achieve it.
105107
106108
<video playsInline autoPlay muted loop style={{ maxWidth: '100%' }}>
109+
107110
<source src="/assets/blog/web-support/permanent-drawer.mp4" type="video/mp4" />
108111
</video>
109112

blog/2021-03-12-react-navigation-6.0-next.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author_image_url: https://avatars2.githubusercontent.com/u/1174278?s=200&v=4
77
tags: [release, announcement]
88
---
99

10-
We're excited to announce that we finally have a prerelease version of React Navigation 6. We released React Navigation 5 more than half a year ago, and it brought a lot of new possibilities with the new dynamic API, and was met with overwhelmingly positive reaction. Since then, we've been working on incremental improvements and refinements to the library and thinking about how to make it even better. This brings us to the next major version of React Navigation.
10+
We're excited to announce that we finally have a prerelease version of React Navigation 6. We released React Navigation 5 more than half a year ago, and it brought a lot of new possibilities with the new dynamic API, and was met with overwhelmingly positive reaction. Since then, we've been working on incremental improvements and refinements to the library and thinking about how to make it even better. This brings us to the next major version of React Navigation.
1111

1212
<!--truncate-->
1313

0 commit comments

Comments
 (0)