Compare commits

...

926 Commits

Author SHA1 Message Date
Brent Vatne
d746a587b0 Release 2.11.2 2018-08-03 15:45:27 -07:00
Brent Vatne
dee03c839a Undo pathUtils rename 2018-08-03 15:33:38 -07:00
Brent Vatne
2104bf1a04 Release 2.11.1 2018-08-03 14:48:49 -07:00
Brent Vatne
4e2a409dca Fix a couple of exports and export a few more modules 2018-08-03 14:47:43 -07:00
Brent Vatne
51bfe8dd19 Release 2.11.0 2018-08-03 14:17:24 -07:00
Brent Vatne
04a4512c1b Export modules useful for moving stack navigator outside of core 2018-08-03 14:16:57 -07:00
Brent Vatne
4a5da86ce0 Release 2.10.0 2018-08-02 13:03:34 -07:00
Brent Vatne
a118122aed Update react-navigation-[tabs&drawer] 2018-08-02 13:02:01 -07:00
Justin Parker
a94f89ffe1 Fixes bug where null doesn't work in routerOptions paths object for deeplinking (#4791)
* Add test for handling null path set on router

* Allow null paths on the router config

Previously if you specified `null` in the router `paths`, the logic would actually fall back to the `path` specified on the route, which is especially bad if the latter is undefined, because then the path would be set as the default of the routeName.
2018-08-01 01:12:49 -07:00
Brent Vatne
9d77fd6d54 Add NavigationTestUtils and release 2.9.3 2018-07-26 15:49:34 -07:00
Brent Vatne
13cf4497ee Release 2.9.2 2018-07-25 11:52:39 -07:00
Tim Wang
9175118383 Export StackViewTransitionConfigs (#4761)
* export StackViewTransitionConfigs

* Add changelogs
2018-07-25 11:50:07 -07:00
Simone D'Avico
6fc21250ec Fix typo in header transition preset check (uitkit -> uikit) (#4757) 2018-07-25 11:49:24 -07:00
Yevhen
714d5eab6b Error when building with haul: ref to pathToRegexp.compile (#4658)
Error in source code that cause problem on react native using haul https://puu.sh/AT1uZ/158623d5a4.png
2018-07-25 20:28:05 +02:00
Brent Vatne
67233dc9ef Release 2.9.1 2018-07-24 10:49:56 -07:00
Brent Vatne
b0443c1861 Move more logs behind debug flag in stack playground 2018-07-24 10:47:59 -07:00
Brent Vatne
c0b637df52 Fix title offfset calculation 2018-07-24 10:47:02 -07:00
Brent Vatne
9a82706fba Fix snapshots 2018-07-20 14:44:26 -07:00
Brent Vatne
d973a26edb Release 2.9.0 2018-07-20 14:33:27 -07:00
Brent Vatne
852e7e1974 Respect custom background color in header wrapper 2018-07-20 14:30:38 -07:00
Brent Vatne
cd3707d64b Add headerLayoutPreset, add config for back button title visibility and make it have reasonable defaults, better back button ripple on Android (#4588) 2018-07-20 14:12:39 -07:00
Brent Vatne
3c36db455f Release 2.8.0 2018-07-19 15:48:09 -07:00
Brent Vatne
ec52c884c5 Update NavigationPlayground to Expo SDK 28 2018-07-19 15:46:24 -07:00
Brent Vatne
c4b3f25a0f Cleanup unused descriptors and handle the case where we might expect to have a descriptor but do not (#4723) 2018-07-19 13:16:38 -07:00
Eric Vicenti
93642e16e7 Fix createNavigator leak of old descriptors 2018-07-19 12:41:14 -07:00
Eric Vicenti
1a76556290 Fix leak in createNavigator
Previous descriptors had been retained because this binding caused `this.prevState` to remain referenced. This binds the component getter to null instead.
2018-07-19 12:21:22 -07:00
Reza Ghorbani
12b21f052e added header container styles to be customized (#4331) 2018-07-18 15:14:08 -07:00
Brent Vatne
c1f07dc167 Release 2.7.0 2018-07-17 15:50:18 -07:00
Brent Vatne
bc04b31d01 Add border for transparent header in example 2018-07-17 15:43:22 -07:00
Eric Vicenti
35307c70be Improve empty path and param handling (#4671)
* Overhaul Path handling

* Another test for deep link
2018-07-17 13:51:20 -07:00
Brent Vatne
7e3f4f3bec Fix tests 2018-07-17 13:49:12 -07:00
Brent Vatne
cbd0958e6f Remove unnecessary style array 2018-07-17 13:36:16 -07:00
Brent Vatne
cab4d71a5e Fix edge case where route was in nav state but never actually graduated to scene 2018-07-17 13:36:16 -07:00
Kenza Iraki
108ac0e2a9 Set borderBottom to transparent and of size 0 if headerTransparent is true (#4701) 2018-07-16 16:32:14 -07:00
Brent Vatne
fa4fdb9c57 Fix onTransitionStart config not being invoked with keyboard aware navigator, and use prop over config when available 2018-07-16 15:13:25 -07:00
Brent Vatne
ebdd2da79f Pull onTransitionStart from navigationConfig, fixes #4100 2018-07-16 14:55:34 -07:00
Matteo Codogno
1fe11c100e Fix #4608 - remove header left component only when a headerLeft optio… (#4679)
* Fix #4608 - remove header left component only when a headerLeft option is not specified

* Update CHANGELOG.md
2018-07-12 11:42:56 -07:00
Eric Vicenti
c4b84f1d66 Fix container referene to startup state data 2018-07-12 11:01:11 -07:00
Michael Lefkowitz
69f394be5b Feat/allow keyless replace (#4636)
* allow key to be undefined on StackNavigation.replace method

* added tests for replace action w/out key

* fix typo

* updated changelog

* updated teests for clarity

* added length check on routes to safely fallthrough to search
2018-07-10 23:41:42 -07:00
Eric Vicenti
316e4991ac Add enableURLHandling to navigation container 2018-07-10 14:47:57 -07:00
Ashoat Tevosyan
805064cb5e [flow] Make NavigationRoute types exact (#4667)
React Native 0.56 introduces Flow 0.75, which makes it impossible to refine `NavigationRoute` based on the presence of `index` or `routes` properties.

This PR turns `NavigationStateRoute` and `NavigationLeafRoute` into exact types, which addresses this issue.
2018-07-10 13:59:09 -07:00
Dariusz Łuksza
8f199980cb Fix changelog (#4651)
Fixes 2.6.1 header link
2018-07-06 20:21:00 -07:00
Brent Vatne
37ca6a92ca Release 2.6.2 2018-07-06 10:44:30 -07:00
Brent Vatne
980e0409dc Temporarily remove warnings on vertical padding in header 2018-07-06 10:42:32 -07:00
Brent Vatne
a00ba5918a Default to 0 elevation on transparent header 2018-07-05 15:17:08 -07:00
Brent Vatne
ad6b25cff9 Fix 2.6.1 changelog 2018-07-05 15:07:17 -07:00
Brent Vatne
a69b67d6d2 Release 2.6.1 2018-07-05 15:03:14 -07:00
Brent Vatne
dc436e4d01 Warn for more invalid header styles 2018-07-05 15:02:48 -07:00
Brent Vatne
fe95bdeee6 Fix regression for shadow in header on Android 2018-07-05 14:53:41 -07:00
Brent Vatne
525528e38f Release 2.6.0 2018-07-04 13:04:00 -07:00
liuqiang1357
9f5f3d994c Fix bug: params not be passed to navigator inside SwitchNavigator (#4306) 2018-07-04 12:28:01 -07:00
Eric Vicenti
e8c1833053 Fix stack router child router delegation priority (#4635)
Stack router had some aggressive logic for deferring to inactive child routers. The child router behavior should come after all of the appropriate stack actions, with the exception of the active child router.

This was causing issues such as https://github.com/react-navigation/react-navigation/issues/4623 , where inactive tab navigators would handle the back action, and cause the stack to attempt to  pop back to it.
2018-07-03 21:18:25 -07:00
Eric Vicenti
0921889f7a Avoid crash when calling isFocused on old route (#4634) 2018-07-03 12:03:54 -07:00
Sébastien Lorber
1951a3ac46 Add <NavigationEvents/> component (#4188)
* add NavigationEvents

* expose TabsWithNavigationEvents in lib entrypoints

* Add NavigationEvents example in playground

* Add NavigationEvents example in playground

* Add NavigationEvents tests

* Add NavigationEvents Flow declarations

* remove useless NavigationEvents constructor

* NavigationEvents => make tests more readable by avoiding beforeEach callback

* fix flow test error by adding <any, any> to React.Component
2018-06-29 07:34:11 -07:00
Eric Vicenti
4e384f8057 Routers: Deep Linking Overhaul (#4590)
* deep linking overhaul

* clean up PlatformHelpers

this had previously been required for old versions of react native and react-native-web
2018-06-29 07:27:12 -07:00
Eric Vicenti
3d06d19d6a clean up PlatformHelpers (#4586)
this had previously been required for old versions of react native and react-native-web
2018-06-28 10:02:52 -07:00
Brent Vatne
30ef5ef72b Release 2.5.5 2018-06-27 18:12:59 -07:00
Brent Vatne
c7fff52408 Delegate to child routers for more than just the top screen in the stack (#4587)
* Delegate to child routers for more than just the top screen in the stack. Fixes #4185

* Add CHANGELOG entry
2018-06-27 17:37:30 -07:00
Brent Vatne
bc01a4cd57 Throw error in development mode when title is not a string 2018-06-27 17:35:29 -07:00
Brent Vatne
cad3d70aed Update react-navigation-drawer to 0.4.3 2018-06-27 17:27:58 -07:00
Brent Vatne
bb5719f438 Throw an error when header is invalid 2018-06-27 17:22:00 -07:00
Brent Vatne
3dd3f5b804 Release 2.5.4 2018-06-27 15:24:34 -07:00
Julian Paas
3d8d5a0634 Adds getNavigation to web exports (#4551) 2018-06-27 13:34:45 -07:00
Brent Vatne
54448ed070 Prevent flicker in header when header is null on initial mount (when using default header sizes) (#4577)
* Prevent flicker in header in most common cases. Fixes https://github.com/react-navigation/react-navigation/issues/4264

* Update snapshots
2018-06-26 13:27:43 -07:00
Julian Paas
369ac2b568 Adds SwitchNavigator to react-navigation-web (#4550)
* Adds SwitchNavigator to react-navigation-web
2018-06-26 11:24:23 -07:00
Vojtech Novak
3dc592f679 Update ISSUE_TEMPLATE.md (#4575) 2018-06-25 15:41:56 -07:00
Brent Vatne
4f93200c91 Release 2.5.3 2018-06-25 14:37:26 -07:00
Brent Vatne
665736d754 Hoist navigation action creators for router above those for child router 2018-06-25 14:33:01 -07:00
Brent Vatne
5598c3e28f Update changelog 2018-06-23 11:03:38 -07:00
Brent Vatne
cde6e845cd Release 2.5.2 2018-06-23 11:02:14 -07:00
Brent Vatne
fb8c712ad8 Update react-navigation-drawer to 0.4.2 to fix toggle regression 2018-06-23 11:01:47 -07:00
Brent Vatne
350b7e0aed Release 2.5.1 2018-06-22 13:21:22 -07:00
Brent Vatne
de112565d3 Fix name of prop, should be lastTransitionProps instead of prevTransitionProps in StackViewLayout
- Fixes #4542
2018-06-22 13:18:26 -07:00
Brent Vatne
acdd515c13 Update example app.json 2018-06-22 12:50:50 -07:00
Rodrigo Bermúdez Schettino
452a6d2004 Improve changelog format (#4559)
Bug fixes should be listed in the "Fixed" section instead of "Changed" according to keepachangelog.
2018-06-22 10:41:58 -07:00
Brent Vatne
08c8031a71 Release 2.5.0 2018-06-22 10:32:11 -07:00
Eric Vicenti
608365266a @ericvicenti/universe (#4493)
* Isolate modules for uncontainerized navigators

* Clean up prop-types

* Fix warnings and web import friendlyness

* strip a flow

* Standalone provider/consumer navigation context

* export shallowEqual as module

* address various lint

# Conflicts:
#	src/navigators/createStackNavigator.js

* Get tests to pass
2018-06-22 10:20:27 -07:00
Rodrigo Bermúdez Schettino
247fba56e6 Fix typo in Pull Request Template (#4558)
Also link to the "Unreleased" section in CHANGELOG.
2018-06-22 10:19:41 -07:00
Brent Vatne
060f5dcecf Update PR template for changelog 2018-06-22 08:25:38 -07:00
Rodrigo Bermúdez Schettino
fdec05c87a Create CHANGELOG.md (#4544)
List all changes between versions to notify about notable changes in releases.
2018-06-22 08:22:15 -07:00
Brent Vatne
76da804574 Fixes #4491 2018-06-21 15:24:52 -07:00
Brent Vatne
dde091848a Release 2.4.1 2018-06-20 15:35:07 -07:00
Brent Vatne
824fa32416 Improve playground on Android 2018-06-20 14:20:00 -07:00
Brent Vatne
c518e7f36c Improve example 2018-06-20 13:51:34 -07:00
Brent Vatne
1cfe01dbdb Release 2.4.0 2018-06-20 13:38:05 -07:00
Brent Vatne
e62a9050fd Fix withDefaultValue 2018-06-20 13:37:33 -07:00
Christophe Hurpeau
310b909ba8 createNavigationContainer: rethrow the error instead of creating a new one (#4533)
Creating a new error makes the stack unreadable in sentry, because the stack is stringified when the error is cast to string to create a new one.
Is there another reason to do that ?
Alternative possible solution would be to add a method to be able to handle the error ourselves ?
2018-06-20 13:03:02 -07:00
Eric Vicenti
aebe8a5c23 Fix isTransitioning on nested navigate (#4520)
This bug wasnt apparent until we fixed the transitioner to fully respect isTransitioning. The router did not handle this properly until now.

Enhanced a test to verify this in the future
2018-06-20 12:17:14 -07:00
Vladislav Shabanov
e1df2c6c4a Make headers of non-standard heights work correctly in StackNavigator when header is null (Fixes #4208) (#4353)
* Measure header height dynamically

* Add comment

* StacksOverTopTabs playground example
2018-06-15 08:10:43 -07:00
Ashoat Tevosyan
fa86718a24 Revert "Export getNavigationActionCreators (#4258)" (#4495)
This reverts commit 1e7d8d55c3.
2018-06-14 11:34:38 -07:00
Ashoat Tevosyan
c8e5673183 [flow] Type getNavigation (#4505)
Unrelated change in here: typing `tabBarOnPress`'s `defaultHandler`. Wasn't sure if I should make a separate PR for a single unrelated line, let me know if you'd prefer that going forward.
2018-06-14 11:33:50 -07:00
Ashoat Tevosyan
b312a5e307 [ReduxExample] Update to use react-navigation-redux-helpers@2.0.0 (#4504) 2018-06-14 11:15:11 -07:00
Brent Vatne
ee6a6c53b1 Fix incorrect methods being called in createKeyboardAwareNavigator 2018-06-13 14:50:03 -07:00
Eric Vicenti
8edec88341 Export getNavigation as public API, test redux (#4489)
This unblocks the fixing of react-navigation-redux-helpers to unbreak redux support in 2.3

https://github.com/react-navigation/react-navigation-redux-helpers/pull/37

All redux users will need to change their code to reflect the changes made here to `ReduxExample/AppNavigator`
2018-06-12 11:59:09 -07:00
Brent Vatne
b8d6d4253d Release 2.3.1 2018-06-12 11:32:08 -07:00
Eric Vicenti
0adb1ba9f1 Export getNavigation as public API, test redux (#4488)
This unblocks the fixing of react-navigation-redux-helpers to unbreak redux support in 2.3

https://github.com/react-navigation/react-navigation-redux-helpers/pull/37

All redux users will need to change their code to reflect the changes made here to `ReduxExample/AppNavigator`
2018-06-12 11:30:23 -07:00
Brent Vatne
d3ef3d1271 Release 2.3.0 2018-06-11 15:54:41 -07:00
k-murakami0609
89a24bdc12 fix broken link to Common mistakes (#4468) 2018-06-10 10:41:18 -07:00
Brent Vatne
128a95b496 Release 2.3.0-beta.1 2018-06-09 14:18:09 -07:00
Brent Vatne
470eaf3b08 Make the actions available on the navigator navigation prop the same as its children (#4467)
* Make the actions available on the navigator navigation prop the same as its children

* Fix test and improve code clarity
2018-06-09 14:13:21 -07:00
Brent Vatne
c91e8206a5 Fix ScenesReducer test 2018-06-08 17:44:32 -07:00
Brent Vatne
da283915f8 Release 2.3.0-beta.0 2018-06-08 17:36:42 -07:00
Brent Vatne
3031e7bd80 Update header when screenProps change (Fixes #4271) 2018-06-08 17:35:17 -07:00
Brent Vatne
98a4f26f26 Bump react-navigation-drawer. Fixes #4416 2018-06-08 16:27:36 -07:00
Brent Vatne
b7f5435c93 Fix withNavigation in non-floating headers 2018-06-08 15:48:21 -07:00
Brent Vatne
21ef4fcb82 Return result of dispatch from action helpers 2018-06-08 14:33:01 -07:00
Eric Vicenti
5f64a2a9cb Refactor redo, child navigation to navigation prop (#4453) 2018-06-08 14:20:07 -07:00
Brent Vatne
992d0fb267 Release 2.2.5 2018-06-08 09:40:39 -07:00
ensecoz
6f41379ed1 extract correct property for onTransitionEnd (#4459) 2018-06-08 09:35:36 -07:00
Tom Klaver
267af01e72 throw readable error when wrong navigation prop is passed (#4455)
* add warning when passing wrong navigation prop: https://github.com/react-navigation/react-navigation/issues/3598

* add test for throwing when passing wrong navigation prop

* wrong nav prop error: update snapshots, throw => throw new, update docs reference url
2018-06-08 09:31:05 -07:00
Arthur Levoyer
b68c3a755d Add missing tests about DeepLinking (#4451)
* Fix #1950 (Deep link not working when nesting have more than two levels.)

* Fix test
2018-06-07 11:37:57 -07:00
Brent Vatne
7345634493 Release 2.2.4 2018-06-07 11:33:14 -07:00
Brent Vatne
6517169119 Re-compute options when screenProps change 2018-06-07 11:31:31 -07:00
Brent Vatne
ea5d14a720 Release 2.2.3 2018-06-06 21:13:00 -07:00
Brent Vatne
313d0726a8 Add some logs to NavigationPlayground around helper dispatch return value
This is a poor substitute for tests
2018-06-06 21:12:18 -07:00
Brent Vatne
b52f153747 Return the result of dispatch from helpers. Fixes #4445 2018-06-06 21:01:51 -07:00
Brent Vatne
44621005ff Release 2.2.2 2018-06-06 14:34:59 -07:00
Brent Vatne
bf58364c3d Bump react-navigation-drawer 2018-06-06 14:34:42 -07:00
Brent Vatne
b55053cde6 Release 2.2.1 2018-06-06 13:24:50 -07:00
Brent Vatne
9abb2644a9 Bump react-navigation-tabs and rebuild yarn.lock 2018-06-06 13:24:29 -07:00
Brent Vatne
6a946d6ab7 Revert "Refactor, move child navigation to navigation prop (#4425)"
This reverts commit ba62509ff4.
2018-06-06 13:19:08 -07:00
陈然
395abe5200 Change 'React' import writing, Prevent warnings in old version React (#4428) 2018-06-06 12:51:09 -07:00
Eric Vicenti
ba62509ff4 Refactor, move child navigation to navigation prop (#4425)
* Refactor, move child navigation to navigation prop

This fixes our descriptor caching issue, and unblocks explicit nested navigation options.

As a side effect, the following APIs are introduced:

- navigation.getChildNavigation(routeKey) , which is useful for explicitly getting children config info
- navigation.router, access to the static router

- router.childRouters[routeName] , an optional way to access the children routers directly. If childRouters are not provided in a router, we will fall back on getComponentForRouteName(routeName).router, which is the previous external API for this (although it may be slower because it will require the whole screen component).

* supporting tests and top level actions

* cleanup
2018-06-06 12:50:30 -07:00
Brent Vatne
45391db7d9 Move all drawer code into react-navigation-drawer (#4435)
* Move all drawer code into react-navigation-drawer

* Remove react-native-drawer-layout-polyfill from package.json
2018-06-06 12:11:28 -07:00
Brent Vatne
7f86362e86 Release 2.2.0 2018-06-05 12:21:09 -07:00
Brent Vatne
99605737e9 Bump react-navigation-tabs to latest 2018-06-05 12:20:47 -07:00
Serge Lebedev
842f5eb7b2 [flow] Fix NavigationScreenComponent's navigationOptions (#4317) 2018-06-05 12:19:12 -07:00
Richárd Biró
183ea82416 Pass getCustomActionCreators to Drawer route (#4433) 2018-06-05 11:12:03 -07:00
Rodrigo Bermúdez Schettino
108a6504a7 Use consistent naming in README (#4427)
Use the same casing (camel case) as in the README's title for the License section.
2018-06-05 10:55:20 -07:00
Eric Vicenti
f92d671746 Fix getCustomActionCreators in drawer navigator 2018-06-05 10:51:05 -07:00
Brent Vatne
e0c4a8f7d3 Release 2.1.0 2018-06-04 14:04:00 -07:00
Rodrigo Bermúdez Schettino
bc881c8aa1 Update deprecated StackNavigator usage (#4389)
Use createStackNavigator instead.
2018-06-04 13:59:55 -07:00
Ashoat Tevosyan
118c19dcce [flow] Update NavigationActions and introduce StackActions and DrawerActions (#4345) 2018-06-04 13:58:14 -07:00
James Bechet
01b43974e6 fix swipe to go back by providing the index (#4409) 2018-06-04 13:55:26 -07:00
Brent Vatne
2f90899620 Cache descriptors in createNavigator (#4424) 2018-06-04 13:54:09 -07:00
Eric Vicenti
6cc86f66e1 Fix stack router state change without isTransitioning change (#4368) 2018-06-04 12:47:40 -07:00
Eric Vicenti
4be99b6645 Transitioner: Fix instantaneous transitions (#4404)
* Transitioner: Fix instantaneous transitions

The transitioner will always perform an animation on state change. Instead we should check if the navigation state is requesting a transition with isTransitioning. If not, we follow a similar codepath to transitioning, without any animation.

* Update .eslintrc
2018-06-04 12:46:08 -07:00
Eric Vicenti
80016b7218 Fix race condition in DrawerView (#4392) 2018-06-03 13:35:55 -07:00
Eric Vicenti
f555a9ec9a Fix drawer router logic to close drawer (#4394) 2018-06-03 13:35:30 -07:00
Brent Vatne
05cbd85d5c Temporarily stop running flow on navigation playground due to internal react-native flow errors 2018-06-01 15:02:12 -07:00
Hunkyo Jung
51965eac38 Pass getCustomActionCreators to StackRouter (#4366) 2018-05-31 19:21:11 -07:00
Brent Vatne
a3956bf3ce Update tab snapshots 2018-05-31 13:53:00 -07:00
Brent Vatne
ce24c66b5a Disable react/no-deprecated to pass CI without breaking old versions of React 2018-05-31 13:47:28 -07:00
Brent Vatne
5467f0e22d Release 2.0.4 2018-05-25 23:05:54 -07:00
Ashoat Tevosyan
1e7d8d55c3 Export getNavigationActionCreators (#4258)
* Export getNavigationActionCreators

`react-navigation-redux-helpers` generally needs to duplicate whatever `createNavigationCreator` does. As of `react-navigation@2.0`, that includes using `getNavigationActionCreators` to construct the top-level `NavigationScreenProp`.

This PR isn't strictly needed, as it's possible to import from the file directly. But that's a brittle approach, and not particularly discoverable for anybody attempting to use a "non-stateful" navigator with their state management library of choice.

* Further refinements after writing the new helper

* Final refinement of NavigationScreenProp's relationship with _DefaultActionCreators

* Resolve merge conflicts
2018-05-25 22:59:11 -07:00
Brent Vatne
1d2ce862c2 Fix Stacks over Tabs example 2018-05-25 16:07:55 -07:00
Louis Lagrange
d778479e4a Fix drawer router initial state (#4219)
* Fix drawer router initial state

* Add test

* Be concise
2018-05-25 16:01:53 -07:00
Sébastien BARBIER
352dae50e1 Apply drawerlockmode from screen options to DrawerLayout component (#4202)
Fix #4201
2018-05-25 15:50:39 -07:00
Louis Lagrange
61385cae59 Export missing Drawer components (#4221) 2018-05-25 15:49:33 -07:00
Brent Vatne
aa3c13891e Bump some versions 2018-05-25 15:26:25 -07:00
Andrei Xavier de Oliveira Calazans
9696d7220d fix(create-nav-container): pass up error on catch (#4298) 2018-05-25 15:13:18 -07:00
Louis Lagrange
2b83b44816 Remove obsolete DrawerScreen (#4222) 2018-05-25 14:45:45 -07:00
Louis Lagrange
ec749023ed [Web] Fix header height margin (#4206) 2018-05-25 14:44:46 -07:00
Sébastien Lorber
adc9389eb3 Add CircleCI Badge to README (#4318)
Displaying a badge is helpful for users but also contributors (for example to know why my upstream-rebased PR is not passing tests)
2018-05-25 14:41:27 -07:00
Sébastien Lorber
54d143fee2 Fix Codecov link -> react-community vs react-navigation (#4319) 2018-05-25 14:39:51 -07:00
Louis Lagrange
d50e74d0c7 Fix NavigatorContainer test (fixes CI) (#4327) 2018-05-24 17:43:58 +02:00
Nicolas Charpentier
22926c5230 Optimize images (#4251) 2018-05-23 16:54:23 -07:00
Ashoat Tevosyan
f6c47a6c66 [examples] Update ReduxExample (#4267)
Using two new utils:
1. `createNavigationPropConstructor`, which is now preferred over `createReduxBoundAddListener`.
2. `initializeListeners`, which is necessary to trigger the event listeners with the initial state.
2018-05-23 10:20:14 -07:00
Ashoat Tevosyan
046a9f8930 [flow] Make StackRouter action creators optional and add DrawerRouter ones (#4257)
This will force all Flow users to do runtime assertions if they want to use these action creators. Open to any better solutions.
2018-05-23 10:18:35 -07:00
Ashoat Tevosyan
72f17538c2 [flow] Fix tabBarOnPress type for react-navigation@2.0 (#4256) 2018-05-23 10:18:11 -07:00
Ashoat Tevosyan
550001b053 [flow] Fixes for v2 libdef (#4230)
* [flow] Remove "any" type from NavigationComponent

"any" cripples the typechecker, so it's best to avoid. It was introduced in #3392, but I don't think the intention was to keep it there.

* [flow] Remove `any` type from `createNavigator` return

And use objects with spread sub-types instead of unions for `React$ComponentType` type param
2018-05-23 10:17:45 -07:00
Brent Vatne
d168ab26f9 Release 2.0.2 2018-05-21 17:56:24 -07:00
Brent Vatne
99916328a1 Don't warn about multiple navigation containers on Android
This really is not ideal but it's an upstream bug on react-native Android
that we can't work around. Users may experience other unexpected behavior as a
result of this upstream bug.
2018-05-21 17:55:05 -07:00
Eric Vicenti
08e1b53f2e Update playground yarn lockfile 2018-05-12 10:48:45 -07:00
Eric Vicenti
2243528e97 Cache panResponder in StackView (#4183)
* fix swipe gesture bug

* panresponder as instance prop
2018-05-09 17:36:57 -07:00
Steven Kabbes
931271198b Remove unused code addNavigationHelpers (#4179) 2018-05-09 14:53:06 -07:00
Brent Vatne
1876706bad Release 2.0.1 2018-05-08 17:45:02 -07:00
Eric Vicenti
e97d6b26a8 Fix dispatch implementation (#4168)
Previously we had been emiting an action event with a null state when the router handles the action by returning null from getStateForAction.

- Fixes the case of null state getting emitted
- Renames a few things for clarity
- Refactors conditionals to read easier
- Comments to explain intent
2018-05-08 17:41:08 -07:00
Brent Vatne
ec1694f909 Release 2.0.0 2018-05-07 13:47:13 -07:00
Brent Vatne
93db7d0c95 Release 2.0.0-rc.14 2018-05-07 13:03:21 -07:00
Brent Vatne
589b80b2fa Update drawer example 2018-05-07 13:01:22 -07:00
Eric Vicenti
364144d639 Navigation Action Helpers at root (#4151) 2018-05-07 12:56:35 -07:00
Brent Vatne
2fd7284fe2 Release candidate lucky number 13 2018-05-07 11:54:50 -07:00
Brent Vatne
6499f02157 Only blur input when index changes on transition start (Fixes #4148) 2018-05-07 11:47:56 -07:00
Brent Vatne
39d5714ac0 Release 2.0.0-rc.12 2018-05-07 11:14:03 -07:00
Brent Vatne
1ceda5f04d Update react-navigation-deprecated-tab-navigator. Closes #4147 2018-05-07 11:13:34 -07:00
Brent Vatne
4533883ba7 Release 2.0.0-rc.11 2018-05-06 13:41:53 -07:00
spaceye
8ec2466fef Fix for broken swipe back gesture in RTL mode (#4119)
* 3127: Fixed gestureDirectionInverted variable declaration and condition in onPanResponderMove method in regards to swipe back action in RTL mode.

* - 4118: Put axis check first;
- Fixed default BackButton mask in RTL mode.
2018-05-06 12:42:22 -07:00
Brent Vatne
1bd6593ede Release 2.0.0-rc.10 2018-05-06 12:00:02 -07:00
Eric Vicenti
4e8d8ce12f Fixes to drawer router handling of child routers (#4131)
Addresses #4129, and also lets child routers swallow actions with null. Tests added
2018-05-06 11:59:40 -07:00
Eric Vicenti
9f95a7f10b Fix CompletionAction trigger (#4115) 2018-05-06 11:57:51 -07:00
Serge Lebedev
f6bd3e4306 Fix setting undefined value to isTransitioning (#4124) 2018-05-06 10:04:57 -07:00
Eric Vicenti
c1a94895f5 Fix drawer stack reset-to-top behavior (#4132)
“reset” is not a NavigationAction anymore.

The correct fix, for v3, to this is to navigate to the first screen inside the stack. With the less-pushy navigate behavior in v2, this will result in the first route getting selected if you specify it by routeName.
2018-05-06 09:51:18 -07:00
Brent Vatne
ad7cde9eb9 Release 2.0.0-rc.9 2018-05-04 11:16:34 -07:00
Brent Vatne
2643f690a9 Pull createMaterialBottomTabNavigator into separate repo 2018-05-04 11:06:51 -07:00
Brent Vatne
8e52995ef3 Release 2.0.0-rc.8 2018-05-04 10:14:34 -07:00
Eric Vicenti
8ed3817c90 Fix event unsubscription logic (#4116)
Events were getting unsubscribed too early, so that the inner willBlur event was getting skipped when trying to “dismiss” a deep navigation stack.
2018-05-04 10:14:22 -07:00
Brent Vatne
eda9bfd567 Update react-lifecycles-compat 2018-05-04 10:10:28 -07:00
Eric Vicenti
723c5f2149 Fix drawer navigation dispatch (#4121) 2018-05-04 09:48:45 -07:00
Brent Vatne
ab5481a290 Add context around a test in switchrouter 2018-05-03 15:43:37 -07:00
Brent Vatne
df281cfed0 Add router tests to clarify route resolution 2018-05-03 15:42:23 -07:00
Eric Vicenti
e0df3cf74a Fix issue with nested navigation actions in stack (#4114) 2018-05-03 10:13:43 -07:00
Vojtech Novak
2440af66e4 add a test so that #2856 can be closed (#4102)
* add test for 2856

* rename variables
2018-05-02 20:02:03 -07:00
simonbuerger
47fe858d4e StateUtils: Use Array.prototype.findIndex instead of map => indexOf (#4106)
* Use Array.prototype.findIndex instead of map => indexOf

Creating a new array and iterating over all the routes is inefficient compared to findIndex, which does not create a new array and exits as soon as it finds a match. Since the indexOf method is used extensively this should provide a minor performance improvement

* reverted yarn.lock edits
2018-05-02 20:01:20 -07:00
Eric Vicenti
c641bee11b Fix initial action dispatch for nonPersisted apps (#4104) 2018-05-02 09:17:00 -07:00
Brent Vatne
4b39e2db3c Release 2.0.0-rc.7 2018-04-30 17:08:23 -07:00
Eric Vicenti
f7533a790f Add tests to confirm setParam behavior (#4099)
Adding these tests because reports from this issue make me nervous:

https://github.com/react-navigation/react-navigation/issues/1274
2018-04-30 16:37:41 -07:00
Brent Vatne
c56122466f Release 2.0.0-rc.6 2018-04-30 16:19:28 -07:00
Brent Vatne
7fc992dc58 Container state can be out of date if we have async functions between getting it and using it (#4098) 2018-04-30 15:59:49 -07:00
Rob Allsopp
32922cdd7d go back to React$, and fix real error (#4095) 2018-04-30 12:04:48 -07:00
Rob Allsopp
eda51b3b79 Fix missing/incorrect flow types (#4085)
* don’t use private global

* add missing method ‘getParam’ to navigation screen prop

* correct return type for ‘withNavigation’

* add usage of `getParam` method
2018-04-27 14:30:23 -07:00
Jed Mao
921ee09587 Fix "npm test" on Windows 10 (#4066)
* Fix Windows

* update prettier

* Explain need for assetsTransformer in comment
2018-04-27 08:57:07 -07:00
Brent Vatne
7ae4c60eb8 Release 2.0.0-rc.5 2018-04-25 17:49:17 -07:00
Brent Vatne
5fff7ef5c6 Give inactive routes in stack opportunity to handle action (#4064) 2018-04-26 00:48:55 +00:00
Brent Vatne
42bb1cc317 Release 2.0.0-rc.4 2018-04-25 17:04:15 -07:00
Brent Vatne
337fd89ad5 Bump react-navigation-deprecated-tab-navigator 2018-04-25 16:57:42 -07:00
Brent Vatne
acf9b92ff7 Bump react-navigation-tabs 2018-04-25 16:49:57 -07:00
Rich Gilbank
5072130d6f Typo in deprecation notice (#4051) 2018-04-24 11:10:48 -07:00
Brent Vatne
20bbbd62ff Release 2.0.0-rc.3 2018-04-20 17:40:02 +03:00
Adam Miskiewicz
0890896824 Make StackNavigator keyboard aware (#3951)
* Make StackNavigator keyboard aware

One thing that has always annoyed me in React Navigation is the handling of the keyboard. When a keyboard is visible on screen and a navigation action occurs (either by tapping a button or using a gesture), the keyboard tends to stay on screen until the transition completes. This feels janky and broken. On native iOS, for instance, the keyboard hides immediately when the navigation starts, and if the transition is cancelled (say, when the user releases the gesture), the keyboard reappears.

This PR introduces a "KeyboardAwareNavigator" higher order component that is enabled on the StackNavigator, unless a `disableKeyboardHandling` prop is passed into the StackNavigator's configuration.

* Set status bar in keyboard handling example

* Call gesture props in keyboard aware navigator if available

* Fix formatting
2018-04-20 17:03:25 +03:00
Serhii Palash
0cf14f8e1e Fix TabNavigator export ( Issue #3962 ) (#3979) 2018-04-20 16:40:18 +03:00
Brent Vatne
e5e434c9e2 Fix _isRouteFocused so it takes a route and returns bool rather than fn 2018-04-20 16:39:03 +03:00
Janic Duplessis
e5d8d2c216 Fix header hardcoded height to accound for iPhone X and orientation changes (#4017) 2018-04-20 16:34:33 +03:00
Eric Vicenti
abd5200739 Fix header ModularLeftComponent to goBack from child navigation (#4023) 2018-04-20 16:33:36 +03:00
Brent Vatne
202609d9cf Release 2.0.0-rc.2 2018-04-09 17:26:32 -07:00
Yao Hui Chua
7b4dd98255 Shift tests to isolate routers (#3876) 2018-04-09 13:00:01 -07:00
Janic Duplessis
70c644f522 Fix transition between 2 screens with no header (#3939) 2018-04-09 12:32:27 -07:00
Janic Duplessis
5274d16e3b Use Header.HEIGHT instead of measuring to avoid flicker (#3940) 2018-04-09 12:31:43 -07:00
Janic Duplessis
e5e2cbb86d Fix header transition when mode is set to screen (#3927) 2018-04-09 11:22:51 -07:00
Brent Vatne
a8caa0d93c Release 2.0.0-rc.1 2018-04-06 15:14:32 -07:00
Eric Vicenti
f70a25a6a8 drawer router key (#3925) 2018-04-06 15:13:55 -07:00
emision
6cde6e2558 add isFocused helper definition (#3912) 2018-04-06 12:43:51 -07:00
Brent Vatne
0794c0faaa Fix typo in SwitchRouter 2018-04-06 12:42:42 -07:00
Brent Vatne
ea28e84e5a Fix stackConfig typo 2018-04-06 12:39:44 -07:00
Eric Vicenti
419ee5318d custom action creators api (#3923) 2018-04-06 12:12:39 -07:00
Brent Vatne
fbbf00875b Release 2.0.0-beta.10 2018-04-05 14:46:33 -07:00
Brent Vatne
22e09f7186 Prevent double application of navigationOptions function when using RouteName: ScreenName route config 2018-04-05 14:45:41 -07:00
Brent Vatne
ece6297e8e Release 2.0.0-beta.9 2018-04-05 12:09:55 -07:00
Eric Vicenti
ad52caf57b Immediate transition fix, avoid stale render (#3901) 2018-04-05 11:35:16 -07:00
Eric Vicenti
11f5e6e8e5 container initialization fix (#3899) 2018-04-05 11:29:59 -07:00
Eric Vicenti
1764b21f34 fix header back (#3900) 2018-04-05 11:29:15 -07:00
Eric Vicenti
bbacabeba3 avoid unnecessary navigation completion dispatches (#3902) 2018-04-05 11:27:32 -07:00
Eric Vicenti
b140b70555 no more component will mount (#3903) 2018-04-05 11:25:26 -07:00
Eric Vicenti
356646cbfa Enhance replace action creator (#3906) 2018-04-05 11:25:04 -07:00
Brent Vatne
6234b5661e Release 2.0.0-beta.8 2018-04-04 19:34:09 -07:00
Brent Vatne
270c3f0754 Bump react-navigation-tabs dependency 2018-04-04 19:33:51 -07:00
Brent Vatne
6f04bdffa6 Update NavigationPlayground dependencies 2018-04-04 19:33:01 -07:00
Brent Vatne
8415378784 Release 2.0.0-beta.7 2018-04-04 18:37:41 -07:00
Brent Vatne
9e47092d56 Fix isFocused and example 2018-04-04 18:37:08 -07:00
Brent Vatne
029d6ac4d2 Update react-navigation-tabs 2018-04-04 18:17:57 -07:00
Gaëtan Renaudeau
d57d118fda Update Flowtype to support navigation.navigate({}) (#3843) 2018-03-26 17:17:36 -04:00
Brent Vatne
2232e394bb Fix refactoring errors 2018-03-25 19:04:15 -07:00
Eric Vicenti
670d48366b Actions creators overhaul (#3619) 2018-03-25 18:31:59 -07:00
Brent Vatne
99ac5b6c08 Release 2.0.0-beta.6 2018-03-25 12:33:30 -07:00
Brent Vatne
68a2a106f3 Warn when users have multiple stateful navigation containers (#3819)
* First pass at warning when users explicitly render nested navigators

* Clean up tests around warnings

* Update comment

* Update comment again
2018-03-25 12:33:11 -07:00
Gianfrancø Palumbo
b7c6d072a5 fix(redux example readme): link to doc (#3828) 2018-03-25 10:49:22 -07:00
Eric Vicenti
ecd9fd71e9 withNavigation improvement (#3834)
The navigation prop should also pass through, and be prioritized over context because it is more explicit

This also fixes an incorrect warning/invariant
2018-03-25 10:49:09 -07:00
Adam Miskiewicz
cfc9690326 Smoothly transition header visibility in Stack
This closes #2732 (which also happens to be the top issue on canny.io).
2018-03-25 10:27:59 -07:00
Adam Miskiewicz
828e7f2d43 Update react-native-scripts in NavigationPlayground (#3820)
We were pretty far behind in react-native-script versions for the playground, so I updated them.

Test Plan:

Run `yarn`.
2018-03-23 12:25:53 -07:00
Tom Klaver
9c3fffa47f Fix broken link behind PRs Welcome badge (#3824) 2018-03-23 11:23:10 -04:00
Brent Vatne
be524e4224 Release 2.0.0-beta.5
- Update react-navigation-tabs
2018-03-22 20:52:47 -07:00
Brent Vatne
095814230b Release 2.0.0-beta.4 2018-03-22 19:43:47 -07:00
Eric Vicenti
9cf557bba0 State persistence (#3716)
Adds a new state persistence mechanisms to all of the navigators via createNavigationContainer

    There are two new props that you can provide to a navigation container: `storageKey` and `renderLoading`.

    `storageKey` is the string key to be used with AsyncStorage while saving and persisting navigation state. To disable persistence, set to null.

    `renderLoading` allows you to render something while the navigator re-hydrates its state and loads its initial URL. By default this returns null, but Expo users will want to render a <AppLoading /> component for smooth app launches

    There is also functionality in this PR to observe errors that come from re-hydrating state, and gracefully recover by dispatching an init action.

    Also this revises the init action to *reset* the navigation state, rather than preserve the previous state.
2018-03-22 22:42:37 -04:00
Eric Vicenti
5e4512f3eb Implement paths on SwitchRouter (#3806)
* Fix paths overriding in SwitchRouter
2018-03-22 22:41:27 -04:00
Brent Vatne
ee1b5972ce Release 2.0.0-beta.3 2018-03-19 16:53:34 -04:00
Brent Vatne
2233d0e1d8 Add switch example 2018-03-19 16:52:12 -04:00
Eric Vicenti
577d99c165 StackRouter to return null on idempotent navigation (#3793)
This new behavior indicates that the action has been handled, but the state has not changed.
2018-03-19 16:46:57 -04:00
Brent Vatne
aa362ea776 Release 2.0.0-beta.2 2018-03-19 13:06:49 -04:00
Brent Vatne
864908a49c Bump version to 2.0.0-beta.1 2018-03-19 01:36:37 -04:00
Brent Vatne
5cab55b8c9 Release 2.0.0-beta.0 2018-03-19 00:13:27 -04:00
Brent Vatne
9b9db86bde Release 2.0.7 2018-03-18 22:22:26 -04:00
Eric Vicenti
4def39c0f7 Improve path matching for SwitchRouter and empty paths (#3784) 2018-03-18 22:10:15 -04:00
Brent Vatne
e6559f5878 Add react-native-tabs as export from react-navigation 2018-03-18 17:50:02 -04:00
Eric Vicenti
a9d8f2e03e Temporarily disable broken test in NavigationPlayground 2018-03-18 12:22:56 -04:00
Brent Vatne
84a070b9d5 Release 2.0.0-alpha.6 2018-03-17 16:27:52 -04:00
Brent Vatne
ee984943c7 Fix push action -- regressed when making navigate "less pushy" 2018-03-17 16:27:19 -04:00
Brent Vatne
9fdfec18f6 Remove yarn link in test script 2018-03-16 20:08:47 -04:00
Eric Vicenti
aee16b91a4 Improve consistency of jest version
Hopefully will fix build on Circle
2018-03-16 16:21:17 -07:00
Jakob Murko
191439f79a Prevent duplicate drawer events (#3763) 2018-03-16 15:36:31 -07:00
Brent Vatne
b1ac152fec Rename 'carefullyGetParent' to 'dangerouslyGetParent'
- It is potentially dangerous because screen components may or may not have the
expected parent, so depending on anything related to the parent may lead to
bugs. You should use carefully because it is dangerous ;)
2018-03-15 16:01:58 -07:00
Brent Vatne
c588ab9f9d Fix TabNavigator related tests 2018-03-15 13:40:29 -07:00
Brent Vatne
ae8cd41396 Deprecate TabNavigator in favor of react-navigation-tabs 2018-03-15 13:31:41 -07:00
Michał Pierzchała
5038ee2360 Fix memory leak in TabView-test.js (#3742) 2018-03-15 12:25:08 -07:00
Brent Vatne
5bf071e3ee Release 2.0.0-alpha.5 2018-03-15 10:57:33 -07:00
Michał Pierzchała
fcbf78e658 feat(context): refactor passing navigation context (#3668)
* feat(context): refactor passing navigation context

* remove commented code in example

* adjust src/views/withNavigationFocus.js

* refactor stuff

* extract scene to variable

* Add test

* Apply CR comments

* remove junk

* bring back screen mode header
2018-03-15 10:55:00 -07:00
KUBO
fd75e9c14c Remove unuseful SafeAreaView (#3721) 2018-03-15 10:35:02 -07:00
Brent Vatne
7d36a3b137 Update snapshots 2018-03-15 10:34:18 -07:00
Brent Vatne
175387b22f Another fix for frustrating tab bar icon layout issue 2018-03-15 10:34:18 -07:00
Brent Vatne
0dd7daecc0 Rename exports for navigators from XNavigator to createXNavigator (#3753) 2018-03-14 23:23:04 -07:00
Brent Vatne
42230634fd Missed a case where we should not have flexGrow 2018-03-14 21:48:48 -07:00
Brent Vatne
a9943e9b2e Update snapshot 2018-03-14 21:42:39 -07:00
Brent Vatne
6475e32dba Apply horizontal icon style whenever we should use horizontal tabs in icon 2018-03-14 21:34:53 -07:00
Brent Vatne
f67872d8f1 Release 2.0.0-alpha.4 2018-03-14 15:22:14 -07:00
Brent Vatne
2c7187b22a Rename exports for navigators from XNavigator to createXNavigator 2018-03-14 15:21:38 -07:00
Brent Vatne
160d44f58e Fix back button on modular header 2018-03-14 15:19:03 -07:00
spaceye
d017ed01b3 Reworked headerBackImage navigation prop and rendering (#3680)
* Added possibility to provide custom header back button's image, introduced API changes: removed old prop "headerBackImage", added new prop "backImage".

* Code style fixes.

* Renamed showcase file to for more clarity; updated the prop's name as well.

* Removed listeners code from showcase screens.
2018-03-13 13:15:11 -07:00
Vojtech Novak
c2e197f8d3 fix contribution docs link (#3707) 2018-03-13 13:14:02 -07:00
Vojtech Novak
6b3968b601 Playground facelift (#3708)
* wip

* fix imports

* use stylesheet for margin

stylesheet now correct

* also remove old headerLeft

* improve header buttons color

* remove ios button margin
2018-03-13 13:13:19 -07:00
Vojtech Novak
b575200879 reuse styles (#3725) 2018-03-13 13:05:21 -07:00
Brent Vatne
cd5bd8882e Release 2.0.0-alpha.3 2018-03-12 16:19:48 -07:00
Brent Vatne
3f837c895e Add lifecycle polyfill and change away from componentWillMount where possible without too much refactoring 2018-03-12 16:05:43 -07:00
Brent Vatne
bc5d35aba3 Release 2.0.0-alpha.2 2018-03-12 16:01:57 -07:00
Brent Vatne
9a6e0bbd98 Add dismiss helper, made possible by also adding carefullyGetParent (#3669)
* Add dismiss action, made possible by getParentState

* Add dismiss to flow interface

* Don't dispatch an action on dismiss helper if no parent state

* carefullyGetParent instead of getParentState
2018-03-12 16:01:29 -07:00
Brent Vatne
052d22804c Release 2.0.0-alpha.1 2018-03-12 15:23:38 -07:00
Brent Vatne
7a978b1087 Implement "less pushy navigate" RFC 2018-03-12 15:22:51 -07:00
Brent Vatne
b06fb7e432 Release 2.0.0-alpha.0 2018-03-12 15:06:47 -07:00
Brent Vatne
a92ed83302 Fix tab icon height on horizontal / ipad 2018-03-12 15:06:47 -07:00
Brent Vatne
0c31bc44ea Make push, pop, and popToTop bubble like navigate (#3617) 2018-03-12 15:06:38 -07:00
Brent Vatne
8e5ee4d312 Use arrow function for isFocused 2018-03-12 09:56:39 -07:00
Brandon Smith
4bb8987ab7 Pass initialRouteKey into StackRouter (#3540) (#3702) 2018-03-09 11:32:01 -08:00
Brent Vatne
81a86fa091 Swap addListener out for isFocused prop on ResourceSavingSceneView (#3700) 2018-03-09 10:55:00 -08:00
Brent Vatne
47f357f332 Fix TabRouter-test 2018-03-09 10:46:05 -08:00
Brent Vatne
bdda6fa5be Add SwitchNavigator to 2.x 2018-03-07 17:35:15 -08:00
Ashoat Tevosyan
b097136f74 [Flow] Some updates, mostly from flow-typed (#3682)
1. Remove `NavigationComponent` from `NavigationScreenRouteConfig`. The only context `NavigationScreenRouteConfig` is used in is as an intersection with an object, and as such the only relevant portions of `NavigationScreenRouteConfig` are the object parts.
2. Add static `HEIGHT` variable to `Header` type.
3. In `NavigationContainerProps`, make `onNavigationStateChange` property value nullable.

PS: if in the future you guys would prefer that I separate these sort of PRs into their constituent parts, let me know.
2018-03-07 11:29:25 -08:00
Ben Styles
c9b0219cec Allow passing null to onNavigationStateChange prop (#3683)
As seen here: react-navigation/react-navigation#360, we need to be able to pass null to turn off logging.
2018-03-07 14:19:00 -05:00
Eric Vicenti
ac83cf804c Fix issue in drawer actions (#3667)
* Fix issue in drawer actions

* Update DrawerView.js
2018-03-06 14:38:03 -08:00
Sirui Li
cf63521516 Flow type: SafeAreaView doesn't require children (#3670)
`children` prop should be optional.
2018-03-06 14:19:46 -08:00
corupta
7c488c8d49 Add activeLabelStyle and inactiveLabelStyle for DrawerItem (#3559)
* Add activeLabelStyle and inactiveLabelStyle

Adding activeLabelStyle, so that active items can be customized more.
My use case: Change font of the active item to bold.
Also, added inactiveLabelStyle which can be used for a similar purpose.

* prettier fix

* Update react-navigation.js

* prettier fix

* Update jest snapshot for DrawerNavigator - for adding a new style property to the styles array
2018-03-05 17:17:08 -08:00
Edward Drapkin
9005494e64 More specific injected Navigation props (#3645) 2018-03-05 16:33:42 -08:00
Brent Vatne
0daab8c55b Add isFocused helper to navigation and fix withNavigationFocus 2018-03-05 12:28:42 -08:00
Brent Vatne
ae98089337 Cache event subscribers and clean up after unmounting (#3648)
* This caches "child event subscribers" by key and removes them when they're not needed anymore. Once a navigator unmounts we also remove upstream subscribers.

* Fix tests
2018-03-05 11:27:57 -08:00
Yordis Prieto
57e37a8783 Fix typespec of back action creator (#3659) 2018-03-05 11:10:39 -08:00
Ashoat Tevosyan
b7994d28db Fix NavigationEventPayload.lastState type (#3664)
Should be nullable, since it is initially called as `null` in `src/createNavigationContainer.js` (and in `react-navigation-redux-helpers`, where it is causing a Flow error)
2018-03-05 11:04:29 -08:00
Vishwesh Jainkuniya
f1bfdeee46 Fix: tabBar icons are not visible. (#3650)
* Fix: tabBar icons are not visible.

* Fix: tests.
2018-03-04 21:21:54 -08:00
Nicolas Beck
c6301abaed Add initialRouteKey for StackRouter (#3540)
* use initialRouteName as key when initializing StackRouter

* fix null headerLeft

* merge back

* fixed tests

* use config flag

* fixed snapshots

* implemented requested changes
2018-03-02 16:06:27 -08:00
Brent Vatne
4569ad49f9 Fix regression in error message for route config validation 2018-03-02 12:18:11 -08:00
Arseny Yankovsky
214eeb13fb Allow modification of SafeAreaView props (#3496)
* SafeAreaView fix

* Updated to only allow modification of forceInset property of SafeAreaView
2018-03-01 13:42:19 -08:00
Michał Pierzchała
416fe58cab Move contributing guide to CONTRIBUTING.md (#3631) 2018-03-01 10:11:30 -08:00
Eric Vicenti
2e47cbb3cb Drawer Router (#3618) 2018-02-27 18:34:05 -08:00
Brent Vatne
cd99dc8054 Update snapshots 2018-02-27 17:32:13 -08:00
Eric Vicenti
e27ad22c57 [BREAKING] New createNavigator API (#3392)
* New createNavigator and View API

See the RFC here:
https://github.com/react-navigation/rfcs/blob/master/text/0002-navigator-view-api.md

* shattered dreams of flow

* fix export

* Fix tab view issues found by brent
2018-02-27 17:27:58 -08:00
Brent Vatne
6785729fb5 Fix snapshots 2018-02-26 16:02:38 -08:00
Brent Vatne
d3b6e70d16 Clarify that people should not report Redux or MobX related integration issues here 2018-02-26 15:53:14 -08:00
Brent Vatne
5f32a48c16 Release 1.2.1 2018-02-26 14:04:44 -08:00
Brent Vatne
d5a0b5912b Apply StyleSheet.flatten properly to headerStyle. Fixes #3608 2018-02-26 14:04:36 -08:00
Yordis Prieto
13fd8acb20 fix typespec (#3583) 2018-02-26 12:25:13 -08:00
Serhii Palash
8fc8f3b8f7 Fix bug #3279 “Action within RESET doesn't trigger” (#3593)
https://github.com/react-navigation/react-navigation/issues/3279
2018-02-26 12:14:29 -08:00
Brent Vatne
a37473c5e4 Release 1.2.0 2018-02-25 17:46:44 -08:00
Brent Vatne
23eb0839cb Improve crossfade configuration for header 2018-02-25 17:44:16 -08:00
Brent Vatne
e84473db78 Use a closer-to-correct spring animation when releasing a gesture in CardStack (#3601) 2018-02-25 17:20:39 -08:00
Brent Vatne
c8531d0f38 Pop to top on TabNavigator when tapping already focused tab icon (#3589)
* Pop to top when tapping the tab icon for an already focused tab

* Dispatch popToTop with key to scope the action properly

* Add test for POP_TO_TOP with key
2018-02-25 16:33:20 -08:00
Vojtech Novak
276fb8f7b3 remove support for deprecated navigation actions (#3595)
* remove support for deprecated navigation actions

* remove deprecated action from flow definitions
2018-02-24 12:08:14 -08:00
Johan Ruokangas
ab758bcaaa Fix RFC link (#3594) 2018-02-24 12:50:31 +01:00
Matt Hamil
2bb91a6740 Updated README (#3567)
Changed wording in the Web Support section of README to reflect priority for previous 1.0 release.
2018-02-22 21:52:09 -08:00
Brent Vatne
ffa3a92534 First crack at publish from circle (#3574)
* First crack at publish from circle

* s/publish/deploy

* Update snapshots

* Try installing with yarn

* Nice one

* Shhh

* Comment some things out and add a webhook

* Add proper webhook url and add back build steps
2018-02-22 16:39:41 -08:00
Brent Vatne
6dda8c30a9 Fix colors for card and header border on iOS 2018-02-22 12:58:33 -08:00
Brent Vatne
065fdf61d8 Several improvements to StackNavigation Header (#3568)
* Refactor to remove unused variables, styles, and outer Animated view

* Style cleanup

* Proof of concept blur background

* Clean it up and add flow interface

* Update snapshots
2018-02-21 18:29:43 -08:00
Brent Vatne
371a714b57 Release 1.1.2 2018-02-20 16:00:44 -08:00
Ron Arts
1d33b95c5f Bump react-native-safe-area-view dep to 0.7.0 for react-native-web support (#3553) 2018-02-20 15:44:20 -08:00
Mike Grabowski
593bc8a648 Improve Header performance a bit (#3556)
* Improve `Header` performance a bit

I have been investigating `<Header />` component performance once again today with `render` cycles in particular. I have observed that during `push` phase, a typical Header in NavigationPlayground re-renders 3 times on iOS and 2 times on Android.

The first time is obvious on both platforms since that's when we add a new scene to an array. Second on iOS was also self-explanatory - we measure title width and other layout parameters in order to provide a better animation. 

What got me thinking was the last render cycle that didn't have a clear origin. After digging around I've found it is caused by a `scenes` array changing when transition finishes. What is surprising, it's just the reference to the object that changes, the content (items inside) stay the same.

I have found out that this is caused by `Transitioner` looping through an array of scenes attempting to remove stale scenes. Since scene becomes stale when you `pop` from it, this is obviously a noop when `pushing` a new route. That, obviously, causes an extra render cycle since `filter` produces same, but with a different pointer, object.

* Update Transitioner.js

* Update Transitioner.js
2018-02-20 15:44:10 -08:00
Brent Vatne
174a6e4175 Release 1.1.1 2018-02-19 18:18:38 -08:00
Brent Vatne
af991e5512 Release 1.1.0 2018-02-19 18:16:23 -08:00
Brent Vatne
0b0e9e9df5 Fix TabRouter to support shorthand route config 2018-02-19 18:16:23 -08:00
Brent Vatne
42b0ccca79 Release 1.1.0-rc.5 2018-02-19 18:16:23 -08:00
Brent Vatne
da6a960bb1 Fix regression in modular back button 2018-02-19 18:16:23 -08:00
Ron Arts
3ca47ec778 Fix react-native-web support for #3526 (#3546)
* MaskedViewIOS use broke react-native-web support, this fixes it.

* Fallback more gracefully.

* Actually return the value ...
2018-02-19 13:48:12 +01:00
Marcin Raburski
14ee56a20d getComponentForState made more generic (#2498) 2018-02-19 04:14:13 -08:00
Matthieu Lemoine
9d36daf48e Pass prevTransitionsProps to transitionConfig (#3304)
* Pass prevTransitionsProps to transitionConfig

* Remove flow type
2018-02-19 02:29:46 -08:00
Brent Vatne
055fdb2ffc Release 1.1.0-rc.4 2018-02-17 12:50:26 -08:00
Brent Vatne
b3bf80634d Move the back button handler subscription to the NavigationContainer constructor (#3542)
* Move the back button handler subscription to the constructor to fix precedence
- See 07d92947a1/src/Navigation.js (L190-L193)

* Return the boolean result of dispatch in global back handler
2018-02-17 12:50:04 -08:00
Brent Vatne
fafd0e8702 Cleanup around StackRouter (#3487)
* Make StackRouter a bit easier to read, update and add some comments, add an explicit test around stack and navigate

* Address feedback for clarity
2018-02-17 11:14:03 -08:00
Brent Vatne
d94045817c Release 1.1.0-rc.3 2018-02-17 09:42:45 -08:00
Brent Vatne
f0acaddf05 Fix headerLeft on first screen regression 2018-02-17 09:40:59 -08:00
Brent Vatne
9beb32ecac Update snapshots 2018-02-16 18:14:07 -08:00
Brent Vatne
29a29936bf Remove withNavigationFocus example until it's fixed 2018-02-16 18:10:33 -08:00
Brent Vatne
8961fef00b Bump version 2018-02-16 18:09:40 -08:00
Brent Vatne
021c7e54be Do not use hide views when swipe or animations are enabled. Improve withNavigationFocus example 2018-02-16 18:05:39 -08:00
Brent Vatne
27538cad94 Properly thread through childNavigation 2018-02-16 17:26:01 -08:00
Brent Vatne
9a8a50ef1d Release 1.1.0-rc.0 2018-02-16 17:07:28 -08:00
Brent Vatne
2c6dc35723 Revert "Revert "Add getParam navigation helper (#3510)" (#3532)"
This reverts commit 5febb81a1c.
2018-02-16 17:06:16 -08:00
Brent Vatne
3600ecbd9b Add back support for lazy tabs and use removeClippedSubviews (#3538)
* Lazy initialization of tabs and move contents off-screen when not active

* Make subview clipping and lazy both configurable

* Record snapshots again

* Update type definition

* Remove unused log
2018-02-16 16:59:19 -08:00
Sébastien Lorber
c74f001b1c add withNavigationFocus HOC (#3512)
* add withNavigationFocus HOC

See:
- https://github.com/react-navigation/react-navigation/issues/51#issuecomment-276003658
- https://github.com/react-navigation/react-navigation/issues/51#issuecomment-278761705
- https://github.com/react-navigation/react-navigation/pull/3345#issuecomment-360260067

* typos

* remove unused import

* Add withNavigationFocus export

* add example TabsWithNavigationFocus

* add example TabsWithNavigationFocus

* withNavigationFocus: get navigation from context or props

* subs => subscriptions

* fix flow issues
2018-02-16 16:57:33 -08:00
Brent Vatne
7f4706e4cc Update snapshots 2018-02-16 12:45:57 -08:00
Brent Vatne
d0ef33b12f Several small changes related to header style commit 2018-02-16 12:42:44 -08:00
Brent Vatne
3c3668c952 Header transition presets with support for standard iOS transition style (#3526)
Header transition presets with approximate support for UIKit transition style
2018-02-16 12:41:59 -08:00
Brent Vatne
5febb81a1c Revert "Add getParam navigation helper (#3510)" (#3532)
This reverts commit 50dcb37cd7.
2018-02-15 13:24:40 -08:00
Peter Piekarczyk
50dcb37cd7 Add getParam navigation helper (#3510)
* add getParam helper

* passing tests

* check for existence of param instead of just or

* fix spacing

* use in instead of checking for null

* add test for null
2018-02-15 10:14:08 -08:00
Ron Arts
69bca191a7 The Linking and BackHandler components are now both supported by react-native-web (#3494)
so there's no need to supply dummy replacements.
2018-02-13 12:23:26 -08:00
Sébastien Lorber
4df9198979 fix doc link (#3513) 2018-02-13 10:30:20 -08:00
Ashoat Tevosyan
0fc7f87173 Run Prettier on Flow libdef on precommit (#3495) 2018-02-12 14:45:50 -08:00
Brent Vatne
5b4d11ab5d Better orientation layout on playground 2018-02-12 11:53:23 -08:00
Brent Vatne
4d1cc285b9 Slightly improved margins on the iOS header back button 2018-02-09 21:19:02 -08:00
Brent Vatne
41725afa8a Use the correct iOS back icon 2018-02-09 20:08:56 -08:00
Brent Vatne
58b77d44ae Make Router({ RouteName: Component }) a valid way to configure a router (#3486)
* Make Router({routeName: Component}) a valid way to instantiate a route

* Update App.js in NavigationPlayground

* Fix route config flow type
2018-02-09 18:20:01 -08:00
Kazato Sugimoto
1d49b6e3fe Decode URI encoded string of deep link (#3455) 2018-02-09 16:26:20 -08:00
Brent Vatne
58b8a08af6 Update snapshots for TabView/TabNavigator 2018-02-09 14:22:31 -08:00
Maxime Florent Fankam
b11ea8a1d5 Allow swipeEnabled be a function (#3378)
* Allow swipeEnabled be a function with state param
2018-02-09 14:04:17 -08:00
Brent Vatne
3c2b977eca Number of lines in label for TabBarBottom is always 1 2018-02-09 13:51:04 -08:00
Brent Vatne
95565487ec Make it possible to go back to menu from key example and improve banner on menu screen (#3479)
* Make it possible to go back to menu from key example and improve banner on menu screen

* Fix NavigationPlayground flow error
2018-02-08 19:10:54 -08:00
Brent Vatne
a26d2acfca Bump to patch version 1.0.3 2018-02-08 18:24:20 -08:00
Brent Vatne
a1b3d2213d No need to have a conditional around slicing the routes array 2018-02-08 18:22:02 -08:00
Brent Vatne
eb39df507e Prevent navigation from getting in bad state when navigating back to route by key (#3478) 2018-02-08 18:20:14 -08:00
Brent Vatne
cca06bb530 Do not use contentInsetAdjustmentBehavior on iOS in ModalStack example 2018-02-08 16:14:45 -08:00
Eric Vicenti
2187d8fe66 Consistent treatment of route keys (#3474)
This problem was found and fixed by @matthargett and @jayphelps in #3397. I’m just rebasing and cleaning a few things up
2018-02-08 15:28:27 -08:00
Eric Vicenti
67f98b69eb Simpler implementation of withNavigation (#3476)
This will allow for refs with onRef (fixes #3461), and will avoid all these warnings from throwing during our tests
2018-02-08 14:20:52 -08:00
Brent Vatne
c0c5c86f63 Bump to patch version 1.0.2 2018-02-08 12:49:04 -08:00
Brent Vatne
4388b6403c Remove console logs from published version of navigation playground 2018-02-08 12:48:28 -08:00
Brent Vatne
2cb740fbf6 Only initialize the CardStack PanResponder if gestures are enabled 2018-02-08 12:36:26 -08:00
Brent Vatne
ac741a703b Remove extra scene in floating header if it hasn't been evicted due to transition yet 2018-02-08 12:32:09 -08:00
Brent Vatne
5641b42975 Revert "StackRouter block actions while transitioning (#3469)"
This reverts commit 858a0d7a53.
2018-02-08 11:49:25 -08:00
Brent Vatne
ea19ceaa6a Bump to minor version 1.0.1 2018-02-08 10:47:48 -08:00
Brent Vatne
57ae6e4736 Make TabRouter handle COMPLETE_TRANSITION in a child router without switching active index (#3473) 2018-02-08 10:46:12 -08:00
Eric Vicenti
858a0d7a53 StackRouter block actions while transitioning (#3469)
The most straightforward fix for two issues is to block all navigation actions while mid-transition of a stack navigator. This will fix:

The double-navigate on double tap issue, because the first navigation will start the transition and the second action will be ignored.

Will fix the buggy header experience that you can see when going back and forward to a different route quickly. This happens because the next navigate action happens before the completion action. After the fix, the navigate action will be ignored, the user will tap again, and will see a good transition
2018-02-08 09:02:47 -08:00
Dave Pack
cf36f22e68 Sync and switch SafeAreaView with standalone (#3452)
* add react-native-safe-area-view npm package

* remove local SafeAreaView, import from package in views

* update to latest react-native-safe-area-view

* update snapshots
2018-02-07 17:32:06 -08:00
Brent Vatne
7385c244b7 Add custom back button example 2018-02-07 10:42:06 -08:00
Brent Vatne
8bd25cf372 Bump to 1.0.0 2018-02-06 17:51:55 -08:00
Brent Vatne
20af8c688e Prevent push from bubbling up (#3454) 2018-02-06 17:49:52 -08:00
Brent Vatne
b0dccd7e88 Prevent pop and popToTop from bubbling up to parent stack (#3453) 2018-02-06 17:35:32 -08:00
Brent Vatne
c69a22f10e Bump version 2018-02-06 15:59:44 -08:00
Eric Vicenti
43a1c5ddbd Fix issue with StackRouter popToTop (#3451)
Previously the state was getting squashed, in this case it would destroy the routeName of the state, which was a route for the parent navigator, who could no longer render properly.
2018-02-06 15:56:39 -08:00
Brent Vatne
e97d41cccf Bump version and update description 2018-02-06 14:53:08 -08:00
Brent Vatne
3e4ddc685a Remove Header.HEIGHT deprecation warning, no good alternative solution available yet 2018-02-06 14:48:44 -08:00
Brent Vatne
f62c728593 Bump version 2018-02-06 14:13:41 -08:00
Eric Vicenti
616f9a56f2 Fix StackRouter Replace Key Behavior (#3450)
Replace should actually provide new keys on the replaced route, use ‘newKey’ on the action if you want to define the new route key
2018-02-06 14:12:59 -08:00
Brent Vatne
3b93faa0fc Bump version 2018-02-06 13:01:46 -08:00
Eric Vicenti
333b2e4b68 StackNavigator Replace Action (#3440)
* Navigation replace action

The long awaited action to replace the a route in StackNavigator

* Fix flow maybe
2018-02-06 12:59:16 -08:00
Brent Vatne
7f50173cf1 Bump version 2018-02-06 12:49:43 -08:00
Brent Vatne
8432f67529 Add adaptive to TabBarBottom flow interface 2018-02-06 12:49:37 -08:00
Eric Vicenti
c72b44ce10 Fix focus event for initial screen (#3448) 2018-02-06 12:49:23 -08:00
Peter Steffey
149f5f5c66 Fix #2795 - Not reducing header height in landscape on iPad (#3251)
* Adding tablet check for small header

* Switching to Platform.isPad

* Moving fully to Platform.isPad, no isHeightConstrained
2018-02-06 10:40:03 -08:00
Peter Steffey
85f77fe903 Issue #2794 - Tab bar fix - Continued from #3041 (#3267)
* Fixing iPad iOS 11 Tab Bar Bottom Behavior with changing widths via Multitasking

* Adding width constrained check

* Moving to only Platform.isPad (no more layout-based tests)

* Remove type import
2018-02-06 10:39:41 -08:00
Jay Phelps
d4b759606d remove $FlowFixMe comments left over, as flow is no longer used (#3439) 2018-02-06 14:59:38 +01:00
Brent Vatne
4d2609f4a8 Use a stack inside of drawer 2018-02-05 14:48:30 -08:00
Brent Vatne
0766ec963e Bump version 2018-02-05 11:43:53 -08:00
Brent Vatne
0759e8cc8f Fix tests 2018-02-05 11:43:33 -08:00
Eric Vicenti
fae1f71fb3 Key for completion action, to prevent eager didFocus (#3435)
The completion action would previously change the isTransitioning of any state, but this will ensure that the completing navigator only marks its own state as isTransitioning:false. Now, even when transition completion happens immediately on the parent, the child focus event still waits for the child isTransitioning to go false.
2018-02-05 11:33:00 -08:00
Eric Vicenti
03fbd98ce4 Fix Transitioner race condition (#3434)
This code was added during the events implementation, but I think we should be able to manage this circumstance from the parent context. In any case, any events bugs that result from this change will be far less insidious than the cardstack transitioner issue we experience now
2018-02-05 10:52:08 -08:00
Andrej Badin
63a6565afa Fix incorrect easing functions for CardStack (#3381)
* Fix invalid easing functions for CardStack

1. `timing` function accepts `TimingAnimationConfig` which expect `easing` (or dont expect at all) function with following signature: `(value: number) => number`
2. under the hood, `TimingAnimation` falls back to `easeInOut` function, if `easing` is not specified
`this._easing = config.easing !== undefined ? config.easing : easeInOut();`
3. by mistake passing `Easing.linear()` results in following
`typeof Easing.linear(); // undefined` which makes statement in step 2 fall back to `easeInOut`

This commit makes passing `easeInOut` function explicit and fixes existing issue and several Flow warnings

* Do not memoize easing function, keep things simple
2018-02-05 10:42:45 -08:00
dushaobindoudou
154aa85f70 remove unuseful SafeAreaView component (#3428) 2018-02-05 10:41:57 -08:00
Brent Vatne
a14002084f Bump version 2018-02-03 12:21:33 -08:00
Eric Vicenti
98cfd7a531 Fix events issue when swiping back (#3420) 2018-02-03 12:20:55 -08:00
Brent Vatne
282e5abac2 Better public example point under help 2018-02-03 11:05:53 -08:00
Brent Vatne
d6d1dd279d Clarify the "how can I help?" section 2018-02-03 11:04:36 -08:00
Brent Vatne
b0b7b556a3 Update the web section of README 2018-02-03 11:02:26 -08:00
Brent Vatne
56d233be8b Add a link to the website repository 2018-02-03 10:56:19 -08:00
Brent Vatne
cfda9b290b Update README again to improve wording of documentation section 2018-02-03 10:55:33 -08:00
Brent Vatne
bce5fde5cb Update README 2018-02-03 10:54:06 -08:00
Brent Vatne
33c6ac9ae7 Remove website, docs and related commit. (#3419)
- This now lives at https://github.com/react-navigation/react-navigation.github.io
2018-02-03 10:38:43 -08:00
Brent Vatne
189e7ee539 Bump version 2018-02-02 18:08:57 -08:00
Brent Vatne
dc06c50966 Update yarn.lock 2018-02-02 12:33:53 -08:00
Ashoat Tevosyan
b013cc98be Redux middleware for new event system (#3399)
* Add Redux bindings for new event system

* construct -> create

* react-navigation-redux-helpers
2018-02-02 11:58:35 -08:00
Ashoat Tevosyan
37c3a357fc Clean up old build process and Babel config (#3406) 2018-02-02 11:57:31 -08:00
Eric Vicenti
836a164693 New StackRouter Push Action (#3401) 2018-02-01 17:14:13 -08:00
Eric Vicenti
a9582c5dd3 StackRouter PopToTop Action (#3403) 2018-02-01 17:10:12 -08:00
Eric Vicenti
fe4079c495 StackRouter PopN Action (#3404) 2018-02-01 17:01:04 -08:00
Eric Vicenti
ed0306587c StackRouter Reset Action should match state key (#3400) 2018-02-01 11:25:30 -08:00
Eric Vicenti
c88ec60fe3 Fix and actually understand event emitter (#3367) 2018-02-01 09:42:48 -08:00
Ashoat Tevosyan
d0da40fa32 Add Flow libdef (#3391)
* Add Flow libdef

* Move libdef to flow folder in root

* Update libdef with some refinements discovered while writing test

Mostly refining navigator config types. In the past when we tried it we got in-repo Flow errors. With a libdef we can now assert it as true!

* Get rid of all imports in libdef and refine some types
2018-02-01 09:34:35 -08:00
Eric Vicenti
7141f66efd Add key support to StackRouter navigate (#3393) 2018-01-31 19:48:04 -08:00
Ashoat Tevosyan
ffcf179883 metro-bundler -> metro (#3396) 2018-01-31 18:41:35 -08:00
Ashoat Tevosyan
441b9ffe10 Add NavigationPlayground Flow test to CI (#3385)
In order to make sure that contributors don't making breaking changes to our Flow types without corresponding updates to the libdefs, we should make sure these breaking changes get caught by CI. Right now our libdefs are any-typed, but I'll put up a PR later that will refine the libdef (located at `flow-typed/npm/react-navigation_vx.x.x.js`).
2018-01-30 15:57:06 -08:00
Ashoat Tevosyan
0d3d83bd90 Fix NavigationEvent types (#3384)
* Fix SimpleTabs types

dca37627a2 broke the types, but it wasn't noticed because Flow wasn't in the CI. This fixes the types; separate PR coming to add Flow to the CI.

* Refine type of NavigationEventListener callback

Instead of typing the callback as `Function`, we're now using the precise type provided by @ericvicenti

* NavigationEventListener -> NavigationEventSubscription
2018-01-30 15:49:47 -08:00
Ashoat Tevosyan
d1d81d7033 Update to RN 0.52 and Expo 25 (#3383)
* Update to RN 0.52 and Expo 25

* Rerecord snapshots for failing Jest tests

* jest-expo@25.1.0-beta.0

* jest-expo@25.1.0
2018-01-30 10:22:20 -08:00
Yao Hui Chua
a1fc566679 Support initialRouteParams for TabRouters (#3352) 2018-01-29 12:06:32 +01:00
Vojtech Novak
088e9e82ad rely on defaultProps in TouchableItem (#3374) 2018-01-28 23:33:21 +01:00
Eric Vicenti
dca37627a2 Add events support to redux example (#3368)
* Fixing redux

* Fix tab events and test event nested event subscriptions

* Add event support to redux example
2018-01-27 14:12:16 -08:00
Brent Vatne
50a3f8de93 Add headerBackImage, closes #1999 2018-01-27 13:53:44 -08:00
Patrick Monteith
e0de8b4dce Don't forward back actions to inactive children of TabRouters (#2121) 2018-01-27 13:21:47 -08:00
Freddy Harris
a62ad18b31 SafeAreaView style padding and inset collapse (#2917) 2018-01-27 12:59:51 -08:00
TheCodeTalker
77b5402404 navigation back fix in example (#3218) 2018-01-27 12:42:45 -08:00
Iacopo Pazzaglia
6c1ab47719 Allow tabBarTestIDProps to be a function that receive the focused status (#3303) 2018-01-27 12:37:36 -08:00
Brent Vatne
24bfab93b4 Manually unset transitionIsRunning rather than going through _onTransitionEnd after state change 2018-01-26 23:02:02 -08:00
Brent Vatne
f8426bef7e Clean up when transitioner state when bailing out early 2018-01-26 18:55:38 -08:00
Brent Vatne
afcce1a0c0 [Playground] Move sdkVersion back to 24 2018-01-26 17:34:08 -08:00
Brent Vatne
6f430b2f1e Revert updates to example package.json 2018-01-26 16:48:02 -08:00
Ashoat Tevosyan
427e89480f Bring back TypeDefinition.js and re-add Flow to NavigationPlayground (#3363)
* Bring back TypeDefinition.js and re-add Flow to NavigationPlayground

* Type EventListener correctly and ignore metro errors
2018-01-26 16:15:49 -08:00
Brent Vatne
4ae2a42a4d Remove NavigatorTypes (#3331) 2018-01-26 15:54:46 -08:00
Moriyoshi Koizumi
9e026ec2c8 Allow pure-wildcard route for nested navigators. (#2929)
* Allow pure-wildcard route for nested navigators.

* Treat empty paths as they are.
2018-01-26 15:52:59 -08:00
Dhruvdutt Jadhav
82572e73f3 Update Guide-Headers.md (#3335) 2018-01-26 15:45:39 -08:00
Dhruvdutt Jadhav
d84c320bd7 Update DrawerNavigator.md (#3337)
Improve code syntax
2018-01-26 15:45:06 -08:00
Dhruvdutt Jadhav
339732e956 Update TabNavigator.md (#3341)
Improve code syntax to match the rest of the code spinnets in docs
2018-01-26 15:44:18 -08:00
Nicolas Beck
8e0fdc67b8 Reset state instead of pushing new routes for navigation actions in Drawer (#3164) 2018-01-26 15:30:11 -08:00
Eric Vicenti
122f6cfcee Simple fix to back button behavior (#3362)
Should always provide the key to go back from
2018-01-26 11:02:27 -08:00
Eric Vicenti
0157a4c9e9 Navigation Event Subscriptions (#3345)
* Add fbemitter, keep flow passing

* Begin support for event emitter

- Adds emitter to navigation prop
- Emits top level onAction event
- stub getChildEventSubscriber for child events

* Support navigationState.isNavigating

* Focus and blur events starting to work

- Navigation completion action wired up
- Event chaining logic built in getChildEventSubscriber
- Renamed onAction evt to ‘action’

* Wrap up events progress and testing

* Rename to isTransitioning and COMPLETE_TRANSITION

* rm accidental dependency

* Suppoert event payload type
2018-01-25 00:13:28 -08:00
Brent Vatne
cbd1fee8a4 Remove website deploy from CI and clean up scripts (#3353)
* Remove website deploy from CI and clean up scripts

* Clobber unnecessary pieces from circle config
2018-01-24 20:48:58 -08:00
Brent Vatne
ebfbbe2c09 Delete some unnecessary noise 2018-01-24 20:21:16 -08:00
Brent Vatne
ecfa38bfd2 Remove flow (#3350)
* Remove flow types from src

* Finish removing Flow

* Clear out flow-typed, some flow mentions in docs, website flow usage, and some other config
2018-01-24 17:52:09 -08:00
Michael Duminy
276249c4c7 HeaderBackButton animation performance (#3305)
* header back button ripple animation performance

* replace InteractionManager with requestAnimationFrame

* getting used to flow typing
2018-01-23 14:03:51 -08:00
Grey Baker
1715513519 Update repository URL in package.json (#3342)
Update repository URL to reflect move from react-community to react-navigation organization.
2018-01-23 13:58:52 -08:00
Brent Vatne
2f4bacf6e2 Add RFC and website repos to issue template 2018-01-22 16:41:31 -08:00
Brent Vatne
05d342dac5 Update issue template 2018-01-22 16:22:03 -08:00
Pranav Kulkarni
a57f129cc0 Fix the section link for Reset action (#3316)
Sectional link to Reset section fails due to case difference.
2018-01-21 22:12:33 +05:30
Tien Pham
c0d76755e7 Update goBack docs (#2834)
* Update goBack docs

* Update Screen-Navigation-Prop.md
2018-01-21 02:07:24 +05:30
Adam Miskiewicz
b221afc80b Make examples use linked copy of react-navigation 2018-01-17 19:11:04 -08:00
Adam Miskiewicz
f895564605 Revert "Move examples to https://github.com/react-navigation/examples"
This reverts commit 36775007b0.
2018-01-17 14:43:28 -08:00
Brent Vatne
36775007b0 Move examples to https://github.com/react-navigation/examples 2018-01-17 12:43:24 -08:00
Brent Vatne
99c4d448b2 Bump version 2018-01-16 11:12:52 -08:00
Brent Vatne
8cf2953115 Revert adding SafeAreaView to TabBarTop 2018-01-16 11:12:06 -08:00
Brent Vatne
abbd88601f Bump version 2018-01-12 15:51:29 -08:00
Brent Vatne
ff6d6f4e5e Update icons in playground app and add some padding to banner 2018-01-12 15:50:12 -08:00
Brent Vatne
7fa0ef3aee Handle translucent status bar within Expo automatically.
- Escape hatch of `ReactNavigation.SafeAreaView.setStatusBarHeight()`.
- `if (Platform.OS === 'android') { ReactNavigation.SafeAreaView.setStatusBarHeight(0) }` to revert to old behavior.
2018-01-12 15:34:40 -08:00
Brent Vatne
6ac3bb90ed Bump version 2018-01-11 18:30:28 -08:00
Brent Vatne
627c487936 Revert "Issue #2794 - Fixing iPad iOS 11 Tab Bar Bottom Behavior (#3041)"
This reverts commit c7b73cd8b4.
2018-01-11 18:21:46 -08:00
Brent Vatne
f46bdff703 Bump version 2018-01-11 18:20:44 -08:00
Adam Miskiewicz
bc75a5b7b9 Use stiffness/damping/mass for card stack transition on React Native >= 50 (#3261) 2018-01-11 18:08:42 -08:00
混沌DM
50d5c8bc0a Set the default value of the DrawerNavigatorConfig correctly. (#3152)
* Set the default value of the DrawerNavigatorConfig correctly.

* update DrawerViewProps type
2018-01-09 14:58:27 +05:30
SteffeyDev
c7b73cd8b4 Issue #2794 - Fixing iPad iOS 11 Tab Bar Bottom Behavior (#3041)
* Fixing iPad iOS 11 Tab Bar Bottom Behavior with changing widths via Multitasking

* Updating snapshot tests

* Changes per discussion in !3041

* Additional changes per discussion in !3041

* Changing to test for constrained height

* Additional changes per discussion in !3041
2018-01-08 20:28:13 -06:00
rgovind92
e2e540c32d Fix drawer toggle (#3191)
* Fixed drawer toggle

* Fixed drawer toggle

* Update DrawerView.js
2018-01-06 10:40:56 -05:00
Brent Vatne
7a57c4e779 Update README, bump version 2018-01-04 14:10:08 -08:00
Jani Eväkallio
4373544257 If URL is just a scheme:// component without a path, default to root "/" URL (#3224) 2018-01-04 13:28:41 -08:00
Satyajit Sahoo
8329e269b6 Upgrade react-native-tab-view (#3064) 2018-01-04 14:15:35 +00:00
Lorenzo Sciandra
450a1e3ba5 removing react-addons-test-utils (#3221) 2018-01-04 14:08:58 +00:00
Brent Vatne
a83220b511 Update ISSUE_TEMPLATE.md 2017-12-27 13:24:36 -08:00
Brent Vatne
6af770d644 Fix example project 2017-12-20 13:35:35 -08:00
Spencer Carli
ef63b230b2 v1.0.0-beta.22 2017-12-18 15:53:48 -06:00
Axel Eirola
41b587ca65 Enable configuration of gesture direction (#3077)
* Enable configuration of gesture direction

* Fix documentation and code style

* Invert behaviour of I18nManager.isRTL instead of overriding
2017-12-18 16:25:16 -05:00
Stephen O'Brien
faed4731bc Safe area view: support animated style values (#3124)
* Use Animated.View instead of View in SafeAreaView

This allows passing animated style properties in certain contexts, as previously supported.

* Update some test snapshots
2017-12-17 17:20:08 -06:00
Nicolas Charpentier
7fe76fb7c6 Fix handling the Hardware Back Button link in Redux section (#3134) 2017-12-16 13:17:43 -06:00
Nicolas Charpentier
89a6668595 Update Contributors Guide link (#3133) 2017-12-15 16:37:31 +00:00
Denis Evgrafov
9cf9e25661 Update Navigation-Actions.md (#3126) 2017-12-15 00:37:22 +01:00
Axel Eirola
363f93fc4d Add support for custom header transitions (#3075)
* Add support for custom header transitions

* Use default props for header transition default values
2017-12-14 22:14:38 +01:00
Ashoat Tevosyan
928f632c89 Don't use params from unrelated action when initializing nav state (#3094)
`TabRouter.getStateForAction` has some code at the start to initialize an empty nav state before handling any action. This initialization is achieved by passing `INIT` actions to all child routes. However, the code strangely also passes these child routes the params that were given to the action. The initialization should be separate from the processing of the action.
2017-12-12 11:00:33 +00:00
Patrick Monteith
950d0c6877 Don't delegate inner action to child router, handle inner action when handling NAVIGATE 2017-12-07 23:25:27 +08:00
Sergei
5a26506595 Disable / enable swipe depending on screen. (#2906)
* Disable / enable swipe depending on screen.

react-community#1760

* Updated to master

* Revert "Updated to master"

This reverts commit a3aede19588cdbc7fc9148d148260f51d6316e6f.

* - Fixed CircleCI errors

* - Fixed CircleCI errors
2017-12-01 15:53:26 -06:00
James Reggio
5cb42bdf5d Await promise from Transitioner onTransitionStart (#2946)
* Await promise from onTransitionStart

* Review feedback

* Update docs for onTransitionEnd
2017-12-01 15:42:53 -06:00
Flo
d5618ebd41 Drawer Improvement, Let define a route key to open/close multiple dra… (#1803)
* Drawer Improvement, Let define a route key to open/close multiple drawer with no side effects

* fix lint issues

* fix flow issues
2017-11-29 09:01:35 -06:00
tab
368bc615c1 Set sdkVersion to 23.0.0 (#3037) 2017-11-25 16:12:51 -06:00
Ashoat Tevosyan
f332b6bdf7 Add NavigationContainer and NavigationContainerProps types (#3030)
Adding types for these fixes the errors we're seeing when using `TabNavigator` and `StackNavigator`.
2017-11-22 14:42:17 +00:00
Spencer Carli
b5700b9277 v1.0.0-beta.21 2017-11-21 09:25:24 -06:00
Spencer Carli
ad59d161db Fix #3020 (#3024) 2017-11-21 09:24:24 -06:00
Vojtech Novak
cc355dcee9 return null if it is passed (#3021) 2017-11-21 08:54:46 -06:00
mukunzidd
04c075c1bb Fix typo On "Getting Started 3." (#3022)
Browse the official example app, which will `demonstrates` various patterns with React Navigation. 
demonstrates should be `demonstrate`
2017-11-21 15:40:01 +01:00
londonoliver
7ae6908428 Update Guide-Quick-Start.md (#3015) 2017-11-21 08:34:39 +01:00
Spencer Carli
93dd28749d Bump version 2017-11-20 19:21:19 -06:00
Vojtech Novak
7f1fb8cdd8 revert TabBarBottom should hide itself when Keyboard is activated (#3013) 2017-11-20 19:18:35 -06:00
Dave Rogers
0a662c9835 Allow transition configuration between tabs (#2222)
* allow transition configuration between tabs

* we don't need to pass configureTransition to TabBarComponent

* Update TabAnimations.js

* Update TabNavigator.md
2017-11-21 00:16:43 +01:00
Ashoat Tevosyan
3cff180224 Update to react-native@0.50 and flow-bin@0.56 (#2998)
* Update to React Native 0.50

* Type Promise used in PlatformHelpers.web.js

* Move $FlowFixMe in CardStack.js

The line number Flow is using for this error changed. The underlying problem has not, but I don't have time to fix it now unfortunately.

* Type TouchableItem's children prop as React.Node

This was my bad. `React.ChildrenArray` should only really be used in the case of having multiple of the same type of child.

* Type HeaderTitle's children prop as React.Node

Same as last commit.

* Add assertion in StackRouter that StateUtils.indexOf returns valid index

Flow doesn't realize that `StateUtils.indexOf` is guaranteed to return a valid index, so we use `invariant` to assert it.

* Remove unused type DrawerNavigationState from TypeDefinition

* Remove unused type parameter T in DrawerView

* Type NavigationStateRoute as NavigationLeafRoute & NavigationState

* Don't constrain generic action types to NavigationAction

By constraining to subtypes of `NavigationAction`, we actually are requiring that any router satisfying our type constraints has to take all of the `NavigationAction` types. Instead, we want to say that it will only take some of them. Changing the types here to be inferred.

* Fix types of NavigationScreenProp and withCachedChildNavigation

1. `NavigationScreenProp` needs to have its type parameter annotated with a `+` to actually indicate covariance on that type parameter, apparently
2. `withCachedChildNavigation` needs to thread through more-specific `NavigationState`s, and right now it just discards that specificity, which breaks `DrawerSidebar` because it needs a `NavigationStateRoute`

* Ignore website/build from Flow

* Fix type of DrawerItems activeItemKey prop

- Even when specified, it can be `null`
- Use a ternary expression instead of `x && x.param` approach

* Get rid of NavigationRouter & NavigationNavigator parameterization on NavigationAction

Since `NavigationRouter`'s `getStateForAction` functionality is a standard Redux reducer, it knows to forward on any actions it doesn't know how to deal with. We can widen the types of these functions to be `NavigationAction` without any negative consequence.

* Explicitly specify null navigationOptions in createNavigator

Not sure why, but Flow doesn't like us leaving it unspecified

* Fix createNavigationContainer/createNavigator/StackNavigator types

* Fix up flow types for TabNavigator and DrawerNavigator

* Properly type defaultContentComponent

* Fix more flow errors in createNavigationContainer

* Replace NavigatorProps with NavigationNavigatorProps

* Type SceneView's navigation prop as NavigationScreenProp<any>

There is an unavoidable* type problem here. A `NavigationComponent` is either a navigator with a `NavigationStateRoute` or a scene with a `NavigationRoute`. The navigation prop it gets passed must match the component's `NavigationState`. However, there's no way for us to say that "`this.props.router.getComponentForRouteName` will have a `NavigationNavigator` iff the corresponding `childNavigationProps` is a `NavigationStateRoute`".

The cleanest way to make this work is to throw an "any" specifically for the navigation prop's state type param.

* We could probably avoid it with sufficient refactoring. If the routers were charged with keeping track of `childNavigationProps` instead of leaving it to the views, they could return the child navigation prop and child `NavigationComponent` in pairs whose types were coupled.

* Pass in screenProps to NavigationComponent in NavigationPlayground's CustomTabs

Flow wants `screenProps` to be passed in here for some reason...

It cites `SceneView`, but that doesn't really make much sense to me. But this is some custom logic that most people aren't likely to run into, so I'm not gonna worry too much about it.

* Patch mismatch with react-native-tab-view type for now

* Use generic NavigationState in createNavigationContainer's _nav var

We made the NavigationState generic while #1313 added a new instance variable. This updates the new instance variable to be generic.

* Fix failing tests
2017-11-20 13:53:48 -06:00
pietro909
88dfd84cf5 Add previous scene to tabBarOnPress - fix #2787 (#2790)
* Add previous scene to tabBarOnPress - fix #2787

* Update docs for tabBarOnPress
2017-11-19 16:00:10 -06:00
Ashoat Tevosyan
4e48d43f0f Allow strings Component types through as screens (#2999)
In React Fiber (React 16), strings are used for intrinsics like 'div' and 'View'. As a result, if you use a View as a screen in an academic experience, you get a red error screen. This PR prevents that from happening.
2017-11-19 15:04:33 -06:00
Iain Diamond
e0704e48a1 Guide-Headers.md (#3000)
Spelling/Typos fixes
2017-11-19 18:24:27 +01:00
Daniel Friesen
caf83794e0 Dispatch can be called multiple times per tick (#1313)
Mostly fixes #1206
2017-11-18 02:15:10 +01:00
Vojtech Novak
65f44ae003 Update withNavigation.md (#2988) 2017-11-17 00:03:27 +01:00
Shubhnik Singh
24a3a79996 Improvement in redux-integration documentation. (#2964)
* Added a guide to intermediate concepts.

* Documentation improvement for redux integration.

* redux-integration feedback incorporated

* incorporated feedback

* heading style changes
2017-11-16 23:21:56 +01:00
Daniel Friesen
e25bdd2ed2 Fix default width of drawer (#2978)
* Fix default width of drawer

Current implementation is simplified / broken.

- The drawerWidth doesn't work for tablets, the drawer becomes massively large
- Header size changes (and thus drawer width changes) in landscape mode on iOS are not accounted for
- An incorrect 64px header size is used for iOS (this includes the status bar height that doesn't belong in the calculation)

Implement a default drawerWidth as a function that follows the Material Design spec closer:
- Screen width - header height
- Use the correct iOS app bar height in portrait and landscape mode
- Drawer max height of 280 on mobile and 320 on tablet

* Update snapshot for drawer width change
2017-11-15 12:04:15 -08:00
James Reggio
346264e132 Add toString() with type for each NavigationAction (#2260)
* Add toString() with type for each NavigationAction

* Add documentation for toString() on NavigationActions
2017-11-15 04:19:55 +01:00
Dave Pack
f2f4e5ce44 Move SafeAreaView out of DrawerNavigatorItems to DrawerSidebar. (#2967)
* Move SafeAreaView out of DrawerNavigatorItems to DrawerSidebar.

The SafeAreaView was breaking custom contentContainers in drawers. Fixes #2963.

* Fix SafeAreaView in DrawerItems and Drawer contentComponent

* Fix flow error and tests.

* Update Drawer documentation with SafeAreaView recommendation. Remove one of the examples for `contentComponent`.

* Put the View back.

* Update snapshot.
2017-11-14 14:09:59 -06:00
Vojtech Novak
931677781e Allow custom header and back button to use the props from react-navigation (#2712)
* allow custom header components

* nicer condtition

* trigger another build

* trigger another build

* distinguist headerLeft component and element

* add docs

* fix typo

* suppress flow
2017-11-14 13:31:21 -06:00
Vojtech Novak
dec79f6a99 Update Guide-Headers.md (#2949)
* Update Guide-Headers.md

* Update Guide-Headers.md
2017-11-14 16:52:39 +00:00
Vojtech Novak
44616dd45a fix 2953 (#2976) 2017-11-14 16:28:52 +00:00
Murad R
fafe68b8cb prevent error `RawText "" must be wrapped in an explicit <Text> compo… (#2415)
this react-native error has no adequate stack, and i waste 4 hours for juggling pieces, until i get the idea to trace error by myself and finded this bug
2017-11-13 10:16:50 +00:00
Mujavid Bukhari
87a1b77525 Update TabBarBottom to accept styling for animations (#2945)
* Update TabBarBottom.js

* Update TabNavigator-test.js.snap

* Update TabView-test.js.snap
2017-11-12 13:00:59 -08:00
Spencer Carli
f0e9f70320 Improve Contributing Guide (#2960)
* Put contributing file in a place where github will pick it up

* New contributing guide
2017-11-10 23:55:33 +00:00
Shubhnik Singh
e396795753 Added a guide under intermediate concepts. (#2958) 2017-11-10 13:26:29 +00:00
rmevans9
53472b72f9 SafeAreaView - Fix for Web usage (#2950) 2017-11-10 11:02:24 +00:00
Zach Bradshaw
6e4afe2153 Fix 'good first issue' link in README (#2919) 2017-11-06 15:25:16 -06:00
tim-soft
838b7c369a [Docs] Fix Comparisons Link in Readme (#2910) 2017-11-06 18:00:25 +01:00
Hawken Rives
6a6207ce7b Export all Flow types from TypeDefinition (#2903) 2017-11-06 09:57:29 -05:00
Martin Malfertheiner
79317e83ae Fix issue #618 - TabBarBottom should hide itself when Keyboard is activated (#1764)
* Fix issue #618 - TabBarBottom should hide when Keyboard is activated

* fix undefined check for _keyboardDidHideSub

* fix prettier

* Update TabBarBottom.js

* Update TabBarBottom.js

* Update TabBarBottom.js

* Update TabBarBottom.js

* Update TabBarBottom.js
2017-11-05 00:44:03 +01:00
Brent Vatne
ffb95fdb73 Bump to beta.19 2017-11-03 15:14:56 -07:00
Brent Vatne
d93acdd918 Add back Header.HEIGHT but with a deprecation warning 2017-11-03 15:07:35 -07:00
Vojtech Novak
b9d1d0d021 improve wording in router docs (#2894) 2017-11-03 20:59:00 +01:00
James Gillmore
7adad618d1 add 2nd params argument to StackRouter.getActionForPathAndParams (#1623)
* add 2nd params argument to StackRouter.getActionForPathAndParams

It still falls back to parsing the query string if no params argument is provided, but now TabRouter.getActionForPathAndParams which might call StackRouter.getActionForPathAndParams with a 2nd params argument will work correctly. 

In addition, if called directly (as may be the case in apps with custom deep-linking needs [which is my primary case]), it will function correctly without users having to build a query string. 

This also solves the problem that deserialization of query strings is currently implemented without support for cases like nested arrays within the query string.

* Update StackRouter.js
2017-11-03 20:19:54 +01:00
Brent Vatne
06cfeb5b2b Bump version 2017-11-02 18:30:53 -07:00
Dave Pack
c0474bb644 SafeAreaView padding from style prop (#2889)
* SafeAreaView now adds padding from style object. If height is specified, inset padding is added to height.

* Header now only accepts headerStyle prop, backgroundColor works as expected.

* TabBarBottom now only accepts style prop, backgroundColor works as expected. Fixes top inset bug.

* Update snapshot.

* Add clarifying comment.

* Support padding with percentage.
2017-11-02 18:14:15 -07:00
Brent Vatne
29ae6f46f6 Safe area example (#2890)
* Add SafeAreaEample for testing

* Remove portrait default lock on SafeAreaExample and add a spacer between buttons
2017-11-02 18:12:11 -07:00
Dave Pack
f899b2eb13 Fixes inputRange on headerStyleInterpolator (#2873) 2017-11-02 13:53:36 +00:00
Abner
e1da55e049 add run redux example script in package.json (#1634) 2017-11-02 10:57:36 +01:00
Emerson Laurentino
43640754cb improve TouchableItem props (#2841)
* Replace props style

* fix: remove eslint-disable-line no-unused-vars

* Update TouchableItem.js

* Update TouchableItem.js
2017-11-02 00:13:45 +01:00
Dave Pack
c5f8eb20d8 Override forceInset on DrawerItems. (#2872)
Fixes second part of issue #2854.

`itemsContainerForceInset` takes the same object as `forceInset` on SafeAreaView. It overrides the SafeAreaView container in DrawerItems.
2017-11-01 15:48:39 -07:00
Dave Pack
313ec7ab76 Fix backgroundColor in Header and TabBar (#2871)
* Add headerBackgroundColor to navigationOptions

* Add backgroundColor to tabBarOptions

* Update snapshots.

* Update docs.
2017-11-01 16:33:50 -05:00
Dave Pack
ed2fc9a09e Fix ios check and array destructuring bug #2853 2017-10-31 15:24:52 -07:00
Spencer Carli
5c533dff89 1.0.0-beta.16 2017-10-31 13:41:14 -05:00
Dave Pack
185289ad66 Add iPhone X SafeAreaView (#2833)
* Add SafeAreaView - JS only version

* Add SafeAreaView

* Looking pretty good

* Small refactor

* Remove console.log

* Fix merge conflict with Header flow types.

* Fix conflict with itemsContainerStyle.

* Fix merge conflict.

* Fix merge conflict, yarn and package.json from fixflow

* Fix merge conflict, navigation playground yarn.lock and package.json with fixflow

* Now it can work on lower versions of RN

* Snapshots merge conflict.

* Update DrawerNavigator snapshot.

* Fix conflict with iconContainerStyle

* Add support for correct status bar height on iPad.

* Update jest snapshots.

* Update StackNavigator snapshot.

* Use modulo instead of while

* Fix landscape tab bar width on < iOS 11
2017-10-31 13:33:40 -05:00
Ashoat Tevosyan
d1c434b54c Update to react-native@0.49 and flow-bin@0.53 (#2845)
* Update root package to react-native@0.49 and flow-bin@0.53

* Update NavigationPlayground package to react-native@0.49 and flow-bin@0.53

* Update ReduxExample package to react-native@0.49 and flow-bin@0.53

* flow-typed update (code-gen)

* Find-and-replace old types with new types

- `React.Element<*>` as the result of a render function is now `React.Node`
- `ReactClass<T>` as the type of a Component is now `React.ComponentType<typeof T>`
- `extends React.Component<DP, P, S>` is now `extends React.Component<P, S>`
- `React.Children<*>` as the type of a children prop is now `React.ChildrenArray<*>`
- Refs are now typed with `React.Ref`

There are also several tiny typo fixes in here.

* Avoid assuming state is NavigationRoute in addNavigationHelpers

For the root, top-level Navigator, the state is a simple `NavigationState` (with no route info) and we still use `addNavigationHelpers` for it. We can't assume `navigation.state.key` is accessible for this type, so we need to do runtime checks here.

* Fix type of NavigationScreenConfig

`navigationOptions` was incorrectly typed

* Give createNavigationContainer's State a type parameter

We want to be able to specifically type this guy so we can use specific NavigationState for things like the Drawer views without having to do runtime assertions about the state type

* Fix typing of NavigationAction

First of all, `NavigationAction` was being used as two different types, so I had to create the new `PossiblyDeprecatedNavigationAction` and add it as a type parameter everywhere. Second of all, generics and implied types were being used far more than they need to be, and they're hard to work with because Flow doesn't really explain things well when they go wrong.

* Make sure children scenes of CardStack have NavigationProp typed with NavigationRoute

CardStack's `NavigationScreenProp` is typed with `NavigationState`, but the children need `NavigationRoute`. Flow gets confused by the spread operator, even if the individual property is replaced later, so we need to explicitly list each property individually (just `dispatch`, actually).

* Allow prevTransitionProps parameter to be nullable

* Allow prevTransitionProps parameter to be nullable

* Narrow down a couple type parameters

* Move NavigationStateRoute cast to within Component.router check in createConfigGetter

* Update withCachedChildNavigation so it's typed correctly with React.ComponentType

* Add a $FlowFixMe for displayName

`React.StatelessFunctionalComponent` is missing `displayName` before Flow 0.54.0

See de37062ea2

* Make TouchableItem's onPress prop optional

`HeaderBackButton` can pass in an undefined onPress, and the React Native `Touchable*` components allow it too

* Simplify withCachedChildNavigation and get rid of generics

The generics don't help us here and they make the types more confusing

* Redefine NavigationComponent as direct intersection

The new type is technically identical to the old type, but Flow is confused by the old type...

* Save router to local var before checking createConfigGetter

Flow seems to think Component.router can change after the check

* Fix DrawerSidebar's navigation prop's type

In order for us to be able to generate a childNavigationProp, the original navigation prop has to have a NavigationState state.

* Colocate action.key check with action.type check in getStateForAction

For some reason, Flow thinks `action` can change sometime after `action.type` is checked. As a result, it's not properly concluding that `action.key` should exist. To avoid this, we pull `action.key` out immediately after doing the `action.type` check.

* Use bounded polymorphism to pass down all props in withCachedChildNavigation

Also makes sure the injected props are specified first in the union

Also removes an unused `eslint-disable-line` in `getScreenForRouteName`

* Make TabRouter's getComponentForState return NavigationComponent

`NavigationScreenComponent` is a subtype of `NavigationComponent`, but it's not clear that `getComponentForState` always returns a `NavigationScreenComponent`, as `getScreenForRouteName` returns `NavigationComponent`

* Define NavigationComponent's props using NavigationNavigatorProps

Right now the types ask Flow to infer the types of `NavigationComponent`'s props. (`NavigationComponent` is the union of `NavigationNavigator` and NavigationScreenComponent.) Instead, we type the props as subtypes of `NavigationNavigatorProps`, so we can properly access those props without type errors. We used bounded polymorphism in `createNavigationContainer` and `createNavigator` to pass down these props. We also explicitly type the action in `createNavigationContainer` so we can properly pass in a `NavigationInitAction` to the dispatch function.

* Parameterize NavigationTabRouterConfig

`NavigationTabRouterConfig` doesn't always take `NavigationTabScreenOptions`; sometimes, it takes `NavigationDrawerScreenOptions`.

* Make all NavigationOptions Exact types

We're seeing weird behavior when these are merged together. By making them Exact types, we make types don't get mangled when they're unioned.

https://flow.org/en/docs/types/unions/#toc-disjoint-unions-with-exact-types

* Silence errors in tests

These errors are unavoidable since we can't type the precise shape of a particular `NavigationState`.

* Include NavigationSetParamsAction in NavigationTabAction

`TabNavigator`'s `getStateForAction` definitely takes `NavigationSetParamsAction`.

* Explicitly list router as void in NavigationScreenComponent

This is so Flow knows that if a `NavigationComponent` has a `router` property, then it is definitely a `NavigationNavigator`.

* Fix website app navigator's type

* Fix createDocPage type in App

In an earlier commit I attempted to fix the types here, but I incorrectly read it as returning a navigator when it just returns a screen. For some reason the error didn't immediately show up.

* Fix NavigationComponent types

Five changes:
1. No longer parameterizing the props of `NavigationComponent`; directly specifying as `NavigationNavigatorProps`
2. Specify the two distinct kinds of route types (leaf and state) directly in `NavigationComponent`
3. Have `SceneView` directly take `NavigationComponent` and allow inferring of `NavigationSceneProp` type
4. Have `CardStack` directly take `NavigationComponent` as well

* Allow Flow to infer `NavigationAction` type in `createNavigator`

* Silence Flow in router code that handles navigator sub-routes

There's no way for us to tell Flow that routes that correspond to navigators should be `NavigationStateRoute`s

* Allow DrawerSidebar to take a null contentComponent

The way `DrawerNavigator` is set up, it's possible to pass in a null `contentComponent` in the config.

If somebody want to do this, we'll just make the `DrawerSidebar` not appear altogether. This is simpler than splitting the types so there's a possibly-unspecified one for the user input, but a definitely-specified one in `DrawerSidebar`.

* Specify missing screenProps prop in DrawerView

* Thread full NavigationStateRoute in to DrawerSidebar

This requiring making `withCachedChildNavigation` use bounded polymorphism to thread the `NavigationStateRoute` through instead of downgrading it to a `NavigationState`

* Make NavigationStateProp's state prop covariant

This means that `NavigationStateProp<NavigationStateRoute>` will be a subtype of `NavigationStateProp<NavigationRoute>` and `NavigationStateProp<NavigationState>`

* Silence Flow's complaints about a route not being a NavigationStateRoute

As mentioned in previous commits and in the comment, there is no way to type a specific navigation state shape, so we have to cast it and silence Flow's complaints.

* Get rid of style prop in CardStack

It looks like at some point, it was possible to specify a `style` prop that got passed all the way down to `Header`, the `TransitionConfig`'s `screenInterpolator`, and `Transitioner`. Doesn't look like we're using it anywhere, and there's a todo saying to remove it, and it's causing a type error.

* Infer type of options instead of using a subtype of {}

I think this has to do with {} allowing for unsealed objects. I'm not 100% sure, but this fixes 4/6 of the remaining errors!

* Fix two type errors in NavigationPlayground

One was just requiring an outdated type (`React.Children` instead of `React.ChildrenArray`), and the other was getting confused regarding types because of a spread operator.

* Use a covariant property to simplify withCachedChildNavigation's InputProps

This doesn't reduce any errors, but it's a bit simpler and cleaner.

* Silence last two Flow errors regarding withCachedChildNavigation injecting childNavigationProps

These are the only two errors I haven't been able to figure out at all. If I had more time I'd try and figure out the simplest case and report it to the Flow team, but I've been working on this for a week already and have to move on.

The issue at hand is that `withCachedChildNavigation` injects `childNavigationProps`, but Flow doesn't see this and thinks it needs to be specified by the view component. We're using the HOC pattern suggested by the Flow docs, and I've tried several other patterns to no avail.

* Use stock react-native instead of Expo's in NavigationPlayground

Expo's causes Flow errors, and apparently this is normal practice because the person who switched us to Expo did this too.

* Silence react-native-gesture-handler Flow errors in NavigationPlayground

Expo requires this package, but it causes Flow errors.

* Fix index check in DrawerSidebar

Silly me, falling for the typical "0 is falsey" problem...

* Rework deprecated action tests

In an earlier commit I moved the `NavigationActions.mapDeprecatedActionAndWarn` out from `getStateForAction` and into `createNavigationContainer`'s `dispatch` function. The tests need to be reworked to support this, as they were previously calling `getStateForAction` directly. I don't imagine any users are calling `getStateForAction` directly.

* Re-record two snapshots

The changes in these snapshots are by design and don't affect anything.

* Infer type of options in NavigationScreenConfig

The issue is that sometimes we include options for different navigators in a single blob.

* Infer types of action and options in createNavigationContainer

Particulary helps with Options. Makes the types more specific and gets rid of an error that only shows up when using the library

* Don't use generics for NavigationState in createNavigationContainer

There's no particular reason for having those generics there, since there's no way we'd be able to get Flow to understand the exact shape of particular navigation states anyways. This fixes a bug when integrating this version of the project into my repo.

* Move ReduxExample to react-native@0.49.3 instead of custom Expo version
2017-10-31 09:41:17 -05:00
Louis Lagrange
701337024e Set initialLayout in defaultProps on Android (#2843)
* Revert "Workaround nested TabNavigation swipe issue (#2733)"

This reverts commit 7b88a475bc.

* Set initialLayout in defaultProps on Android

This reverts the previous PR (#2733) and takes into account #2385
In order to fix https://github.com/react-native-community/react-native-tab-view/issues/312

* Don't use window's dimensions
2017-10-30 11:17:55 +01:00
fxwan
7b88a475bc Workaround nested TabNavigation swipe issue (#2733)
* Workaround nested TabNavigation swipe issue

* Add prop types
2017-10-29 08:37:45 +00:00
Terrance Wood
817e360a53 Avoid one frame delay using TabNavigator (#2385)
* Added optional initialLayout func prop to TabNavigatorConfig.

* Fix default initialLayout prop type.

* Fix default initialLayout prop type.

* Fix lint error.

* Normalized capitalization and punctuation for TabNavigator.md.

* Added react-native-tab-view link to initialLayout prop documentation in TabNavigator.md.

* Update TabView.js
2017-10-28 16:21:55 +01:00
Bruno
468a8ca9be Added iconContainerStyle prop to Drawer (#2825)
* Added iconContainerStyle prop to Drawer

* Updated DrawerNavigator docs

* Improved code quality

* Improved code with eslint
2017-10-28 10:07:17 -05:00
94cstyles
e6505054bd Fix stack navigator animations (#1493) (#2520)
* Fix animation (#1493)

* Rewrite the file animatedInterpolate.js. To increase readability.

* Rename the variable, To increase readability.

* minor renaming
2017-10-26 22:25:59 +02:00
Freddy Harris
c5ffe41b91 Fix impossible to renderTitle in full width on ios (#2641)
* Fix impossible to renderTitle in full width on ios

* Fix test and add a test
2017-10-26 08:59:34 -05:00
James Lin
283518b54a fix redirect bug in stacks in tab (#2674) 2017-10-25 15:58:18 +01:00
Duong Le
3a63950ec8 Add custom style for DrawerItem (#2764)
* Add custom style of DrawerItem

* Update itemStyle to DrawerNavigator doc

* rename style to itemsContainerStyle [BREAKING CHANGE]

* update

* update

* fix issue comma

* update DrawerNavigator-test
2017-10-25 09:38:31 +01:00
Jacob Lauritzen
4df002daab Add 'save-pattern' to docs (#2806)
* Add save-pattern to docs, #145

* Sync style

* Language clarity

* Typo
2017-10-24 20:19:58 -05:00
Anthony Garritano
2ee85482ba Pass transition and modal props to transitionConfigurer (#2383)
* Pass transition and modal props to transitionConfigurer

* Make arguments passed to transitionConfigurer required

* Update docs with params passed to transitionConfigurer
2017-10-24 15:55:38 +01:00
Spencer Carli
5e26ced280 Add a "Quick Start" guide. (#2775)
* Give docs some more room to breath

* Working on the new docs

* New intro

* Writing installation guide

* Finish tab intro.

* Write intro to drawernavigator.

* Add some space

* Rename guide

* Minimize changes

* Fix links

* Edits
2017-10-24 09:51:00 +01:00
Lorenzo Sciandra
f43e85e1c3 Adding a FAQ about performance (#2802)
* adding faq about perfs

* adding to table of content

* was missing an s

* wording
2017-10-23 15:34:21 +02:00
Tien Pham
6a9ed3414a Fix typos (#2811) 2017-10-23 13:44:15 +02:00
Lorenzo Sciandra
4951a6d9d1 Revert "fix broken link to the Navigation Actions guide (#2809)" (#2812)
This reverts commit 34ede7c79f.
2017-10-23 13:27:44 +02:00
Octavian
34ede7c79f fix broken link to the Navigation Actions guide (#2809) 2017-10-23 10:12:08 +01:00
Hirokazu Hata
176a26baa8 Remove unused imported vars (#2718) 2017-10-22 18:21:49 +02:00
Adam Miskiewicz
ef9875417d Redirect to root domain 2017-10-20 15:27:36 -07:00
Adam Miskiewicz
a57ed0ab6a Don't use docker_layer_caching option 2017-10-20 15:09:32 -07:00
Adam Miskiewicz
5fd1df1b1a Fix circleci.yml typo 2017-10-20 15:07:17 -07:00
Adam Miskiewicz
58a19ce264 Make sure Docker is installed in CircleCI deploy process 2017-10-20 15:04:35 -07:00
Adam Miskiewicz
c33f7f83cc Enabled docker support in CircleCI 2017-10-20 14:59:01 -07:00
Adam Miskiewicz
c5851fc940 Deploy to Heroku using Docker 2017-10-20 14:54:25 -07:00
Chris Hunter
1ca407b5ec Add tests for navigators (#2796)
Add minimal unit tests for the DrawerNavigator, StackNavigator and
TabNavigator.
2017-10-20 16:35:54 +01:00
Spencer Carli
1b761cf9d1 1.0.0-beta.15 2017-10-18 08:24:12 -05:00
Spencer Carli
642af12ecb Fix tabbar bottom issue on Android. (#2774) 2017-10-18 09:16:22 +01:00
Dave Pack
3e37ee6d0c Fixes default drawerWidth to match Material UI patterns. (#2773)
* Fixes default drawerWidth to match material ui patterns.

Previously: calculated based on device width regardless of orientation and did not recalculate when orientation changed.
Now: calculates based on minimum of device height/width, remains constant and guaranteed to always fit screen regardless of orientation.

This is the expected behavior based on observing Google apps (e.g. Gmail). This is also better than recalculating on every orientation change, which would result in variable width drawers and awkward empty space when in landscape in most cases.

* Remove console.log
2017-10-17 18:24:56 -05:00
Spencer Carli
29e451193d 1.0.0-beta.14 2017-10-17 11:11:45 -05:00
Spencer Carli
36ffc4f31a [iOS 11] Handle landscape tabbar correctly. (#2676)
* Handle the ios11 tabbar correctly

* Fix an issue when showLabel is false

* Add a basic test for the tabbarbottom

* Add check for ios version number

* Tests shall pass

* make things work for all the versions

* Again, fix the tests
2017-10-16 10:01:30 +01:00
robertkongsvmx
82c2cdbe09 Issue-2662: Add support for testID and accessibilityLabel for tab bar items (#2684) 2017-10-15 19:45:22 -05:00
Lorenzo Sciandra
3ae4b31a9d Updating the README (#2752)
* update the README

* Fixing a couple formats

* rephrase intro

* reordering and relinking

* small reorder

* typo

* couple more changes

* couple tweaks

* libraries section
2017-10-15 16:20:01 -05:00
Finian
f84fe15272 Add allowFontScaling option for TabView and headerTitleAllowFontScaling for HeaderTitle (#2377) (#2721) 2017-10-15 09:57:09 +01:00
Chid Gilovitz
5576b84d8a Update Routers.md (#2750)
Added import line to code example.
2017-10-14 12:31:46 +01:00
Lucas Padilha
09e396002f added drawerBackgroundColor for documentation (#2723)
* added property inside drawerConfig to backgroundColor (drawerBackgroundColor)

* Adjusting documentation for PR deployment (# 2698)

* add example in the doc
2017-10-11 14:04:22 +01:00
Akshay Kadam
2dca5b2135 Typo: 'create' was written twice 😂 (#2727) 2017-10-11 14:00:49 +01:00
Pat Needham
27d496c268 Fix Querystring params not set for nested URI (issue #2251) (#2695)
* fix issue #2251 by including queryString to get nested action

* only use nested query string when original queryString exists, and include test cases
2017-10-09 21:21:39 -05:00
Lucas Padilha
df788fd9ac added property inside drawerConfig to backgroundColor (drawerBackgroundColor) (#2698) 2017-10-08 10:40:08 +01:00
Vojtech Novak
e4a7b7e073 remove ineffective invariant usages, fixes #2258 (#2693)
* remove ineffective invariant usages

* fix flow err

* fix tests

* fix tests

* use throw
2017-10-05 11:59:13 +01:00
David Lewis
c08be7fb43 Suggest flex: 1 for embedded navigator (#2639) 2017-10-03 17:01:52 -05:00
Neo
81d8d91085 add doc for transitionConfig (#1827)
* add doc for transitionConfig

* address review
2017-10-03 16:54:19 -05:00
Dan Gurney
5e001155fb Fix "drawerLockMode" terminology for screenProps (#2667)
Should be "drawerLockMode" instead of "lockMode"
2017-10-03 17:21:49 +01:00
Lorenzo Sciandra
c1d181eccd Fixing Intro Guide (#2679)
* Fixing Intro Guide

Fixes #832 - the code in this page was wrong, that export default was causing errors.

I've also modified a few phrases here and there to help the comprehension.

* more fixes, for CRNA
2017-10-03 09:05:39 -05:00
Spencer Carli
a8556b0df2 Improve StatusBar/Header Behavior (#2669)
* Track orientation change

* Add tests for withOrientation

* Better variable naming
2017-09-29 16:11:30 -05:00
Dave Pack
c4541f44af Updates examples to react-native 0.48.4 and expo sdk 21. (#2675) 2017-09-29 16:06:56 -05:00
Vojtech Novak
ef82f1b5ff Update ISSUE_TEMPLATE.md (#2668)
the problem I see with many bug reports in this repo is that people write a very vague description of what their problem is and expect to get some help. I tried to:

1 . emphasise how important it is to include a runnable reproduction
2 . cut down on some extra words at the beginning of the template so it's more to the point
2017-09-29 15:51:06 -05:00
Spencer Carli
1a62bf7955 Remove RelativeImageStub providesModule 2017-09-28 14:57:17 -05:00
Ashoat Tevosyan
a79d86b152 Remove @providesModule declarations in src/utils to avoid Flow conflicts with fbjs package (#2665) 2017-09-28 14:42:14 -05:00
Spencer Carli
e139e83a1a 1.0.0-beta.13 2017-09-27 09:55:06 -05:00
Alexei Malashkevich
4202892a5d Adding search to docs website (#2606)
* Adding search to docs website

* fix eslint errors
2017-09-27 09:25:27 -05:00
Alessandro Annini
2f0e386a24 Added js highlighting (#2610) 2017-09-25 15:23:47 -05:00
Masayuki Iwai
69397af74d Make GESTURE_RESPONSE_DISTANCE_* configurable. (#2172)
* Make gestureResponseDistance configurable.

* Fix format.

* Set vertical and horizontal distance individually.

* Fix type error.

* Move gestureResponseDistance to NavigationStackScreenOptions.

* Add documentation.
2017-09-25 20:16:13 +01:00
Ashoat Tevosyan
b759d3136e Fix Flow types (and update RN version) (#2619)
* Fix .flowconfig to stop ignoring modules and properly include React Native libraries

Currently, there are numerous ignored libraries that are hiding type errors. Actually, they're causing type errors too. This sort of thing only patches over actual problems, so we have to revert them to get a config we can build upon.

* Update react-native/flow-bin dependencies

We want to have Flow types working with the latest packages.

* Update flow-typed libraries (auto-generated)

* Fix typing of navigation prop used by withNavigation HOC

The current typing is clearly a typo, as it is circular. `NavigationScreenProp` should be used to type the navigation prop

* Fix typing of easing function

What's funny is that I fixed this before in d71ed75133. @skevy reintroduced the mistyped function in 9436d03fe8, which didn't trigger any Flow errors because .flowconfig was ignoring the entire react-native package

* Correct typing of View and Text style prop

The current code thinks it can import these, but this isn't true, and was being hidden because the .flowconfig ignored the whole react-native package. There's no easy to type Text and View at the current moment, as far as I can tell. Importing the highly generic `StyleObj` seems like the best bet, and is what I have being using in my projects.

* Import NavigationScreenComponent using full path

* Updating yarn.lock files

* Get rid of library overrides in flow-typed/react-native.js and flow/react-navigation.js

* Add @flow to src/react-navigation.js and make last three params to createNavigator optional

* Make screenProps and navigationOptions optional in NavigationNavigatorProps

* yarn run format

* Readd react-navigation/node_modules ignore to NavigationPlayground's .flowconfig

Realized this line I removed in the first commit is necessary when using npm link/yarn link, which is what the CircleCI build does

* Make all DrawerViewConfig's params optional

Some of these params are marked as optional because they have defaults. However, the only place `DrawerViewConfig` is used is as the input the function that then applies the defaults

* Make all props in NavigationNavigatorProps optional

`NavigationNavigatorProps` is used to type the props of the component that is output by the `StackNavigator`, `TabNavigator`, etc. component factories. This component does not need to have any props specified.

* Make second param to `DrawerNavigator` factory optional

`DrawerNavigator`, just like `TabNavigator` and `StackNavigator`, can be called with just a single argument (ie. omitting the config)

* Upgrade to RN 0.48.4 to address https://github.com/facebook/react-native/issues/15810
2017-09-25 11:29:34 -05:00
Jeff Mendez
17c910fb5d drawerLockMode (#1377)
* added drawerLockMode with cabilities to update it on the fly

* fixed incorrect name on markdown for usage

* added handling if screenProps is not being used

* Fix linting error

* Use drawerLockMode instead of lockMode

* Correct docs

* Fix flow issues

* Make drawerLockMode optional
2017-09-21 12:53:46 -05:00
Matt Hamil
2b40182cd7 Reverting last commit (#2626) 2017-09-20 15:08:11 -05:00
Matt Hamil
7832ed72c0 Merge branch 'master' into master 2017-09-20 14:40:37 -05:00
Sakamoto, Kazunori
365eec8efa Refactor .eslintrc to be more readable. (#2595)
- Replace 0, 1 and 2 with "off", "warn" and "error" because strings seem more readable than numbers.
2017-09-15 17:21:08 -05:00
Sakamoto, Kazunori
98cb493449 Employ pre-commit hook for formatting code. (#2597)
This change comes thanks to @plasticine's great idea (https://github.com/react-community/react-navigation/pull/2581#issuecomment-329661371).
- Add husky and lint-staged to use pre-commit hook.
- Automate formatting JavaScript code using ESLint and Prettier before committing changes.
2017-09-15 17:17:09 -05:00
andry-baka
500c8a07ac Doc Improvement: goBack key doc improvement (#2035)
* chore(Doc Improvement): goBack key doc improvement

* chore(Doc improvement): fix wording

* chore(Doc Improvement): fix uppercase/lowercase wording
2017-09-15 16:43:35 -05:00
Tomas Reimers
3ad142b818 Update documentation on Title. (#2092) 2017-09-15 16:36:44 -05:00
Peter Piekarczyk
44a65fc5a1 Add Syntax highlighting to Redux-Integration.md (#2355)
* Add Syntax highlighting to Redux-Integration.md

* Update Redux-Integration.md
2017-09-15 16:21:16 -05:00
Matt Hamil
627bb36995 Add RNNavigation Links Repo to README (#2586)
* Add RNNavigation Links Repo to README

* Changed = to -
2017-09-15 16:13:46 -05:00
Spencer Carli
4262b8a736 Merge branch 'probeadd-master' 2017-09-15 16:02:11 -05:00
Spencer Carli
6efca5d2dd Fix code block and add export default. 2017-09-15 16:01:26 -05:00
Spencer Carli
65313ab523 Merge branch 'master' into master 2017-09-15 15:51:53 -05:00
Jonathan Kim
73cf08744e Add documentation for useNativeAnimations option in DrawerNavigator (#2593) 2017-09-15 15:49:54 -05:00
Justin Morris
b7768d12e6 Trivial: cleanup warnings in test suite (#2581)
* Mock and verify console warnings to prevent noise in the test output.

* Tighten up expectations on deprecation output.

* 80 column formatting.

* Actually fix formatting.
2017-09-15 08:42:23 -05:00
Justin Morris
ee2e27c24b Trivial: Ignore the jest setup file when calculating test coverage. (#2579)
* Ignore the jest setup file when calculating test coverage.

* Actually collect coverage from the whole library codebase so that the numbers are actually useful.
2017-09-14 21:02:09 -05:00
Spencer Carli
2716fe4fea Blog: A (Renewed) Path to React Navigation V1 2017-09-14 20:24:03 -05:00
Jonathan Kim
23da6aebff Expose useNativeAnimations for Drawer navigator (#2568)
* Expose useNativeAnimations for Drawer navigator

* Default useNativeAnimations to true
2017-09-12 17:03:37 +01:00
Kevin Cooper
fe4b1e2379 Accept a tabBarOnPress param (#1335)
* Accept a 'tabBarOnPress' param

* Make tabBarOnPress a navigationOption
2017-09-12 09:17:37 -05:00
Tom Aranda
eeda63fb3e Update top-level component nav documentation (#2543)
The code example listed in the current documentation results in a deprecation warning.  This update should work.
2017-09-09 11:13:32 -05:00
Joey Baker
70785d635a Fix actually remove openURL event listener (#2235)
Previously, we were creating an anonymous function as the event listener handler. This means we can't un-listen because we don't have a reference to the handler.
2017-09-09 11:09:18 -05:00
Kevin Cooper
312b68790a Upgrade the ReduxExample app (use CRNA) (#2171)
* [ReduxExample] Delete android and ios dirs

* [ReduxExample] Upgrade using create-react-native-app

* [ReduxExample] Add postinstall script to clean up files Yarn copies in

Yarn copies them when installing locally, causing lots of @proviesModule collisions.

* [ReduxExample] Upgrade expo and other dependencies

* [ReduxExample] Don't delete .git just in case
2017-09-06 21:02:57 -05:00
Aleksey Kuznetsov
af53b0e5b8 Add custom transitioner example to NavigationPlayground (#2412) 2017-09-06 19:41:41 -05:00
Adam Miskiewicz
c414ba8385 Update CI docker image 2017-09-06 15:51:46 -07:00
Adam Miskiewicz
b5d3ff0aae Use token when running 'now alias' 2017-09-06 15:13:50 -07:00
Adam Miskiewicz
22b26ff6af Deploy website using NOW_TOKEN 2017-09-06 14:59:25 -07:00
Spencer Carli
ba3fb1a7ee Fix Website Build (#2526)
* Update .eslintrc to allow compile.

* Resolve .web.js extension

* Look for __DEV__ on global

Fixes ReferenceError when not in the React Native environment.

* Replace __DEV__ at compile time via babel

* Don't try to lint a website build
2017-09-06 16:08:08 -05:00
Spencer Carli
0c62701ddc Revert changes to yarn.lock (#2545)
* Rollback changes to yarn.lock

* Update react-native-tab-view in yarn.lock
2017-09-06 13:22:08 -05:00
Manu Bamba
c815626020 Fixed issue with tab navigation (#2527) 2017-09-06 11:42:48 -05:00
Kevin Cooper
19babadf38 Fix the NavigationPlayground example! (#2170)
* [Playground] Commit auto-changes to package.json, yarn.lock

* [Playground] Rerun create-react-native-app

Preserving rn-cli.js and transformer.js

Still not quite working.

* [Playground] Fix the Expo loading issue by removing projectRoots

Now it looks in the right place to find its resources, including 'entryPoint'.

* [Playground] Add postinstall script to clean up files Yarn copies in

Yarn copies them when installing locally, causing lots of @providesModule collisions.

* Update the Contributors guide to explain how to use the example app

And recommend Yarn by default

* [Playground] Remove now-obsolete rn-cli.config.js

* [Playground] Upgrade expo and other dependencies

* [Playground] Don't delete .git just in case
2017-09-06 10:36:20 -05:00
Hawken Rives
2e1624e976 pin react-native-tab-view with ~ instead of ^ (#2348)
Because react-native-tab-view insists on sticking at 0.0.*, 
the caret version pinning won't install "minor" updates.

Semver rules are weird with 0. major versions.

Is this something you'd be interested in?
2017-08-31 09:58:47 -05:00
Andréas Hanss
024297b014 Add documentation to help handling Hardware Back Button in Android (#2486) 2017-08-30 16:34:46 -05:00
Brooks Lyrette
a71fd99cd4 Corrected broken links. (#2374)
Updated links for Card.js, CardStack.js and Header.js
2017-08-30 16:30:23 -05:00
Gant Laborde
8fdfc6d7a6 Feature/toggle (#2492)
* add toggle functionality

* add documentation
2017-08-29 21:55:33 -05:00
Satrio Adi Prabowo
e91e820823 Fixed conflict 2017-08-29 23:39:50 +07:00
probeadd
1b0c417633 Fixed 2017-08-29 23:36:30 +07:00
probeadd
d99f1fc07c Merge branch 'master' of https://github.com/probeadd/react-navigation 2017-08-29 17:36:10 +07:00
probeadd
7ee535cbd7 Fixed from review 2017-08-29 17:25:11 +07:00
Jan Peer Stöcklmair
aa92bcb0dd Fix ActiveScreen in custom navigation (#2354) 2017-08-28 21:35:48 -05:00
Farzad Qasim
8cd77cfad4 Fix broken links (#2366) 2017-08-28 21:33:28 -05:00
Keegan Stothert
ae9d49f1ab Update TabNavigator.md (#2482)
tabNavigatorConfig doc improvements
2017-08-28 21:25:56 -05:00
Bruno
3336022279 Fix style variable in docs. (#2451) 2017-08-23 20:07:12 -05:00
Spencer Carli
f172ade4ae Add additional guidance information to the GitHub issue template. (#2428)
* Add additional guidance information to the GitHub issue template.

- Provides links to best places to ask usage questions.
- Uncomments guiding information in issue template that wasn't visible when creating issue.
- Based on questions asked here: https://new-issue.vuejs.org/#modal

* Remove  ' instead of the expected behavior'
2017-08-20 15:08:56 -05:00
probeadd
d95f01f552 #Provide intro for create-react-native-app and react-native init 2017-08-12 12:58:27 +07:00
James Ide
ae9fb10e60 [assets] Optimize back-icon PNGs (#2341)
Ran the images through `optipng -o7 -strip all`. In some cases got the images down from > 1 TCP packet to below 1.
2017-08-08 23:26:18 -07:00
Matt Hamil
2e958c9677 Upgraded to react-native-tab-view@0.0.67 2017-08-04 11:00:54 -05:00
Matt Hamil
7eda8a2fe7 reverted back to 0.0.66 react-native-tab-view 2017-08-04 10:23:07 -05:00
Matt Hamil
b537b1ca4e pulled 2017-08-04 10:14:38 -05:00
Matt Hamil
59a71f7acf updated react-native-tab-view 2017-08-04 10:13:02 -05:00
Fidan Hakaj
b00208baa7 Updates Routers.md - adds missing parenthesis (#2230)
Adds missing parenthesis to *Handling Custom URIs* code example
2017-08-02 00:29:55 -05:00
Adam Miskiewicz
99cd4604b4 Change parallelism on Circle to 2 2017-07-19 14:11:11 -07:00
Adam Miskiewicz
ba47c772ff Remove ReduxExample from Circle 2017-07-19 14:10:43 -07:00
Adam Miskiewicz
e2afc982da Fix tests in NavigationPlayground 2017-07-19 14:03:58 -07:00
Adam Miskiewicz
5e075e1c31 1.0.0-beta.12 2017-07-19 13:11:57 -07:00
Adam Miskiewicz
dd3290aa59 Remove generating prop-types from Flow 2017-07-19 13:11:56 -07:00
Adam Miskiewicz
2f0241d774 Update dependencies 2017-07-19 13:04:04 -07:00
Adam Miskiewicz
a0741712ed Add flow definition to eslintignore 2017-07-19 13:01:23 -07:00
Adam Miskiewicz
eb8434a5b6 Clean up some flow types code-base wide, reorganize cardstack views 2017-07-19 12:59:40 -07:00
Adam Miskiewicz
bbd82dff53 Stricter flow typing on CardStackStyleInterpolator 2017-07-19 12:59:40 -07:00
Adam Miskiewicz
681e1c6e31 Update depenencies, update Prettier 2017-07-19 12:59:40 -07:00
Adam Miskiewicz
ebf1e2e893 Update NavigationPlayground to 0.45.1, add stub react-nav flow definition 2017-07-19 12:59:40 -07:00
Adam Miskiewicz
9436d03fe8 Update to RN 0.45, fix/improve flow coverage 2017-07-19 12:59:39 -07:00
Adam Miskiewicz
c2c81d95f6 Update flow-typed defs 2017-07-19 12:59:39 -07:00
Adam Miskiewicz
c209b2dfcc Add react-native flow-typed definition 2017-07-19 12:59:39 -07:00
Adam Miskiewicz
8455b75dbd BackAndroid -> BackHandler 2017-07-19 12:59:39 -07:00
Adam Miskiewicz
1919bff719 Disable noisy logging unless process.env.REACT_NAV_LOGGING is set 2017-07-19 12:59:39 -07:00
Adam Miskiewicz
2da42c0cc0 Improved header + tab bar styles on iOS 2017-07-19 12:59:38 -07:00
Scott Brady
cc22138b19 Adding reset key documentation (#1297) 2017-07-10 20:46:29 -05:00
Yohan Spychala
9037dd3c4e Fix flow type for NavigationParams (#1574) 2017-07-04 02:30:04 -04:00
Nicolas Beck
5e27ecf35e fixed bug with wrong label&icon in Drawer (#1914)
* fixed bug with wrong label&icon in Drawer

* itemPress in Drawer now always navigates to first screen of a nested StackRouter

* used eslint formatting

* added comments
2017-07-04 02:26:16 -04:00
Hugo Dozois
fa9a2d6960 Removed duplicate navigation flow annotation in CardStack (#1993)
- Also defined in the NavigationTransitionProps
2017-07-04 02:25:37 -04:00
Gabriel Bull
72f6331fdb Added with navitation to website’s docs (#1974) 2017-07-04 02:24:49 -04:00
Tiziano Munegato
b310b153fd fix header metrics based on Material design guidelines (#2001) 2017-07-04 02:24:29 -04:00
Franco Sarachu
8772e5f373 Update StackRouter.md (#2047)
Add missing ":"
2017-07-04 02:23:20 -04:00
Michael
04b5578c14 Fixed spelling mistake in validateRouteConfigMap (#2049) 2017-07-04 02:23:02 -04:00
Adam Miskiewicz
b6de8cb276 Fix CircleCI configuration 2017-07-03 23:15:07 -07:00
Adam Miskiewicz
b354b8eb49 Revert "[BUGFIX] Use a proper source of headerBackTitle (#2007)" (#2018)
This reverts commit 075902147d.
2017-06-28 12:04:56 -07:00
Alexey
075902147d [BUGFIX] Use a proper source of headerBackTitle (#2007) 2017-06-28 23:21:43 +05:30
Jan Peer Stöcklmair
661d01dc54 Docs: typo (#1783)
* Docs: typo
2017-06-27 17:27:54 -05:00
Gabriel Bull
f3bb04888e Fixed website dev bug (#1973) 2017-06-26 10:02:59 -07:00
Fidan Hakaj
a2fdb6d704 Use animatable text component for the header title (#1922)
* Uses animatable text component for the header title

* fix: prettier issue
2017-06-23 17:19:49 -07:00
Koen Punt
027c6ae5aa ignore files starting with a dot (#1971)
macOS creates metadata files named `.DS_Store`. The script incorrect tries to read it with a `.md` extension.  By excluding all files that start with a dot we can prevent this.
2017-06-23 17:19:13 -07:00
Nimrod Argov
a849eefc90 Add doc note for nesting wrapped navigator (#1947)
After having to look for a solution for nesting a navigator embedded in a component, found this issue that dealt with the same problem: https://github.com/react-community/react-navigation/issues/90.
Added the solution to the guide as a side note.
2017-06-23 17:18:13 -07:00
Nicholas Thompson
be1da2c4c9 Clarify headerBackTitle usage (#1649)
* Clarify headerBackTitle usage

* Updating text to that suggested by @pvinis

See https://github.com/react-community/react-navigation/pull/1649#discussion_r118195443
2017-06-22 20:47:16 -07:00
Koen Punt
fac91e097b allow empty path to be matched (#1811)
previously when opening a deeplink without a path, it would result in an array of 2 empty strings, which is are falsy values, so the full url was passed on.

by checking if the value is actually `undefined` instead of falsy we have no more false positives
2017-06-22 20:30:12 -07:00
Iftekhar Rifat
608217abbc DrawerNav: don't push screen to stack if it's already focused (#1817) 2017-06-22 20:29:30 -07:00
Neo
c61d72f9e7 Fix typo -- movedDistance moveX, moveY -> dy/dx (#1824) 2017-06-22 20:26:54 -07:00
Stefan Roex
d29dc05e73 More iOS-ish transitions (#1786) 2017-06-22 20:24:43 -07:00
Sergey Zhigunov
4f26834ef0 Update examples (#1968)
Use prop-types instead of React.PropTypes
2017-06-22 20:05:03 -07:00
Ron Arts
7138f8ccd5 Clarify in docs that npm install in main dir is needed for NavigationPlayground (#1712)
Updated documentation on running the NavigationPlayground example
2017-06-22 09:08:52 -05:00
G. Kay Lee
f3ca1de867 Update Screen-Nav-Options.md (#1793)
Fix grammatical error in docs
2017-06-21 21:36:15 -05:00
Matt Hamil
07c74eff6d Merge branch 'master' into master 2017-06-19 15:58:44 -05:00
Alan Foster
36642ebb69 Reduce rerenders on header back button (#1913) 2017-06-19 12:07:07 +05:30
Adam Miskiewicz
52a2846e77 Add CoC 2017-06-14 21:31:56 -07:00
Matt Hamil
75b4f2371f Merge branch 'master' into master 2017-06-12 14:17:18 -05:00
Koen Punt
3f0577f97a pass screenProps to TabBarComponent (#1841)
To support for example filtering the tabs based on a property passed to a parent navigator, I need to have to access to the screenProps in the tab bar
2017-06-12 19:20:31 +05:30
Matt Hamil
7e96ad4189 Fixed issue with back button 2017-06-06 17:24:13 -05:00
Matt Hamil
484c729154 Updated to react-navigation v1.0.0-beta.11 2017-06-06 14:24:27 -05:00
Matt Hamil
528b1ad812 Stack pushes are now idempotent 2017-06-06 14:15:15 -05:00
James Gillmore
8d91753e9c change TabNavigator type to NavigatorTypes.TABS (#1628) 2017-06-03 12:41:06 -07:00
William Schurman
a60d1d529f Correct sizing of header back button image on iOS (#1687) 2017-06-03 12:22:10 -07:00
JSON Deppen
bff7d0778b Update broken links (#1696) 2017-06-03 12:21:39 -07:00
Gabriel Bull
77b04f342d Removed dependency on fbjs (#1698) 2017-06-03 12:21:08 -07:00
Paul McBride
48b09bfdae Fix documention header styles (#1742) 2017-06-03 12:01:13 -07:00
Jacob Lauritzen
3abbb950e8 Update drawer layout polyfill to 1.3.1 (#1716) 2017-05-29 13:05:43 +05:30
Satyajit Sahoo
a3f7930c58 Upgrade React Native Tab View to v0.0.66 (#1713) 2017-05-28 19:55:49 -07:00
Kyle Herock
e8ec07d9e3 Expose CardStackTransitioner as export (closes #1326) (#1676) 2017-05-24 12:15:55 -07:00
Gabriel Bull
89db9ea204 Added tabStyle property (#1667) 2017-05-24 11:33:23 +05:30
Adam Miskiewicz
ff2a6b1c97 1.0.0-beta.11 2017-05-23 21:53:38 -07:00
Adam Miskiewicz
269311c2a3 Fix flow error in CardStack 2017-05-23 21:51:30 -07:00
Satyajit Sahoo
934458ae8e Release beta 10 2017-05-19 21:32:42 +05:30
Gregory
9027e1a88f Fix backAndroid warning (#1520) 2017-05-19 08:57:33 -07:00
Daniel Friesen
03698c9a69 Allow the routes outputted by DrawerView.Items to be overridden (#1039) 2017-05-19 09:23:19 +05:30
Samuel Rounce
ec74206a91 Mention Reactiflux channel in README.md (#1553)
I think some mention of the channel on Reactiflux might be good as the signal to noise ratio in issues is out of control.
2017-05-18 07:58:01 -07:00
Adam Miskiewicz
296becd5d1 Tweak iOS animation easing, gesture tweaks 2017-05-16 23:04:33 -07:00
Adam Miskiewicz
880e93c1d3 Increase cache version for Circle 2017-05-15 21:53:50 -07:00
Adam Miskiewicz
59db7cfeec Increase cache key search for Circle 2017-05-15 21:51:51 -07:00
Adam Miskiewicz
ef709f6b5d Disable Expo deploy for now -- cuz of watchman 2017-05-15 21:41:55 -07:00
Adam Miskiewicz
088ee9a6fe Try to up inotify watches 2017-05-15 20:20:14 -07:00
Adam Miskiewicz
2b1081076b Add watchman to docker image 2017-05-15 20:09:08 -07:00
Adam Miskiewicz
b7f8ea9bae Change directory to proper place before exp publish 2017-05-15 19:56:58 -07:00
Adam Miskiewicz
fff7ef49c5 Add icon for example 2017-05-15 19:45:27 -07:00
Adam Miskiewicz
604fe7fca4 Clear CI caches 2017-05-15 19:41:23 -07:00
Adam Miskiewicz
690365a6e5 Update docker image 2017-05-15 19:41:03 -07:00
Adam Miskiewicz
83e2cf007b Fix tests in examples 2017-05-15 19:36:04 -07:00
Adam Miskiewicz
de6396facd Don't use jest-setup on NavigationPlayground 2017-05-15 19:16:00 -07:00
Adam Miskiewicz
518f491727 Install react-navigation in NavigationPlayground 2017-05-15 19:12:52 -07:00
Adam Miskiewicz
4632e1c348 Fix path to Jest in NavigationPlayground 2017-05-15 19:08:16 -07:00
Adam Miskiewicz
44dac9b629 Don't run Jest watch in CI 2017-05-15 19:06:17 -07:00
Adam Miskiewicz
fc1472dc84 Restore jest-setup.js file 2017-05-15 19:02:46 -07:00
Adam Miskiewicz
1cd16bcf4a Convert NavigationPlayground project to a CRNA project 2017-05-15 18:57:22 -07:00
Adam Miskiewicz
d145332fdf Remove old NavigationPlayground code (and ExpoNavigationPlayground) 2017-05-15 18:57:22 -07:00
Daniel Schmidt
b19beda0a7 Add NavigationPlayground Expo Demo (#1523)
* use react-navigation as dependency
* add expo based playground app
* name expo playground demo in the docs
* add ci task to deploy playground demo
2017-05-15 16:55:10 -07:00
Miguel Oller
ed0a818aee Exclude __tests__ from published files (#1525) 2017-05-15 10:33:14 -07:00
Adam Miskiewicz
a61b4478f0 Make sure root deps are installed before running yarn in example folders 2017-05-14 23:16:02 -07:00
Adam Miskiewicz
9edb4ef5e8 More CI parallelization optimizations 2017-05-14 23:14:22 -07:00
Adam Miskiewicz
aa84a5e316 Migrate to CircleCI v2 (#1517)
Use the new Docker-based, beta version of CircleCI.

This adds a docker image that has the correct deps to run flow, and then migrates from the old circle.yml format to the new.

This gets test runs wayyyyy down. Earlier today, on the old stack, before optimizations, we were at > 9 min for PR builds (aka, CI runs without a website deploy). The build for this PR ran in 1 min 33 seconds. Woo!
2017-05-14 23:08:13 -07:00
Adam Miskiewicz
3b6eee6367 Split test commands into test.sh, respect CIRCLE_NODE_INDEX 2017-05-14 22:11:18 -07:00
Adam Miskiewicz
37c9d07b9d Paralellize tests 2017-05-14 22:04:55 -07:00
Adam Miskiewicz
ebb20ad632 Hotfix website error (maximum callstack size exceeded 2017-05-14 21:54:56 -07:00
Adam Miskiewicz
e083d4bf86 Fix website build -- needs eslint 2017-05-14 21:42:34 -07:00
Adam Miskiewicz
bf1c1afd64 Add codecov.io badge 2017-05-14 21:32:55 -07:00
Adam Miskiewicz
fe9e30d8a8 Change react-navigation path in example package.json to relative 2017-05-14 21:28:38 -07:00
Adam Miskiewicz
6c09b85d4e Update Circle.yml with more caching 2017-05-14 21:28:38 -07:00
Adam Miskiewicz
c5e2229376 Add codecov.yml 2017-05-14 21:28:38 -07:00
Adam Miskiewicz
96a1c1fddf Add codecov.io support 2017-05-14 21:28:38 -07:00
Adam Miskiewicz
a781c35e75 Run 'flow check' instead of 'flow' in CI 2017-05-14 21:28:38 -07:00
Adam Miskiewicz
1ae3798137 Upgrade to React Native 0.44 + Flow 0.42 2017-05-14 21:28:38 -07:00
Adam Miskiewicz
30ca3c1f80 Fix Flow and Tests (#1510)
* Navigation actions should be string literals to work properly with Flow

* Update StackRouter/TabRouter tests with eslint ignore rule

* Use `expect.objectContaining` so we don't rely on keys
2017-05-14 14:18:09 -07:00
Adam Miskiewicz
f3a958dca1 Update/Fix Prettier + Eslint config for codebase
Run Prettier/Eslint on entire codebase, fix issues
2017-05-14 14:18:09 -07:00
Neo
a301b41479 stop using Animated.spring (#1500)
* stop using Animated.spring

* use layout instead of window.size
2017-05-14 08:40:02 -07:00
Stephen J. Collings
c2f49e52a9 Add testID to HeaderBackButton (#1397) 2017-05-12 15:28:32 -07:00
Kevin Cooper
f575d90986 [Minor] Update Stacks examples for better clarity (#1341)
* Update Stacks{In,Over}Tabs example for better clarity

* Remove redundant navigationOptions in stack examples

* Update text in ReduxExample to clarify which route is being used
2017-05-12 15:27:53 -07:00
Daniel Friesen
625fc5b109 Don’t use Init# keys for reset (#1320)
This Init{index} pattern guarantees that the same keys will always be re-used when doing a RESET.
This behaviour doesn’t match how the rest of the router works and causes bugs.

Namely if you are on `{ routeName: ‘Dashboard’, params: { user: ‘A’ } }` and use RESET to `{ routeName: ‘Dashboard’, params: { user: ‘B’ } }` when the user switches, it will act like a `setParams` action instead of a `RESET` action and the Dashboard will not be re-mounted.
2017-05-12 15:13:33 -07:00
HelloYou
116dfb662e Init to Init-UUID (#1419) 2017-05-12 15:08:22 -07:00
Koen Punt
506214f9ab allow uriPrefix to be a regular expression (#1431)
when accepting both a protocol url and a normal url, it's hard to define a static prefix.
2017-05-12 14:40:10 -07:00
Tim Liu
a9de445015 Variable name consistency (#1452) 2017-05-12 14:37:55 -07:00
kdenz
79a67d9114 Minor update (#1491)
styles.tabIcon leads to nowhere, only has styles.icon
2017-05-12 14:37:15 -07:00
Kohki Makimoto
673b9d2877 Fix incorrect link (#1426) 2017-05-12 14:36:53 -07:00
Satyajit Sahoo
d4b4697f33 Update react-native-tab-view. Fixes #1248, #1163 (#1327) 2017-05-10 13:34:06 +02:00
Koen Punt
ff99d6ec0a accept style prop on Header component
to allow composition of the Header component when using a custom header
component, styling is probably one of the options you want to have.

For example, I need to dynamicly change the height of the header based
on scroll position, and without this change I have to inherit from the
Header component and copy the render function, instead of composing the
Header component in my own component.
2017-05-07 11:39:13 +05:30
Luke Rhodes
31ee86ad5c Pass tintColor to tabBarLabel within navigationOptions 2017-05-07 11:38:14 +05:30
Des Preston
f61ce3d46a clarify title option
If you attempt to use something other than a string, it will throw an error in some situations. #1318 provides more details about the error. If it is expecting a certain type, the docs should clarify that.
2017-05-07 11:35:57 +05:30
ashoat
d71ed75133 Fix type of Easing function to match type in react-native module 2017-05-07 11:33:43 +05:30
Ihor
5aaf4a86be Delete unused import component 2017-05-07 11:26:34 +05:30
Rich Gilbank
4c953e0e8f Fixes NavigationActions docs links 2017-05-07 11:25:06 +05:30
zakster12
d4ce9b08ab Changed View to Animated.View for TabBarBottom (#1360) 2017-05-04 16:41:57 +05:30
Satyajit Sahoo
b8dbbe964e Hide overflow on individual pages in tab view (#1271) 2017-04-28 15:23:25 +02:00
Koen Punt
b532f8cc19 fix toggle header example (#1286) 2017-04-28 12:58:13 +02:00
Koen Punt
c04ea5b492 add headerBackTitleStyle screen option (#1083)
* add headerBackTitleStyle screen option

since the title is customizable, the back title should too.

* add documentation for `headerBackTitleStyle`

* make absence of headerBackTitle not affect return value

* merge styles so current scene can override

If there's no last scene, return the `headerBackTitleStyle` from the
current scene.
Otherwise return the `headerTitleStyle` from the last scene, and the
`headerBackTitleStyle` from the current scene, with the latter having
precedence.

* take headerBackTitleStyle from current scene

also the title style of the last scene is no longer taken into account
2017-04-28 07:55:15 +02:00
Neo
961cf13268 skip Transitioner animation after swiped back (#1036)
* fix gesture

* add easing

* skip Transitioner animation after swiped back

* Run format
2017-04-27 07:47:57 -07:00
Gabriel Handford
d32f6e4ac6 Fix navigator links (#1259) 2017-04-27 13:37:05 +05:30
Mike Grabowski
004e9632f6 Release v1.0.0-beta.9. 2017-04-26 23:59:37 +02:00
Mike Grabowski
c25e0265c4 Fix glitch (#1264) 2017-04-26 14:56:10 -07:00
Mike Grabowski
f2dd70a29e Add a blog post about new release (#1262)
* Create 2017-02-On-the-path-to-v1.md

* Add doc to website

* Rename 2017-02-On-the-path-to-v1.md to 2017-04-On-the-path-to-v1.md

* Update 2017-04-On-the-path-to-v1.md
2017-04-26 23:46:58 +02:00
Tuyen Nguyen
7be9f79144 Implement change request in #653 (#1105)
* Implement getPathAndParamsForState for StackRouter

* Add test to make sure `params` is correct in getPathAndParamsForState of StackRouter

* chore: fix flow
2017-04-26 14:45:04 -07:00
Neo
1d6fd37663 remove 30px offset workaround for screen’s shadow disappearing (#1110)
* remove 30px offset workaround for screen’s shadow disappearing

* Run prettier
2017-04-26 10:38:33 -07:00
Neo
d3fb9447b7 make test pass (#1253)
test fails since #1231
`383:25  error    'options' is assigned a value but never used  no-unused-vars`
2017-04-26 17:15:25 +02:00
Dave Bennett
aa7fe56bb4 Modal gestureEnabled (#1243)
* Fix Modal Gestures

* Update StackNavigator.md for gesturesEnabled to include modals again

* Remove modal gesture todo

* Gesture response distance top, side => vertical, horizontal
2017-04-26 18:25:25 +05:30
Mike Grabowski
a14ac29c30 Remove navigationOptions from component props (#1231) 2017-04-26 17:06:00 +05:30
Mike Grabowski
2b24492370 Make header configurable (#1220)
* Initial commit

* Remove null mention

Technically, it's possible, though it's not recommended approach. People should use `headerVisible`.

* Update SimpleStack.js

* Updates

* Remove headerVisible

* Fix docs

* Fix flow

* Bring back validation

* Fix import
2017-04-26 13:34:21 +02:00
Satyajit Sahoo
8df3fa9db1 Switch pager when swipe and animations are disabled (#1234) 2017-04-26 06:15:01 +02:00
Satyajit Sahoo
cfc8c1fed1 Fix lazy prop not passed (#1235) 2017-04-26 06:11:27 +02:00
Satyajit Sahoo
0cd3eaa97a BREAKING: Update React Native TabView (#1218) 2017-04-25 21:47:29 +02:00
Kevin Cooper
655b46b60b Improve the Redux docs (#1172)
* [ReduxExample] Programmatically generate initial state

* [ReduxExample] Return original state if nextState is null

* [Docs] Add getStateForAction to redux integration example

* [Docs] Add link to ReduxExample app

* [Docs] Give each example a 'DRY' README linking to real docs

* [Docs] Clean up the Contributors guide a bit

* [Docs] Remove numbers from sections in Contributors guide

They don't seem very meaningful, and don't need to be done in order
2017-04-25 11:48:54 +02:00
Mike Grabowski
c39dd9d45f Export all the things (#1219)
* Initial

* Add missing title

* Fix style and ref issues
2017-04-25 14:23:09 +05:30
Aaron Cannon
7bd748a6be Force the back button to be recognized as such by screen readers. (#1155)
* Force the back button to be recognized as such by screen readers.

* Update HeaderBackButton.js

* Update HeaderBackButton.js

* Update HeaderBackButton.js

* Format remaining issues
2017-04-24 11:29:04 -07:00
Melih
4a4a563e99 Update Screen-Nav-Options.md (#1211)
* Update Screen-Nav-Options.md

* Apply some tweaks
2017-04-24 11:22:37 -07:00
Kevin Cooper
85c2235a3c Improve CircleCI infrastructure (#1173)
* [Example] Get tests passing on ReduxExample and NavigationPlayground

* [CI] Use more vague versioning so we're always up to date

* [CI] Test that the example apps run without error

* [CI] Install the current local version of react-nav before testing

* Fix tabs => spaces in ReduxExample/package.json

* Remove LinkingExample entirely

It's now part of NavigationPlayground.
2017-04-24 10:54:58 -07:00
maxkomarychev
75921cfddd Respect gesturesEnabled (#1147)
* Use flag value from screen details

* Only respect `gesturesEnabled` when `mode === card`

* Update docs
2017-04-24 10:51:08 -07:00
Mike Grabowski
47285bf5d6 Update docs on headerLeft/Right (#1203) 2017-04-24 10:47:42 -07:00
Mike Grabowski
cbc21bb7af Add issue template (#1199)
* Add issue template

* Ask for screenshot

* Update ISSUE_TEMPLATE.md
2017-04-24 19:40:43 +02:00
Mike Grabowski
be09d50f22 Update router guide (#1207) 2017-04-24 09:27:06 -07:00
Neo
6b8cb793b4 Add support for custom transitionConfig (#1187)
* Fix transitionConfig regression

* Fix flow

* Add doc

* Update StackNavigator.md

* Update StackNavigator.md

* Update CardStackTransitioner.js

* Update TypeDefinition.js
2017-04-24 14:31:44 +02:00
Mike Grabowski
bbe9caff06 Fix eslint issues and turn on prettier by default (#1195)
* Automatically generate prop-types from Flow

* Remove propTypes usage

* Fix flow

* Modify some eslint settings

* Fix flowtype

* Lint tweaks

* use prop-types pkg

* Run prettier

* Fix flow

* Fix few lint issues

* Make eslint pass

* Run lint on tests

* Fix flow

* Fixes

* Alphabetical

* Trailing comma: ES5 for website compat, also fix config/paths

* Apply eslint --fix only to src now

* Fix missing transitionconfig

* Update TypeDefinition.js

* New stuff

* Unstage website and examples

* reformat code

* Update circle.yml
2017-04-24 17:31:22 +05:30
Tomas Roos
23e310742c Expose Card through the API surface (#1002)
* Expose Card through the API surface

We use Card directly without CardStack

* Added Header + HeaderBackButton to exports
2017-04-24 13:44:22 +02:00
Mike Grabowski
5905501183 Update Redux-Integration.md (#1184) 2017-04-24 11:52:47 +02:00
Mike Grabowski
0f6b328687 Add an ability to disable built-in logger (#1115)
* Fix logger

* Update Navigators.md

* Update Navigators.md
2017-04-24 11:08:36 +02:00
Daniel Schmidt
c8062d014c docs: add remark about nesting (#1121)
This relates to #709
2017-04-23 20:21:15 +02:00
Kevin Cooper
5c12c41d96 Fix the ReduxExample app (3) (#1144)
* [Example] Upgrade dependencies to fix the ReduxExample app

* [Example] Also upgrade and fix the LinkingExample app

* [Example] Update MainApplication.java to fix Android API
2017-04-23 17:33:57 +02:00
Ville Immonen
261ea8aa05 Get truncated back button title from the previous scene (#1167) 2017-04-23 17:14:21 +02:00
Ville Immonen
c384e3371c Add a config to override the truncated back title (#1137)
Fixes #1136.
2017-04-22 08:26:31 +02:00
Thomas Subera
046acd2b5e Allow tabBarLabel to be also a function again (#1156)
This fixes #1024
2017-04-22 08:11:45 +02:00
Rasool Dastoori
afe3c2be9e Update react-native-tab-view version (#1138)
Fix RTL support for `TabNavigator`
2017-04-21 22:11:32 +05:30
Adam Miskiewicz
e94c9c1061 v1.0.0-beta.8 2017-04-19 20:32:49 -07:00
Mike Grabowski
a252b46c50 Breaking: Replace containerOptions with just props (#1100) 2017-04-19 14:10:50 +05:30
Mike Grabowski
ba98f7a1ae Fix hashbang behaviour (#1095) 2017-04-18 15:25:12 +02:00
Joe McKie
2bbfc03cd0 Bump dependency versions to reflect current RN 2017-04-18 15:04:47 +02:00
Mike Grabowski
ce5be229ed Upgrade React Native (#1093)
* Upgrade RN

* Clean up
2017-04-18 14:28:47 +02:00
Daniel Friesen
1bb0b84c26 Swap Platform preference for title alignment (#997)
Centered titles are generally specific to iOS, left alignment of the title appears more common in platforms outside Android and iOS.

This also fits better with the rest of the conditionals that test for iOS instead of Android.
2017-04-18 13:38:35 +02:00
Joe McKie
633d4819ec Update flow-react-proptypes to ^1.2.0 (#1084) 2017-04-18 11:27:34 +02:00
Ville Immonen
77313a2a0b Fix screenProps not being passed through to CardStack (#1051)
`screenProps` were not being passed to `CardStack` and consequently not
available for the navigationOptions function in components using
`StackNavigator`.
2017-04-17 07:16:41 -07:00
Edwin Tsatsu
c5f8c8b34d removed reptiton of headerBackTitle text (#1076) 2017-04-17 07:15:06 -07:00
Mike Grabowski
7165efce02 Upgrade babel-plugin-flow-prop-types (#1045)
* Fix build

* Latest version fixes Header

* Fix propTypes from react-native leaking to web context

* Update todo notice
2017-04-14 17:38:52 +05:30
Mike Grabowski
cf6564b3e5 Move prop-types to dependencies (#1042)
* Move `prop-types` to dependencies

* Update package.json

* Update CardStackTransitioner.js
2017-04-14 11:41:39 +05:30
Mike Grabowski
e2f5e7fd49 Automatically generate prop-types from Flow (#1033)
* Automatically generate prop-types from Flow

* Remove propTypes usage

* Fix flow

* Modify some eslint settings

* Fix flowtype

* Lint tweaks

* use prop-types pkg
2017-04-13 15:19:30 -07:00
Mike Grabowski
4c55887990 Fix regressions in Header (#1027)
* Fix warnings and errors with Header

* bring back deleted docs

* headerLeft can be null
2017-04-13 22:56:42 +02:00
Mike Grabowski
52e24dd380 pass cardstack style (#1029) 2017-04-13 09:32:09 -07:00
Mike Grabowski
2dc869fedd Navigate to nested router within stack (#1025) 2017-04-13 09:28:47 -07:00
Joe McKie
44e78f8644 Fix typo in StackRouter.md (#975) 2017-04-12 17:01:40 -07:00
Mike Grabowski
93976d358e Introducing flat options (#984)
* Initial commit

* Remove HybridExample (#985)

* Remove HybridExample

* Remove last mention of HelloHybrid

* Remove console log

* Fix flow and example

* Fix routers api docs

* Keep options in single place

* chore

* Fix styling

* Organise miscs

* Better flow type for screen options

* Flow test website and add more types to options

* navigationOptions instead of prevOptions makes more sense

* Fixes

* Fix up docs

* Fix

* Update route decl

* Provide error when removed API is used

* Remove lock

* Add validators

* Make StacksOverTabs config valid again

* Do not return

* Fix redbox
2017-04-12 15:49:08 -07:00
Mike Grabowski
fb2a0ad33d Remove HybridExample (#985)
* Remove HybridExample

* Remove last mention of HelloHybrid
2017-04-10 12:40:14 -07:00
Mauro Gabriel Titimoli
511cd3e1be Add support to navigation to other tabs passing params (#969) 2017-04-09 08:54:30 -07:00
Navid Taha
96a34db809 Add iconStyle prop to tabBarOptions for TabBarTop (#965) 2017-04-08 23:32:52 +05:30
Kevin Cooper
6978ceec85 Fix the ReduxExample app (2) (#945)
* [Example] Fix the ReduxExample app

Just a bit of cleanup so it can run.

* [Example] Remove AsyncStorage persistence from ReduxExample

It's a cool feature, but isn't necessary to demonstrate how to use
react-navigation and may cause more confusion than it's worth.
2017-04-07 09:06:44 -07:00
Jamie Parkinson
31c538413e Add pressColor to StackNavigator header options (#926)
* Add pressColor to StackNavigator header options

* Rename pressColor -> pressColorAndroid for StackNavigator
2017-04-07 09:02:43 -07:00
Aaron Cannon
297470099d Added the Header accessibility trait to the header title (#948)
Without this trait, VoiceOver on IOS does not identify the title as a header, which it is.
2017-04-07 12:09:26 +05:30
Sami Jaber
669da3eca5 refactored Redux Example (#819) 2017-04-06 16:20:04 -07:00
Kevin Cooper
2b307c754a [Playground] Add TabsInDrawer example (#930) 2017-04-06 09:25:38 -07:00
Kevin Cooper
b49b2c1b62 [Playgrond] Add StacksOverTabs example (#928)
* [Playground] Duplicate StacksInTabs to StacksOverTabs

* [Playground] Move nested routes into root stack so they appear on top

* [Playground] Go to SettingsTab instead of pushing a new Settings screen
2017-04-06 09:24:35 -07:00
taiki-t
0fa801d4ee Fix setParams with nested routers (#929)
This fixes the setParams problem with:
https://github.com/react-community/react-navigation/pull/789
2017-04-06 09:22:06 -07:00
Norman Rzepka
d211492a4c Query string parsing capabilities for deep linking (#510)
* adds query string parsing capabilities to URI handling

* improves query params test case

* adds test with empty query value
2017-04-04 22:03:52 -07:00
Kevin Cooper
5006076352 Fix the ReduxExample app (#900)
* [Redux example] Use HTTPS-enabled endpoint to get npm modules

To fix 'yarn install'

* [Redux example] Add ReduxExample to rn-cli.config.js

This prevents those annoying @providesModule naming collisions

* [Examples] Add a basic README linking to the usage instructions
2017-04-04 21:21:06 -07:00
Koen Punt
5ca45e0aa5 add command to open URI in the iOS simulator (#909) 2017-04-04 21:01:30 -07:00
Mauricio Pasquier Juan
2a050da960 Fix wrong param name in the guides (#911)
The text used `name` as param but the examples used `user` instead.
2017-04-04 21:00:37 -07:00
Scott Brady
e402eba3a7 Reset specific StackRouter with key (#789)
* First test

* Allow a key to be passed for which scene should handle the action

* Adding key to NavigationResetAction

* Added test

* Add reset test with key

* Only apply this change if it is a RESET action

* Fix logic error, only check if the action is null if it is a RESET
2017-04-04 17:26:37 -07:00
Michel Maubert
e8726c1e68 add jest config for react-navigation in docs (#256) (#331)
* add jest config for react-navigation in docs (#256)

* Docs: Update redux-integration guide #246
2017-04-04 10:02:21 -07:00
Sabbir Ahmed
83f8a44219 Docs: Added clarification for header configuration (#891) 2017-04-03 07:07:47 +05:30
Bruno Lemos
3eb7b12f85 Fix gesturesEnabled regression (#886)
Closes #818
Regression caused by 11cab8eab6
2017-04-02 08:15:49 +05:30
Daniel Schmidt
8c9a626401 bump react-native-drawer-layout-polyfill (#882)
includes access to the accessabilityView options and
a fix for #871 (adjusted zIndex)
2017-04-01 20:40:41 +05:30
Juwan Wheatley
b0c05e5977 Fix rebase commands (#870) 2017-03-30 23:28:09 +05:30
Grzegorz Mandziak
3cee5c30fa Possibility to overwrite label's style if defined as string. (#731)
* Added option to overwrite label style for only if label is as string defined in navigationOptions in DrawerNavigation.

* update doc for labelStyle prop

* change title to label
2017-03-30 09:20:56 +05:30
Bernhard
84d284d591 add example for DrawerNavigatorConfig (#552)
* add example for DrawerNavigatorConfig

* add explanation for the example
2017-03-30 09:16:29 +05:30
Stoicescu Cristi
05f0361971 Workaround for screenProps in TabViewAnimated (#862) 2017-03-30 09:07:06 +05:30
PhpGuyZim
8196f62335 Update Guide-Nested.md (#813)
* Update Guide-Nested.md

Docs do not indicate that you must import the necessary module.

* Update Guide-Nested.md
2017-03-29 00:36:21 -07:00
Neo
7edd9a79aa remove ReactComponentWithPureRenderMixin (#809)
`ReactComponentWithPureRenderMixin` is useless in this file, and it has been removed from the core of latest `react`

build fails on master branch of `react-native` for this error
2017-03-29 00:34:10 -07:00
Javier Olaechea
65e71042d5 Docs: Update md links from coodoo's fork to react-community (#750) 2017-03-22 13:51:16 -07:00
Elliott Ro
dff746a83c Navigation Actions Doc (#338)
* Initial saving

* Updated docs

* Adding navigation actions into website App.js

* Updated navigation prop structure

* Added in missing link
2017-03-22 12:10:34 -07:00
Cai Leao
498f329005 Update documentation regarding DrawerNavigator customisation (#646)
* Update documentation regarding `DrawerNavigator` customisation

* Updated docs as requested in the PR.
2017-03-22 12:09:10 -07:00
Alejandro Garcia
0f19a0bddf Fix flow in Navigation Playground (#735) 2017-03-22 12:08:08 -07:00
Juwan Wheatley
a268d67b53 Adds documentation about forking and syncing repo (#765) 2017-03-22 05:42:18 +05:30
Karan Thakkar
c5f2475182 fix(docs): Fix incorrect style in TabNavigator sample (#734)
The example provides styling for the tab icon via the `icon` property in the styles object. However in the example, it is used as `tabIcon` which does not exist.
2017-03-19 17:43:15 +05:30
mbaroukh
0820366a1c correction of a few documentation typo (#563) 2017-03-16 15:35:53 -07:00
Yann Pringault
255a4361aa Fix typo in docs for getComponentForRouteName (#714) 2017-03-16 15:30:02 -07:00
Javier Olaechea
da5ec61027 Drawer sidebar description (#617)
* Fix typo in DrawerScreen.js

* Fix the description of the DrawerSidebar Component
2017-03-16 11:57:40 -07:00
Christoph Jerolimov
b009db9446 Remove 2nd return statement (#661) 2017-03-16 11:56:50 -07:00
Adam Miskiewicz
11cab8eab6 Resolve gesture issues in CardStack 2017-03-15 16:03:09 -07:00
Adam Miskiewicz
619a06c8cd Update dependencies 2017-03-15 16:02:49 -07:00
Satyajit Sahoo
00972a3bf5 Bump version number (#650) 2017-03-11 09:19:31 -08:00
Satyajit Sahoo
ecef7771e6 Update react-native-tab-view. Fixes #476 (#641) 2017-03-10 09:34:43 -08:00
Satyajit Sahoo
f16e634d70 Remove top margin from drawer view (#642) 2017-03-10 09:34:22 -08:00
YinYin Chiu
a2c9a14045 Pass transitionProps, prevTransitionProps and isModal to custom TransitionConfig (#565) 2017-03-10 18:25:07 +05:30
juhasuni
725f6d77b0 Fix issue where initialRouteParams were not set (#150) 2017-03-10 18:16:30 +05:30
Daniel Schmidt
af787e56fe move from react-native-drawer-layout to react-native-drawer-layout-polyfill
This enables us to use the native DrawerLayoutAndroid on android devices
2017-03-07 19:12:21 +05:30
Jordan Hayashi
eb6646f6da Make TabNavigator code example formatting consistent (#462)
* Make TabNavigator code example formatting consistent

* Fix typo in StackRouter docs
2017-03-06 22:50:12 -08:00
Gant
37ea268d3f screen props warning removed 2017-03-06 01:30:27 +05:30
Felipe Matos
da8f85895a Fix typo (#554) 2017-03-03 16:32:59 +01:00
Mike Grabowski
e650f341e3 Change <Header /> layout back to absolute (#562) 2017-03-03 17:43:30 +05:30
Neo
bbab489a6a Update Screen-Tracking.md (#549) 2017-03-03 12:28:58 +05:30
Taylor Hurt
99583d2a64 Update Screen-Tracking.md (#545)
* Update Screen-Tracking.md

updated names in the onNavigationStateChange example function

* Update Screen-Tracking.md
2017-03-02 16:01:50 +01:00
andrey
0c8f9f7424 Accept tabBar label to be a function (#524)
* Accept tabBar label to be a function

* label as a function in TabBarBottom

* label as a function in TabBarTop
2017-03-02 09:38:06 +01:00
Bartol Karuza
2df983516b add import to clarify source of helper (#517)
* add import to clarify source of helper

It took me a while to figure out where 'addNavigationHelpers' comes from, maybe adding the import in the doc here will help the next guy.

* add spaces around imported value

* removed empty line
2017-03-01 13:18:08 +01:00
Mike Grabowski
e44dee158f [Docs] Link every heading automatically (#459)
* Link every heading automatically

* Factor in nav height

* Make it like in React
2017-02-27 22:38:51 -08:00
Adam Miskiewicz
29a6564261 v1.0.0-beta.6 2017-02-27 18:40:16 -08:00
Álvaro Medina Ballester
420450c31a Fix TabBarBottom item layout (#499)
Instead of `flexGrow`, `TabBarBottom` should use `flex` in order to match iOS HIG for UITabBar. Otherwise, if labels with different length are set, the layout of the tab bar isn't consistent with what iOS users expect (tab highlighted with red border):

![screen shot 2017-02-27 at 11 23 27](https://cloud.githubusercontent.com/assets/289640/23364131/07103c5a-fcfe-11e6-8b7a-d7bc28ca3080.png)

After the change, this is how the tab bar looks:

<img width="429" alt="screen shot 2017-02-27 at 15 14 35" src="https://cloud.githubusercontent.com/assets/289640/23364470/7f652e76-fcff-11e6-9e84-8a0efa7d9c5d.png">
2017-02-27 19:52:47 +05:30
Igor Ovsiannikov
fa8370b378 fix typo (#496) 2017-02-27 13:45:42 +01:00
Igor Ovsiannikov
1ca18dee13 Add router prop for the DrawerNavigator content component (#487) 2017-02-26 20:49:08 +05:30
Mike Grabowski
49133c3dfe Fix glitches in Header when calling replace (#418)
* Change the way we store computed layout

We cannot store layouts under `index` because when calling `replace`, there are two competing layouts
on the same index, which will cause an infinite loop (are almost infinite) of flickering / jumping title.

* Disable transition at all when index didn't change
2017-02-23 22:19:56 -08:00
Mike Grabowski
26b165200f Add onNavigationStateChange (#453)
* Support

* Revert consoleg

* Add very bad doc

* Improve docs

* Surpress flow
2017-02-23 22:18:06 -08:00
Mike Grabowski
71e8c95b34 Add React.Element support for TabBar/Drawer and fix docs (#451)
* Initial impl

* Fix up some docs and support more for drawer

* Fix comments

* Support TabBar

* Make flow more correct

* Clarify even more

* Rename all the things lol

* Also rename renderLabel to getLabel
2017-02-23 20:39:11 +05:30
Vlad Zhukov
16d57bcf40 fix (#454) 2017-02-23 15:35:08 +01:00
Javier Cuevas
fdb5faae7e Fix redux documentation (#450)
I think the navigation key for the redux store should be `nav` and not `navReducer`.
2017-02-23 10:57:10 +01:00
Satyajit Sahoo
e0c1c95e6f Remove screen tracking without redux (#449)
This is a hack and we shouldn't put it in official documentation.
2017-02-23 10:40:40 +01:00
Luke San Antonio Bialecki
423aa85354 Fix low header when scene doesn't take up entire screen (#446)
Adds a nested View around the content in CardStack so that the content expands
and puts the header bar at the top of the screen.
2017-02-23 06:47:51 +01:00
Mike Grabowski
f54578c0f9 Fix a header on Android (#437) 2017-02-22 12:28:53 +01:00
Mike Grabowski
4d1e531c6b Fix header positions 2017-02-22 14:25:26 +05:30
Matt Hamil
fb856ba06d Move Navigation Containers and containerOptions into Navigators API docs (#409)
* Removed Navigation Containers and containerOptions

Cut out text to move to navigators docs page

* Moved nav containers section to Navigators API docs
2017-02-21 20:45:19 -08:00
Mike Grabowski
62025cc8be Update StackNavScreen docs (#411)
Remove confusing mention of `color`
2017-02-21 20:15:42 -08:00
Angelo
8e1b6e9042 Updated the reducer (#431)
When the drawer opens / close, the result of AppNavigator.router.getStateForAction(action, state); is null. So the nav state in the store is null which causes errors. This solves that.
2017-02-21 20:15:30 -08:00
David Cameron
3a1766cb78 Update 2017-01-Introducing-React-Navigation.md (#410) 2017-02-22 07:19:59 +05:30
William Schurman
7229708d22 Fix null style warning in Header component (#422) 2017-02-21 19:23:19 +01:00
James Isaac
15caee76f3 Merge action params into navigator's child screens (#306) 2017-02-21 03:29:46 +05:30
Ashoat
2d0a7fa4ed Make it possible for a screen to set gesturesEnabled (#385)
Closes #292
2017-02-21 02:52:15 +05:30
hysan
257ce3eff9 Updated Hello Mobile Navigation for clarity (#265)
Per request [#228](https://github.com/react-community/react-navigation/issues/228), I've updated the the Hello Mobile Navigation guide to try and make it more approachable to newcomers like myself. I changed the order of some of the explanations and broke out passing params into its own section. This should make the guide easier to follow as only one new concept is introduced per section; a common principle in teaching methodology.

I'm open to suggestions as I am also a newcomer to both React Native and React Navigation. So it's very possible that there are concepts that I've misunderstood or am not explaining well.
2017-02-20 10:02:34 -08:00
Mike Grabowski
2bb81d8c63 Fix backgrounds (#399) 2017-02-20 09:10:10 -08:00
Kyle Kamperschroer
b4d6507c84 Add a simple motiviation section to the README (#35) 2017-02-20 05:18:35 +05:30
Mike Grabowski
79f21277cb Add back button label to header (#257) 2017-02-20 05:09:56 +05:30
Corentin de Boisset
4b2f94544a Pass navigation prop to TabBarComponent (#396) 2017-02-20 05:02:12 +05:30
Satyajit Sahoo
6aff0ac366 More gestures cleanup (#353)
* More gestures cleanup

* Fix flow
2017-02-17 10:56:37 -08:00
lintonye
2273ef1c14 CardStack: Don't overwrite custom transitionConfig with default (#99)
* Don't overwrite transitionConfg with default

* Call this.props.transitionConfig as a function

* Update flow definition of transitionConfig
2017-02-17 08:42:20 -08:00
Satyajit Sahoo
d6b5b28811 Update react-native-tab-view (#366)
Fixes #209
2017-02-17 08:28:10 -08:00
rmevans9
e30ac63f79 Make future proof (and also fix it for the current beta) (#322) 2017-02-16 19:54:16 +05:30
juhasuni
02a388073c Remove 'appBar' child component to fully support header styling (#341) 2017-02-16 19:30:33 +05:30
Adam Miskiewicz
330cc054f6 1.0.0-beta.5
Fix broken `yarn publish`
2017-02-15 19:11:46 -08:00
Adam Miskiewicz
5c478ec244 1.0.0-beta.4 2017-02-15 18:57:31 -08:00
Adam Miskiewicz
7967fb81d2 Update yarn.lock to include react 15.4.2 2017-02-15 18:56:55 -08:00
Jakub Stasiak
2f1105dd08 Exported withNavigation to web (#330) 2017-02-16 01:41:44 +05:30
Mike Grabowski
a41e8b58a0 Overwrite 1x.ios as well 2017-02-16 00:30:08 +05:30
Satyajit Sahoo
24e7db361f Fix gesture recognition in card stack (#324) 2017-02-13 13:50:15 -08:00
Satyajit Sahoo
a7b1243053 Fix flow (#305)
* Fix Flow and Android build

* Enable flow on CI

* Fix and suppress flow errors
2017-02-13 08:26:30 -08:00
João Luís Lima
67d64807da adds button to photo screen (#301) 2017-02-12 22:05:12 -08:00
Jeremy Lu
546fc657d5 Add showIcon to tabBarOptions so that icons can be hidden on iOS (#291) 2017-02-11 04:27:31 +05:30
Matt Revell
a7002f2151 [FLOW] Fix missing "type" in flow import.
Fixes: Named import from module `../TypeDefinition` `ContextWithNavigation` is a type, but not a value. In order to import it, please use `import type`.
2017-02-10 22:07:47 +05:30
Mike Grabowski
4f1bd4c888 Fix style prop for header 2017-02-10 22:06:59 +05:30
Jonathan Lalande
296e83abed Remove uncompleted sentence in Contributors guide. (#280) 2017-02-10 17:24:48 +01:00
Evan Turner
24044e15d2 Add missing characters to navigators api doc (#264) 2017-02-09 23:11:46 +05:30
juhasuni
ac8260874a Set numberOfLines to 1 for HeaderTitle (#260) 2017-02-09 20:11:18 +05:30
Li Lin
163d5e4c07 Add code sample for google analytics integration (#107) 2017-02-09 19:40:16 +05:30
Satyajit Sahoo
b82b8c4b3c Bump version number 2017-02-09 19:33:44 +05:30
Satyajit Sahoo
1f80d98112 Show screen props warning only once. Fixes #258 2017-02-09 19:32:59 +05:30
Hilke Heremans
73426e8015 Add clarification for Redux <-> Nested Navigators (#26)
* Add clarification for Redux <-> Nested Navigators

See also https://github.com/react-community/react-navigation/issues/16

* Update per comments

* Update per comments in PR #26
2017-02-09 10:28:19 +01:00
kameyin
fe968c2003 React Native Buttons use title, not label. 2017-02-09 13:10:54 +05:30
535 changed files with 44072 additions and 43911 deletions

View File

@@ -1,32 +1,3 @@
{
"env": {
// For RN example development
"development": {
"presets": ["react-native"],
"plugins": [
"transform-flow-strip-types",
],
},
// For Jest
"test": {
"presets": ["react-native"],
"plugins": [
"transform-flow-strip-types",
],
},
// For publishing to NPM for RN
"publish-rn": {
"presets": ["react-native-syntax"],
"plugins": [
"transform-flow-strip-types",
],
},
// For publishing to NPM for web
"publish-web": {
"presets": ["es2015", "stage-1", "react"],
"plugins": [
"transform-flow-strip-types",
],
},
},
"presets": ["react-native"]
}

40
.circleci/config.yml Normal file
View File

@@ -0,0 +1,40 @@
version: 2
jobs:
build:
docker:
- image: reactcommunity/node-ci:8.4.0-0 # custom image -- includes ocaml, libelf1, Yarn
parallelism: 2
working_directory: ~/react-navigation
steps:
- checkout
- restore_cache:
# cache by branch + package.json, by branch, and then master
keys:
- v3-react-navigation-{{ .Branch }}-{{ checksum "package.json" }}
- v3-react-navigation-{{ .Branch }}
- v3-react-navigation-master
- run: yarn # install root deps
- run: ./scripts/test.sh # run tests
- setup_remote_docker
- deploy:
command: |
set -x
VER="17.03.0-ce"
curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
yarn global add exp
set +x
exp login -u "$EXPO_USERNAME" -p "$EXPO_PASSWORD"
set -x
cd examples/NavigationPlayground && yarn && exp publish --release-channel "${CIRCLE_SHA1}"
- save_cache:
key: v3-react-navigation-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- ~/.cache/yarn
- ~/react-navigation/examples/NavigationPlayground/node_modules
- ~/react-navigation/examples/ReduxExample/node_modules
notify:
webhooks:
- url: https://react-navigation-ci.now.sh

2
.codecov.yml Normal file
View File

@@ -0,0 +1,2 @@
comment:
require_changes: yes

14
.editorconfig Normal file
View File

@@ -0,0 +1,14 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
[*.gradle]
indent_size = 4

8
.eslintignore Normal file
View File

@@ -0,0 +1,8 @@
coverage
flow
node_modules
lib*
build
## Temporary
examples

103
.eslintrc
View File

@@ -1,77 +1,52 @@
{
"extends": "airbnb",
"parser": "babel-eslint",
"plugins": [
"flowtype"
"extends": [
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"prettier",
"prettier/react"
],
"parser": "babel-eslint",
"plugins": ["react", "prettier"],
"env": {
"jasmine": true
},
"rules": {
"no-underscore-dangle": 0,
"no-use-before-define": 0,
"no-unused-expressions": 0,
"new-cap": 0,
"no-plusplus": 0,
"no-class-assign": 0,
"no-duplicate-imports": 0,
"import/extensions": 0,
"import/no-extraneous-dependencies": 0,
"import/no-unresolved": 0,
"react/jsx-filename-extension": [
0, { "extensions": [".js", ".jsx"] }
],
"react/forbid-prop-types": 0,
"react/sort-comp": 0,
"react/prefer-stateless-function": 0,
"flowtype/boolean-style": [
2,
"boolean"
],
"flowtype/define-flow-type": 1,
"flowtype/generic-spacing": [
2,
"never"
],
"flowtype/no-weak-types": 1,
"flowtype/require-parameter-type": 2,
"flowtype/require-return-type": [
0,
"always",
"prettier/prettier": [
"error",
{
"annotateUndefined": "never"
"trailingComma": "es5",
"singleQuote": true
}
],
"flowtype/require-valid-file-annotation": 2,
"flowtype/semi": [
2,
"always"
],
"flowtype/space-after-type-colon": [
2,
"always"
],
"flowtype/space-before-generic-bracket": [
2,
"never"
],
"flowtype/space-before-type-colon": [
2,
"never"
],
"flowtype/union-intersection-spacing": [
2,
"always"
],
"flowtype/use-flow-type": 1,
"flowtype/valid-syntax": 1
"no-underscore-dangle": "off",
"no-use-before-define": "off",
"no-unused-expressions": "off",
"new-cap": "off",
"no-plusplus": "off",
"no-class-assign": "off",
"no-duplicate-imports": "off",
"import/extensions": "off",
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"react/jsx-filename-extension": ["off", { "extensions": [".js", ".jsx"] }],
"react/sort-comp": "off",
"react/prefer-stateless-function": "off",
"react/no-deprecated": "off",
"react/forbid-prop-types": "warn",
"react/prop-types": "off",
"react/require-default-props": "off",
"react/no-unused-prop-types": "off"
},
"settings": {
"flowtype": {
"onlyFilesWithFlowAnnotation": false
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
}
}

View File

@@ -1,55 +0,0 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore templates for 'react-native init'
.*/local-cli/templates/.*
; Ignore the website subdir
.*/node_modules/react-native/website/.*
; Ignore "BUCK" generated dirs
.*/node_modules/react-native/\.buckd/
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/node_modules/react-native/Libraries/react-native/React.js
.*/node_modules/react-native/Libraries/react-native/ReactNative.js
<PROJECT_ROOT>/lib
<PROJECT_ROOT>/lib-rn
<PROJECT_ROOT>/examples
<PROJECT_ROOT>/website
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
flow/
[options]
module.system=haste
experimental.strict_type_args=true
munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-7]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-7]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
unsafe.enable_getters_and_setters=true
[version]
^0.35.0

39
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,39 @@
## The issue tracker is reserved for bug reports only.
If you have a question, feature request, or an idea for improving the library or its related tools, please try one of the following resources:
- [Read the documentation](https://reactnavigation.org/)
- [Post an issue to the website repository if you'd like to see a documentation change](http://github.com/react-navigation/website)
- [Post a feature request to Canny](https://react-navigation.canny.io/feature-requests)
- [Write a RFC if you have ideas for how to implement a feature request](https://github.com/react-navigation/rfcs)
- [Get help on Discord chat (#react-navigation on Reactiflux)](https://discord.gg/4xEK3nD) or [on StackOverflow](https://stackoverflow.com/questions/tagged/react-navigation)
- Search for your issue - it may have already been answered or even fixed in the development branch. However, if you find that an old, closed issue still persists in the latest version, you should open a new issue.
Bugs with react-navigation must be reproducible *without any external libraries that operate on it*. This means that if you are attempting to use Redux or MobX with it and you think you have found a bug, you must be able to reproduce it without Redux or MobX in this report. Redux related issues belong in [react-navigation-redux-helpers](https://github.com/react-navigation/react-navigation-redux-helpers), and we do not have any first-class integration with MobX at the moment.
---
### Current Behavior
- What code are you running and what is happening?
- Include a screenshot if it makes sense.
### Expected Behavior
- What do you expect should be happening?
- Include a screenshot if it makes sense.
### How to reproduce
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repoistory as that is outside of the scope of React Navigation.
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
### Your Environment
| software | version
| ---------------- | -------
| react-navigation |
| react-native |
| node |
| npm or yarn |

21
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,21 @@
Please provide enough information so that others can review your pull request:
## Motivation
Explain the **motivation** for making this change. What existing problem does the pull request solve?
## Test plan
Demonstrate the code is solid. Example: the exact commands you ran and their output, screenshots / videos if the pull request changes UI.
Make sure you test on both platforms if your change affects both platforms.
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.

4
.gitignore vendored
View File

@@ -8,8 +8,6 @@ jsconfig.json
# NodeJS
npm-debug.log
node_modules
lib-rn
lib
yarn-error.log
# OS X
@@ -19,4 +17,4 @@ yarn-error.log
.exponent
# Jest
coverage
coverage

View File

@@ -1 +1,2 @@
examples
examples
__tests__

161
CHANGELOG.md Normal file
View File

@@ -0,0 +1,161 @@
# 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]
## [2.11.2] - [2018-08-03](https://github.com/react-navigation/react-navigation/releases/tag/2.11.2)
### Changed
- Revert rename of pathUtils
## [2.11.1] - [2018-08-03](https://github.com/react-navigation/react-navigation/releases/tag/2.11.1)
### Changed
- Fix some exports related to the 2.11.0 changes to move stack navigator out of core
## [2.11.0] - [2018-08-03](https://github.com/react-navigation/react-navigation/releases/tag/2.11.0)
### Added
- Export some modules that are useful for moving stack navigator outside of core
## [2.10.0] - [2018-08-02](https://github.com/react-navigation/react-navigation/releases/tag/2.10.0)
### Added
- `lazy` and `optimizationsEnabled` options to `createMaterialTopTabNavigator` (react-navigation-tabs@0.6.0)
### Fixed
- Android back button in stack with drawer closes drawer properly if open (react-navigation-drawer@0.5.0)
- Fixes bug where `null` doesn't work in routerOptions `paths` object for deeplinking ([#4791](https://github.com/react-navigation/react-navigation/pull/4791))
## [2.9.3] - [2018-07-26](https://github.com/react-navigation/react-navigation/releases/tag/2.9.3)
### Added
- Add `NavigationTestUtils` which can be imported by path to be used with jest snapshot testing.
## [2.9.2] - [2018-07-25](https://github.com/react-navigation/react-navigation/releases/tag/2.9.2)
### Added
- Export `StackViewTransitionConfigs` to allow you to extend default config in custom transition configs. [#4761](https://github.com/react-navigation/react-navigation/pull/4761)
### Fixed
- Error when building with haul: ref to pathToRegexp.compile(#4658).
- Error when building with haul: ref to pathToRegexp.compile. [#4658](https://github.com/react-navigation/react-navigation/pull/4658).
## [2.9.1] - [2018-07-24](https://github.com/react-navigation/react-navigation/releases/tag/2.9.1)
### Fixed
- Incorrect parameters passed to title offset calculation led to bug in header layout when no right component (https://github.com/react-navigation/react-navigation/issues/4754)
### Fixed
- Typo in Header transition preset check.
## [2.9.0] - [2018-07-20](https://github.com/react-navigation/react-navigation/releases/tag/2.9.0)
### Added
- `headerLayoutPreset: 'center' | 'left'` to provide an easy solution for [questions like this](https://github.com/react-navigation/react-navigation/issues/4615).
- `headerBackTitleEnabled` - this configuration option for stack navigator allows you to force back button titles to either be rendered or not (if you disagree with defaults for your platform and layout preset).
### Fixed
- Android back button ripple is now appropriately sized (fixes [#3955](https://github.com/react-navigation/react-navigation/issues/3955)).
- Respect header background color on container (fixes edge case where user depended on displaying content that was rendered behind the navigator, this particular behavior should not be depended on and may break in the future, but this change is still useful regardless).
## [2.8.0] - [2018-07-19](https://github.com/react-navigation/react-navigation/releases/tag/2.8.0)
### Added
- `headerLeftContainerStyle`, `headerTitleContainerStyle`, and `headerRightContainerStyle` are exposed on `navigationOptions`. These properties allow you to customize the style of the container of `headerLeft`, `headerTitle` and `headerRight` components.
### Fixed
- Fixed memory leaks in `createNavigator`: [closure scope leak](https://github.com/react-navigation/react-navigation/commit/1a765562905e93bbae0262dd20c2688221c999e8), and [clean up old descriptors](https://github.com/react-navigation/react-navigation/commit/93642e16e7ff029586b68ee732ec790504ee4862).
## [2.7.0] - [2018-07-17](https://github.com/react-navigation/react-navigation/releases/tag/2.7.0)
### Added
- The enableURLHandling prop on the top level navigator component allows you to disable deep linking handling. Currently it is always enabled. To disable it, `<RootNavigator enableURLHandling={false} />`
### Changed
- StackNavigator.replace method no longer requires a key param. If the key is left undefined, the last screen in the stack will be replaced.
### Fixed
- Support headerLeft component for the first screen in a stack (#4608).
- Removed bottomBorder when `headerTransparent` is set to true.
- Improve empty path and param handling in deep linking (#4671). This fixes issues with deep linking and fully tests the differences between path: '' and path: null. Empty string matches empty paths, and null path will let the child router handle paths at the same level. Also it makes sure that params are not duplicated between path and query when they are serialized with getPathAndParamsForState.
- Fix onTransitionStart not being invoked when provided in navigator config.(#4100)
- Rare case when users navigated back and forth quickly with exactly the right timing would cause a crash due to a scene being queued to transition, then clobbered, then attempted to render as a stale scene but without a descriptor. ([commit](https://github.com/react-navigation/react-navigation/commit/cab4d71a5e09188df3f4a294c98779eecb860a78))
## [2.6.2] - [2018-07-06](https://github.com/react-navigation/react-navigation/releases/tag/2.6.2)
### Changed
- Relax vertical padding warnings on header.
## [2.6.1] - [2018-07-05](https://github.com/react-navigation/react-navigation/releases/tag/2.6.1)
### Added
- Warn for more invalid headerStyle properties (padding, top/right/bottom/left, position).
### Fixed
- Fixed missing header shadow on Android.
## [2.6.0] - [2018-07-04](https://github.com/react-navigation/react-navigation/releases/tag/2.6.0)
### Added
- [NavigationEvents](https://github.com/react-navigation/react-navigation/pull/4188) component as a declarative interface for subscribing to navigation focus events.
### Fixed
- Fix stack router child router delegation priority (https://github.com/react-navigation/react-navigation/commit/e8c1833053e37d28f0ce505ff323565abf23b6a2)
- Avoid crash when calling isFocused on old route (https://github.com/react-navigation/react-navigation/commit/0921889f7a3acfc6d6bcc4909d209eeeee985ba7)
- Stack router no longer attempts to parse query params within path handling
- Switch router now has exact same param treatment for URLs as stack router does
### Changed
- Internally we no longer need to special case PlatformHelpers by platform as react-native-web handles the APIs we mocked out with it now.
## [2.5.5] - [2018-06-27](https://github.com/react-navigation/react-navigation/releases/tag/2.5.5)
### Added
- Throw error in development mode when header navigation option is set to a string - a common mistake that would otherwise result in a cryptic error message.
- Throw error in development mode when title is not a string.
### Fixed
- Delegate to child routers for more than just the top screen in the stack.
- Update react-navigation-drawer to 0.4.3 to fix `initialRouteParams` option
## [2.5.4] - [2018-06-27](https://github.com/react-navigation/react-navigation/releases/tag/2.5.4)
### Fixed
- Header no longer sometimes flashes for 1 frame when using `header: null` on initial route of stack with floating header.
- Export `createSwitchNavigator` in react-navigation.web.js
## [2.5.3] - [2018-06-23](https://github.com/react-navigation/react-navigation/releases/tag/2.5.3)
### Fixed
- `setParams` applies to the navigation object it is called on even if that is the navigation object for a navigation view (more details in https://github.com/react-navigation/react-navigation/issues/4497)
## [2.5.2] - [2018-06-23](https://github.com/react-navigation/react-navigation/releases/tag/2.5.2)
### Fixed
- Update react-navigation-drawer to fix regression in toggleDrawer
## [2.5.1] - [2018-06-22](https://github.com/react-navigation/react-navigation/releases/tag/2.5.1)
### Fixed
- `transitionConfig` in stack navigator no longer passes incorrect `fromTransitionProps` when navigating back
## [2.5.0] - [2018-06-22](https://github.com/react-navigation/react-navigation/releases/tag/2.5.0)
### Changed
- Refactor internals to make it play more nicely with web
### Fixed
- `const defaultGetStateForAction = SwitchBasedNavigator.router.getStateForAction` no longer throws error.
- Updated react-navigation-drawer to 0.4.1 which should fix issues related to automatically closing drawer when changing routes.
## [2.4.1] - [2018-06-21](https://github.com/react-navigation/react-navigation/releases/tag/2.4.1)
### Changed
- Improved examples
[Unreleased]: https://github.com/react-navigation/react-navigation/compare/2.11.2...HEAD
[2.11.2]: https://github.com/react-navigation/react-navigation/compare/2.11.1...2.11.2
[2.11.1]: https://github.com/react-navigation/react-navigation/compare/2.11.0...2.11.1
[2.11.0]: https://github.com/react-navigation/react-navigation/compare/2.10.0...2.11.0
[2.10.0]: https://github.com/react-navigation/react-navigation/compare/2.9.3...2.10.0
[2.9.3]: https://github.com/react-navigation/react-navigation/compare/2.9.2...2.9.3
[2.9.2]: https://github.com/react-navigation/react-navigation/compare/2.9.1...2.9.2
[2.9.1]: https://github.com/react-navigation/react-navigation/compare/2.9.0...2.9.1
[2.9.0]: https://github.com/react-navigation/react-navigation/compare/2.8.0...2.9.0
[2.8.0]: https://github.com/react-navigation/react-navigation/compare/2.7.0...2.8.0
[2.7.0]: https://github.com/react-navigation/react-navigation/compare/2.6.2...2.7.0
[2.6.2]: https://github.com/react-navigation/react-navigation/compare/2.6.1...2.6.2
[2.6.1]: https://github.com/react-navigation/react-navigation/compare/2.6.0...2.6.1
[2.6.0]: https://github.com/react-navigation/react-navigation/compare/2.5.5...2.6.0
[2.5.5]: https://github.com/react-navigation/react-navigation/compare/2.5.4...2.5.5
[2.5.4]: https://github.com/react-navigation/react-navigation/compare/2.5.3...2.5.4
[2.5.3]: https://github.com/react-navigation/react-navigation/compare/2.5.2...2.5.3
[2.5.2]: https://github.com/react-navigation/react-navigation/compare/2.5.1...2.5.2
[2.5.1]: https://github.com/react-navigation/react-navigation/compare/2.5.0...2.5.1
[2.5.0]: https://github.com/react-navigation/react-navigation/compare/2.4.1...2.5.0
[2.4.1]: https://github.com/react-navigation/react-navigation/compare/2.4.0...2.4.1

46
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at adam@expo.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

43
COMMUNITY_RESOURCES.md Normal file
View File

@@ -0,0 +1,43 @@
## Community resources
A lot of developers poured their knowledge in blog posts, and other repos - we will try to keep here a list of resources to help someone who wants to learn about React Navigation and techniques to handle navigation effectively.
#### Introduction to the library
* [Getting Started with React Navigation](https://hackernoon.com/getting-started-with-react-navigation-the-navigation-solution-for-react-native-ea3f4bd786a4)
#### Basic Tutorials
* [Basic ReactNavigation Example App and Tutorial](http://docs.nativebase.io/docs/examples/navigation/StackNavigationExample.html)
* [Understanding Navigation in React Native](https://www.codementor.io/blessingoraz/understanding-navigation-in-react-native-a3wlcxmzu?published=1#.WXfDlvk_ooE.twitter)
* [Comprehensive routing and navigation in React Native made easy](https://medium.com/@kevinle/comprehensive-routing-and-navigation-in-react-native-made-easy-6383e6cdc293)
* [Replace a Screen Using React Navigation](https://medium.com/handlebar-labs/replace-a-screen-using-react-navigation-a503eab207eb)
#### Intermediate Concepts
* [Integrating React-Navigation and Redux with authentication flow](https://medium.com/@shubhnik/a-comprehensive-guide-for-integrating-react-navigation-with-redux-including-authentication-flow-cb7b90611adf)
* [Using React Navigation and Redux in your React Native Application](https://medium.com/modus-create-front-end-development/using-react-navigation-and-redux-in-your-react-native-application-efac33265138)
* [React-Navigation, complete Redux state management, tab-bar, and multiple navigators](https://medium.com/@parkerdan/react-navigation-with-complete-redux-state-management-tab-bar-and-multiple-navigators-ed30a69d9a4d)
* [Custom Drawer with React-Navigation in React-Native](http://www.skywardsoftwares.co.in/react-native/custom-drawer-with-react-navigation-in-react-native/)
* [React Navigation Drawer - a tutorial series](https://shift.infinite.red/react-navigation-drawer-tutorial-a802fc3ee6dc)
#### Advanced Topics
* [Full Stack React Native Development using GraphCool and Apollo Subscriptions + React Navigation](https://medium.com/react-native-training/full-stack-react-native-development-using-graphcool-and-apollo-subscriptions-react-navigation-cdb3e1374c05)
#### Comparisons and Discussion
* [Migrate from ExNavigation to React Navigation](https://hackernoon.com/migrate-from-exnavigation-to-react-navigation-1af661ec5082)
* [Playing with React Navigation and Airbnb's Native Navigation](https://medium.com/@ericvicenti/playing-with-react-navigation-and-airbnbs-native-navigation-4e49fc765489)
* [How we restructured our app with React Navigation](https://m.oursky.com/how-we-restructured-our-app-with-react-navigation-98a89e219c26)
* [Whats Happening with Navigation in React Native?](https://blog.revisify.com/whats-happening-with-navigation-in-react-native-c193535888c3)
#### Example Projects
* [Yaba-Social](https://github.com/allpwrfulroot/yaba-social)
* [React Native Boilerplate with React Navigation and Redux integration](https://github.com/verybluebot/react-native-boilerplate)
#### Libraries
* [react-navigation-addons](https://github.com/satya164/react-navigation-addons)
* [react-navigation-props-mapper](https://github.com/vonovak/react-navigation-props-mapper)

13
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,13 @@
# Contributing to React Navigation
This library is a community effort: it can only be great if we all help out in one way or another! If you feel like you aren't experienced enough using React Navigation to contribute, you can still make an impact by:
* Responding to one of the open [issues](https://github.com/react-community/react-navigation/issues). Even if you can't resolve or fully answer a question, asking for more information or clarity on an issue is extremely beneficial for someone to come after you to resolve the issue.
* Creating public example repositories or [Snacks](https://snack.expo.io/) of navigation problems you have solved and sharing the links in [Community Resources](https://github.com/react-navigation/react-navigation/blob/master/COMMUNITY_RESOURCES.md).
* Answering questions on [Stack Overflow](https://stackoverflow.com/search?q=react-navigation).
* Answering questions in our [Reactiflux](https://www.reactiflux.com/) channel.
* Providing feedback on the open [PRs](https://github.com/react-navigation/react-navigation/pulls).
* Providing feedback on the open [RFCs](https://github.com/react-navigation/rfcs).
* Improving the [website](https://github.com/react-navigation/react-navigation.github.io).
If you would like to submit a pull request, please follow the [Contributors guide](https://reactnavigation.org/docs/contributing.html) to find out how. If you don't know where to start, check the ones with the label [`good first issue`](https://github.com/react-community/react-navigation/labels/good%20first%20issue) - even [fixing a typo in the documentation](https://github.com/react-community/react-navigation/pull/2727) is a worthy contribution!

7
NavigationTestUtils.js Normal file
View File

@@ -0,0 +1,7 @@
import { _TESTING_ONLY_reset_container_count } from './src/createNavigationContainer';
export default {
resetInternalState: () => {
_TESTING_ONLY_reset_container_count();
},
};

View File

@@ -1,17 +0,0 @@
Please provide enough information so that others can review your pull request:
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise split it.
**Test plan (required)**
Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.
Make sure you test on both platforms if your change affects both platforms.
The code must pass tests and shouldn't add more Flow errors.
**Code formatting**
Look around. Match the style of the rest of the codebase.

View File

@@ -1,42 +1,58 @@
# React Navigation [![CircleCI](https://circleci.com/gh/react-community/react-navigation/tree/master.svg?style=shield&circle-token=622fcb1d78413084c2f44699ed2104246a177485)](https://circleci.com/gh/react-community/react-navigation/tree/master) [![npm version](https://badge.fury.io/js/react-navigation.svg)](https://badge.fury.io/js/react-navigation)
# React Navigation
*Learn once, navigate anywhere.*
[![npm version](https://badge.fury.io/js/react-navigation.svg)](https://badge.fury.io/js/react-navigation) [![codecov](https://codecov.io/gh/react-navigation/react-navigation/branch/master/graph/badge.svg)](https://codecov.io/gh/react-navigation/react-navigation) [![CircleCI badge](https://circleci.com/gh/react-navigation/react-navigation/tree/master.svg?style=shield)](https://circleci.com/gh/react-navigation/react-navigation/tree/master) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactnavigation.org/docs/contributing.html)
Browse the docs on [reactnavigation.org](https://reactnavigation.org/).
React Navigation is born from the React Native community's need for an extensible yet easy-to-use navigation solution based on Javascript.
## [Getting started](https://reactnavigation.org/docs/intro/)
## Installation
1. Create a new React Native App
```
react-native init SimpleApp
cd SimpleApp
```
Since the library is a JS-based solution, to install the latest version of react-navigation you only need to run:
2. Install the latest version of react-navigation from npm
```
yarn add react-navigation
```
or
```
npm install --save react-navigation
```
```bash
yarn add react-navigation
```
3. Run the new app
```
react-native run-android # or:
react-native run-ios
```
or
## Advanced guide
```bash
npm install --save react-navigation
```
- [Redux integration](https://reactnavigation.org/docs/guides/redux)
- [Web integration](https://reactnavigation.org/docs/guides/web)
- [Deep linking](https://reactnavigation.org/docs/guides/linking)
- [Contributors guide](https://reactnavigation.org/docs/guides/contributors)
## Documentation
## React Navigation API
* The best way to learn is to follow the [Getting started guide](https://reactnavigation.org/docs/getting-started.html). It guides you through the fundamentals of React Navigation.
* The documentation includes solutions for common use cases in the "How do I do ...?" section, such as [tab navigation](https://reactnavigation.org/docs/tab-based-navigation.html) and [Redux integration](https://reactnavigation.org/docs/redux-integration.html).
* If you need to build your own navigator, [there's a section for that](https://reactnavigation.org/docs/custom-navigator-overview.html) too.
* The [API reference](https://reactnavigation.org/docs/api-reference.html) lists all public APIs.
* 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).
- [Navigators](https://reactnavigation.org/docs/navigators/)
- [Routers](https://reactnavigation.org/docs/routers/)
- [Views](https://reactnavigation.org/docs/views/)
## 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.
## FAQs
#### I'm having troubles using the library, what can I do?
See [the help page](https://reactnavigation.org/en/help.html).
#### How can I help?
See our [Contributing Guide](CONTRIBUTING.md)!
#### Is this the only library available for navigation?
Certainly not! There other libraries - which, depending on your needs, can be better or worse suited for your project. Read more in the [alternative libraries](https://reactnavigation.org/docs/alternatives.html) documentation, and read React Navigation's [pitch & anti-pitch](https://reactnavigation.org/docs/pitch.html) to understand the tradeoffs.
#### Can I use this library for web?
Web support was [not a priority for the 1.0 release](https://github.com/react-community/react-navigation/issues/2585#issuecomment-330338793), but the architecture of this library allows for it (and it has worked in the past). If you would like to lead this charge, please reach out with your ideas for how to move forward on the [RFCs repository](https://github.com/react-navigation/rfcs) and we would be happy to discuss.
## Code of conduct
This library has adopted a Code of Conduct that we expect project participants to adhere to. Please read the [full text](https://github.com/react-community/react-navigation/blob/master/CODE_OF_CONDUCT.md) so that you can understand what actions will and will not be tolerated.
## License
React Navigation is licensed under the [BSD 2-clause "Simplified" License](https://github.com/react-community/react-navigation/blob/master/LICENSE).

12
assetsTransformer.js Normal file
View File

@@ -0,0 +1,12 @@
/**
* This file is needed to hijack asset imports so that test files don't attempt
* to import them as JavaScript modules.
* See https://github.com/facebook/jest/issues/2663#issuecomment-317109798
*/
const path = require('path');
module.exports = {
process(src, filename, config, options) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
},
};

View File

@@ -1,19 +0,0 @@
machine:
node:
version: 6.9.4
pre:
- mkdir ~/.yarn-cache
dependencies:
pre:
- curl -o- -L https://yarnpkg.com/install.sh | bash
cache_directories:
- "~/.yarn-cache"
override:
- yarn install
- cd website && yarn install
deployment:
website-prod:
branch: master
commands:
- yarn run build-docs
- ./scripts/deploy-website.sh

View File

@@ -1,135 +0,0 @@
# DrawerNavigator
Used to easily set up a screen with a drawer navigation.
```js
class MyHomeScreen extends React.Component {
static navigationOptions = {
drawer: () => ({
label: 'Home',
icon: ({ tintColor }) => (
<Image
source={require('./chats-icon.png')}
style={[styles.icon, {tintColor: tintColor}]}
/>
),
}),
}
render() {
return (
<Button
onPress={() => this.props.navigation.navigate('Notifications')}
title="Go to notifications"
/>
);
}
}
class MyNotificationsScreen extends React.Component {
static navigationOptions = {
drawer: () => ({
label: 'Notifications',
icon: ({ tintColor }) => (
<Image
source={require('./notif-icon.png')}
style={[styles.tabIcon, {tintColor: tintColor}]}
/>
),
}),
}
render() {
return (
<Button
onPress={() => this.props.navigation.goBack()}
title="Go back home"
/>
);
}
}
const styles = StyleSheet.create({
icon: {
width: 24,
height: 24,
},
});
const MyApp = DrawerNavigator({
Home: {
screen: MyHomeScreen,
},
Notifications: {
screen: MyNotificationsScreen,
},
});
```
To open and close drawer, navigate to `'DrawerOpen'` and `'DrawerClose'` respectively.
```js
this.props.navigation.navigate('DrawerOpen'); // open drawer
this.props.navigation.navigate('DrawerClose'); // close drawer
```
## API Definition
```js
DrawerNavigator(RouteConfigs, DrawerNavigatorConfig)
```
### RouteConfigs
The route configs object is a mapping from route name to a route config, which tells the navigator what to present for that route, see [example](https://github.com/coodoo/react-navigation/blob/master/docs/api/navigators/StackNavigator.md#routeconfigs) from `StackNavigator`.
### DrawerNavigatorConfig
- `drawerWidth` - Width of the drawer
- `drawerPosition` - Options are `left` or `right`. Default is `left` position.
- `contentComponent` - Component to use to render the navigation items. Receives the `navigation` prop for the drawer. Defaults to `DrawerView.Items`.
- `contentOptions` - Configure the drawer content, see below.
Several options get passed to the underlying router to modify navigation logic:
- `initialRouteName` - The routeName for the initial route.
- `order` - Array of routeNames which defines the order of the drawer items.
- `paths` - Provide a mapping of routeName to path config, which overrides the paths set in the routeConfigs.
- `backBehavior` - Should the back button cause switch to the initial route? If yes, set to `initialRoute`, otherwise `none`. Defaults to `initialRoute` behavior.
### `contentOptions` for `DrawerView.Items`
- `activeTintColor` - label and icon color of the active label
- `activeBackgroundColor` - background color of the active label
- `inactiveTintColor` - label and icon color of the inactive label
- `inactiveBackgroundColor` - background color of the inactive label
- `style` - style object for the content section
#### Example:
```js
contentOptions: {
activeTintColor: '#e91e63',
style: {
marginVertical: 0,
}
}
```
### Navigator Props
The navigator component created by `DrawerNavigator(...)` takes the following props:
- `screenProps` - Pass down extra options to child screens, for example:
```jsx
const DrawerNav = DrawerNavigator({
// config
});
<DrawerNav
screenProps={/* this prop will get passed to the screen components as this.props.screenProps */}
/>
```

View File

@@ -1,41 +0,0 @@
# Navigators
Navigators allow you define you application's navigation structure. Navigators also render common elements such as headers and tab bars which you can configure.
Under the hood, navigators are plain React components.
## Built-in Navigators
`react-navigation` includes the following functions to help you create navigators:
- [StackNavigator](/docs/navigators/stack) - Renders one screen at a time and provides transitions between screens. When a new screen is opened it is placed on top of the stack.
- [TabNavigator](/docs/navigators/tab) - Renders a tab bar that lets the user switch between several screens
- [DrawerNavigator](/docs/navigators/drawer) - Provides a drawer that slides in from the left of the screen
## Rendering screens with Navigators
The navigators render application screens which are just React components.
To learn how to create screens, read about:
- [Screen `navigation` prop](/docs/navigators/navigation-prop) to allow the screen to dispatch navigation actions, such as opening another screen
- [Screen `navigationOptions`](/docs/navigators/navigation-options) to customize how the screen gets presented by the navigator (e.g. header title, tab label)
### Calling Navigate on Top Level Component
In case you want to use Navigator from the same level you declare it you can use react's [`ref`](https://facebook.github.io/react/docs/refs-and-the-dom.html#the-ref-callback-attribute) option:
```js
const AppNavigator = StackNavigator(SomeAppRouteConfigs);
class App extends React.Component {
someEvent() {
// call navigate for AppNavigator here:
this.navigator && this.navigator.dispatch({ type: 'Navigate', routeName, params });
}
render() {
return (
<AppNavigator ref={nav => { this.navigator = nav; }} />
);
}
}
```
Please notice that this solution should only be used on the top level navigator.

View File

@@ -1,148 +0,0 @@
# StackNavigator
Provides a way for your app to transition between screens where each new screen is placed on top of a stack.
By default the StackNavigator is configured to have the familiar iOS and Android look & feel: new screens slide in from the right on iOS, fade in from the bottom on Android. On iOS the StackNavigator can also be configured to a modal style where screens slide in from the bottom.
```jsx
class MyHomeScreen extends React.Component {
static navigationOptions = {
title: 'Home',
}
render() {
return (
<Button
onPress={() => this.props.navigation.navigate('Profile', {name: 'Lucy'})}
label="Go to Lucy's profile"
/>
);
}
}
const ModalStack = StackNavigator({
Home: {
screen: MyHomeScreen,
},
Profile: {
path: 'people/:name',
screen: MyProfileScreen,
},
});
```
## API Definition
```js
StackNavigator(RouteConfigs, StackNavigatorConfig)
```
### RouteConfigs
The route configs object is a mapping from route name to a route config, which tells the navigator what to present for that route.
```js
StackNavigator({
// For each screen that you can navigate to, create a new entry like this:
Profile: {
// `ProfileScreen` is a React component that will be the main content of the screen.
screen: ProfileScreen,
// When `ProfileScreen` is loaded by the StackNavigator, it will be given a `navigation` prop.
// Optional: When deep linking or using react-navigation in a web app, this path is used:
path: 'people/:username',
// The action and route params are extracted from the path.
// Optional: Override the `navigationOptions` for the screen
navigationOptions: {
title: ({state}) => `${state.params.username}'s Profile'`,
},
},
...MyOtherRoutes,
});
```
### StackNavigatorConfig
Options for the router:
- `initialRouteName` - Sets the default screen of the stack. Must match one of the keys in route configs.
- `initialRouteParams` - The params for the initial route
- `navigationOptions` - Default navigation options to use for screens
- `paths` - A mapping of overrides for the paths set in the route configs
Visual options:
- `mode` - Defines the style for rendering and transitions:
- `card` - Use the standard iOS and Android screen transitions. This is the default.
- `modal` - Make the screens slide in from the bottom which is a common iOS pattern. Only works on iOS, has no effect on Android.
- `headerMode` - Specifies how the header should be rendered:
- `float` - Render a single header that stays at the top and animates as screens are changed. This is a common pattern on iOS.
- `screen` - Each screen has a header attached to it and the header fades in and out together with the screen. This is a common pattern on Android.
- `none` - No header will be rendered.
- `cardStyle` - Use this prop to override or extend the default style for an individual card in stack.
- `onTransitionStart` - Function to be invoked when the card transition animation is about to start.
- `onTransitionEnd` - Function to be invoked once the card transition animation completes.
### Screen Navigation Options
Usually you define static `navigationOptions` on your screen component. For example:
```jsx
class ProfileScreen extends React.Component {
static navigationOptions = {
title: ({ state }) => `${state.params.name}'s Profile!`,
header: ({ state, setParams }) => ({
// Render a button on the right side of the header
// When pressed switches the screen to edit mode.
right: (
<Button
title={state.params.editing ? 'Done' : 'Edit'}
onPress={() => setParams({editing: state.params.editing ? false : true})}
/>
),
}),
};
...
```
All `navigationOptions` for the `StackNavigator`:
- `title` - a title (string) displayed in the header
- `header` - a config object for the header bar:
- `visible` - Boolean toggle of header visibility. Only works when `headerMode` is `screen`.
- `title` - Title string used by the navigation bar, or a custom React component
- `right` - Custom React Element to display on the right side of the header
- `left` - Custom React Element to display on the left side of the header
- `style` - Style object for the navigation bar
- `titleStyle` - Style object for the title component
- `tintColor` - Tint color for the header
### Navigator Props
The navigator component created by `StackNavigator(...)` takes the following props:
- `screenProps` - Pass down extra options to child screens, for example:
```jsx
const SomeStack = StackNavigator({
// config
});
<SomeStack
screenProps={/* this prop will get passed to the screen components as this.props.screenProps */}
/>
```
### Examples
See the examples [SimpleStack.js](https://github.com/react-community/react-navigation/tree/master/examples/NavigationPlayground/js/SimpleStack.js) and [ModalStack.js](https://github.com/react-community/react-navigation/tree/master/examples/NavigationPlayground/js/ModalStack.js) which you can run locally as part of the [NavigationPlayground](https://github.com/react-community/react-navigation/tree/master/examples/NavigationPlayground) app.

View File

@@ -1,168 +0,0 @@
# TabNavigator
Used to easily set up a screen with several tabs with a TabRouter.
```js
class MyHomeScreen extends React.Component {
static navigationOptions = {
tabBar: {
label: 'Home',
// Note: By default the icon is only shown on iOS. Search the showIcon option below.
icon: ({ tintColor }) => (
<Image
source={require('./chats-icon.png')}
style={[styles.icon, {tintColor: tintColor}]}
/>
),
},
}
render() {
return (
<Button
onPress={() => this.props.navigation.navigate('Notifications')}
title="Go to notifications"
/>
);
}
}
class MyNotificationsScreen extends React.Component {
static navigationOptions = {
tabBar: {
label: 'Notifications',
icon: ({ tintColor }) => (
<Image
source={require('./notif-icon.png')}
style={[styles.tabIcon, {tintColor: tintColor}]}
/>
),
},
}
render() {
return (
<Button
onPress={() => this.props.navigation.goBack()}
title="Go back home"
/>
);
}
}
const styles = StyleSheet.create({
icon: {
width: 26,
height: 26,
},
});
const MyApp = TabNavigator({
Home: {
screen: MyHomeScreen,
},
Notifications: {
screen: MyNotificationsScreen,
},
}, {
tabBarOptions: {
activeTintColor: '#e91e63',
},
});
```
## API Definition
```js
TabNavigator(RouteConfigs, TabNavigatorConfig)
```
### RouteConfigs
The route configs object is a mapping from route name to a route config, which tells the navigator what to present for that route, see [example](https://github.com/coodoo/react-navigation/blob/master/docs/api/navigators/StackNavigator.md#routeconfigs) from `StackNavigator`.
### TabNavigatorConfig
- `tabBarComponent` - component to use as the tab bar, e.g. `TabView.TabBarBottom`
(this is the default on iOS), `TabView.TabBarTop`
(this is the default on Android)
- `tabBarPosition` - position of the tab bar, can be `'top'` or `'bottom'`
- `swipeEnabled` - whether to allow swiping between tabs
- `animationEnabled` - whether to animate when changing tabs
- `lazyLoad` - whether to lazily render tabs as needed as opposed to rendering them upfront
- `tabBarOptions` - configure the tab bar, see below.
Several options get passed to the underlying router to modify navigation logic:
- `initialRouteName` - The routeName for the initial tab route when first loading
- `order` - Array of routeNames which defines the order of the tabs
- `paths` - Provide a mapping of routeName to path config, which overrides the paths set in the routeConfigs.
- `backBehavior` - Should the back button cause a tab switch to the initial tab? If yes, set to `initialRoute`, otherwise `none`. Defaults to `initialRoute` behavior.
### `tabBarOptions` for `TabBarBottom` (default tab bar on iOS)
- `activeTintColor` - label and icon color of the active tab
- `activeBackgroundColor` - background color of the active tab
- `inactiveTintColor` - label and icon color of the inactive tab
- `inactiveBackgroundColor` - background color of the inactive tab
- `showLabel` - whether to show label for tab, default is true
- `style` - style object for the tab bar
- `labelStyle` - style object for the tab label
Example:
```js
tabBarOptions: {
activeTintColor: '#e91e63',
labelStyle: { fontSize: 12 },
style: {
backgroundColor: 'blue',
}
}
```
### `tabBarOptions` for `TabBarTop` (default tab bar on Android)
- `activeTintColor` - label and icon color of the active tab
- `inactiveTintColor` - label and icon color of the inactive tab
- `showIcon` - whether to show icon for tab, default is false
- `showLabel` - whether to show label for tab, default is true
- `upperCaseLabel` - whether to make label uppercase, default is true
- `pressColor` - color for material ripple (Android >= 5.0 only)
- `pressOpacity` - opacity for pressed tab (iOS and Android < 5.0 only)
- `scrollEnabled` - whether to enable scrollable tabs
- `tabStyle` - style object for the tab
- `indicatorStyle` - style object for the tab indicator (line at the bottom of the tab)
- `labelStyle` - style object for the tab label
- `style` - style object for the tab bar
Example:
```js
tabBarOptions: {
labelStyle: {
fontSize: 12,
},
style: {
backgroundColor: 'blue',
}
}
```
### Navigator Props
The navigator component created by `TabNavigator(...)` takes the following props:
- `screenProps` - Pass down extra options to child screens, for example:
```jsx
const TabNav = TabNavigator({
// config
});
<TabNav
screenProps={/* this prop will get passed to the screen components as this.props.screenProps */}
/>
```

View File

@@ -1,130 +0,0 @@
# Routers
Routers define a component's navigation state, and they allow the developer to define paths and actions that can be handled.
## Built-In Routers
`react-navigation` ships with a few standard routers:
- [StackRouter](/docs/routers/stack)
- [TabRouter](/docs/routers/tabs)
## Using Routers
To make a navigator manually, put a static `router` on a component. (To quickly make a navigator with a built-in component, it may be easier to use a [Navigator Factory](/docs/navigators) instead)
```js
class MyNavigator extends React.Component {
static router = StackRouter(routes, config);
...
}
```
Now you can use this component as a `screen` in another navigator, and the navigation logic for `MyNavigator` will be defined by this `StackRouter`.
## Customizing Routers
See the [Custom Router API spec](/docs/routers/api) to learn about the API of `StackRouter` and `TabRouter`. You can override the router functions as you see fit:
### Custom Navigation Actions
To override navigation behavior, you can override the navigation state logic in `getStateForAction`, and manually manipulate the `routes` and `index`.
```js
const MyApp = StackNavigator({
Home: { screen: HomeScreen },
Profile: { screen: ProfileScreen },
}, {
initialRouteName: 'Home',
})
MyApp.router = {
...MyApp.router,
getStateForAction(action, state) {
if (state && action.type === 'PushTwoProfiles') {
const routes = [
...state.routes,
{key: 'A', routeName: 'Profile', params: { name: action.name1 }},
{key: 'B', routeName: 'Profile', params: { name: action.name2 }},
];
return {
...state,
routes,
index: routes.length - 1,
};
}
return MyApp.router.getStateForAction(action, state);
},
};
```
### Blocking Navigation Actions
Sometimes you may want to prevent some navigation activity, depending on your route.
```js
const MyStackRouter = StackRouter({
Home: { screen: HomeScreen },
Profile: { screen: ProfileScreen },
}, {
initialRouteName: 'Home',
})
const MyAppRouter = {
...MyStackRouter,
getStateForAction(action, state) {
if (
state &&
action.type === NavigationActions.BACK &&
state.routes[state.index].params.isEditing
) {
// Returning null from getStateForAction means that the action
// has been handled/blocked, but there is not a new state
return null;
}
return MyStackRouter.getStateForAction(action, state);
},
};
```
### Handling Custom URIs
Perhaps your app has a unique URI which the built-in routers cannot handle. You can always extend the router `getActionForPathAndParams`.
```js
import { NavigationActions } from 'react-navigation'
const MyApp = StackNavigator({
Home: { screen: HomeScreen },
Profile: { screen: ProfileScreen },
}, {
initialRouteName: 'Home',
})
MyApp.router = {
...MyApp.router,
getActionForPathAndParams(path, params) {
if (
path === 'my/custom/path' &&
params.magic === 'yes'
) {
// returns a profile navigate action for /my/custom/path?magic=yes
return NavigationActions.navigate({
routeName: 'Profile',
action: NavigationActions.navigate({
// This child action will get passed to the child router
// ProfileScreen.router.getStateForAction to get the child
// navigation state.
routeName: 'Friends',
}),
});
return null;
}
return MyApp.router.getStateForAction(action, state);
},
};
```

View File

@@ -1,101 +0,0 @@
## Custom Router API
You can make your own router by building an object with the following functions:
```js
const MyRouter = {
getStateForAction: (action) => ({}),
getActionForPathAndParams: (path, params) => null,
getPathAndParamsForState: (state) => null,
getComponentForState: (state) => MyScreen,
getComponentForRouteName: (routeName) => MyScreen,
};
// Now, you can make a navigator by putting the router on it:
class MyNavigator extends React.Component {
static router = MyRouter;
render() {
...
}
}
```
![Routers manage the relationship between URIs, actions, and navigation state](/assets/routers-concept-map.png)
### `getStateForAction(action, state)`
Defines the navigation state in response to a given action. This function will be run when an action gets passed into `props.navigation.dispatch(`, or when any of the helper functions are called, like `navigation.navigate(`.
Typically this should return a navigation state, with the following form:
```
{
index: 1, // identifies which route in the routes array is active
routes: [
{
// Each route needs a name to identify the type.
routeName: 'MyRouteName',
// A unique identifier for this route in the routes array:
key: 'myroute-123',
// (used to specify the re-ordering of routes)
// Routes can have any data, as long as key and routeName are correct
...randomRouteData,
},
...moreRoutes,
]
}
```
If the router has handled the action externally, or wants to swallow it without changing the navigation state, this function will return `null`.
### `getComponentRouteName(routeName)`
Returns the child component or navigator for the given route name.
Say a router `getStateForAction` outputs a state like this:
```js
{
index: 1,
routes: [
{ key: 'A', routeName: 'Foo' },
{ key: 'B', routeName: 'Bar' },
],
}
```
Based on the routeNames in the state, the router is responsible for returning valid components when calling `router.getComponentRouteName('Foo')` or `router.getComponentRouteName('Bar')`.
### `getComponentForState(state)`
Returns the active component for a deep navigation state.
### `getActionForPathAndParams`
Returns an optional navigation action that should be used when the user navigates to this path and provides optional query parameters.
### `getPathAndParamsForState`
Returns the path and params that can be put into the URL to link the user back to the same spot in the app.
The path/params that are output from this should form an action when passed back into the router's `getActionForPathAndParams`. That action should take you to a similar state once passed through `getStateForAction`.
### `getScreenConfig`
Used to retrieve the navigation options for a route. Must provide the screen's current navigation prop, and the name of the option to be retrieved.
- `navigation` - This is the navigation prop that the screen will use, where the state refers to the screen's route/state. Dispatch will trigger actions in the context of that screen.
- `optionName` - What named option is being fetched, such as 'title'
Inside an example view, perhaps you need to fetch the configured title:
```js
// First, prepare a navigation prop for your child, or re-use one if already available.
const childNavigation = addNavigationHelpers({
// In this case we use navigation.state.index because we want the title for the active route.
state: navigation.state.routes[navigation.state.index],
dispatch: navigation.dispatch,
})
const screenTitle = this.props.router.getScreenConfig(childNavigation, 'title');
```

View File

@@ -1,64 +0,0 @@
# StackRouter
Manage the logical navigation stack, including pushing, popping, and handling path parsing to create a deep stack.
Let's take a look at a simple stack router:
```js
const MyApp = StackRouter({
Home: { screen: HomeScreen },
Profile: { screen: ProfileScreen },
}, {
initialRouteName: 'Home',
})
```
### RouteConfig
A basic stack router have a route config. Here is an example configuration:
```js
const MyApp = StackRouter({ // This is the RouteConfig:
Home: {
screen: HomeScreen,
path: '',
},
Profile: {
screen: ProfileScreen,
path: 'profile/:name',
},
Settings {
// This can be handy to lazily require a screen:
getScreen: () => require('Settings').default,
// Note: Child navigators cannot be configured using getScreen because
// the router will not be accessible. Navigators must be configured
// using `screen: MyNavigator`
path: 'settings',
},
});
```
Each item in the config may have the following:
- `path` - Specify the path and params to be parsed for item in the stack
- `screen` - Specify the screen component or child navigator
- `getScreen` - Set a lazy getter for a screen component (but not navigators)
### StackConfig
Config options that are also passed to the stack router.
- `initalRouteName` - The routeName for the default route when the stack first loads
- `initialRouteParams` - Default params of the initial route
- `paths` - Provide a mapping of routeName to path config, which overrides the paths set in the routeConfigs.
### Supported Actions
The stack router may respond to the following navigation actions. The router will generally delegate the action handling to a child router, if possible.
- Navigate - Will push a new route on the stack if the routeName matches one of the router's routeConfigs
- Back - Goes back (pops)
- Reset - Clears the stack and provides new actions to create a fully new navigation state
- SetParams - An action that a screen dispatches to change the params of the current route.

View File

@@ -1,60 +0,0 @@
# TabRouter
Manage a set of tabs in the application, handle jumping to tabs, and handle the back button press to jump to the initial tab.
Let's take a look at a simple tabs router:
```js
const MyApp = TabRouter({
Home: { screen: HomeScreen },
Settings: { screen: SettingsScreen },
}, {
initialRouteName: 'Home',
})
```
### RouteConfig
A tabs router has a routeConfig for each possible tab:
```js
const MyApp = TabRouter({ // This is the RouteConfig:
Home: {
screen: HomeScreen,
path: 'main',
},
Settings: {
// This can be handy to lazily require a tab:
getScreen: () => require('./SettingsScreen').default,
// Note: Child navigators cannot be configured using getScreen because
// the router will not be accessible. Navigators must be configured
// using `screen: MyNavigator`
path: 'settings',
},
});
```
Each item in the config may have the following:
- `path` - Specify the path for each tab
- `screen` - Specify the screen component or child navigator
- `getScreen` - Set a lazy getter for a screen component (but not navigators)
### Tab Router Config
Config options that are also passed to the router.
- `initialRouteName` - The routeName for the initial tab route when first loading
- `order` - Array of routeNames which defines the order of the tabs
- `paths` - Provide a mapping of routeName to path config, which overrides the paths set in the routeConfigs.
- `backBehavior` - Should the back button cause a tab switch to the initial tab? If yes, set to `initialRoute`, otherwise `none`. Defaults to `initialRoute` behavior.
### Supported Actions
The tabs router may respond to the following navigation actions. The router will generally delegate the action handling to a child router, if possible.
- Navigate - Will jump to the routeName if it matches a tab
- Back - Goes to the first tab, if not already selected
- SetParams - An action that a screen dispatches to change the params of the current route.

View File

@@ -1,191 +0,0 @@
# Transitioner
`Transitioner` is a React component that helps manage transitions for complex animated components. It manages the timing of animations and keeps track of various screens as they enter and leave, but it doesn't know what anything looks like, because rendering is entirely deferred to the developer.
Under the covers, `Transitioner` is used to implement `CardStack`, and hence the `StackNavigator`.
The most useful thing `Transitioner` does is to take in a prop of the current navigation state. When routes are removed from that navigation state, `Transitioner` will coordinate the transition away from those routes, keeping them on screen even though they are gone from the navigation state.
## Example
```jsx
class MyNavView extends Component {
...
render() {
return (
<Transitioner
configureTransition={this._configureTransition}
navigation={this.props.navigation}
render={this._render}
onTransitionStart={this.onTransitionStart}
onTransitionEnd={this.onTransitionEnd}
/>
);
}
```
## Props
### `configureTransition` function
Invoked on `Transitioner.componentWillReceiveProps`, this function allows customization of animation parameters such as `duration`. The value returned from this function will be fed into a timing function, by default `Animated.timing()`, as its config.
#### Examples
```js
_configureTransition(transitionProps, prevTransitionProps) {
return {
// duration in milliseconds, default: 250
duration: 500,
// An easing function from `Easing`, default: Easing.inOut(Easing.ease)
easing: Easing.bounce,
}
}
```
Note: `duration` and `easing` are only applicable when the timing function is `Animated.timing`. We can also use a different timing function and its corresponding config parameters, like so:
```js
_configureTransition(transitionProps, prevTransitionProps) {
return {
// A timing function, default: Animated.timing.
timing: Animated.spring,
// Some parameters relevant to Animated.spring
friction: 1,
tension: 0.5,
}
}
```
#### Flow definition
```js
configureTransition: (
transitionProps: NavigationTransitionProps,
prevTransitionProps: ?NavigationTransitionProps,
) => NavigationTransitionSpec,
```
#### Parameters
- `transitionProps`: the current [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the current navigation state and props
- `prevTransitionProps`: the previous [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the previous navigation state and props
#### Returns
- An object of type [NavigationTransitionSpec](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L316) that will be fed into an Animated timing function as its config
### `navigationState` object
A plain object that represents the navigation state
#### Example value
```js
{
// Index refers to the active child route in the routes array.
index: 1,
routes: [
{ key: 'DF2FGWGAS-12', routeName: 'ContactHome' },
{ key: 'DF2FGWGAS-13', routeName: 'ContactDetail', params: { personId: 123 } }
]
}
```
#### Flow definition
```js
export type NavigationState = {
index: number,
routes: Array<NavigationRoute>,
};
```
For more information about the `NavigationRoute` type, check out its [flow definition](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L32).
### `render` function
Invoked from `Transitioner.render()`. This function performs the actual rendering delegated from `Transitioner`. In this function, we can use the information included in the `transitionProps` and `prevTransitionProps` parameters to render scenes, create animations and handle gestures.
There are a few important properties of the `transitionProps` and `prevTransitionProps` parameters that are useful for the tasks mentioned above:
- `scenes: Array<NavigationScene>` - a list of all available scenes
- `position: NavigationAnimatedValue` - the progressive index of the transitioner's navigation state
- `progress: NavigationAnimatedValue` - the value that represents the progress of the transition when navigation state changes from one to another. Its numberic value will range from 0 to 1.
For the complete list of properties of `NavigationTransitionProps`, check out its [flow definition](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273).
#### Examples
`transitionProps.scenes` is the list of all available scenes. It is up to the implementor to determine how to lay them out on the screen. For example, we can render the scenes as a stack of cards like so:
```jsx
_render(transitionProps, prevTransitionProps) {
const scenes = transitionProps.scenes.map(scene => this._renderScene(transitionProps, scene));
return (
<View style={styles.stack}>
{scenes}
</View>
);
}
```
We can then use an `Animated.View` to animate the transition. To create necessary animated style properties, such as `opacity`, we can interpolate on `position` and `progress` values that come with `transitionProps`:
```jsx
_renderScene(transitionProps, scene) {
const { position } = transitionProps;
const { index } = scene;
const opacity = position.interpolate({
inputRange: [index-1, index, index+1],
outputRange: [0, 1, 0],
});
// The prop `router` is populated when we call `createNavigator`.
const Scene = this.props.router.getComponent(scene.route.routeName);
return (
<Animated.View style={{ opacity }}>
{ Scene }
</Animated.View>
)
}
```
The above code creates a cross fade animation during transition.
For a comprehensive tutorial on how to create custom transitions, see this [blog post](http://www.reactnativediary.com/2016/12/20/navigation-experimental-custom-transition-1.html).
#### Flow definition
```js
render: (transitionProps: NavigationTransitionProps, prevTransitionProps: ?NavigationTransitionProps) => React.Element<*>,
```
#### Parameters
- `transitionProps`: the current [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the current state and props
- `prevTransitionProps`: the previous [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the previous state and props
#### Returns
- A ReactElement, which will be used to render the Transitioner component
### `onTransitionStart` function
Invoked when the transition animation is about to start.
#### Flow definition
```js
onTransitionStart: (transitionProps: NavigationTransitionProps, prevTransitionProps: ?NavigationTransitionProps) => void,
```
#### Parameters
- `transitionProps`: the current [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the current state and props
- `prevTransitionProps`: the previous [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the previous state and props
#### Returns
- none.
### `onTransitionEnd` function
Invoked once the transition animation completes.
#### Flow definition
```js
onTransitionEnd: () => void
```
#### Parameters
- none.
#### Returns
- none.

View File

@@ -1,17 +0,0 @@
# Views
Navigation views are presentation components that take a [`router`](/docs/api/routers) and a [`navigation`](/docs/navigators/navigation-prop) prop, and can display several screens, as specified by the `navigation.state`.
Navigation views are controlled React components that can present the current navigation state. They manage switching of screens, animations and gestures. They also present persistent navigation views such as tab bars and headers.
## Built in Views
- [CardStack](https://github.com/react-community/react-navigation/blob/master/src/views/CardStack.js) - Present a stack that looks suitable on any platform
+ [Card](https://github.com/react-community/react-navigation/blob/master/src/views/Card.js) - Present one card from the card stack, with gestures
+ [Header](https://github.com/react-community/react-navigation/blob/master/src/views/Header.js) - The header view for the card stack
- [Tabs](https://github.com/react-community/react-navigation/blob/master/src/views/TabView) - A configurable tab switcher / pager
- [Drawer](https://github.com/react-community/react-navigation/tree/master/src/views/Drawer) - A view with a drawer that slides from the left
## [Transitioner](/docs/views/transitioner)
`Transitioner` manages the animations during the transition and can be used to build fully custom navigation views. It is used inside the `CardStack` view. [Learn more about Transitioner here.](/docs/views/transitioner)

View File

@@ -1,17 +0,0 @@
# withNavigation
[`withNavigation`](/src/views/withNavigation.js) is a Higher Order Component which passes the `navigation` prop into wrapped Component. It's useful when you cannnot pass the `navigation` prop into into the component directly, or don't want to pass it in case of a deeply nested child.
## Example
```js
import { Button } 'react-native';
import { withNavigation } from 'react-navigation';
const MyComponent = ({ to, navigation }) => (
<Button title={`navigate to ${to}`} onPress={() => navigation.navigate(to)} />
);
const MyComponentWithNavigation = withNavigation(MyComponent);
```

View File

@@ -1,61 +0,0 @@
# Introducing React Navigation for React Native
Today we're excited to introduce React Navigation, a flexible navigation library for React Native and web, including customizable views for React Native, routers for any platform, and navigators that make it super easy to get started. We aim to provide a simple and extensible solution which enables developers to share one navigation paradigm for all of their React apps.
## Start Quick with pre-built Navigators
A navigator is a React component with a static `.router` declared on it. To make it super easy to get started, React Navigation ships with a few navigator factories, pairing common views with routers.
For example, the provided `StackNavigator` makes it easy to use a `CardStack` view and a `StackRouter` together:
```js
const MyApp = StackNavigator({
Home: {screen: HomeScreen},
Profile: {screen: ProfileScreen},
});
```
Each of these screens are just React components, and they can easily set their own title:
```js
class HomeScreen extends React.Component {
static navigationOptions = {
title: 'Home',
};
render() {
const { navigate } = this.props.navigation;
return (
<Button
onPress={() => navigate('Profile', { name: 'A' })}
title="Go to A's profile"
/>
);
}
}
```
To learn more, [continue with the getting started guide](/docs/intro).
## Performant Views on React Native
Animations and gestures are critical for smooth navigation in a mobile app. React Navigation utilizes React Native's Animated library to provide 60fps animations that are driven from the native thread.
The views are designed to be highly extensible. For your app, you may want to build a custom modal, fork the stack header, or even utilize the underlying `<Transitioner>` component to build an entirely custom navigation presentation.
## Routers for Every Platform
In React Navigation, routers manage the [relationship between actions, state, and URIs](/docs/routers/api). The routers are cross-platform, and there is example code for iOS, Android, and web. Several routers are included, including [`TabRouter`](/docs/routers/tab) and [`StackRouter`](/docs/routers/stack), and it is encouraged to [override their behavior as needed](/docs/routers).
The routers are composable and can be useful for structuring your app. A common navigation structure in iOS is to have an independent navigation stack for each tab, where all tabs can be covered by a modal. This is three layers of router: a card stack, within tabs, all within a modal stack. So unlike our experience on web apps, the navigation state of mobile apps is too complex to encode into a single URI. Routers in `react-navigation` map from URIs to navigation actions, which are then used to compute navigation state.
## Future
React Navigation is born from the React Native community's need for an extensible yet easy-to-use navigation solution. It replaces and improves upon several navigation libraries in the ecosystem, including Ex-Navigation and React Native's Navigator and NavigationExperimental components.
Until the community lands on one navigation solution that works well on the web and React Native, we will forever be destined to re-invent navigation. We are extremely sensitive about the burden of change that accompanies a new navigation library, so we aim to provide a solution that will work long into the future. We are excited to support React Navigation for any platform, including cutting-edge frontiers like hybrid native apps, web server rendering, and ReactVR.
The first beta of React Navigation is available today on npm and GitHub, and you can [get started here](/docs/intro). We're excited to hear feedback from the React community, and together we still have a long way to go before our dream is realized. We'd love to see the community flourish with beautiful navigation views, custom router integrations, and more easy-to-use navigators. All of these individual contributions can work together seamlessly. If you have improvements for the built-in components, please [follow the contributors guide](/docs/guides/contributors) and dive right in!

View File

@@ -1,229 +0,0 @@
# Common Navigation Spec
### Introduction
It is useful to have “one standard way” to handle navigation in a React app. Unfortunately, we've learned that a single navigation library cannot be the right fit for every application. There is often a tradeoff between several useful features:
* Simplicity
* Supporting complex animations
* Navigating between natively-implemented screens and JavaScript screens
* Precise fidelity to the native UI controls
* Default support for deep linking and the Android back button
Although the React Native community will need more than one navigation library, we can make them work nicely together. The goal of this document is to specify a common API for navigation libraries. Consistency will make several things easier for React Native developers:
* Combining multiple navigation libraries in one application
* Switching out navigation libraries when requirements change
* Learning navigation once, and applying that knowledge in different applications
Navigation libraries don't have to implement all of this API - it's just a recommendation.
(TODO: When we actually publish this spec, we should mention here what libraries are supporting it, what libraries will support it, and (link to?) how to migrate from other now-discouraged navigation libraries.)
## Key Concepts
#### Navigation Container
The parent component which hosts a navigation-aware component. It must provide the `navigation` prop, and usually uses the child component's static `router` to determine navigation state.
#### Navigation-Aware Component
A React component which can observe and initiate navigation in an app. It uses the navigation prop to see navigation state and request actions. It may expose a router to define navigation state and URI handling.
The card stack of your application may be a navigation-aware component. Also, one screen of your app that handles the Android back button is a navigation-aware component.
#### Navigation State
The object that defines the navigation state of your component, passed in as a prop. A router can define the state, which optionally specifies the title and URI of the component.
#### Action
A JSON object used to request changes in the app's navigation state.
#### Router
Defines the navigation behavior of a component by defining navigation state as a function of actions, and allows URIs to be optionally converted into an action that can be handled.
#### Navigator
A navigation-aware component that hosts other navigation-aware components. Most navigators are expected to delegate all router logic, manage child navigation state, and pass up actions as they are dispatched.
## Specification
### The `navigation` prop
The navigation prop should be provided to components who need access to navigation. If provided, it must follow this interface:
```javascript
type BackAction = {type: 'Navigation/BACK'};
type URIAction = {type: 'Navigation/URI', uri: string};
interface Navigation<S, A> {
dispatch(action: (A | BackAction | URIAction)): boolean;
state: S;
}
```
#### navigation.state
The controlled navigation state prop, as requested by the parent.
```javascript
const MyView = ({ navigation }) => {
switch (navigation.state.myRequestedView) {
case 'ViewA': return <ViewA />;
case 'ViewB': return <ViewB />;
default: return <OtherView />;
}
}
```
#### navigation.dispatch(action)
The channel that a component can call to request navigation from its parent. When calling `dispatch`, you must provide an action object with a `type`. There are two special action types: 'Navigation/BACK' and 'Navigation/URI'.
```javascript
const MyLink = ({ navigation }) => (
<Button onPress={() => {
navigation.dispatch({
type: 'MyNavigationRequest',
myParam: 42,
});
}>
Press me to navigate
</Button>
);
```
### The static `router`
A router object may be statically defined on your component. If defined, it must follow this interface:
```javascript
type BackAction = {type: 'Navigation/BACK'};
type URIAction = {type: 'Navigation/URI', uri: string};
interface Router<S, A> {
getStateForAction(action: (A | BackAction | URIAction), lastState: ?S): ?S;
getActionForURI(uri: string): ?A;
}
```
The state and action types of the static router must match the state and action types associated with the navigation prop passed into the component.
#### router.getStateForAction(action, lastState)
This function is defined on the static router and is used to define the expected navigation state.
```javascript
class ScreenWithEditMode extends React.Component {
static router = {
getStateForAction: (action, prevState) => {
return { isEditing: true };
},
};
render() {
// this.props.navigation.state.isEditing === true
...
}
}
```
`getStateForAction` must **always** return a navigation state that can be rendered by the component when passed in as the `navigation.state` prop.
If null is returned, we are signaling that the previous navigation state has not changed, but the action is handled. This is usually used in cases where the action is being swallowed.
#### router.getActionForURI(uri)
Return an action if a URI can be handled, otherwise return `null`
### Special Actions
There are two special actions that can be fired into `navigation.dispatch` and can be handled by your `router.getStateForAction`.
#### Back Action
This action means the same thing as an Android back button press.
```
type BackAction = { type: 'Navigation/BACK' };
```
#### URI Open Action
Used to request the enclosing app or OS to open a link at a particular URI. If it is a web URI like `http` or `https`, the app may open a WebView to present the page. Or the app may open the URI in a web browser. In some cases, an app may choose to block a URI action or handle it differently.
```
type URIAction = { type: 'Navigation/URI', uri: string };
```
### Special Navigation State
The state defined by `router.getStateForAction` can contain special navigation properties that may be relevant to your app. The title and current URI of a component may change over time, and the parent often needs to observe the behavior.
#### `state.title`
If the navigation state contains 'title', it will be used as the title for the given component. This is relevant for top-level components on the web to update the browser title, and is relevant in mobile apps where a title is shown in the header.
#### `state.uri`
A URI can also be put in `state.uri`, which will signal to the parent how it may be possible to deep link into a similar navigation state. In web apps, this will be used to keep the URI bar in sync with the current navigation state of the app.
## Use Cases
### "Block the Android back button on one screen of my app"
To block the Android back button:
```
class Foo extends React.Component {
static router = {
getStateForAction(action, prevState = {}) {
if (action.type === 'Navigation/BACK') return null;
else return prevState;
},
};
render() {
...
```
Because we return null, we signal to our container that the action has been handled but the state does not change. The parent should not handle the back behavior at this point, and nothing should be re-rendered.
### "Link deeply into one screen of my app"
```
class Foo extends React.Component {
static router = {
getStateForAction(action, prevState = {deep: false}) {
if (action.type === 'GoDeep') return { deep: true };
else return prevState;
},
getActionForURI(uri) {
if (uri === 'myapp://foo')
return {type: 'Go'};
else if (uri === 'myapp://foo_deep')
return {type: 'GoDeep'};
return null;
},
};
render() {
// this.props.navigation.state.deep may be true or false
...
```
Based on the state URI we may decide to return an action. If an action is returned, `getStateForAction` is expected to output the correct state for a deep link.
## Reference Implementations
A library to that helps easily produce navigation-aware components: https://github.com/react-community/react-navigation . (Also uses a HOC to provide navigation containers when needed.)
A simple navigation container: https://gist.github.com/ericvicenti/77d190e2ec408012255937400e34bdb1
A web implementation of a navigation container: https://gist.github.com/ericvicenti/55bef95fcd8558029a3bae8483baea6c

View File

@@ -1,79 +0,0 @@
# Contributors Guide
## Environment
React navigation was initially developed on macOS 10.12, with node 7+, and react-native v0.39+. Please open issues when uncovering problems in different environments.
## Development
### 0. Basic Install
```
git clone git@github.com:react-community/react-navigation.git
cd react-navigation
npm install
```
### 1. Run the native playground
```
cd examples/NavigationPlayground
npm install
cd ../..
npm start
# In a seperate terminal tab:
npm run run-playground-android
npm run run-playground-ios
```
### 2. Run the website
For development mode and live-reloading:
```
cd website
npm install
npm run start
```
To run the website in production mode with server rendering:
```
npm run prod
```
### 3. Run tests, run flow
```
jest
flow
```
Tests must pass for your changes to be accepted and merged.
Flow is not yet passing, but your code should be flow checked and we expect that your changes do not introduce any flow errors.
### 4. Developing Docs
The docs are indexed in [App.js](https://github.com/react-community/react-navigation/blob/master/website/src/App.js), where all the pages are declared alongside the titles. To test the docs, follow the above instructions for running the website. Changing existing markdown files should not require any testing.
The markdown from the `docs` folder gets generated and dumped into a json file as a part of the build step. To see updated docs appear in the website, re-run the build step by running `npm run build-docs` from the `react-navigation` root folder.
## Submitting Contributions
### New views or unique features
Often navigation needs are specific to certain apps. If your changes are unique to your app, you may want to fork the view or router that has changed. You can keep the source code in your app, or publish it on npm as a `react-navigation` compatible view or router.
This library is intended to include highly standard and generic navigation patterns. But it
### Major Changes
Before embarking on any major changes, please file an issue describing the suggested change and motivation. We may already have thought about it and we want to make sure we all are on the same page before starting on any big changes.
### Minor Bugfixes
Simple bug fixes are welcomed in pull requests! Please check for duplicate PRs before posting.

View File

@@ -1,110 +0,0 @@
# Custom Navigators
A navigator is any React component that has a [router](/docs/routers/) on it. Here is a basic one, which uses the [router's API](/docs/routers/api) to get the active component to render:
```js
class MyNavigator extends React.Component {
static router = MyRouter;
render() {
const { state, dispatch } = this.props.navigation;
const { routes, index } = state;
// Figure out what to render based on the navigation state and the router:
const Component = MyRouter.getComponentForState(state);
// The state of the active child screen can be found at routes[index]
let childNavigation = { dispatch, state: routes[index] };
// If we want, we can also tinker with the dispatch function here, to limit
// or augment our children's actions
// Assuming our children want the convenience of calling .navigate() and so on,
// we should call addNavigationHelpers to augment our navigation prop:
childNavigation = addNavigationHelpers(childNavigation);
return <Component navigation={childNavigation} />;
}
}
```
## Navigation Prop
The navigation prop passed down to a navigator only includes `state` and `dispatch`. This is the current state of the navigator, and an event channel to send action requests.
All navigators are controlled components: they always display what is coming in through `props.navigation.state`, and their only way to change the state is to send actions into `props.navigation.dispatch`.
Navigators can specify custom behavior to parent navigators by [customizing their router](/docs/routers/). For example, a navigator is able to specify when actions should be blocked by returning null from `router.getStateForAction`. Or a navigator can specify custom URI handling by overriding `router.getActionForPathAndParams` to output a relevant navigation action, and handling that action in `router.getStateForAction`.
### Navigation State
The navigation state that is passed into a navigator's `props.navigation.state` has the following structure:
```
{
index: 1, // identifies which route in the routes array is active
routes: [
{
// Each route needs a name, which routers will use to associate each route
// with a react component
routeName: 'MyRouteName',
// A unique id for this route, used to keep order in the routes array:
key: 'myroute-123',
// Routes can have any additional data. The included routers have `params`
...customRouteData,
},
...moreRoutes,
]
}
```
### Navigation Dispatchers
A navigator can dispatch navigation actions, such as 'Go to a URI', 'Go back'.
The dispatcher will return `true` if the action was successfully handled, otherwise `false`.
## Navigation Containers
The built in navigators can automatically behave like top-level navigators when the navigation prop is missing. This functionality provides a transparent navigation container, which is where the top-level navigation prop comes from.
When rendering one of the included navigators, the navigation prop is optional. When it is missing, the container steps in and manages its own navigation state. It also handles URLs, external linking, and Android back button integration.
For the purpose of convenience, the built-in navigators have this ability because behind the scenes they use `createNavigationContainer`. Usually, navigators require a navigation prop in order to function.
### `containerOptions`
These options can be used to configure a navigator when it is used at the top level.
An error will be thrown if a navigator is configured with `containerOptions` and also receives a `navigation` prop, because in that case it would be unclear if the navigator should handle its own state.
- `URIPrefix` - The prefix of the URIs that the app might handle. This will be used when handling a [deep link](/docs/guides/linking) to extract the path passed to the router.
## API for building custom navigators
To help developers implement custom navigators, the following utilities are provided with React Navigation:
### `createNavigator`
This utility combines a [router](/docs/routers/) and a [navigation view](/docs/views/) together in a standard way:
```js
const MyApp = createNavigator(MyRouter)(MyView);
```
All this does behind the scenes is:
```js
const MyApp = ({ navigation }) => (
<MyView router={MyRouter} navigation={navigation} />
);
MyApp.router = MyRouter;
```
### `addNavigationHelpers`
Takes in a bare navigator navigation prop with `state` and `dispatch`, and augments it with all the various functions in a screen navigation prop, such as `navigation.navigate()` and `navigation.goBack()`. These functions are simply helpers to create the actions and send them into `dispatch`.
### `createNavigationContainer`
If you want your navigator to be usable as a top-level component, (without a navigation prop being passed in), you can use `createNavigationContainer`. This utility will make your navigator act like a top-level navigator when the navigation prop is missing. It will manage the app state, and integrate with app-level nav features, like handling incoming and outgoing links, and Android back button behavior.

View File

@@ -1,53 +0,0 @@
## Customizing Navigation Views
Modify the presentation of navigation, including styles, animations and gestures.
## Customizing Routers
Building a custom router allows you to change the navigation logic of your component, manage navigation state, and define behavior for URIs.
A router can be defined like this:
```
class MyNavigationAwareComponent extends React.Component {
static router = {
// Defines the navigation state for a component:
getStateForAction: (action: {type: string}, lastState?: any) => {
const state = lastState = { myMode: 'default' };
if (action.type === 'MyAction') {
return { myMode: 'action' };
} else if (action.type === NavigationActions.BACK) {
return { myMode: 'blockBackButton' };
} else {
return state;
}
},
// Defines if a component can handle a particular URI.
// If it does, return an action to be passed to `getStateForAction`
getActionForURI: (uri: string) => {
if (uri === 'myapp://myAction') {
return { type: 'MyAction' };
}
return null;
},
};
render() {
// render something based on this.props.navigation.state
...
}
onButtonPress = () => {
this.props.navigation.dispatch({ type: 'MyAction' });
};
...
}
```

View File

@@ -1,107 +0,0 @@
# Deep Linking
In this guide we will set up our app to handle external URIs. Let's start with the SimpleApp that [we created in the getting started guide](/docs/intro).
In this example, we want a URI like `mychat://chat/Taylor` to open our app and link straight into Taylor's chat page.
## Configuration
Previously, we had defined a navigator like this:
```js
const SimpleApp = StackNavigator({
Home: { screen: HomeScreen },
Chat: { screen: ChatScreen },
});
```
We want paths like `chat/Taylor` to link to a "Chat" screen with the `user` passed as a param. Let's re-configure our chat screen with a `path` that tells the router what relative path to match against, and what params to extract. This path spec would be `chat/:user`.
```js
const SimpleApp = StackNavigator({
Home: { screen: HomeScreen },
Chat: {
screen: ChatScreen,
path: 'chat/:user',
},
});
```
### URI Prefix
Next, let's configure our navigation container to extract the path from the app's incoming URI. When configuring a top-level navigator, we can provide `containerOptions`:
```js
const SimpleApp = StackNavigator({
...
}, {
containerOptions: {
// on Android, the URI prefix typically contains a host in addition to scheme
URIPrefix: Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://',
},
});
```
## iOS
Let's configure the native iOS app to open based on the `mychat://` URI scheme.
In `SimpleApp/ios/SimpleApp/AppDelegate.m`:
```
// Add the header at the top of the file:
#import <React/RCTLinkingManager.h>
// Add this above the `@end`:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation];
}
```
In Xcode, open the project at `SimpleApp/ios/SimpleApp.xcodeproj`. Select the project in sidebar and navigate to the info tab. Scroll down to "URL Types" and add one. In the new URL type, set the identifier and the url scheme to your desired url scheme.
![Xcode project info URL types with mychat added](/assets/xcode-linking.png)
Now you can press play in Xcode, or re-build on the command line:
```sh
react-native run-ios
```
To test the URI in iOS, open safari and type `mychat://chat/Taylor`.
## Android
To configure the external linking in Android, you can create a new intent in the manifest.
In `SimpleApp/android/app/src/main/AndroidManifest.xml`, add the new `VIEW` type `intent-filter` inside the `MainActivity` entry:
```
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mychat"
android:host="mychat" />
</intent-filter>
```
Now, re-install the app:
```sh
react-native run-android
```
To test the intent handling in Android, run the following:
```
adb shell am start -W -a android.intent.action.VIEW -d "mychat://mychat/chat/Taylor" com.simpleapp
```
```phone-example
linking
```

View File

@@ -1,98 +0,0 @@
# Configuring the Header
In the previous example, we created a StackNavigator to display several screens in our app.
When navigating to a chat screen, we can specify params for the new route by providing them to the navigate function. In this case, we want to provide the name of the person on the chat screen:
```js
this.props.navigation.navigate('Chat', { user: 'Lucy' });
```
The `user` param can be accessed from the chat screen:
```js
class ChatScreen extends React.Component {
render() {
const { params } = this.props.navigation.state;
return <Text>Chat with {params.user}</Text>;
}
}
```
### Setting the Header Title
Next, the header title can be configured to use the screen param:
```js
class ChatScreen extends React.Component {
static navigationOptions = {
// // Title may be a simple string:
// title: 'Hello',
// Or the title string may be a function of the navigation prop:
title: ({ state }) => `Chat with ${state.params.user}`
};
...
}
```
```phone-example
basic-header
```
### Adding a Right Button
Then we can add a [`header` navigation option](/docs/navigators/navigation-options#Stack-Navigation-Options) that allows us to add a custom right button:
```js
static navigationOptions = {
header: {
right: <Button title="Info" />,
},
...
```
```phone-example
header-button
```
Just like `title`, the `header` option can be defined as a function of the [navigation prop](/docs/navigators/navigation-prop). Let's render a different button based on the route params, and set up the button to call `navigation.setParams` when pressed.
```js
static navigationOptions = {
title: ({ state }) => {
if (state.params.mode === 'info') {
return `${state.params.user}'s Contact Info`;
}
return `Chat with ${state.params.user}`;
},
header: ({ state, setParams }) => {
// The navigation prop has functions like setParams, goBack, and navigate.
let right = (
<Button
title={`${state.params.user}'s info`}
onPress={() => setParams({ mode: 'info' })}
/>
);
if (state.params.mode === 'info') {
right = (
<Button
title="Done"
onPress={() => setParams({ mode: 'none' })}
/>
);
}
return { right };
},
...
```
Now, the header can interact with the screen route/state:
```phone-example
header-interaction
```
To see the rest of the header options, see the [navigation options document](/docs/navigators/navigation-options#Stack-Navigation-Options).

View File

@@ -1,124 +0,0 @@
# Hello Mobile Navigation
Let's use React Navigation to build a simple chat application for Android and iOS.
## Setup and Installation
First, make sure you're [all set up to use React Native](http://facebook.github.io/react-native/docs/getting-started.html). Next, create a new project and add `react-navigation`:
```sh
# Create a new React Native App
react-native init SimpleApp
cd SimpleApp
# Install the latest version of react-navigation from npm
npm install --save react-navigation
# Run the new app
react-native run-android # or:
react-native run-ios
```
Verify that you can successfully see the bare sample app run on iOS and/or Android:
```phone-example
bare-project
```
We want to share code on iOS and Android, so lets delete the contents of `index.ios.js` and `index.android.js` and replace it with `import './App';`.
Now lets create the new file for our app implementation, `App.js`.
## Introducing Stack Navigator
For our app, we want to use the `StackNavigator` because we want a conceptual 'stack' navigation, where each new screen is put on the top of the stack, and going back removes a screen from the top of the stack. Lets start with just one screen:
```js
import React from 'react';
import {
AppRegistry,
Text,
} from 'react-native';
import { StackNavigator } from 'react-navigation';
class HomeScreen extends React.Component {
static navigationOptions = {
title: 'Welcome',
};
render() {
return <Text>Hello, Navigation!</Text>;
}
}
const SimpleApp = StackNavigator({
Home: { screen: HomeScreen },
});
AppRegistry.registerComponent('SimpleApp', () => SimpleApp);
```
The `title` of the screen is configurable on the [static `navigationOptions`](/docs/navigators/navigation-options), where many options can be set to configure the presentation of the screen in the navigator.
Now the same screen should appear on both iPhone and Android apps:
```phone-example
first-screen
```
## Adding a New Screen
Lets create a button in the `HomeScreen` component that links to our second page:
```js
class HomeScreen extends React.Component {
static navigationOptions = {
title: 'Welcome',
};
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Text>Hello, Chat App!</Text>
<Button
onPress={() => navigate('Chat', { user: 'Lucy' })}
title="Chat with Lucy"
/>
</View>
);
}
}
```
We're using the navigate function from the [screen navigation prop](/docs/navigators/navigation-prop). In addition to specifying the target `routeName`, we can also pass params that will be put into the new route.
Now let's create the Chat screen that displays the `name` param passed in through the route:
```js
class ChatScreen extends React.Component {
static navigationOptions = {
// Nav options can be defined as a function of the navigation prop:
title: ({ state }) => `Chat with ${state.params.user}`,
};
render() {
// The screen's current route is passed in to `props.navigation.state`:
const { params } = this.props.navigation.state;
return (
<View>
<Text>Chat with {params.user}</Text>
</View>
);
}
}
const SimpleApp = StackNavigator({
Home: { screen: HomeScreen },
Chat: { screen: ChatScreen },
});
```
Now you can navigate to your new screen, and go back:
```phone-example
first-navigation
```

View File

@@ -1,72 +0,0 @@
# Nesting Navigators
It is common in mobile apps to compose various forms of navigation. The routers and navigators in React Navigation are composable, which allows you to define a complicated navigation structure for your app.
For our chat app, we want to put several tabs on the first screen, to view recent chat threads or all contacts.
## Introducing Tab Navigator
Lets create a new `TabNavigator` in our `App.js`:
```js
class RecentChatsScreen extends React.Component {
render() {
return <Text>List of recent chats</Text>
}
}
class AllContactsScreen extends React.Component {
render() {
return <Text>List of all contacts</Text>
}
}
const MainScreenNavigator = TabNavigator({
Recent: { screen: RecentChatsScreen },
All: { screen: AllContactsScreen },
});
```
If the `MainScreenNavigator` was rendered as the top-level navigator component, it would look like this:
```phone-example
simple-tabs
```
## Nesting a Navigator in a screen
We want these tabs to be visible in the first screen of the app, but new screens in the stack should cover the tabs.
Lets add our tabs navigator as a screen in our top-level `StackNavigator` that we set up in the [previous step](/docs/intro/).
```js
const SimpleApp = StackNavigator({
Home: { screen: MainScreenNavigator },
Chat: { screen: ChatScreen },
});
```
Because `MainScreenNavigator` is being used as a screen, we can give it `navigationOptions`:
```js
MainScreenNavigator.navigationOptions = {
title: 'My Chats',
};
```
Lets also add a button to each tab that links to a chat:
```js
<Button
onPress={() => this.props.navigation.navigate('Chat', { user: 'Lucy' })}
title="Chat with Lucy"
/>
```
Now we have put one navigator inside another, and we can `navigate` between navigators:
```phone-example
nested
```

View File

@@ -1,174 +0,0 @@
## Common React Navigation API - Hybrid Integration
This is a purely speculative API that demonstrates how it may be possible to integrate the [JS navigation API](./Common-Navigation-Spec.md) in a hybrid app.
## Setting up a screen
It should be possible to register new screens from JS into native. In your main bundle:
```
const HybridNavigationModule = require('NativeModules').HybridNavigation;
HybridNavigationModule.registerScreens([
{
type: 'Marketplace',
screen: MarketplaceScreen,
},
{
type: 'Product',
screen: ProductScreen,
},
]);
```
## Linking to JS
Now, your native code can open a react screen by type name:
```
// please pretend this is Obj-C or Java syntax:
CoreHybridNavigation.openReactScreen('Profile', {id: 123});
```
## Linking to Native
If JS product code wants to request navigation to a screen that may *or may not* be in native, it can do this:
```
const MarketplaceScreen = ({ navigation }) => (
<View>
<Button onPress={() => navigation.dispatch({
type: 'Product',
id: 42,
})}>
See product 42
</Button>
</View>
);
```
Inside the infra:
```
class InfraScreen extends React.Component {
constructor() {
const {initURI, type} = this.props;
const ScreenView = ScreenRegistry[type].screen;
const router = ScreenView.router;
const deepLinkAction = router.getActionForURI(initURI);
const initAction = deepLinkAction || {type: 'init'}
const nav = router.getStateForAction(initAction);
this.state = {
nav,
};
HybridNavigationModule.setNavOptions(this.state.nav);
}
componentWillUpdate() {
HybridNavigationModule.setNavOptions(this.state.nav);
}
dispatch = (action) => {
const {type} = this.props;
const ScreenView = ScreenRegistry[type].screen;
const {getStateForAction} = ScreenView.router;
const newNavState = getStateForAction(action, this.state.nav);
if (newNavState !== this.state.nav) {
this.setState({ nav: newNavState });
return true;
}
if (action.type === 'URI') {
HybridNavigationModule.openURI(action.uri);
return true;
}
if (action.type === NavigationActions.BACK) {
HybridNavigationModule.goBack();
return true;
}
HybridNavigationModule.openAction(action);
return true;
}
render() {
const {type} = this.props;
const ScreenView = ScreenRegistry[type].screen;
const navigation = {
dispatch: this.dispatch,
state: this.state.nav,
};
return <ScreenView navigation={navigation} />;
}
}
```
## Setting title
```
MarketplaceScreen.router = {
getStateForAction(action, lastState) {
return lastState || {title: 'Marketplace Home'};
},
};
```
A HOC could be used to make this feel more elegant.
## Disabling/Enabling the right button
```
const TestScreen = ({ navigation }) => (
<View>
<Button onPress={() => navigation.dispatch({
type: 'ToggleMyButtonPressability',
})}>
{navigation.state.rightButtonEnabled ? 'Disable' : 'Enable'} right button
</Button>
<Text>Pressed {navigation.state} times</Text>
</View>
);
TestScreen.router = {
getStateForAction(action, lastState = {}) {
let state = lastState || {
rightButtonEnabled: true,
rightButtonTitle: 'Tap Me',
pressCount: 0,
};
if (action.type === 'ToggleMyButtonPressability') {
state = {
...state,
rightButtonEnabled: !state.rightButtonEnabled,
};
} else if (action.type === 'RightButtonPress') {
state = {
...state,
pressCount: state.pressCount + 1,
};
}
return state;
},
};
```
## Before JS starts
A JSON file could be defined for native to consume before JS spins up:
```
{
"screens": [
{
"type": "Profile",
"path": "/users/:id?name=:name",
"params": {
"name": "string",
"id": "number"
},
"title": "%name%' s Profile",
"rightButtonTitle": "Message %name%"
},
{
...
}
]
}
```
This seems like a pain to set up, so we can statically analyze our JS and autogenerate this JSON! If the JS in an app changes, there could be a way for JS to report the new routing configuration to native for use on the next cold start.

View File

@@ -1,46 +0,0 @@
# Redux Integration
To handle your app's navigation state in redux, you can pass your own `navigation` prop to a navigator. Your navigation prop must provide the current state, as well as access to a dispatcher to handle navigation options.
With redux, your app's state is defined by a reducer. Each navigation router effectively has a reducer, called `getStateForAction`. The following is a minimal example of how you might use navigators within a redux application:
```
const AppNavigator = StackNavigator(AppRouteConfigs);
const appReducer = combineReducers({
nav: (state, action) => (
AppNavigator.router.getStateForAction(action, state)
),
...
});
@connect(state => ({
nav: state.nav,
}))
class AppWithNavigationState extends React.Component {
render() {
return (
<AppNavigator navigation={addNavigationHelpers({
dispatch: this.props.dispatch,
state: this.props.nav,
})} />
);
}
}
const store = createStore(appReducer);
class App extends React.Component {
render() {
return (
<Provider store={store}>
<AppWithNavigationState />
</Provider>
);
}
}
```
Now, your navigation state is stored with redux, and you can fire navigation actions using redux.
When a navigator is given a `navigation` prop, it relinquishes control of the state. So you are now responsible for persisting state, handling deep linking, integrating the back button, etc.

View File

@@ -1,124 +0,0 @@
# Screen Navigation Options
Each screen can configure several aspects about how it gets presented in parent navigators.
#### Two Ways to specify each option
**Static configuration:** Each navigation option can either be directly assigned:
```js
class MyScreen extends React.Component {
static navigationOptions = {
title: 'Great',
};
...
```
**Dynamic Configuration**
Or, each option can be a function that takes the following arguments, and returns the value of the option.
- `navigation` - the [navigation prop](/docs/navigators/navigation-prop) for the screen, with the screen's route at `navigation.state`
- `childRouter` - The child router, if the screen is a navigator
```js
class ProfileScreen extends React.Component {
static navigationOptions = {
title: (navigation, childRouter) => {
return navigation.state.params.name + "'s Profile!";
},
};
...
```
#### Generic Navigation Options
The `title` navigation option is generic between every navigator. It is used to set the title string for a given screen.
```js
class MyScreen extends React.Component {
static navigationOptions = {
title: 'Great',
};
...
```
Unlike the other nav options which are only utilized by the navigator view, the title option can be used by the environment to update the title in the browser window or app switcher.
#### Default Navigation Options
It's very common to define `navigationOptions` on a screen, but sometimes it is useful to define `navigationOptions` on a navigator too.
Imagine the following scenario:
Your `TabNavigator` represents one of the screens in the app, and is nested within a top-level `StackNavigator`:
```
StackNavigator:
- route1: A screen
- route2: A TabNavigator
```
Now, when `route2` is active, you would like to hide the header. It's easy to hide the header for `route1`, and it should also be easy to do it for `route2`. This is what Default Navigation Options are for - they are simply `navigationOptions` set on a navigator:
```js
TabNavigator({
profile: ProfileScreen,
...
}, {
navigationOptions: {
header: {
visible: false,
},
},
});
```
Note that you can still decide to **also** specify the `navigationOptions` on the screens at the leaf level - e.g. the `ProfileScreen` above. The `navigationOptions` from the screen will be merged key-by-key with the default options coming from the navigator. Whenever both the navigator and screen define the same option (e.g. `header`), the screen wins. Therefore, you could make the header visible again when `ProfileScreen` is active.
**Extending defaults:** In order to extend default config with screen-specific properties instead of overriding it, you configure an option like this:
```js
class ProfileScreen extends React.Component {
static navigationOptions = {
header: (navigation, defaultHeader) => ({
...defaultHeader,
visible: true,
color: 'blue',
}),
}
...
}
```
The 2nd argument passed to the function are the default values for the `header` as defined on the navigator.
## Tab Navigation Options
```js
class TabScreen extends React.Component {
static navigationOptions = {
tabBar: ({ state }) => ({
label: 'Tab Label',
icon: ({ tintColor }) => (
<Image
source={require('./tab-icon.png')}
style={[styles.icon, {tintColor: tintColor}]}
/>
),
visible: true
}),
};
};
```
- `label` - can be string or react component
- `icon` - function that returns icon component
- `visible` - true or false to show or hide the tab bar, if not set then defaults to true
## Stack Navigation Options
Coming Soon

View File

@@ -1,172 +0,0 @@
# Screen Navigation Prop
Each screen in your app will recieve a navigation prop, which contains the following:
## `navigate` - Link to other screens
Call this to link to another screen in your app. Takes the following arguments:
- `routeName` - A destination routeName that has been registered somewhere in the app's router
- `params` - Params to merge into the destination route
- `action` - (advanced) The sub-action to run in the child router, if the screen is a navigator.
```js
class HomeScreen extends React.Component {
render() {
const {navigate} = this.props.navigation;
return (
<View>
<Text>This is the home screen of the app</Text>
<Button
onPress={() => navigate('Profile', {name: 'Brent'})}
title="Go to Brent's profile"
/>
</View>
)
}
}
```
## `state` - The screen's current state/route
A screen has access to its route via `this.props.navigation.state`. Each will contain:
- `routeName` - the name of the route config in the router
- `key` - a unique identifier used to sort routes
- `params` - an optional object of string options for this screen
```js
class ProfileScreen extends React.Component {
render() {
const {state} = this.props.navigation;
// state.routeName === 'Profile'
return (
<Text>Name: {state.params.name}</Text>
);
}
}
```
## `setParams` - Make changes to route params
Firing the `setParams` action allows a screen to change the params in the route, which is useful for updating the header buttons and title.
```js
class ProfileScreen extends React.Component {
render() {
const {setParams} = this.props.navigation;
return (
<Button
onPress={() => setParams({name: 'Lucy'})}
title="Set title name to 'Lucy'"
/>
)
}
}
```
## `goBack` - Close the active screen and move back
```js
class HomeScreen extends React.Component {
render() {
const {goBack} = this.props.navigation;
return (
<View>
<Button
onPress={() => goBack()}
title="Go back from this HomeScreen"
/>
<Button
onPress={() => goBack(null)}
title="Go back anywhere"
/>
<Button
onPress={() => goBack('screen-123')}
title="Go back from screen-123"
/>
</View>
)
}
}
```
Optionally provide a key, which specifies the route to go back from. By default, goBack will close the route that it is called from. If the goal is to go back *anywhere*, without specifying what is getting closed, call `.goBack(null);`
## `dispatch` - Send an action to the router
Use dispatch to send any navigation action to the router. The other navigation functions use dispatch behind the scenes.
Note that if you want to dispatch react-navigation actions you should use the action creators provided in this library.
The following actions are supported:
### Navigate
```js
import { NavigationActions } from 'react-navigation'
const navigationAction = NavigationActions.navigate({
routeName: 'Profile',
params: {},
// navigate can have a nested navigate action that will be run inside the child router
action: NavigationActions.navigate({ routeName: 'SubProfileRoute'})
})
this.props.navigation.dispatch(navigationAction)
```
### Reset
The `Reset` action wipes the whole navigation state and replaces it with the result of several actions.
```js
import { NavigationActions } from 'react-navigation'
const resetAction = NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'Profile'})
]
})
this.props.navigation.dispatch(resetAction)
```
You can issue multiple actions, but make sure to set `index` correctly:
```js
import { NavigationActions } from 'react-navigation'
const resetAction = NavigationActions.reset({
index: 1,
actions: [
NavigationActions.navigate({ routeName: 'Profile'}),
NavigationActions.navigate({ routeName: 'Settings'})
]
})
this.props.navigation.dispatch(resetAction)
```
### SetParams
When dispatching `SetParams`, the router will produce a new state that has changed the params of a particular route, as identified by the key
```js
import { NavigationActions } from 'react-navigation'
const setParamsAction = NavigationActions.setParams({
params: {}, // these are the new params that will be merged into the existing route params
// The key of the route that should get the new params
key: 'screen-123',
})
this.props.navigation.dispatch(setParamsAction)
```

View File

@@ -1,16 +0,0 @@
# Web Integration
React Navigation routers work on web and allow you to share navigation logic with native apps. The views currently bundled in `react-navigation` currently only work on React Native, but that may change with future-facing projects like [react-primitives](https://github.com/lelandrichardson/react-primitives).
## Example App
[This website](https://reactnavigation.org/) is [built with](https://github.com/react-community/react-navigation/blob/master/website/) React Navigation, specifically using `createNavigator` and `TabRouter`.
See the source code of the site here: [App.js](https://github.com/react-community/react-navigation/blob/master/website/src/App.js).
To see how the app gets rendered on the server, see [Server.js](https://github.com/react-community/react-navigation/blob/master/website/src/Server.js). On the browser, the App wakes up and gets rendered with [BrowserAppContainer.js](https://github.com/react-community/react-navigation/blob/master/website/src/BrowserAppContainer.js).
## More Coming Soon
Soon this guide will be replaced with a more thorough walkthrough of react-navigation usage on the web.

View File

@@ -1,3 +0,0 @@
{
"presets": ["react-native"]
}

View File

@@ -1,6 +0,0 @@
[android]
target = Google Inc.:Google APIs:23
[maven_repositories]
central = https://repo1.maven.org/maven2

View File

@@ -1,44 +0,0 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
flow/
[options]
module.system=haste
experimental.strict_type_args=true
munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
unsafe.enable_getters_and_setters=true
[version]
^0.36.0

View File

@@ -1 +0,0 @@
*.pbxproj -text

View File

@@ -1,53 +0,0 @@
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
# node.js
#
node_modules/
npm-debug.log
# BUCK
buck-out/
\.buckd/
android/app/libs
*.keystore
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots

View File

@@ -1 +0,0 @@
{}

View File

@@ -1,119 +0,0 @@
/**
* @flow
*/
import React, { Component } from 'react';
import {
NativeModules,
} from 'react-native';
import {
NavigationActions,
addNavigationHelpers,
} from 'react-navigation';
const {
HybridNavigationManager,
} = NativeModules;
const HybridContainer = (ReactScreens) => {
class HybridAppScreen extends Component {
constructor(props) {
super(props);
const { name, params, rootTag } = props;
let ScreenView = ReactScreens[name];
let screenKey = name;
let navState = null;
const action = NavigationActions.navigate({ routeName: name, params });
if (!ScreenView) {
// Deep linking magic here. Try each screen to see if the state changes
// in response to this action. The first screen who returns
// a new state for the action is used
Object.keys(ReactScreens).forEach(screenId => {
if (!ScreenView) {
const V = ReactScreens[screenId];
if (!V || !V.router || !V.router.getStateForAction) {
return;
}
const baseState = V.router.getStateForAction(NavigationActions.init());
const linkedState = V.router.getStateForAction(action, baseState);
if (baseState !== linkedState) {
ScreenView = V;
navState = linkedState;
screenKey = screenId;
}
}
});
}
if (!ScreenView) {
screenKey = 'NotFoundComponent';
ScreenView = ReactScreens.NotFoundComponent;
}
if (!navState) {
const router = ScreenView.router;
navState = router && router.getStateForAction(action);
}
let title = null;
const defaultNavState = { routeName: name, key: `screen-${rootTag}`, params };
if (navState) {
const { routes, index } = navState;
const router = ScreenView.router;
const routeConfig = router && router.getScreenConfig({
state: routes[index], dispatch: () => {}
}, index, true);
title = routeConfig && routeConfig.title;
}
this.state = {
navState: navState || defaultNavState,
screenKey,
};
HybridNavigationManager.setTitle(rootTag, title || name);
}
dispatch = (action) => {
const { name, rootTag } = this.props;
const ScreenView = ReactScreens[this.state.screenKey] || ReactScreens.NotFoundComponent;
const router = ScreenView.router;
const navState = router && router.getStateForAction(action, this.state.navState);
if (navState && navState !== this.state.navState) {
this.setState({ navState });
return true;
}
if (action.type === NavigationActions.NAVIGATE) {
HybridNavigationManager.navigate(action.routeName, action.params || {});
}
return true;
}
render() {
const Component = ReactScreens[this.state.screenKey] || ReactScreens.NotFoundComponent;
const navigation = addNavigationHelpers({
state: this.state.navState,
dispatch: this.dispatch,
});
return (
<Component navigation={navigation} />
);
}
componentWillUpdate(props, state) {
const { name, rootTag } = props;
const ScreenView = ReactScreens[name];
if (!ScreenView) {
console.log('Experiencing an error! Fix me!')
}
let title = null;
if (state.navState) {
const { routes, index } = state.navState;
const router = ScreenView.router;
const routeConfig = router && router.getScreenConfig({
state: routes[index], dispatch: () => {}
}, index, true);
title = (routeConfig && routeConfig.title) || state.navState.routeName;
}
HybridNavigationManager.setTitle(rootTag, title || name);
}
}
return HybridAppScreen;
};
export default HybridContainer;

View File

@@ -1,17 +0,0 @@
# Hello Hybrid Example
A reference implementation for integrating react-navigation into a native app.
iOS only right now. Help needed to support Android!
## Setup:
```
cd react-navigation
npm install
cd examples/HelloHybrid
npm install
open ios/HelloHybrid.xcodeproj
cd ../..
react-native start
```

View File

@@ -1,12 +0,0 @@
import 'react-native';
import React from 'react';
import Index from '../index.android.js';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});

View File

@@ -1,12 +0,0 @@
import 'react-native';
import React from 'react';
import Index from '../index.ios.js';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});

View File

@@ -1,66 +0,0 @@
import re
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#
lib_deps = []
for jarfile in glob(['libs/*.jar']):
name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)
lib_deps.append(':' + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)
for aarfile in glob(['libs/*.aar']):
name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)
lib_deps.append(':' + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)
android_library(
name = 'all-libs',
exported_deps = lib_deps
)
android_library(
name = 'app-code',
srcs = glob([
'src/main/java/**/*.java',
]),
deps = [
':all-libs',
':build_config',
':res',
],
)
android_build_config(
name = 'build_config',
package = 'com.hellohybrid',
)
android_resource(
name = 'res',
res = 'src/main/res',
package = 'com.hellohybrid',
)
android_binary(
name = 'app',
package_type = 'debug',
manifest = 'src/main/AndroidManifest.xml',
keystore = '//android/keystores:debug',
deps = [
':app-code',
],
)

View File

@@ -1,139 +0,0 @@
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"]
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.hellohybrid"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

View File

@@ -1,66 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
-dontobfuscate
# React Native
# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
@com.facebook.common.internal.DoNotStrip *;
}
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
void set*(***);
*** get*();
}
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
-dontwarn com.facebook.react.**
# okhttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
# okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**

View File

@@ -1,31 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hellohybrid"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>

View File

@@ -1,15 +0,0 @@
package com.hellohybrid;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "HelloHybrid";
}
}

View File

@@ -1,42 +0,0 @@
package com.hellohybrid;
import android.app.Application;
import android.util.Log;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -1,3 +0,0 @@
<resources>
<string name="app_name">HelloHybrid</string>
</resources>

View File

@@ -1,8 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -1,24 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}

View File

@@ -1,20 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useDeprecatedNdk=true

View File

@@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

View File

@@ -1,164 +0,0 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

View File

@@ -1,90 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -1,8 +0,0 @@
keystore(
name = 'debug',
store = 'debug.keystore',
properties = 'debug.keystore.properties',
visibility = [
'PUBLIC',
],
)

View File

@@ -1,4 +0,0 @@
key.store=debug.keystore
key.alias=androiddebugkey
key.store.password=android
key.alias.password=android

View File

@@ -1,3 +0,0 @@
rootProject.name = 'HelloHybrid'
include ':app'

View File

@@ -1,53 +0,0 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
} from 'react-native';
export default class HelloHybrid extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('HelloHybrid', () => HelloHybrid);

View File

@@ -1,43 +0,0 @@
/**
* @flow
*/
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
} from 'react-native';
import HybridContainer from './HybridContainer';
const NotFoundComponent = () => (
<View style={styles.container}>
<Text style={styles.welcome}>
Screen not found!
</Text>
</View>
);
const HelloHybrid = HybridContainer({
Settings: require('./screens/Settings'),
Story: require('./screens/Story'),
NotFoundComponent,
});
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});
AppRegistry.registerComponent('HelloHybrid', () => HelloHybrid);

File diff suppressed because it is too large Load Diff

View File

@@ -1,129 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0620"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
BuildableName = "libReact.a"
BlueprintName = "React"
ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "HelloHybrid.app"
BlueprintName = "HelloHybrid"
ReferencedContainer = "container:HelloHybrid.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "HelloHybridTests.xctest"
BlueprintName = "HelloHybridTests"
ReferencedContainer = "container:HelloHybrid.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "HelloHybridTests.xctest"
BlueprintName = "HelloHybridTests"
ReferencedContainer = "container:HelloHybrid.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "HelloHybrid.app"
BlueprintName = "HelloHybrid"
ReferencedContainer = "container:HelloHybrid.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "HelloHybrid.app"
BlueprintName = "HelloHybrid"
ReferencedContainer = "container:HelloHybrid.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "HelloHybrid.app"
BlueprintName = "HelloHybrid"
ReferencedContainer = "container:HelloHybrid.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -1,13 +0,0 @@
#import <UIKit/UIKit.h>
#import <React/RCTRootView.h>
#import "AppNavigationDelegate.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, AppNavigationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIViewController *rootController;
@property (strong, nonatomic) UINavigationController *nav;
@property (strong, nonatomic) RCTBridge *bridge;
@end

View File

@@ -1,54 +0,0 @@
#import "AppDelegate.h"
#import "HomeViewController.h"
#import "ProfileViewController.h"
#import "ReactViewController.h"
#import "HybridNavigationManager.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
_bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions: launchOptions];
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
_rootController = [[HomeViewController alloc] initWithDelegate:self];
_nav = [[UINavigationController alloc] initWithRootViewController:self.rootController];
[_window addSubview:_nav.view];
[_window setRootViewController:_nav];
[_window makeKeyAndVisible];
return YES;
}
#pragma mark AppNavigationDelegate
- (void)openViewWithName:(NSString *)name andParams:(NSDictionary *)params
{
if ([name isEqualToString:@"Profile"]) {
ProfileViewController *profileView = [[ProfileViewController alloc] initWithDelegate: self];
[_nav pushViewController:profileView animated:true];
return;
}
ReactViewController *reactView = [[ReactViewController alloc] initWithDelegate:self bridge:_bridge viewName:name viewParams:params];
[_nav pushViewController:reactView animated:true];
}
#pragma mark RCTBridgeDelegate
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"examples/HelloHybrid/index.ios" fallbackResource:nil];
}
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge;
{
return @[
[[HybridNavigationManager alloc] initWithBridge:_bridge navigationDelegate:self],
];
}
@end

View File

@@ -1,9 +0,0 @@
#import <UIKit/UIKit.h>
@protocol AppNavigationDelegate <NSObject>
- (void)openViewWithName:(NSString *)name andParams:(NSDictionary *)params;
@optional
@end

View File

@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="HelloHybrid" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>

View File

@@ -1,12 +0,0 @@
#import <UIKit/UIKit.h>
#import "AppNavigationDelegate.h"
@interface HomeViewController : UIViewController {
id<AppNavigationDelegate> navigation;
}
- (id) initWithDelegate:(id<AppNavigationDelegate>)delegate;
@end

View File

@@ -1,57 +0,0 @@
#import "HomeViewController.h"
@interface HomeViewController ()
@end
@implementation HomeViewController
- (id)initWithDelegate:(id<AppNavigationDelegate>)delegate;
{
self = [super init];
if (self) {
navigation = delegate;
}
return self;
}
- (void)loadView {
CGRect rect = [UIScreen mainScreen].bounds;
self.view = [[UIView alloc] initWithFrame:rect];
self.view.backgroundColor = [UIColor whiteColor];
self.navigationItem.title = @"Home Screen";
UILabel *labelView = [[UILabel alloc] initWithFrame:CGRectMake(5,80,self.view.frame.size.width,50)];
labelView.text = @"This screen is native";
labelView.textAlignment = NSTextAlignmentCenter;
labelView.textColor = [UIColor blackColor];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:@selector(openProfile:)
forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"Open Profile" forState:UIControlStateNormal];
button.frame = CGRectMake(10.0, 120.0, self.view.frame.size.width, 40.0);
UIButton *button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button2 addTarget:self
action:@selector(openSettings:)
forControlEvents:UIControlEventTouchUpInside];
[button2 setTitle:@"Open Settings" forState:UIControlStateNormal];
button2.frame = CGRectMake(10.0, 160.0, self.view.frame.size.width, 40.0);
[self.view addSubview:button];
[self.view addSubview:button2];
[self.view addSubview:labelView];
}
- (void) openProfile:(UIButton*)sender
{
[navigation openViewWithName:@"Profile" andParams:@{}];
}
- (void) openSettings:(UIButton*)sender
{
[navigation openViewWithName:@"Settings" andParams:@{}];
}
@end

View File

@@ -1,9 +0,0 @@
#import <React/RCTBridgeModule.h>
#import "AppNavigationDelegate.h"
@interface HybridNavigationManager : NSObject <RCTBridgeModule>
- (id)initWithBridge:(RCTBridge *)bridge navigationDelegate:(id<AppNavigationDelegate>)delegate;
@end

View File

@@ -1,42 +0,0 @@
#import "AppNavigationDelegate.h"
#import "HybridNavigationManager.h"
#import <React/RCTLog.h>
#import <React/RCTRootView.h>
#import <React/RCTUIManager.h>
@implementation HybridNavigationManager {
__weak id<AppNavigationDelegate> _delegate;
}
@synthesize bridge = _bridge;
- (id)initWithBridge:(RCTBridge *)bridge navigationDelegate:(id<AppNavigationDelegate>)delegate;
{
if (self = [super init]) {
_bridge = bridge;
_delegate = delegate;
}
return self;
}
RCT_EXPORT_MODULE();
- (dispatch_queue_t)methodQueue
{
return dispatch_get_main_queue();
}
RCT_EXPORT_METHOD(navigate:(NSString *)name params:(NSDictionary *)params)
{
[_delegate openViewWithName:name andParams:params];
}
RCT_EXPORT_METHOD(setTitle:(nonnull NSNumber *)rootTag title:(nonnull NSString *)title)
{
RCTRootView *rootView = (RCTRootView *)[_bridge.uiManager viewForReactTag: rootTag];
rootView.reactViewController.navigationItem.title = title;
}
@end

View File

@@ -1,48 +0,0 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@@ -1,12 +0,0 @@
#import <UIKit/UIKit.h>
#import "AppNavigationDelegate.h"
@interface ProfileViewController : UIViewController {
id<AppNavigationDelegate> navigation;
}
- (id) initWithDelegate:(id<AppNavigationDelegate>)delegate;
@end

View File

@@ -1,70 +0,0 @@
#import "ProfileViewController.h"
@interface ProfileViewController ()
@end
@implementation ProfileViewController
- (id)initWithDelegate:(id<AppNavigationDelegate>)delegate;
{
self = [super init];
if (self) {
navigation = delegate;
}
return self;
}
- (void)loadView {
self.view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.view.backgroundColor = [UIColor whiteColor];
self.navigationItem.title = @"Profile Screen";
UILabel *labelView = [[UILabel alloc] initWithFrame:CGRectMake(5,80,self.view.frame.size.width,50)];
labelView.text = @"This screen is native";
labelView.textAlignment = NSTextAlignmentCenter;
labelView.textColor = [UIColor blackColor];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:@selector(openStory:)
forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"Open Story" forState:UIControlStateNormal];
button.frame = CGRectMake(10.0, 120.0, self.view.frame.size.width, 40.0);
UIButton *button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button2 addTarget:self
action:@selector(openSettings:)
forControlEvents:UIControlEventTouchUpInside];
[button2 setTitle:@"Open Settings" forState:UIControlStateNormal];
button2.frame = CGRectMake(10.0, 160.0, self.view.frame.size.width, 40.0);
UIButton *button3 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button3 addTarget:self
action:@selector(openAdvancedSettings:)
forControlEvents:UIControlEventTouchUpInside];
[button3 setTitle:@"Open Advanced Settings" forState:UIControlStateNormal];
button3.frame = CGRectMake(10.0, 200.0, self.view.frame.size.width, 40.0);
[self.view addSubview:button];
[self.view addSubview:button2];
[self.view addSubview:button3];
[self.view addSubview:labelView];
}
- (void)openStory:(UIButton*)sender
{
[navigation openViewWithName:@"Story" andParams:@{ @"id": @"4242" }];
}
- (void)openSettings:(UIButton*)sender
{
[navigation openViewWithName:@"Settings" andParams:@{}];
}
- (void)openAdvancedSettings:(UIButton*)sender
{
[navigation openViewWithName:@"AdvancedSettings" andParams:@{}];
}
@end

View File

@@ -1,16 +0,0 @@
#import <UIKit/UIKit.h>
#import "AppNavigationDelegate.h"
#import <React/RCTRootView.h>
@interface ReactViewController : UIViewController {
id<AppNavigationDelegate> navigation;
NSString* name;
NSDictionary* params;
RCTBridge* bridge;
}
- (id)initWithDelegate:(id<AppNavigationDelegate>)delegate bridge:(RCTBridge *)bridge viewName:(NSString *)name viewParams:(NSDictionary *)params;
@end

View File

@@ -1,34 +0,0 @@
#import "ReactViewController.h"
#import <React/RCTRootView.h>
@interface ReactViewController ()
@end
@implementation ReactViewController
- (id)initWithDelegate:(id<AppNavigationDelegate>)delegate bridge:(RCTBridge *)inBridge viewName:(NSString *)inName viewParams:(NSDictionary *)inParams
{
self = [super init];
if (self) {
navigation = delegate;
name = inName;
params = inParams;
bridge = inBridge;
}
return self;
}
- (void)loadView {
self.navigationItem.title = @"";
self.view = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"HelloHybrid" initialProperties: @{ @"name": name, @"params": params }];
self.view.backgroundColor = [UIColor whiteColor];
}
- (void)requestClose:(UIButton*)sender
{
[self dismissViewControllerAnimated:true completion:^{}];
}
@end

View File

@@ -1,10 +0,0 @@
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@@ -1,62 +0,0 @@
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import <React/RCTLog.h>
#import <React/RCTRootView.h>
#define TIMEOUT_SECONDS 600
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
@interface HelloHybridTests : XCTestCase
@end
@implementation HelloHybridTests
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
{
if (test(view)) {
return YES;
}
for (UIView *subview in [view subviews]) {
if ([self findSubviewInView:subview matching:test]) {
return YES;
}
}
return NO;
}
- (void)testRendersWelcomeScreen
{
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
BOOL foundElement = NO;
__block NSString *redboxError = nil;
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
if (level >= RCTLogLevelError) {
redboxError = message;
}
});
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
return YES;
}
return NO;
}];
}
RCTSetLogFunction(RCTDefaultLogFunction);
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
}
@end

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -1,25 +0,0 @@
{
"name": "HelloHybrid",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "^15.4.2",
"react-native": "^0.40.0",
"react-navigation": "file:../.."
},
"jest": {
"preset": "jest-react-native"
},
"devDependencies": {
"babel-jest": "16.0.0",
"babel-preset-react-native": "1.9.0",
"jest": "16.0.2",
"jest-react-native": "16.0.0",
"react-test-renderer": "15.3.2",
"whatwg-fetch": "1.0.0"
}
}

View File

@@ -1,83 +0,0 @@
import React, { Component } from 'react';
import {
SegmentedControlIOS,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native';
import {
TabNavigator,
} from 'react-navigation';
const BasicSettingsScreen = () => (
<Text style={styles.welcome}>
Settings, Built in React!
</Text>
);
const AdvancedSettingsScreen = () => (
<Text style={styles.welcome}>
Advanced settings - also React!
</Text>
);
const TabView = ({children, navigation, tabs}) => (
<View style={styles.container}>
<SegmentedControlIOS
style={styles.tabBar}
values={tabs.map(tab => tab.myLabel)}
selectedIndex={navigation.state.index}
onChange={({nativeEvent}) => {
navigation.dispatch({
type: tabs[nativeEvent.selectedSegmentIndex].key,
});
}}
/>
{children}
</View>
);
const SettingsScreen = TabNavigator({
Settings: {
screen: BasicSettingsScreen,
navigationOptions: {
title: () => 'Settings',
},
},
AdvancedSettings: {
screen: AdvancedSettingsScreen,
navigationOptions: {
title: () => 'Advanced Settings',
},
},
});
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingTop: 80,
},
tabBar: {
alignSelf: 'stretch',
height: 40,
margin: 10,
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
link: {
textAlign: 'center',
color: '#0A5FFF',
fontSize: 16,
marginVertical: 10,
},
});
module.exports = SettingsScreen;

View File

@@ -1,59 +0,0 @@
import React, { Component } from 'react';
import {
StyleSheet,
ScrollView,
Text,
TouchableOpacity,
View,
} from 'react-native';
const Story = ({navigation}) => (
<View style={styles.container}>
<ScrollView>
<Text style={styles.welcome}>
React Screen. Story ID: {JSON.stringify(navigation.state)}
</Text>
<TouchableOpacity
onPress={() => {
navigation.navigate('Profile', {id: '9876'});
}}>
<Text style={styles.link}>Navigate to native profile</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
navigation.navigate('Settings');
}}>
<Text style={styles.link}>Navigate to react settings</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
navigation.navigate('RandomLink');
}}>
<Text style={styles.link}>Navigate to unimpemented page</Text>
</TouchableOpacity>
</ScrollView>
</View>
);
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
marginTop: 80,
},
link: {
textAlign: 'center',
color: '#0A5FFF',
fontSize: 16,
marginVertical: 10,
},
});
module.exports = Story;

Some files were not shown because too many files have changed in this diff Show More