mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-25 05:18:15 +08:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6232860c5 | ||
|
|
e7028ce75a | ||
|
|
523cf17f8e | ||
|
|
11458a9f73 | ||
|
|
2744c53843 | ||
|
|
4e7f9f07ee | ||
|
|
97016c4498 | ||
|
|
b83c4bb379 | ||
|
|
136db984ee | ||
|
|
de6921061e |
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -15,7 +15,3 @@ The code must pass tests.
|
||||
## Code formatting
|
||||
|
||||
Look around. Match the style of the rest of the codebase. Run `yarn format` before committing.
|
||||
|
||||
## Changelog
|
||||
|
||||
Add an entry under the "Unreleased" heading in [CHANGELOG.md](https://github.com/react-navigation/react-navigation/blob/master/CHANGELOG.md#unreleased) which explains your change.
|
||||
|
||||
336
CHANGELOG.md
336
CHANGELOG.md
@@ -1,336 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Add missing Flow type exports for `ScrollView` and `NavigationContext`
|
||||
|
||||
## [3.11.1]
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fix `navigationOptions` type from `NavigationScreenProp<NavigationRoute>` to `NavigationScreenConfig<Options>`.
|
||||
- Fix missing `isFirstRouteInParent` type in typescript and flow.
|
||||
- Add missing `backTitleVisible` for typescript, `disabled` and `backTitleVisible` for flow definitions in type `HeaderBackButtonProps`
|
||||
- Add missing `keyboardHidesTabBar` for TypeScript to `TabViewConfig.tabBarOptions`
|
||||
- Add missing `unmountInactiveRoutes` for TypeScript to `DrawerNavigatorConfig`
|
||||
|
||||
## [3.11.0]
|
||||
|
||||
## New Features
|
||||
|
||||
- Export `SwitchActions`
|
||||
|
||||
## [3.10.2]
|
||||
|
||||
## Fixes
|
||||
|
||||
- Update Flow types - Add `cardShadowEnabled` and `cardOverlayEnabled` to NavigationStackViewConfig
|
||||
- Upgrade react-navigation-tabs [#5914](https://github.com/react-navigation/react-navigation/issues/5914)
|
||||
|
||||
## [3.10.0] - [2019-05-16](https://github.com/react-navigation/react-navigation/releases/tag/3.10.0)
|
||||
|
||||
## Removed
|
||||
|
||||
- `persistenceKey` no longer automatically saves and restores navigation state using AsyncStorage. Typically this would be a breaking change that would require a major version bump, but because this has always been marked as experimental in the documentation and it is unlikely to impact production apps, we are rolling it in a minor release. `persistenceKey` has been replaced with `persistNavigationState` and `loadNavigationState`. See the diff in docs: https://github.com/react-navigation/react-navigation.github.io/pull/425/files?short_path=b668b1a#diff-b668b1a4201e40b1378036dc012100fe
|
||||
|
||||
## Changed
|
||||
|
||||
- Removed animations from stack on web
|
||||
- Ensure that headerMode is float by default on web
|
||||
|
||||
## Fixes
|
||||
|
||||
- Prevent transitionConfig's useNativeDriver value being overwritten. (https://github.com/react-navigation/stack/commit/8b2af7d94209d4658abd8d799bc78744a1004b4e)
|
||||
- Update typescript with headerLeftContainerStyle and headerRightContainerStyle
|
||||
- Update typescript - Add `safeAreaInset` to `BottomTabBarProps`
|
||||
- Update typescript - `TabBarTop` is now `MaterialTopTabBar`
|
||||
- Update typescript - Remove `SwitchNavigator`, `TabNavigator` and `StackNavigator`. Added exports for `SceneView` and `SwitchRouter`
|
||||
- Update typescript - `getLabel` is now `getLabelText` in BottomTabProps and TopTabProps
|
||||
- Silence deprecated lifecycle warning in Stack Transitioner
|
||||
|
||||
## [3.9.0] - [2019-04-23](https://github.com/react-navigation/react-navigation/releases/tag/3.9.0)
|
||||
|
||||
## Fixes
|
||||
|
||||
- Remove `createTabNavigator` from type definitions
|
||||
- Add missing types for `DrawerNavigatorConfig`
|
||||
- Use `preserveFocus` action param rather than matching on specific action types to determine if index needs to be updated if child router changes (https://github.com/react-navigation/react-navigation-core/pull/56)
|
||||
|
||||
## [3.8.1] - [2019-04-12](https://github.com/react-navigation/react-navigation/releases/tag/3.8.1)
|
||||
|
||||
## Changed
|
||||
|
||||
- Add missing type for `enableURLHandling` to TypeScript definition (#5803)
|
||||
- Update Flow types (#5806)
|
||||
|
||||
## [3.8.0] - [2019-04-12](https://github.com/react-navigation/react-navigation/releases/tag/3.8.0)
|
||||
|
||||
## Fixes
|
||||
|
||||
- `onRefresh` on exported lists `FlatList` and `SectionList` works as expected now (no need to add `refreshControl` prop explicitly)
|
||||
- On Android, the exported `ScrollView` is now same as the React Native ScrollView (but with scroll-to-top behavior added), whereas on iOS we still use react-native-gesture-handler ScrollView. We can change Android back to react-native-gesture-handler ScrollView when https://github.com/kmagiera/react-native-gesture-handler/issues/560 is resolved.
|
||||
- Look for `scrollResponderScrollTo` function in our ScrollView, in react-native 0.59 the interface appears to have changed for FlatList such that this is needed. (react-navigation-native#20)
|
||||
|
||||
## Changed
|
||||
|
||||
- Stack header style improvements for web (react-navigation-stack#104)
|
||||
|
||||
## [3.7.1] - [2019-04-10](https://github.com/react-navigation/react-navigation/releases/tag/3.7.1)
|
||||
|
||||
## Fixes
|
||||
|
||||
- Update Flow types (#5800 and #5801)
|
||||
- More open `navigationOptions` types for bottom tab navigator config (#5796)
|
||||
- Fix hit slop for bottom tab bar (react-navigation-tabs#110)
|
||||
|
||||
## Added
|
||||
|
||||
- Add accessibility role and state to bottom bar (react-navigation-tabs#90)
|
||||
- Hide tab bar when keyboard is shown (react-navigation-tabs#112)
|
||||
- Specify default values for getAccessibilityX on tabs (react-navigation-tabs##116)
|
||||
- Add a isFirstRouteInParent method to navigation object (react-navigation-core#51)
|
||||
|
||||
## [3.6.1] - [2019-04-02](https://github.com/react-navigation/react-navigation/releases/tag/3.6.1)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Move event subscriptions to constructor in `withNavigationFocus` to ensure initial `didFocus` event is received.
|
||||
|
||||
## [3.6.0] - [2019-03-31](https://github.com/react-navigation/react-navigation/releases/tag/3.6.0)
|
||||
|
||||
## Added
|
||||
|
||||
- Export TabBarIconProps, TabBarLabelProps, DrawerIconProps, DrawerLabelProps, ScreenProps and InitialLayout.
|
||||
- Add `disabled` prop to HeaderBackButton
|
||||
- Add `StackViewTransitionConfigs.NoAnimation`
|
||||
- Add `drawerContainerStyle` to navigator config for drawer navigator
|
||||
|
||||
## [3.5.1] - [2019-03-19](https://github.com/react-navigation/react-navigation/releases/tag/3.5.1)
|
||||
|
||||
## Added
|
||||
|
||||
- Export StackGestureContext and DrawerGestureContext
|
||||
- Add missing type for withOrientation
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fix header HeaderBackButton title TypeScript type
|
||||
|
||||
## [3.5.0] - [2019-03-19](https://github.com/react-navigation/react-navigation/releases/tag/3.5.0)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed types for `BottomTabBar`
|
||||
- export `NavigationContext` type
|
||||
|
||||
## Changed
|
||||
|
||||
- Make 'react-native-gesture-handler' a peer dependency rather than a hard dependency
|
||||
|
||||
## [3.4.1] - [2019-03-16](https://github.com/react-navigation/react-navigation/releases/tag/3.4.1)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fix missing TypeScript definitions file in release package
|
||||
|
||||
## [3.4.0] - [2019-03-15](https://github.com/react-navigation/react-navigation/releases/tag/3.4.0)
|
||||
|
||||
## Added
|
||||
|
||||
- TypeScript type definition now included in the project.
|
||||
- Better support for react-native-web in core and stack.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Default key to null in stack reset action (https://github.com/react-navigation/react-navigation-core/commit/59238160d86284a3353d53af10688fcf3f36004f)
|
||||
- Fix header back button label and title label scaling. Defaults to false. (https://github.com/react-navigation/react-navigation-stack/commit/c1f1dff465e9eebe274a08e274cf10570045fa23)
|
||||
|
||||
## Changed
|
||||
|
||||
- Remove react-lifecycles-compat from @react-navigation/core
|
||||
- NavigationPlayground uses TypeScript
|
||||
|
||||
## [3.3.2] - [2019-02-25](https://github.com/react-navigation/react-navigation/releases/tag/3.3.2)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Updated Flow types (https://github.com/react-navigation/react-navigation/commit/d3040e52b39bc8e91ffc1354d9c5f8c096baf597)
|
||||
|
||||
## [3.3.1] - [2019-02-25](https://github.com/react-navigation/react-navigation/releases/tag/3.3.1)
|
||||
|
||||
## Fixed
|
||||
|
||||
- SafeAreaView bottom inset on iPhone XR and XS fixed. (https://github.com/react-navigation/react-navigation/issues/5625)
|
||||
|
||||
## [3.3.0] - [2019-02-16](https://github.com/react-navigation/react-navigation/releases/tag/3.3.0)
|
||||
|
||||
## Added
|
||||
|
||||
- Pass through `drawerOpenProgress` to drawer content component (https://github.com/react-navigation/react-navigation-drawer/pull/40)
|
||||
|
||||
## [3.2.3] - [2019-02-09](https://github.com/react-navigation/react-navigation/releases/tag/3.2.3)
|
||||
|
||||
## Fixed
|
||||
|
||||
- `await` the result of `onTransitionStart` before starting the transition (https://github.com/react-navigation/react-navigation-stack/pull/79)
|
||||
|
||||
## [3.2.2]
|
||||
|
||||
- Oops, I skipped it. Nothing here.
|
||||
|
||||
## [3.2.1] - [2019-02-09](https://github.com/react-navigation/react-navigation/releases/tag/3.2.1)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Remove accidental console.log
|
||||
|
||||
## [3.2.0] - [2019-02-08](https://github.com/react-navigation/react-navigation/releases/tag/3.2.0)
|
||||
|
||||
## Added
|
||||
|
||||
- Add support for `backBehavior: history'` and `backBehavior: 'order'` to any navigator based on SwitchRouter (eg: tab navigators). (https://github.com/react-navigation/react-navigation-core/pull/31)
|
||||
|
||||
## [3.1.5] - [2019-02-06](https://github.com/react-navigation/react-navigation/releases/tag/3.1.5)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Revert "Transparent header measurement fix (https://github.com/react-navigation/react-navigation-stack/pull/71)"
|
||||
|
||||
## [3.1.4] - [2019-02-05](https://github.com/react-navigation/react-navigation/releases/tag/3.1.4)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fix references to onGestureFinish in StackViewLayout, should be onGestureEnd
|
||||
|
||||
## [3.1.3] - [2019-02-04](https://github.com/react-navigation/react-navigation/releases/tag/3.1.3)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Stack navigator properly dismisses and restores keyboard when gesture starts and is cancelled
|
||||
- Transparent header measurement fix (https://github.com/react-navigation/react-navigation-stack/pull/71)
|
||||
|
||||
## [3.1.2] - [2019-02-01](https://github.com/react-navigation/react-navigation/releases/tag/3.1.2)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Update flow definition for `withNavigation` and `withNavigationFocus` to support `defaultProps`
|
||||
- Prevent onRef callback be called twice on withNavigationFocus components (https://github.com/react-navigation/react-navigation-core/pull/30)
|
||||
- Bump react-navigation-drawer version to improve performance - if you use Expo, you will need expo@^32.0.3 to update!
|
||||
|
||||
## [3.0.9] - [2018-12-19](https://github.com/react-navigation/react-navigation/releases/tag/3.0.9)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Intermittent flicker when changing tabs while using react-native-screens fixed by not changing opacity (https://github.com/react-navigation/react-navigation-tabs/pull/80)
|
||||
- Prevent fading the previous screen on push/pop on Android (https://github.com/react-navigation/react-navigation-stack/pull/73)
|
||||
|
||||
## [3.0.8] - [2018-12-08](https://github.com/react-navigation/react-navigation/releases/tag/3.0.8)
|
||||
|
||||
## Changed
|
||||
|
||||
- Lock create-react-context to 0.2.2
|
||||
|
||||
## [3.0.7] - [2018-12-08](https://github.com/react-navigation/react-navigation/releases/tag/3.0.7)
|
||||
|
||||
## Changed
|
||||
|
||||
- Optimize stack gesture to avoid a setState and reduce unnecessary Animated node creation (https://github.com/react-navigation/react-navigation-stack/pull/70)
|
||||
|
||||
## [3.0.6] - [2018-12-06](https://github.com/react-navigation/react-navigation/releases/tag/3.0.6)
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fix drawer accessibility label when drawer label is not a string
|
||||
|
||||
## [3.0.5] - [2018-12-03](https://github.com/react-navigation/react-navigation/releases/tag/3.0.5)
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fix crash in rare case where onNavigationStateChange on container leads to setState and container has screenProps (https://github.com/react-navigation/react-navigation/issues/5301)
|
||||
- Expose underlaying ScrollView methods to NavigationAwareScrollable (https://github.com/react-navigation/react-navigation-native/pull/8)
|
||||
|
||||
## [3.0.4] - [2018-11-30](https://github.com/react-navigation/react-navigation/releases/tag/3.0.4)
|
||||
|
||||
## Changed
|
||||
|
||||
- Lock dependencies to exact versions
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fix crash when screenInterpolator is null (https://github.com/react-navigation/react-navigation-stack/issues/64)
|
||||
- Fix renderPager override (https://github.com/react-navigation/react-navigation-tabs/pull/70)
|
||||
|
||||
## Added
|
||||
|
||||
- Accessibility labels on drawer items (https://github.com/react-navigation/react-navigation-drawer/pull/30)
|
||||
|
||||
## [3.0.3] - [2018-11-30](https://github.com/react-navigation/react-navigation/releases/tag/3.0.3)
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fix bug where if you navigate immediately when the navigator is first mounted the stack could get in an invalid state.
|
||||
- Transparent stack card factors in header height now, even though you probably won't want to use this.
|
||||
- Fix bug where shadow was still rendered on transparent stack
|
||||
- Fix gestureResponseDistance custom values being ignored for modal stack
|
||||
|
||||
## [3.0.2] - [2018-11-27](https://github.com/react-navigation/react-navigation/releases/tag/3.0.2)
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fix `drawerLockMode` on drawer navigator
|
||||
- Fix RTL support in drawer navigator
|
||||
|
||||
## [3.0.1] - [2018-11-26](https://github.com/react-navigation/react-navigation/releases/tag/3.0.1)
|
||||
|
||||
## Fixes
|
||||
|
||||
- fix NavigationTestUtils.js deprecated file import.
|
||||
- Update `getParam` flow typings to check `key` and `fallback` arguments, as well as return the correct type automatically.
|
||||
- Fix regression in backgroundColor on cardStyle for stack navigator.
|
||||
|
||||
## [3.0.0] - [2018-11-17](https://github.com/react-navigation/react-navigation/releases/tag/3.0.0)
|
||||
|
||||
- Changes between the latest 2.x release and 3.0.0 are listed on the blog at https://reactnavigation.org/blog/2018/11/17/react-navigation-3.0.html
|
||||
|
||||
# [Previous major versions]
|
||||
|
||||
- [2.x](https://github.com/react-navigation/react-navigation/blob/2.x/CHANGELOG.md)
|
||||
|
||||
[Unreleased]: Fixed NavigationStackScreenOptions types by adding headerTitleContainerStyle
|
||||
[Unreleased]: https://github.com/react-navigation/react-navigation/compare/3.10.0...HEAD
|
||||
[3.10.0]: https://github.com/react-navigation/react-navigation/compare/3.10.0...3.9.0
|
||||
[3.9.0]: https://github.com/react-navigation/react-navigation/compare/3.8.1...3.9.0
|
||||
[3.8.1]: https://github.com/react-navigation/react-navigation/compare/3.8.0...3.8.1
|
||||
[3.8.0]: https://github.com/react-navigation/react-navigation/compare/3.7.1...3.8.0
|
||||
[3.7.1]: https://github.com/react-navigation/react-navigation/compare/3.6.1...3.7.1
|
||||
[3.6.1]: https://github.com/react-navigation/react-navigation/compare/3.6.0...3.6.1
|
||||
[3.6.0]: https://github.com/react-navigation/react-navigation/compare/3.5.1...3.6.0
|
||||
[3.5.1]: https://github.com/react-navigation/react-navigation/compare/3.5.0...3.5.1
|
||||
[3.5.0]: https://github.com/react-navigation/react-navigation/compare/3.4.1...3.5.0
|
||||
[3.4.1]: https://github.com/react-navigation/react-navigation/compare/3.4.0...3.4.1
|
||||
[3.4.0]: https://github.com/react-navigation/react-navigation/compare/3.3.2...3.4.0
|
||||
[3.3.2]: https://github.com/react-navigation/react-navigation/compare/3.3.1...3.3.2
|
||||
[3.3.1]: https://github.com/react-navigation/react-navigation/compare/3.3.0...3.3.1
|
||||
[3.3.0]: https://github.com/react-navigation/react-navigation/compare/3.2.3...3.3.0
|
||||
[3.2.3]: https://github.com/react-navigation/react-navigation/compare/3.2.1...3.2.3
|
||||
[3.2.1]: https://github.com/react-navigation/react-navigation/compare/3.2.0...3.2.1
|
||||
[3.2.0]: https://github.com/react-navigation/react-navigation/compare/3.1.5...3.2.0
|
||||
[3.1.5]: https://github.com/react-navigation/react-navigation/compare/3.1.4...3.1.5
|
||||
[3.1.4]: https://github.com/react-navigation/react-navigation/compare/3.1.3...3.1.4
|
||||
[3.1.3]: https://github.com/react-navigation/react-navigation/compare/3.1.2...3.1.3
|
||||
[3.1.2]: https://github.com/react-navigation/react-navigation/compare/3.0.9...3.1.2
|
||||
[3.0.9]: https://github.com/react-navigation/react-navigation/compare/3.0.8...3.0.9
|
||||
[3.0.8]: https://github.com/react-navigation/react-navigation/compare/3.0.7...3.0.8
|
||||
[3.0.7]: https://github.com/react-navigation/react-navigation/compare/3.0.6...3.0.7
|
||||
[3.0.6]: https://github.com/react-navigation/react-navigation/compare/3.0.5...3.0.6
|
||||
[3.0.5]: https://github.com/react-navigation/react-navigation/compare/3.0.4...3.0.5
|
||||
[3.0.4]: https://github.com/react-navigation/react-navigation/compare/3.0.3...3.0.4
|
||||
[3.0.3]: https://github.com/react-navigation/react-navigation/compare/3.0.2...3.0.3
|
||||
[3.0.2]: https://github.com/react-navigation/react-navigation/compare/3.0.1...3.0.2
|
||||
[3.0.1]: https://github.com/react-navigation/react-navigation/compare/3.0.0...3.0.1
|
||||
[3.0.0]: https://github.com/react-navigation/react-navigation/compare/2.x...3.0.0
|
||||
@@ -17,6 +17,10 @@ See: https://reactnavigation.org/docs/en/getting-started.html
|
||||
* The [Community Resources](https://github.com/react-navigation/react-navigation/blob/master/COMMUNITY_RESOURCES.md) document lists some other resources submitted to us by people who use React Navigation. Feel free to open a pull request to add your resource to the list.
|
||||
* You can contribute improvements to the documentation [in the website repository](https://github.com/react-navigation/react-navigation.github.io).
|
||||
|
||||
## Changelog
|
||||
|
||||
The changes for each release are outlined on [the Github releases page](https://github.com/react-navigation/react-navigation/releases).
|
||||
|
||||
## Try it out
|
||||
|
||||
You can also try out the [Navigation Playground app](https://exp.host/@react-navigation/NavigationPlayground) to get a sense for some of the tools built in to React Navigation. The "Fundamentals" in the documentation also include examples you can play with.
|
||||
@@ -45,4 +49,4 @@ This library has adopted a Code of Conduct that we expect project participants t
|
||||
|
||||
## License
|
||||
|
||||
React Navigation is licensed under the [BSD 2-clause "Simplified" License](https://github.com/react-community/react-navigation/blob/master/LICENSE).
|
||||
React Navigation is licensed under the [MIT](https://github.com/react-community/react-navigation/blob/master/LICENSE).
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import { StatusBar } from 'react-native';
|
||||
import {
|
||||
NavigationScreenProp,
|
||||
NavigationState,
|
||||
SafeAreaView,
|
||||
Themed,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
|
||||
@@ -30,7 +30,7 @@ class HomeScreen extends React.Component<NavScreenProps> {
|
||||
title="Push screen with no header"
|
||||
/>
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go Home" />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class OtherScreen extends React.Component<NavScreenProps> {
|
||||
/>
|
||||
<Button onPress={() => pop()} title="Pop" />
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class ScreenWithLongTitle extends React.Component<NavScreenProps> {
|
||||
<SafeAreaView style={{ paddingTop: 30 }}>
|
||||
<Button onPress={() => pop()} title="Pop" />
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class ScreenWithNoHeader extends React.Component<NavScreenProps> {
|
||||
<Button onPress={() => push('Other')} title="Push another screen" />
|
||||
<Button onPress={() => pop()} title="Pop" />
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import React from 'react';
|
||||
import { StatusBar, Text, View } from 'react-native';
|
||||
import { NavigationScreenProp, NavigationState } from 'react-navigation';
|
||||
import { Text, View } from 'react-native';
|
||||
import {
|
||||
NavigationScreenProp,
|
||||
NavigationState,
|
||||
Themed,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
|
||||
@@ -27,7 +31,7 @@ class HomeScreen extends React.Component<Props, any> {
|
||||
title="Go back to other examples"
|
||||
onPress={() => this.props.navigation.goBack(null)}
|
||||
/>
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { StatusBar, Text } from 'react-native';
|
||||
import { Text } from 'react-native';
|
||||
import {
|
||||
Themed,
|
||||
NavigationScreenProp,
|
||||
NavigationState,
|
||||
SafeAreaView,
|
||||
@@ -52,7 +53,7 @@ class MyNavScreen extends React.Component<Props> {
|
||||
))}
|
||||
</SafeAreaView>
|
||||
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@ import React from 'react';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
AsyncStorage,
|
||||
StatusBar,
|
||||
StyleSheet,
|
||||
View,
|
||||
Platform,
|
||||
} from 'react-native';
|
||||
import { createSwitchNavigator } from 'react-navigation';
|
||||
import { Themed, createSwitchNavigator } from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
|
||||
@@ -24,7 +23,7 @@ class SignInScreen extends React.Component<any, any> {
|
||||
title="Go back to other examples"
|
||||
onPress={() => this.props.navigation.goBack(null)}
|
||||
/>
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -45,7 +44,7 @@ class HomeScreen extends React.Component<any, any> {
|
||||
<View style={styles.container}>
|
||||
<Button title="Show me more of the app" onPress={this.showMoreApp} />
|
||||
<Button title="Actually, sign me out :)" onPress={this.signOutAsync} />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -74,7 +73,7 @@ class OtherScreen extends React.Component<any, any> {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Button title="I'm done, sign me out" onPress={this.signOutAsync} />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -105,7 +104,7 @@ class LoadingScreen extends React.Component<any, any> {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<ActivityIndicator />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-navigation",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.2",
|
||||
"description": "Routing and navigation for your React Native apps",
|
||||
"main": "src/react-navigation.js",
|
||||
"types": "typescript/react-navigation.d.ts",
|
||||
|
||||
@@ -52,7 +52,7 @@ module.exports = {
|
||||
|
||||
get DrawerGestureContext() {
|
||||
throwError(
|
||||
'`DrawerGestureContext` has been moved to `react-navigation-drawe`',
|
||||
'`DrawerGestureContext` has been moved to `react-navigation-drawer`',
|
||||
'stack-navigator'
|
||||
);
|
||||
},
|
||||
@@ -68,7 +68,7 @@ module.exports = {
|
||||
|
||||
get DrawerActions() {
|
||||
throwError(
|
||||
'`DrawerActions` has been moved to `react-navigation-drawe`',
|
||||
'`DrawerActions` has been moved to `react-navigation-drawer`',
|
||||
'drawer-navigator'
|
||||
);
|
||||
},
|
||||
|
||||
108
typescript/react-navigation.d.ts
vendored
108
typescript/react-navigation.d.ts
vendored
@@ -33,7 +33,6 @@
|
||||
|
||||
declare module 'react-navigation' {
|
||||
import * as React from 'react';
|
||||
import { PanGestureHandler } from 'react-native-gesture-handler';
|
||||
|
||||
import {
|
||||
Animated,
|
||||
@@ -50,14 +49,10 @@ declare module 'react-navigation' {
|
||||
// @todo: should we re-export from RNGH? not currently exposed through it
|
||||
export { FlatList, SectionList, ScrollView } from 'react-native';
|
||||
|
||||
export type ScreenProps = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
// @todo - any..
|
||||
export function getActiveChildNavigationOptions<S>(
|
||||
navigation: NavigationProp<S>,
|
||||
screenProps?: ScreenProps,
|
||||
screenProps?: unknown,
|
||||
theme?: SupportedThemes
|
||||
): NavigationParams;
|
||||
|
||||
@@ -138,7 +133,7 @@ declare module 'react-navigation' {
|
||||
|
||||
export type NavigationScreenOptionsGetter<Options> = (
|
||||
navigation: NavigationScreenProp<NavigationRoute<any>>,
|
||||
screenProps: ScreenProps | null,
|
||||
screenProps: unknown | null,
|
||||
theme: SupportedThemes
|
||||
) => Options;
|
||||
|
||||
@@ -173,6 +168,13 @@ declare module 'react-navigation' {
|
||||
|
||||
getComponentForState: (state: State) => NavigationComponent;
|
||||
|
||||
getActionCreators: (
|
||||
route: NavigationRoute,
|
||||
key: string
|
||||
) => {
|
||||
[key: string]: () => NavigationAction;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the screen navigation options for a given screen.
|
||||
*
|
||||
@@ -194,13 +196,9 @@ declare module 'react-navigation' {
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
}
|
||||
|
||||
export type NavigationScreenOptions = NavigationStackScreenOptions &
|
||||
NavigationTabScreenOptions &
|
||||
NavigationDrawerScreenOptions;
|
||||
|
||||
export interface NavigationScreenConfigProps {
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
screenProps: ScreenProps;
|
||||
screenProps: unknown;
|
||||
theme: SupportedThemes;
|
||||
}
|
||||
|
||||
@@ -255,6 +253,7 @@ declare module 'react-navigation' {
|
||||
|
||||
export interface NavigationBackActionPayload {
|
||||
key?: string | null;
|
||||
immediate?: boolean;
|
||||
}
|
||||
|
||||
export interface NavigationBackAction extends NavigationBackActionPayload {
|
||||
@@ -280,6 +279,7 @@ declare module 'react-navigation' {
|
||||
|
||||
export interface NavigationInitAction extends NavigationInitActionPayload {
|
||||
type: 'Navigation/INIT';
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface NavigationReplaceActionPayload {
|
||||
@@ -300,6 +300,7 @@ declare module 'react-navigation' {
|
||||
|
||||
export interface NavigationCompleteTransitionActionPayload {
|
||||
key?: string;
|
||||
toChildKey?: string;
|
||||
}
|
||||
|
||||
export interface NavigationCompleteTransitionAction {
|
||||
@@ -333,6 +334,7 @@ declare module 'react-navigation' {
|
||||
|
||||
export interface NavigationPopAction extends NavigationPopActionPayload {
|
||||
type: 'Navigation/POP';
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface NavigationPopToTopActionPayload {
|
||||
@@ -374,6 +376,16 @@ declare module 'react-navigation' {
|
||||
params?: NavigationParams;
|
||||
}
|
||||
|
||||
export interface NavigationDrawerOpenedAction {
|
||||
key?: string;
|
||||
type: 'Navigation/DRAWER_OPENED';
|
||||
}
|
||||
|
||||
export interface NavigationDrawerClosedAction {
|
||||
key?: string;
|
||||
type: 'Navigation/DRAWER_CLOSED';
|
||||
}
|
||||
|
||||
export interface NavigationOpenDrawerAction {
|
||||
key?: string;
|
||||
type: 'Navigation/OPEN_DRAWER';
|
||||
@@ -392,19 +404,19 @@ declare module 'react-navigation' {
|
||||
/**
|
||||
* Switch Navigator
|
||||
*/
|
||||
|
||||
export interface SwitchRouter extends NavigationRouter {}
|
||||
|
||||
export interface NavigationSwitchRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
defaultNavigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
order?: string[];
|
||||
backBehavior: 'none' | 'initialRoute' | 'history' | 'order'; // defaults to 'none'
|
||||
backBehavior?: 'none' | 'initialRoute' | 'history' | 'order'; // defaults to 'none'
|
||||
resetOnBlur?: boolean; // defaults to `true`
|
||||
}
|
||||
|
||||
export function SwitchRouter(
|
||||
routeConfigs: NavigationRouteConfigMap,
|
||||
config?: NavigationSwitchRouterConfig
|
||||
): NavigationRouter<any, any>;
|
||||
|
||||
export type NavigationStackAction =
|
||||
| NavigationInitAction
|
||||
@@ -424,6 +436,8 @@ declare module 'react-navigation' {
|
||||
| NavigationBackAction;
|
||||
|
||||
export type NavigationDrawerAction =
|
||||
| NavigationDrawerOpenedAction
|
||||
| NavigationDrawerClosedAction
|
||||
| NavigationOpenDrawerAction
|
||||
| NavigationCloseDrawerAction
|
||||
| NavigationToggleDrawerAction;
|
||||
@@ -435,7 +449,8 @@ declare module 'react-navigation' {
|
||||
| NavigationStackAction
|
||||
| NavigationTabAction
|
||||
| NavigationDrawerAction
|
||||
| NavigationSwitchAction;
|
||||
| NavigationSwitchAction
|
||||
| { type: 'CHILD_ACTION'; key?: string };
|
||||
|
||||
export type NavigationRouteConfig =
|
||||
| NavigationComponent
|
||||
@@ -458,7 +473,7 @@ declare module 'react-navigation' {
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:strict-export-declare-modifiers
|
||||
interface NavigationTabRouterConfigBase {
|
||||
interface NavigationTabRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
@@ -466,18 +481,6 @@ declare module 'react-navigation' {
|
||||
backBehavior?: 'none' | 'initialRoute' | 'history' | 'order'; // defaults to 'initialRoute'
|
||||
resetOnBlur?: boolean;
|
||||
}
|
||||
export interface NavigationTabRouterConfig
|
||||
extends NavigationTabRouterConfigBase {
|
||||
defaultNavigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
navigationOptions?: NavigationScreenConfig<any>;
|
||||
}
|
||||
export interface NavigationBottomTabRouterConfig
|
||||
extends NavigationTabRouterConfigBase {
|
||||
defaultNavigationOptions?: NavigationScreenConfig<
|
||||
NavigationBottomTabScreenOptions
|
||||
>;
|
||||
navigationOptions?: NavigationScreenConfig<any>;
|
||||
}
|
||||
|
||||
export interface NavigationRouteConfigMap {
|
||||
[routeName: string]: NavigationRouteConfig;
|
||||
@@ -581,7 +584,7 @@ declare module 'react-navigation' {
|
||||
theme?: SupportedThemes | 'no-preference';
|
||||
detached?: boolean;
|
||||
navigation?: NavigationProp<S>;
|
||||
screenProps?: ScreenProps;
|
||||
screenProps?: unknown;
|
||||
navigationOptions?: O;
|
||||
}
|
||||
|
||||
@@ -614,7 +617,7 @@ declare module 'react-navigation' {
|
||||
persistNavigationState?: (state: NavigationState) => Promise<any>;
|
||||
|
||||
renderLoadingExperimental?: React.ComponentType;
|
||||
screenProps?: ScreenProps;
|
||||
screenProps?: unknown;
|
||||
navigationOptions?: O;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
}
|
||||
@@ -636,7 +639,7 @@ declare module 'react-navigation' {
|
||||
): NavigationContainerComponent;
|
||||
|
||||
router: NavigationRouter<any, any>;
|
||||
screenProps: ScreenProps;
|
||||
screenProps: unknown;
|
||||
navigationOptions: any;
|
||||
state: { nav: NavigationState | null };
|
||||
}
|
||||
@@ -714,7 +717,7 @@ declare module 'react-navigation' {
|
||||
): NavigationReplaceAction;
|
||||
|
||||
function completeTransition(
|
||||
payload: NavigationCompleteTransitionActionPayload
|
||||
payload?: NavigationCompleteTransitionActionPayload
|
||||
): NavigationCompleteTransitionAction;
|
||||
}
|
||||
|
||||
@@ -746,15 +749,13 @@ declare module 'react-navigation' {
|
||||
*/
|
||||
export function StackRouter(
|
||||
routeConfigs: NavigationRouteConfigMap,
|
||||
config: NavigationTabRouterConfig
|
||||
config?: NavigationTabRouterConfig
|
||||
): NavigationRouter<any, any>;
|
||||
|
||||
export interface NavigationStackRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
defaultNavigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
navigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
initialRouteKey?: string;
|
||||
}
|
||||
|
||||
@@ -763,11 +764,14 @@ declare module 'react-navigation' {
|
||||
*
|
||||
* @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js
|
||||
*/
|
||||
export interface NavigationDescriptor<Params = NavigationParams> {
|
||||
export interface NavigationDescriptor<
|
||||
Params = NavigationParams,
|
||||
Options = {}
|
||||
> {
|
||||
key: string;
|
||||
state: NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
|
||||
navigation: NavigationScreenProp<any>;
|
||||
options: NavigationScreenOptions;
|
||||
options: Options;
|
||||
getComponent: () => React.ComponentType;
|
||||
}
|
||||
|
||||
@@ -775,7 +779,7 @@ declare module 'react-navigation' {
|
||||
{
|
||||
descriptors: { [key: string]: NavigationDescriptor };
|
||||
navigationConfig: O;
|
||||
screenProps?: ScreenProps;
|
||||
screenProps?: unknown;
|
||||
} & NavigationInjectedProps
|
||||
>;
|
||||
|
||||
@@ -820,7 +824,7 @@ declare module 'react-navigation' {
|
||||
Options = any
|
||||
> {
|
||||
navigation: NavigationScreenProp<NavigationRoute<Params>, Params>;
|
||||
screenProps?: ScreenProps;
|
||||
screenProps?: unknown;
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
}
|
||||
|
||||
@@ -838,6 +842,11 @@ declare module 'react-navigation' {
|
||||
isLandscape: boolean;
|
||||
}
|
||||
|
||||
export function createKeyboardAwareNavigator<Props>(
|
||||
Comp: React.ComponentType<Props>,
|
||||
stackConfig: object
|
||||
): React.ComponentType<Props>;
|
||||
|
||||
export function withOrientation<P extends NavigationOrientationInjectedProps>(
|
||||
Component: React.ComponentType<P>
|
||||
): React.ComponentType<Omit<P, keyof NavigationOrientationInjectedProps>>;
|
||||
@@ -869,6 +878,10 @@ declare module 'react-navigation' {
|
||||
T & { onRef?: React.Ref<React.Component<T & NavigationInjectedProps<P>>> }
|
||||
>;
|
||||
|
||||
export const NavigationProvider: React.ComponentType<{
|
||||
value: NavigationProp<any>;
|
||||
}>;
|
||||
|
||||
export interface NavigationFocusInjectedProps<P = NavigationParams>
|
||||
extends NavigationInjectedProps<P> {
|
||||
isFocused: boolean;
|
||||
@@ -921,17 +934,22 @@ declare module 'react-navigation' {
|
||||
NavigationScreenProp<NavigationRoute>
|
||||
>;
|
||||
|
||||
export function createKeyboardAwareNavigator<Props>(
|
||||
Comp: React.ComponentType<Props>,
|
||||
stackConfig: object
|
||||
): React.ComponentType<Props>;
|
||||
|
||||
/**
|
||||
* SceneView
|
||||
*/
|
||||
|
||||
export interface SceneViewProps {
|
||||
component: React.ComponentType;
|
||||
screenProps: ScreenProps;
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
screenProps: unknown;
|
||||
navigation: NavigationProp<any>;
|
||||
}
|
||||
|
||||
export class SceneView extends React.Component {}
|
||||
export const SceneView: React.ComponentType<SceneViewProps>;
|
||||
|
||||
/**
|
||||
* Themes
|
||||
|
||||
Reference in New Issue
Block a user