Commit Graph

379 Commits

Author SHA1 Message Date
Hedger Wang 4f8668b110 Support animation and gesture for Pager.
Summary: We need to support animation and gesture for Pager.

Reviewed By: ericvicenti

Differential Revision: D3066596

fb-gh-sync-id: 1c1a3d34b4298b4b0dd158f817057ae22dea72f4
shipit-source-id: 1c1a3d34b4298b4b0dd158f817057ae22dea72f4
2016-03-23 12:51:00 -07:00
Satyajit Sahoo 720c76f94d Rework the NavigationHeader
Summary:Add ability to specify custom left, right components, and title component. Style the `NavigationBar` according to the Platform.

Refer https://github.com/ericvicenti/navigation-rfc/pull/21

cc ericvicenti
Closes https://github.com/facebook/react-native/pull/5971

Differential Revision: D3080601

Pulled By: ericvicenti

fb-gh-sync-id: 7b921cd36b4c2ec1edf6f52629f1f9890d272dfd
shipit-source-id: 7b921cd36b4c2ec1edf6f52629f1f9890d272dfd
2016-03-21 22:07:26 -07:00
Adrien Brault 7fdabd8f14 Navigator: emit didFocus after routeStack reset
Summary:Hi,

I am using https://github.com/aksonov/react-native-router-flux / https://github.com/exponentjs/ex-navigator and I needed a way to update my redux store with the current route.

I'm using the navigation context to do this:

```javascript
if (navigationContext) {
  const handler = () => {
    updateCurrentRouteState(navigationContext.currentRoute);
  };
  navigationContext.addListener('willfocus', handler);
  navigationContext.addListener('didfocus', handler);
}
```

However, when the whole stack is replaced, no event is emitted. This PR aims to fix that.
Closes https://github.com/facebook/react-native/pull/5596

Differential Revision: D3080004

Pulled By: ericvicenti

fb-gh-sync-id: 0ef4ecebec7076275b6433c80aae6102cf28c039
shipit-source-id: 0ef4ecebec7076275b6433c80aae6102cf28c039
2016-03-21 19:18:53 -07:00
Hedger Wang 206f846507 Move scenes reducer logic into a separate module.
Reviewed By: ericvicenti

Differential Revision: D3068237

fb-gh-sync-id: 0146f38be6024c080ed4e00ac6b7c1e2f3d8e56f
shipit-source-id: 0146f38be6024c080ed4e00ac6b7c1e2f3d8e56f
2016-03-21 11:14:22 -07:00
Dilan Edirisinghe 8d7b419ed7 Add missing conditional to ListView.
Reviewed By: jingc

Differential Revision: D3062338

fb-gh-sync-id: 52f9477604f488b7bc4829046f166c8e30aef868
shipit-source-id: 52f9477604f488b7bc4829046f166c8e30aef868
2016-03-17 12:11:25 -07:00
Hedger Wang 3dbf9b9844 Port `onWillFocus` and `onDidFocus` from `Navigator` to `NavigationLegacyNavigatorRouteStack`.
Summary: Port the legendary props `onWillFocus` and `onDidFocus` from `Navigator` to `NavigationLegacyNavigatorRouteStack`.

Reviewed By: fkgozali

Differential Revision: D3063530

fb-gh-sync-id: 89583b8c80ee6ed0ef844a56b942a2d74b98717f
shipit-source-id: 89583b8c80ee6ed0ef844a56b942a2d74b98717f
2016-03-17 11:27:24 -07:00
Hedger Wang 55477ffd67 Make NavigationLegacyNavigator more testable.
Summary:- Move the logics that manage the routes stack into `NavigationLegacyNavigatorRouteStack`
- Add more unit tests for NavigationLegacyNavigatorRouteStack.
- Keep NavigationLegacyNavigator as a pure view as possible as we could.

Reviewed By: fkgozali

Differential Revision: D3060459

fb-gh-sync-id: 2c6802115c3f6ca5e396903f0d314ff54129524c
shipit-source-id: 2c6802115c3f6ca5e396903f0d314ff54129524c
2016-03-16 17:20:25 -07:00
Hedger Wang 28649b8cf0 Simplify <NavigationCard />.
Summary:Per offline discussion with ericvicenti,  we'd like to reudce the complexity by
keeping <NavigationCard /> nothing more than just a simple `<Animated.View />`,
which helps us to avoid over generalize the styles, gestures of what the Navigation card
needs to be.

The proposalis to use the same props (NavigationSceneRendererProps) that is used to render
the scene to generate the style and pan handlers needed for the navigation card.

No behavior changes, just implementation details clean up work.

Reviewed By: ericvicenti

Differential Revision: D3037225

fb-gh-sync-id: f6e718a282d25a319f5d8efd3e2ffebc66b2c8cb
shipit-source-id: f6e718a282d25a319f5d8efd3e2ffebc66b2c8cb
2016-03-15 15:59:26 -07:00
Petr Glotov e07fe0cc60 render empty section headers
Summary:Changed behavior so that empty section headers are rendered, fixes this [issue](https://github.com/facebook/react-native/issues/5639).
Closes https://github.com/facebook/react-native/pull/5713

Differential Revision: D3053765

Pulled By: sahrens

fb-gh-sync-id: 59a78a4b19288b2acc04a7b166de8c2ad16eacd7
shipit-source-id: 59a78a4b19288b2acc04a7b166de8c2ad16eacd7
2016-03-15 12:14:28 -07:00
Hedger Wang 3833c1b751 Implements `renderHeader` for legacy navigator.
Reviewed By: ericvicenti

Differential Revision: D3029188

fb-gh-sync-id: 6f0b91244bc0d0e5eee0e610764a39adaaffe001
shipit-source-id: 6f0b91244bc0d0e5eee0e610764a39adaaffe001
2016-03-10 17:17:21 -08:00
Hedger Wang 7da65a817c backed out changeset 87e6fe282c08
Reviewed By: ericvicenti

Differential Revision: D3033857

fb-gh-sync-id: 7391ae943a88c675f8539f5cc81587caec36e80e
shipit-source-id: 7391ae943a88c675f8539f5cc81587caec36e80e
2016-03-10 14:28:35 -08:00
Eric Vicenti 9ca853d4d1 NavigationExperimental: Fix missed renaming of setTiming to applyAnimation
Summary:f2483eb1ee (diff-0d0be087e61cb933286a7cc733767cbeR106)

approve2ship

Reviewed By: hedgerwang

Differential Revision: D3034798

fb-gh-sync-id: 74d0688f935bc324791cf43b15c0106f3c4dd703
shipit-source-id: 74d0688f935bc324791cf43b15c0106f3c4dd703
2016-03-10 11:34:26 -08:00
Konstantin Raev 9213d0411d Backed out changeset ed509fc86e9d
Reviewed By: javache

Differential Revision: D3029704

fb-gh-sync-id: 87e6fe282c08d7128e1f5f00a956af0b6e341b30
shipit-source-id: 87e6fe282c08d7128e1f5f00a956af0b6e341b30
2016-03-09 08:25:25 -08:00
Richard Lai f2483eb1ee Rename setTiming to applyAnimation
Summary:Given that you can do all kinds of animations other than `Animated.timing`, it made no sense to have `setTiming`. In addition, you can't intuitively tell that this is the callback where you would do custom animations.

The discussion took place on Discord with ericvicenti: https://discordapp.com/channels/102860784329052160/154015578669973504
Closes https://github.com/facebook/react-native/pull/6235

Differential Revision: D2999121

Pulled By: hedgerwang

fb-gh-sync-id: f587b865de11ba5e8dc9c430720252ffb5d12794
shipit-source-id: f587b865de11ba5e8dc9c430720252ffb5d12794
2016-03-08 23:37:34 -08:00
Hedger Wang fa5783e3ee Initial implementation of the Navigator with NavigationExperimental.
Summary:This is the initial implementation of the Navigator done with the NavigationExperimental library.
There will be following diffs to support more features that are currently available from the Navigator.

Reviewed By: ericvicenti

Differential Revision: D3016084

fb-gh-sync-id: ed509fc86e9dc67b5334be9e60b582494fd52844
shipit-source-id: ed509fc86e9dc67b5334be9e60b582494fd52844
2016-03-08 16:26:24 -08:00
Hedger Wang 71e59761c9 Clean up APIs.
Reviewed By: ericvicenti

Differential Revision: D3010136

fb-gh-sync-id: 310864450bfc86ebc2d696f8ef4876b14fa3a57f
shipit-source-id: 310864450bfc86ebc2d696f8ef4876b14fa3a57f
2016-03-04 14:57:31 -08:00
Hedger Wang 1caebf175a Add data structure to manage the stack for the legacy navigator.
Reviewed By: ericvicenti

Differential Revision: D3002015

fb-gh-sync-id: 27519a1b67fe514bd6d9102031ea482f76fae16b
shipit-source-id: 27519a1b67fe514bd6d9102031ea482f76fae16b
2016-03-03 22:52:51 -08:00
Wenjing Wang 8a1629166e nested emit call in a queue should be handled in FIFO
Summary: I think we should dispose events in FIFO order

Reviewed By: fkgozali

Differential Revision: D2987425

fb-gh-sync-id: a4ad256512725d0bed0086b642e10fe7e7715070
shipit-source-id: a4ad256512725d0bed0086b642e10fe7e7715070
2016-03-03 18:57:52 -08:00
Konstantin Raev 5ffeb9764c Back out of D3000972
Reviewed By: dmmiller

Differential Revision: D3003211

fb-gh-sync-id: e64f1f17dcbf19a32066de91d6e839d59cd5d27c
shipit-source-id: e64f1f17dcbf19a32066de91d6e839d59cd5d27c
2016-03-03 04:21:36 -08:00
Martin Konicek 8717b2d19c Rework the NavigationHeader
Reviewed By: dmmiller, ericvicenti

Differential Revision: D3000972

fb-gh-sync-id: fcd4e63b72a70440e611289f03ed4757e230dc5b
shipit-source-id: fcd4e63b72a70440e611289f03ed4757e230dc5b
2016-03-02 12:21:36 -08:00
David Aurelio c331d113dc Fix breakages caused by switch to fbjs
Summary: This fixes a couple of breakages introduced by the switch to fbjs

Reviewed By: bestander

Differential Revision: D3000078

fb-gh-sync-id: 2971d049030f754d5001f6729716373a64078ddf
shipit-source-id: 2971d049030f754d5001f6729716373a64078ddf
2016-03-02 08:26:33 -08:00
David Aurelio ad8a335864 Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00
Hedger Wang caac520952 Add gesture handling for the card stack.
Reviewed By: ericvicenti

Differential Revision: D2995958

fb-gh-sync-id: f66759440b03072b650a572f011cadd06a0180d2
shipit-source-id: f66759440b03072b650a572f011cadd06a0180d2
2016-03-01 18:45:37 -08:00
Hedger Wang 0db22f184d NavigationCardStack - Add card stack item.
Summary: Add card stack item that moves from the right or the bottom.

Reviewed By: ericvicenti

Differential Revision: D2975659

fb-gh-sync-id: a04724943375ba0a9931eafb2aa82d6d8c31acfe
shipit-source-id: a04724943375ba0a9931eafb2aa82d6d8c31acfe
2016-03-01 09:44:31 -08:00
Hedger Wang 73bdef4089 Unify scene rederer params that are used render the scene / header.
Reviewed By: fkgozali

Differential Revision: D2981045

fb-gh-sync-id: 21688d92e31d882c5a31dd83ca064c2a01837164
shipit-source-id: 21688d92e31d882c5a31dd83ca064c2a01837164
2016-02-29 13:22:57 -08:00
Hedger Wang 3812c74e7c Guard navigator from dismatching gestures.
Reviewed By: fkgozali

Differential Revision: D2985510

fb-gh-sync-id: 72639c37fa61c91bbd75ba74166eed96f11d7564
shipit-source-id: 72639c37fa61c91bbd75ba74166eed96f11d7564
2016-02-26 18:11:32 -08:00
Christoph Jerolimov c449d9e72d Fix an issue (Sticky header index was outside the range) when renderSeparator is defined but returns null
Summary:Fix an issue when using ListView and define `renderSeparator` but the implementation returns null.

In such cases the sectionHeaderIndices mismatch the child element index and the app shows a warning like "Sticky header index 18 was outside the range {0, 13}".
Closes https://github.com/facebook/react-native/pull/5800

Differential Revision: D2980005

Pulled By: vjeux

fb-gh-sync-id: cd2d51d83698ed189bb65ea40b7b073644136b49
shipit-source-id: cd2d51d83698ed189bb65ea40b7b073644136b49
2016-02-25 17:16:14 -08:00
Hedger Wang 480e9abec5 Sets up example for LegacyNavigator.
Summary:We'd plan to build the `NavigationLegacyNavigator` that is meant to replace
Navigator seemlessly without  API changes. While the APIs remain
compatible with Navigator, it should be built with the new
Navigation API such as `NavigationAnimatedView`...etc.

To ensure that the new NavigationLegacyNavigagtor delivers the same
UX and maintains APIs compability, we'd start with using the exact same
examples as the same ones that Navigator uses.

Reviewed By: ericvicenti

Differential Revision: D2955273

fb-gh-sync-id: b4723cf54ea2258e5589f39dceeaee88be2b93f0
shipit-source-id: b4723cf54ea2258e5589f39dceeaee88be2b93f0
2016-02-25 14:57:03 -08:00
Hedger Wang 6bcb2a05eb Introducing NavigationCardStack
Summary:Basic implementation of the component NavigationCardStack that animates
a list of NavigationCard.

This will be used to port the UX of teh current Navigator.

Reviewed By: ericvicenti, fkgozali

Differential Revision: D2967065

fb-gh-sync-id: a72920e141364fab328e45a083aef21ca5e6fe0c
shipit-source-id: a72920e141364fab328e45a083aef21ca5e6fe0c
2016-02-24 18:51:30 -08:00
Eric Vicenti dcb68db758 Add sub-reducer support to NavigationStackReducer
Summary: Revise APIs of reducers, and ensure the stack reducer can support sub-reducers

Reviewed By: javache

Differential Revision: D2959915

fb-gh-sync-id: 20b28b9ead7ace3373489a806486999048d32aef
shipit-source-id: 20b28b9ead7ace3373489a806486999048d32aef
2016-02-22 16:17:12 -08:00
Nick Lockwood b516976457 Support custom ScrollView implementations in ListView
Summary: See e9f64b2f3f (commitcomment-16166567)

Reviewed By: tadeuzagallo

Differential Revision: D2953787

fb-gh-sync-id: b8978b3fa6ae9e848be918cc707335a06ea56cf6
shipit-source-id: b8978b3fa6ae9e848be918cc707335a06ea56cf6
2016-02-19 05:03:33 -08:00
Eric Vicenti a91466f84a Rename NavigationState module to NavigationStateUtils
Summary: There is a NavigationState type within this module so the name cannot be shared

Reviewed By: hedgerwang

Differential Revision: D2938311

fb-gh-sync-id: c5208755c9dfa5bf0e67666957c01e203ddd4218
shipit-source-id: c5208755c9dfa5bf0e67666957c01e203ddd4218
2016-02-19 01:24:54 -08:00
Hedger Wang 5ca9245067 stop wanring about using `onWillFocus` and `onDidFocus`.
Reviewed By: chaceliang

Differential Revision: D2925643

fb-gh-sync-id: d12b774b5c43d5369e2c02832d80541b2534fba6
shipit-source-id: d12b774b5c43d5369e2c02832d80541b2534fba6
2016-02-11 22:27:33 -08:00
Nick Lockwood e7005f7f54 Fixed missing rows on UIExplorer <ListView> - Grid Layout example
Summary:
public
I was looking into the missing panels at the bottom of the <ListView> - Grid Layout example, and found that it was caused by several problems, some in the example and some in ListView itself.

The first problem seemed to be a bug in the `_getDistanceFromEnd()` method, which calculates whether the ListView needs to load more content based on the distance of the visible content from the bottom of the scrollview. This was previously using the function

    Math.max(scrollProperties.contentLength, scrollProperties.visibleLength) - scrollProperties.visibleLength - scrollProperties.offset

to calculate the amount the user could scroll before they run out of content. This sort-of works in most cases because `scrollProperties.contentLength` is usually longer than `scrollProperties.visibleLength`, so this would generally evaluate to

    scrollProperties.contentLength - scrollProperties.visibleLength - scrollProperties.offset

which meant that it would be positive as long as there was content still to be displayed offscreen, and negative when you reached the end of the content. This logic breaks down if `contentLength` is less than `visibleLength`, however. For example, if you have 300pts of content loaded, and your scrollView is 500pts tall, and your scroll position is zero, this evaluates to

    Math.max(300, 500) - 500 - 0 = 0

In other words, the algorithm is saying that you have zero pts of scroll content remaining before you need to reload. But actually, the bottom 200pts of the screen are empty, so you're really 200pts in debt, and need to load extra rows to fill that space. The correct algorithm is simply to get rid of the `Math.max` and just use

    scrollProperties.contentLength - scrollProperties.visibleLength - scrollProperties.offset

I originally thought that this was the cause of the gap, but it isn't, because ListView has `DEFAULT_SCROLL_RENDER_AHEAD = 1000`, which means that it tries to load at least 1000pts more content than is currently visible, to avoid gaps. This masked the bug, so in practice it wasn't causing an issue.

The next problem I found was that there is an implict assumption in ListView that the first page of content you load is sufficient to cover the screen, or rather, that the first _ second page is sufficient. The constants `DEFAULT_INITIAL_ROWS = 10` and `DEFAULT_PAGE_SIZE = 1`, mean that when the ListView first loads, the following happens:

    1. It loads 10 rows of content.
    2. It checks if `_getDistanceFromEnd() < DEFAULT_SCROLL_RENDER_AHEAD` (1000).
    3. If it is, it loads another `DEFAULT_PAGE_SIZE` rows of content, then stops.

In the case of the ListView Grid Layout example, this meant that it first loaded 10 cells, then loaded another 1, for a total of 11. The problem was that going from 10 to 11 cells isn't sufficient to fill the visible scroll area, and it doesn't change the `contentSize` (since the cells wrap onto the same line), and since ListView doesn't try to load any more until the `contentSize` or `scrollOffset ` changes, it stops loading new rows at that point.

I tried fixing this by calling `_renderMoreRowsIfNeeded()` after `_pageInNewRows()` so that it will continue to fetch new rows until the `_getDistanceFromEnd()` is less than the threshold, rather than stopping after the first page and waiting until the `contentSize` or `scrollOffset` change, but although this solves the problem for the Grid Layout example, it leads to over-fetching in the more common case of a standard row-based ListView.

In the end, I just increased the `pageSize` to 3 for the Grid Layout example, which makes more sense anyway since loading a page that is not a multiple of the number of cells per row confuses the `_renderMoreRowsIfNeeded` algorithm, and leads to gaps at the bottom of the view.

This solved the problem, however there was still a "pop-in" effect, where the additional rows were paged in after the ListView appeared. This was simply a misconfiguration in the example itself: The default of 10 rows was insufficient to fill the screen, so I changed the `initialListSize` prop to `20`.

Reviewed By: javache

Differential Revision: D2911690

fb-gh-sync-id: 8d6bd78843335fb091e7e24f7c2e6a416b0321d3
shipit-source-id: 8d6bd78843335fb091e7e24f7c2e6a416b0321d3
2016-02-10 08:37:57 -08:00
Eric Vicenti 7b2b0c3c1c Navigation Back support and examples for Android
Summary:
public
- Intro new back action
- Add support in the two main reducers
- Use it in examples to support Android back button
- Disable NavigationCard gestures on Android

Reviewed By: hedgerwang

Differential Revision: D2914154

fb-gh-sync-id: d4dce6538e19613a2ffca21e2e3b2ecaded3d5dc
shipit-source-id: d4dce6538e19613a2ffca21e2e3b2ecaded3d5dc
2016-02-08 20:03:31 -08:00
Hedger Wang 7b57b5c84a re-render the whole navigation bar while calling immediatelyResetRouteStack
Summary:
public

Navigator expects that the navigation bar implements the method to refresh itself.
NavigatorNavigationBar already has this method but not for NavigatorBreadcrumbNavigationBar.

Fix diff fixes this with the same fix as D2751922 did.

Reviewed By: wenjingw

Differential Revision: D2914475

fb-gh-sync-id: a2960bad5df3b403bdd2ab1dc4d349d7251b86c8
shipit-source-id: a2960bad5df3b403bdd2ab1dc4d349d7251b86c8
2016-02-08 19:51:35 -08:00
Eric Vicenti a3085464f6 NavigationExperimental
Summary:
A new API to unify internal navigation. Also addresses a highly-rated community 'pain': https://productpains.com/post/react-native/better-navigator-api-and-docs/

Offers the following improvements:

- Redux-style navigation logic is easy to reason about
- Navigation state can be easily saved and restored through refreshes
- Declarative navigation views can be implemented in native or JS
- Animations and gestures are isolated and now use the Animated library

public

Reviewed By: hedgerwang

Differential Revision: D2798048

fb-gh-sync-id: 88027ef9ead8a80afa38354252bc377455cc6dbb
2016-02-05 14:26:35 -08:00
Pieter De Baets d2ab6cabd4 Don't automatically render more rows when dataSource updates
Reviewed By: sahrens

Differential Revision: D2875678

fb-gh-sync-id: c10e2c65c133d01245ac134170b25cb93377f97b
2016-02-05 11:09:32 -08:00
Olivier Notteghem 4326b01181 safety fixes
Reviewed By: nspaun

Differential Revision: D2902378

fb-gh-sync-id: da35b6d61e6248e5920eab6f5e53a7ce8deb8e01
2016-02-04 15:46:32 -08:00
Nick Lockwood e9f64b2f3f Updated ListView.scrollTo() API to match ScrollView
Reviewed By: davidaurelio

Differential Revision: D2895460

fb-gh-sync-id: 0520df3f2ed6614a08e3fc20a2417c7a8e2ace68
2016-02-03 09:17:33 -08:00
Gaëtan Renaudeau 9506e5afc7 add animated param in ListView#scrollTo
Summary:
Since scrollTo(x,y,**animated**) params has been introduced, it was not backported to ListView scrollTo method.
Closes https://github.com/facebook/react-native/pull/5661

Reviewed By: svcscm

Differential Revision: D2886049

Pulled By: nicklockwood

fb-gh-sync-id: 016e92beadc7f397be77b8c58dc572119f873556
2016-02-01 14:53:11 -08:00
Janic Duplessis 1c6e837504 Add a deprecatedPropType module to show deprecation warnings
Summary:
To allow smoother API changes for users we often deprecate props and keep them around for a while before removing them. Right now it is all done manually, this adds a consistent way to show a warning when using a deprecated prop.

This also adds a deprecation warning of the website generated from the deprecatedPropType.

<img width="643" alt="screen shot 2016-01-26 at 7 43 08 pm" src="https://cloud.githubusercontent.com/assets/2677334/12600172/7af28fb0-c465-11e5-85e5-3786852bf522.png">

It also changes places where we added the warnings manually to use deprecatedPropType instead.
Closes https://github.com/facebook/react-native/pull/5566

Reviewed By: svcscm

Differential Revision: D2874629

Pulled By: nicklockwood

fb-gh-sync-id: c3c63bae7bbec26cc146029abd9aa5efbe73f795
2016-01-29 02:05:38 -08:00
Hedger Wang 1edcf4c6ac Disable navigation bar right button when it's transparent.
Reviewed By: chaceliang

Differential Revision: D2863157

fb-gh-sync-id: ca73545303607333fe32cd8e2e8f040134ee1d24
2016-01-26 01:28:34 -08:00
Nick Lockwood cb45eaa0e8 Made Map & Set polyfills available globally
Summary:
public

Map and Set are a standard JavaScript features, but are only supported in a subset of JSC versions that we target (e.g. iOS 7's JSC doesn't support Set).

The consequence of this is that failing to require('Set') before using it won't error during testing on a modern OS, but will fail on older OS versions. This diff makes the Map and Set polyfills available globally to all RN apps to avoid that problem.

Reviewed By: davidaurelio

Differential Revision: D2833997

fb-gh-sync-id: 713d8b69f6a1bce2472a1b2e6b84f69d75f30289
2016-01-20 08:27:38 -08:00
Gaëtan Renaudeau 1abd12b68b configureScene: add routeStack in second argument
Summary:
Giving routeStack in second parameter of configureScene allows to do more advanced scene configuration.
I have use-case where I can only determine the scene config from the navigation context (not only from the route object but also from where it's located).
Closes https://github.com/facebook/react-native/pull/5254

Reviewed By: svcscm

Differential Revision: D2828415

Pulled By: androidtrunkagent

fb-gh-sync-id: 27b6c79b24cbc194e080541e9202ca84c55a0bc4
2016-01-13 13:27:31 -08:00
Eric Raio 5fb1966509 Adding `resetTo` documentation in Navigator methods
Summary: Closes https://github.com/facebook/react-native/pull/5220

Reviewed By: svcscm

Differential Revision: D2818993

Pulled By: bestander

fb-gh-sync-id: 0bc0feb68e6c6f6132203daef586d78489047731
2016-01-12 04:47:37 -08:00
Olivier Notteghem e14b24936d Move THFeedListView to right location
Reviewed By: hnery

Differential Revision: D2815711

fb-gh-sync-id: 261343ea6c57786beb9c02917c56a3bef544d85b
2016-01-08 16:38:46 -08:00
Christoph Pojer b84ad2ab0d Updates for haste2 inside of jest
Summary:
I'm working on deploying haste2 with jest. This updates all the files that require changes for this to work and they are backwards compatible with the current version of jest.

* package.json was just outdated. I think haste1's liberal handling with collisions made this a "non-issue"
* env.js didn't properly set up ErrorUtils, also unsure why that isn't a problem in jest right now already?
* some things were mocking things they shouldn't
* Because of the regex that matches against providesModule and System.import, it isn't possible to list module names more than once. We have multiple tests reusing the same providesModule ids and using System.import with modules that only exist virtually within that test. Splitting up the strings makes the regexes work (we do the same kind of splitting on www sometimes if we need to) and using different providesModule names in different test files fixes the problem. I think the BundlesLayoutIntegration-test is going to be deleted, so this doesn't even matter.

public

Reviewed By: voideanvalue

Differential Revision: D2809681

fb-gh-sync-id: 8fe6ed8b5a1be28ba141e9001de143e502693281
2016-01-08 06:52:29 -08:00
olivier notteghem 47d0e3c288 introduce custom listview to be experimented in groups that fixes tail-fetch and improve skipped frame
Reviewed By: nspaun

Differential Revision: D2810265

fb-gh-sync-id: b5b312858f9096f82f14e2262d205d0580ac9e46
2016-01-07 18:19:00 -08:00
Gaëtan Renaudeau 4f9086f0e7 Fixes error when navigationBar is set back to null
Summary:
This fixes a regression introduced in df70005c12

If you set navigationBar props (on Navigator) and then later set it back to null, it will crashes.
(N.B. this should be possible as navigationBar is optional)

cc satya164
Closes https://github.com/facebook/react-native/pull/4941

Reviewed By: svcscm

Differential Revision: D2788889

Pulled By: bestander

fb-gh-sync-id: f8f1cd6cc2ce13b1b1b86fa76d3b22c26a8adb5b
2016-01-07 12:01:37 -08:00
Olivier Notteghem b75c939d59 Fix corner case bug in ListView
Reviewed By: sahrens

Differential Revision: D2802885

fb-gh-sync-id: e4bb82e3c63ded2af46f5b078b712636d3afa156
2016-01-06 19:16:32 -08:00
Emilio Rodriguez 33e05a11f0 Added scrollTo method to ListView
Summary: Closes https://github.com/facebook/react-native/pull/4781

Reviewed By: svcscm

Differential Revision: D2803479

Pulled By: mkonicek

fb-gh-sync-id: 7da41eb0bdfb0f90b4f81d1006eaf00446820827
2016-01-06 10:25:34 -08:00
Alex Rothberg 4bc425c521 Added stickyHeaderIndices to ListView
Summary:
Closes #3870

Alternatively I could make this a bool `stickyheader` that just adds `0` to  the `stickyHeaderIndices` passed down to the ScrollView.
Closes https://github.com/facebook/react-native/pull/4213

Reviewed By: svcscm

Differential Revision: D2807414

Pulled By: androidtrunkagent

fb-gh-sync-id: 091b6c6c91cebe175181f57b5c2785395b5db19b
2016-01-06 09:21:47 -08:00
olivier notteghem 5bc45f1881 improve navigation and tail fetch logging
Reviewed By: nspaun

Differential Revision: D2791366

fb-gh-sync-id: 5cacc34ef29630437e82b1fab18c928c8794d551
2015-12-30 05:08:25 -08:00
sunnylqm 8080583f52 update description about removeClippedSubviews
Summary: Closes https://github.com/facebook/react-native/pull/4998

Reviewed By: svcscm

Differential Revision: D2790689

Pulled By: androidtrunkagent

fb-gh-sync-id: 2db476eabe067fd770b6acce47b62607df348052
2015-12-28 07:56:28 -08:00
sunnylqm 58bbd7bc5b Hint for passing navigator in renderScene
Summary: Closes https://github.com/facebook/react-native/pull/4999

Reviewed By: svcscm

Differential Revision: D2790687

Pulled By: androidtrunkagent

fb-gh-sync-id: af055123b351e37081a37d6153333666a878113c
2015-12-28 06:39:32 -08:00
olivier notteghem 040909904c fix listview inefficiency for tail-fetching scenarios (part1)
Reviewed By: sahrens

Differential Revision: D2775226

fb-gh-sync-id: 13cc895d8cde4ab1baf527ab468d6c7b47158aef
2015-12-21 08:41:31 -08:00
olivier notteghem 174d37c1d9 fix listview inefficiency for tail-fetching scenarios (part2)
Reviewed By: sahrens

Differential Revision: D2775293

fb-gh-sync-id: a18a2fd6f64b5c979267a21ecdac8c3d97d9e007
2015-12-19 17:13:28 -08:00
Sameer Rahmani f48961388e FloatFromLeft scene configuration fixed. HorizontalSwipeJumpFromRight…
Summary:
`FloatFromLeft` configuration was wrong. its animation was ok but the swipe back was wrong. for example you had to swipe from left to right for a `back` action which should be swipe from right to left.

`HorizontalSwipeJumpFromRight` is the same as `HorizontalSwipeJump` but for RTL layouts.
Closes https://github.com/facebook/react-native/pull/4815

Reviewed By: svcscm

Differential Revision: D2766720

Pulled By: androidtrunkagent

fb-gh-sync-id: 2b60f2d238a8f8e5b27dbfb307887934be477c81
2015-12-16 15:08:44 -08:00
Hedger Wang 67c6afd14b immediatelyResetRouteStack does not update Navigator's title
Summary:
re-render the whole navigation bar while calling immediatelyResetRouteStack
from navigator.

Reviewed By: zjj010104

Differential Revision: D2751922

fb-gh-sync-id: 79bcd1457a96eaf3ca94b81da9bfecbec7f8af46
2015-12-15 15:40:27 -08:00
Oleg Lokhvitsky 7377fb8baf Fix Navigator.NavigationBar Title interactivity
Reviewed By: hedgerwang

Differential Revision: D2755832

fb-gh-sync-id: 22f937ba271703d49f54acf2e3cdbf1994fad878
2015-12-15 12:02:27 -08:00
Gaëtan Renaudeau db69004300 Fix events to go through the navigation bar layers
Summary:
Here is a showcase of 2 bugs that are fixed with this PR: touchability of title, touchability of overlapped top-right positionned (under the navbar).

(i'm using the inspector)

![bug](https://cloud.githubusercontent.com/assets/211411/11809475/7b6ba71a-a327-11e5-90cf-cbe58637c447.gif)

I have a navbar with a back button, a Title area with a **Green Circle**, a Right area with nothing inside.
In my Screen View, I've positioned in absolute a **Red Rectangle** just on the top-right corner under the navbar.

I want my **Green Circle** and **Red Rectangle** to be touchable but in current React Native version, this is not possible: as shown in the gif, the 3 LeftButton/Title/RightButton wrapper View are **catching the touch events**. My PR allows events to go through these wrapper View.

**After the fix:**

![nobug](https://cloud.githubusercontent.com/assets/211411/11809590/3b803994-a328-11e5-81f7-c1a3bab45e1b.gif)

Complementary Notes:
- in the case of the Red Rectangle, only the lower part of it i
Closes https://github.com/facebook/react-native/pull/4786

Reviewed By: svcscm

Differential Revision: D2760205

Pulled By: androidtrunkagent

fb-gh-sync-id: 55bb141c8f61ab537ff9e832b65b04cb904dfeb9
2015-12-15 11:04:43 -08:00
Justas Brazauskas 0e8b207cc3 Bugfix - Typos
Summary:
Fixed few typos in `./Examples` and `./Libraries` folders.
Closes https://github.com/facebook/react-native/pull/4788

Reviewed By: svcscm

Differential Revision: D2759918

Pulled By: androidtrunkagent

fb-gh-sync-id: d692b5c7f561822353e522f9d4dfde7e60b491cf
2015-12-15 09:09:32 -08:00
Thomas Parslow 3cfcd401c1 Support onLayout and onContentSizeChange attributes on ListView
Summary:
Docs say they're supported and presumably they should work exactly as for ScrollView but currently they are intercepted by the ListView
Closes https://github.com/facebook/react-native/pull/4712

Reviewed By: svcscm

Differential Revision: D2745080

Pulled By: vjeux

fb-gh-sync-id: 531907f03ae46d5200003cdb335c10b40c7d3bed
2015-12-10 12:46:31 -08:00
Satyajit Sahoo 93f9a4a7ee Fix for flow (https://github.com/facebook/flow/tree/v0.19.0)
Summary:
From flow release notes (https://github.com/facebook/flow/releases),
> import type * as Foo is now disallowed in favor of import type Foo
Closes https://github.com/facebook/react-native/pull/4565

Reviewed By: svcscm

Differential Revision: D2723280

Pulled By: mkonicek

fb-gh-sync-id: 57074ab893c3e2eae3cefc3002853bfdfed91734
2015-12-07 11:29:24 -08:00
moschan d1029d1b9d fixed mardown formatting of ListView
Summary:
about renderRow and renderSeparator.
insert a new line before description.
Closes https://github.com/facebook/react-native/pull/4532

Reviewed By: svcscm

Differential Revision: D2718764

Pulled By: androidtrunkagent

fb-gh-sync-id: eeefd16617fcb5e5ca21f6fd0cf29d63cb3b1f1c
2015-12-03 11:56:29 -08:00
Wenjing Wang 0571250521 8/n Fix warnings at startup
Summary:
public
- Add missing required `key` prop for array of child components

Reviewed By: zjj010104

Differential Revision: D2711271

fb-gh-sync-id: b9848abffd3c458cf45b1231be5eff0a5de805f1
2015-12-01 22:53:30 -08:00
Gabe Levi 892dd5b86a Fix errors uncovered by v0.19.0
Reviewed By: mroch

Differential Revision: D2706663

fb-gh-sync-id: 017c91bab849bf18767cacd2ebe32d1a1b10c715
2015-12-01 20:11:26 -08:00
Huang Yu 7242efde0a fix navigator lint warnings
Summary: fix some lint warnings under `Libraries/CustomComponents/Navigator/` directory
Closes https://github.com/facebook/react-native/pull/4447

Reviewed By: svcscm

Differential Revision: D2706390

Pulled By: ericvicenti

fb-gh-sync-id: 5bfed687265e07a162ffc528a41fa5b0d384f635
2015-11-30 19:31:30 -08:00
Danny Arnold df70005c12 calling navigationBar's overridden ref function
Summary: Before that it was not possible to get a ref to a navigation bar (unless using Navigator's internal `_navBar` prop)
Closes https://github.com/facebook/react-native/pull/3755

Reviewed By: svcscm

Differential Revision: D2674315

Pulled By: nicklockwood

fb-gh-sync-id: 26120f7bcbb675e8217b8bd963dcc6ed314d4ba3
2015-11-30 08:32:23 -08:00
Nick Lockwood 60db876f66 Wrapped UIManager native module for better abstraction
Summary: public

RCTUIManager is a public module with several useful methods, however, unlike most such modules, it does not have a JS wrapper that would allow it to be required directly.

Besides making it more cumbersome to use, this also makes it impossible to modify the UIManager API, or smooth over differences between platforms in the JS layer without breaking all of the call sites.

This diff adds a simple JS wrapper file for the UIManager module to make it easier to work with.

Reviewed By: tadeuzagallo

Differential Revision: D2700348

fb-gh-sync-id: dd9030eface100b1baf756da11bae355dc0f266f
2015-11-27 07:00:32 -08:00
Hedger Wang e0d53e1c48 Fix move gesture handling.
Summary: public

The gesture that moves scene around should only be attached when the
move starts at the moment that the first move is granted.

No move would ever be granted if the move event is prevented by the
decendent children (e.g. a slider component).

For now, the move gesture is attached at `onPanResponderGrant`
instead of `onPanResponderMove` thus we'd create "ghost-move-gesture"
when no actual moves is received my the navigator.

Reviewed By: fkgozali

Differential Revision: D2683802

fb-gh-sync-id: 50ae877787167511df48378304bd2ad665c73300
2015-11-23 09:20:28 -08:00
Krzysztof Magiera 1195f9c8e8 Further improvements in RecyclerViewBackedScrollView.
Summary: public
Changed ListView to use onLayout and onContentSizeChange (new) events instead of measure. Updated ScrollView implementation to support contentSizeChange event with an implementation based on onLayout attached to the content view. For RecyclerViewBackedScrollView we need to generate that event directly as it doesn't have a concept of content view.
This greatly improves performance of ListView that uses RecyclerViewBackedScrollView

Reviewed By: mkonicek

Differential Revision: D2679460

fb-gh-sync-id: ba26462d9d3b071965cbe46314f89f0dcfd9db9f
2015-11-20 07:44:31 -08:00
Qiao Liang 993f15d2fe Ensure row key uniqueness for listview with sections
Summary: I encounter issues when using ListView with multiple Sections.
```
...
var ds = new ListView.DataSource({
  rowHasChanged           : (row1, row2) => row1 !== row2,
  sectionHeaderHasChanged : (s1, s2) => s1 !== s2
});
...
  getInitialState: function() {

    var sectionIDs = [0,1,2]
    var rowIDs = [
        [0,1,2],
        [0,1,2],
        [0,1,2]
    ]

    var dataBlob = [
        [blob0,blob1,blob2],
        [blob3,blob4,blob5],
        [blob6,blob7,blob8],
    ]

    return {
      dataSource : ds.cloneWithRowsAndSections(dataBlob, sectionIDs, rowIDs),
    };

```

the code above would throw error because of duplicate key, as ''sectionID0 + rowID0 === sectionID1 + rowID1'. And I have to do:
```
...
sectionIDs.map((id)=>{
  return id+'';
});

rowIDs.map((sec)=>{
  return sec,map((id)=>{
    return id+'';
  });
});
...
```

ListView with sections does not seem to be documented yet, so I am not sure if this is the intended behaviour or am I missing anything. Co
Closes https://github.com/facebook/react-native/pull/4082

Reviewed By: svcscm

Differential Revision: D2652028

Pulled By: mkonicek

fb-gh-sync-id: a9933bac1a1ae2d6cbc73a11ef6aefde6fcdb35f
2015-11-13 08:15:59 -08:00
Spencer Ahrens a94c2aea37 revert onEndReached change to investigate perf regression
Differential Revision: D2651998

fb-gh-sync-id: 81ef96bbd79a282b5d82b8cc9b0654e7163fbdfb
2015-11-13 06:21:58 -08:00
Christine Abernathy 12488da9cf Left nav shouldn't visible when moved to left
Summary: This issue shows up if you have a really long left nav item. When the navigator is pushed in iOS, the long nav item will be visible alongside the new nav item.

Steps to repro:
1/ Modify Examples/UIExplorer/Navigator/NavigationBarSample.js
2/ In NavigationBarRouteMapper.LeftButton, make the following change

    <Text style={[styles.navBarText, styles.navBarButtonText]}>
      Very Long Title {previousRoute.title}
    </Text>

3/ On iOS, get the UIExplorer project up and navigate to Navigator > Navbar Example > Next (top-right nav item) > Next

You should see the overlap.

<img width="592" alt="leftnavitem_issue" src="https://cloud.githubusercontent.com/assets/691109/11086934/b5b82e26-880a-11e5-9945-13901346a5c5.png">

With these changes the overlap is gone.
Closes https://github.com/facebook/react-native/pull/4067

Reviewed By: svcscm

Differential Revision: D2641934

Pulled By: ericvicenti

fb-gh-sync-id: 962536b97f77a3b7f176423aa11dc94f24f07332
2015-11-11 09:02:57 -08:00
Hedger Wang 1f0566f55f clean up navigator when it's unmounted.
Summary: public

We've noticed that some of the navigator functions are called after the navigator
being unmounted. This diff adds the checks to protect the navigator from throwing
error when it's calling function after be unmounted.

Reviewed By: fkgozali

Differential Revision: D2629484

fb-gh-sync-id: 1cbee02b1a8d2a5d285e7d76f382d2599ed8caed
2015-11-06 23:41:26 -08:00
Spencer Ahrens a4f7aa4853 make onEndReached a little more robust
Summary: public

Now if you scroll up out of the end threshold and then back down into it,
onEndReached will get triggered again.  This closes https://github.com/facebook/react-native/issues/1967

This also resets onEndReached when the data source changes.  This would fix
issues where the data source changes and onEndReached should fire again since
the new data may have more pages, whereas the old data had reached the end and
stopped.

Reviewed By: jingc

Differential Revision: D2610799

fb-gh-sync-id: f6cef513a42d4765514bf4bc55d9e31a760117f1
2015-11-04 11:32:28 -08:00
Hedger Wang 4763f89efa update NavigationContext API.
Summary: 1. Add a new api `top` which returns the root navigator of a nested navigator.
2. Remove the param `context` from the method `addListener` because it's not used and not necessary.

public

Reviewed By: fkgozali

Differential Revision: D2613852

fb-gh-sync-id: 0d5544422ff0be7875824989a4fbefbef9aac986
2015-11-03 19:08:31 -08:00
aleclarsoniv 5dd3b88a81 Use 'visibleLength' if 'contentLength' is less
Summary: This prevents the 'distanceFromEnd' from being negative when 'offset' is zero, for example.
Closes https://github.com/facebook/react-native/pull/3074

Reviewed By: svcscm

Differential Revision: D2610771

Pulled By: sahrens

fb-gh-sync-id: f878f1c1b865063294013c3bb96b90831877d372
2015-11-03 10:13:28 -08:00
Hedger Wang a33fe94dac build nested navigation context based on the hierarchy of navigators.
Reviewed By: zjj010104

Differential Revision: D2598388

fb-gh-sync-id: 9655bcc86021678984e2a29df20ad2496a1762d1
2015-10-30 11:09:28 -07:00
Oleg Lokhvitsky 26e3bf97d3 Revert D2590497
Reviewed By: pvulgaris

Differential Revision: D2597148

fb-gh-sync-id: a8b6e7c3a90a8a1eaefc996d6243c4a171df37c8
2015-10-29 14:35:32 -07:00
Hedger Wang 064de3b338 Replace Navigator with AdsManagerNavigator - step 1
Reviewed By: fkgozali

Differential Revision: D2585102

fb-gh-sync-id: 6f0d51d755e0926f7c6f4d411a026cebf49333a2
2015-10-28 18:27:26 -07:00
Krzysztof Magiera dea4c2ca8e Use onLayout in listview instead of calling measure for every scroll event.
Reviewed By: sahrens

Differential Revision: D2590497

fb-gh-sync-id: 42a8f97dcb43b3a59ba3f0a008fb363f8e8c7200
2015-10-28 12:43:29 -07:00
Hedger Wang ae58fe221b Stop handling animation once Navigator is unmounted.
Summary: public
Navigator subscribes to its internal animation spring that may still
asks navigator to re-render after being unmounted.

This diff clears the listeners of its animation spring once navigator
is unmounted.

Reviewed By: zjj010104

Differential Revision: D2588434

fb-gh-sync-id: 2b3ee65d3a6c3d45e5c6904d1dc65ac5a3e4534a
2015-10-27 18:30:24 -07:00
Hedger Wang 06a154e061 Fix Js error in Navigator
Summary: public

In Navigator, there are several places that mutate `this.state.presentedIndex`
with the express `this.state.presentedIndex = destIndex` instead of calling
`this.setState`, which creates the problem that not all internal states are
updated within the same React update cycle.

One of the symptoms is that over-swiping within the Navigator may throw JS error
due to `this.state.sceneConfigStack` and `this.state.presentedIndex` are not both
updated.

The workaround is to bypass the over-swiping gesture to avoid JS error.

Reviewed By: ericvicenti

Differential Revision: D2557140

fb-gh-sync-id: 1e5c9047ed17c04a63e2a568118848b00723fb1d
2015-10-20 11:04:23 -07:00
Hedger Wang 73b80773ba supports event capturing and bubbling phases in Navigation context.
Summary: Adds the API that enables the navigation events capturing and bubbling which is the feature
that is enabled if the nested navigation contexts is created by the navigator.

This would allow developer to observe or reconcile navigation events within the navigation tree.

public

./Libraries/FBReactKit/jest

Reviewed By: zjj010104

Differential Revision: D2546451

fb-gh-sync-id: dfc9d16defaa563b9e80fd751a20570f6e524b74
2015-10-19 10:06:22 -07:00
Hedger Wang a2524bac33 Support nested navigation context.
Reviewed By: fkgozali

Differential Revision: D2525434

fb-gh-sync-id: 18e7d672b2cbadc318a207c8812f38d8669bad30
2015-10-17 04:25:26 -07:00
Andy Street 28f6eba22d Make removeClippedSubviews default to true on ListView/RecyclingListView
Reviewed By: @satishsampath

Differential Revision: D2536046

fb-gh-sync-id: 7e0b4442bb0b3705bba3b5f7bdf873fb348a83f6
2015-10-13 08:06:26 -07:00
James Ide 2c7de35dee Export per-platform NavigatorNavigationBarStyles for consistent styling
Summary: This allows for the iOS-style navigation bar on Android and vice versa in order to simplify design. It is entirely optional in that NavigationBars will continue to defauly to their platform-specific style, but you can override it with the `navigationStyles` prop:

```js
<Navigator.NavigationBar
  navigationStyles={Navigator.NavigationBar.StylesIOS}
/>
```

Fixes #2995.
Closes https://github.com/facebook/react-native/pull/3028

Reviewed By: @​svcscm

Differential Revision: D2527902

Pulled By: @ericvicenti

fb-gh-sync-id: c7b1bfac200b5e03fc0d9dfb8acc8b916c825595
2015-10-10 15:32:46 -07:00
Spencer Ahrens b0bdd4e45d Fix ListView bug where onEndReached wouldn't trigger initially
Summary: @​public

Sometimes we want to load a very small number of rows initially and want the
onEndReached callback to be called immediately to trigger more data to be
loaded without waiting for the  user to scroll at all.  This diff makes that
happen by also checking on mount instead of only when scrolling.

Reviewed By: @vjeux

Differential Revision: D2507184

fb-gh-sync-id: ea8e47667d00387a935a426dd45afe978fd6d8cd
2015-10-05 13:49:00 -07:00
Hedger Wang 200d9af315 Add method `stopPropagation` and `stop` to NavigationEvent
Summary: @​public

Add method `stopPropagation` and `stop` to NavigationEvent so we can stop event easily once event bubbling and capturing is supported.

Reviewed By: @fkgozali

Differential Revision: D2471903
2015-09-24 08:19:52 -07:00
Elia Grady 88b101bb3e Fixed typo
Summary: _setRenderSceneToHarwareTextureAndroid was changed to _setRenderSceneToHardwareTextureAndroid.
Closes https://github.com/facebook/react-native/pull/2869

Reviewed By: @​svcscm

Differential Revision: D2472438

Pulled By: @vjeux
2015-09-23 19:29:14 -07:00
Hedger Wang b2049e3ccb Hierarchical event bubbling - 1
Reviewed By: @fkgozali

Differential Revision: D2469495
2015-09-23 19:28:56 -07:00
Alex Coco 12a0045412 Fix typo in cloneWithRows comments
Summary: `s/informatoin/information/`
Closes https://github.com/facebook/react-native/pull/2532

Reviewed By: @​svcscm

Differential Revision: D2469067

Pulled By: @vjeux
2015-09-22 17:02:27 -07:00
Jan Kassens 9486642322 Prop routeMapper of Navigator.NavigationBar is required
Summary: The component will crash if the prop is not provided. This helps with a better
error message in the console output.
Closes https://github.com/facebook/react-native/pull/2894

Reviewed By: @​svcscm

Differential Revision: D2461752

Pulled By: @ericvicenti
2015-09-22 14:44:28 -07:00
Tamara Woodson 4447bff976 Fix minor grammatical error in documentation
Summary: No code changes; comments/documentation only.
Closes https://github.com/facebook/react-native/pull/2083

Reviewed By: @​svcscm

Differential Revision: D2468024

Pulled By: @vjeux
2015-09-22 14:25:25 -07:00
Eric Vicenti c962251900 Fix crash when touch terminates without active gesture
Summary: When the touch gets terminated, it is not guaranteed that there is an active gesture. It looks like this was causing crashes

@​public

Reviewed By: @​chaceliang

Differential Revision: D2441469
2015-09-15 13:12:05 -07:00
Yamill Vallecillo f8f75ff612 Navigator.NavigationBar Landscape Fix
Summary: NavigationBar items are fixed to Portrait when Device is in Landscape.

This supplements that fix by removing the `width` properties and just using `left` and `right` positioning respectively.

<strong>Before:</strong>

![ios simulator screen shot sep 8 2015 1 27 02 pm](https://cloud.githubusercontent.com/assets/755943/9743817/3e6b858a-5636-11e5-80e8-81e62b46c46e.png)

<strong>After:</strong>

![ios simulator screen shot sep 8 2015 1 29 21 pm](https://cloud.githubusercontent.com/assets/755943/9743822/43e7d4b4-5636-11e5-8e1c-9f13bdc492b2.png)

Closes https://github.com/facebook/react-native/pull/2606

Reviewed By: @vjeux

Differential Revision: D2426942

Pulled By: @ericvicenti
2015-09-10 14:00:26 -07:00
Emily Janzer 4b28a847e6 [android] fix crash if breadcrumb refs don't exist 2015-08-20 19:08:16 -07:00
Hedger Wang 8463625bd9 [Navigation]: Add a method to map the stack routes to an array.
Summary:
Add a method to map the stack routes to an array.
2015-08-06 02:01:59 -08:00
Hedger Wang 222594cb44 [Navigator] A method `subtract` to compute the diff between stack mutation.
Summary:
When mutation of a stack happens, we'd like to compute the diff of the stacks (before and after) so that
we can know which routes are removed in the new stack.

This diff adds a new method `substract` which does what we need.
2015-08-04 16:16:17 -08:00
Eric Vicenti 41dd6fe6ea [ReactNative][Navigator] Fix disabled scene height change
Summary:
Disabling the scene this way would make the scene height go to zero and mess up the scroll position. By setting the bottom to the same distance, the view does not get resized and the scroll position is preserved through a scene disable cycle.
2015-07-30 12:58:45 -08:00
Hedger Wang 4b16e4d550 [Navigator]: Add a method `keyOf` to NavigationRouteStack.
Summary:
# Summary

Add a method `keyOf` to NavigationRouteStack.

The method `keyOf` returns a key that is associated with the route.
The a route is added to a stack, the stack creats an unique key for it and
will keep the key for the route until the route is rmeoved from the stack.

The stack also passes the keys to its derived stack (the new stack created by the
mutation API such as `push`, `pop`...etc).

The key for the route persists until the initial stack and its derived stack no longer
contains this route.

# Why Do We Need This?

Navigator has needs to use an unique key to manage the scenes rendered.
The problem is that `route` itself isn't a very reliable thing to be used as the key.

Consider this example:

```
// `scene_1` animates into the viewport.
navigator.push('scene_1');

setTimeout(() => {
 // `scene_1` animates off the viewport.
 navigator.pop();
}, 100);

setTimeout(() => {
 // Should we bring in a new scene or bring back the one that was previously popped?
 navigator.push('scene_1');
}, 200);

```

Because we currently use `route` itself as a key for the scene, we'd have to block a route
until its scene is completely off the components tree even the route itself is no longer
in the stack otherwise we'd see strange animation of jumping scenes.

# What's Next

We're hoping that we can build pure reactive view for NavigationRouteStack easily.
The naive implementation of  NavigationRouteStackView may look like this:

```
class NavigationRouteStackView {
  constructor() {
    this.state = {
      staleScenes: {},
    };
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.stack !== this.props.stack) {
      var stale;
      var staleScenes = {...this.state.staleScenes};
      this.props.stack.forEach((route, index, key) => {
        if (nextProps.stack.keyOf(route) !== key) {
          stale = true;
          staleScenes[key] = {route, index, key, stale};
        }
      });
      if (stale) {
        this.setState({
          staleScenes,
        });
      }
    }
  }

  render() {
    var scenes = [];

    this.props.stack.forEach((route, index, key) => {
      scenes.push({route, index, key});
    });

    Object.keys(this.state.staleScenes).forEach(key => {
      scenes.push(this.state.staleScenes[key]);
    });

    scenes.sort(stableSortByIndex);

    return <View>{scenes.map(renderScene)}</View>;
  }
}

```
2015-07-29 16:55:21 -08:00
Hedger Wang 809a2dc1d6 [Navigator: Prevent user from over-popping the routes.
Summary:
If user taps the back button quickly, the app crashes becuase "pop"
internally only checks `this.state.presentedIndex` which does not
always update when transtion happens.

This diff addresses this issue.
2015-07-29 11:42:34 -08:00
Rui Chen 842ce51099 [Treehouse RN] Make smoothScrollTo works by not calling it twice 2015-07-27 11:25:28 -08:00
Hedger Wang ea5276ed24 [Navigator] Port navigation APIs from Navigator to NavigationContext 2015-07-24 17:10:41 -08:00
James Ide bf7e2a85d0 [Navigator] Vertically hide disabled scenes and use pointerEvents="none"
Summary:
Hides disabled scenes using `top` instead of `left`, which fixes a bug with the native UITabBar. When the UITabBar's width is zeroed because the scene has `left: SCREEN_WIDTH, right: 0` applied, this triggers a bug with the kerning of the tab titles. Instead, zeroing the height by setting `top: SCREEN_HEIGHT` avoids the bug.

Also applies `pointerEvents="none"` to disabled scenes so that views in the off-screen scenes definitely don't receive touches, which was occurring before.

Fixes #1401, fixes #2011

Closes https://github.com/facebook/react-native/pull/2104
Github Author: James Ide <ide@jameside.com>
2015-07-24 14:45:19 -08:00
Martin Konicek d10e4dbf0f [ReactNative] Use ASCII double quotes
Summary:
We mix ASCII double quotes with left and right quotes: https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/ListView/ListView.js#L13

Let's be consistent.
2015-07-24 13:16:25 -08:00
Rui Chen accf6f12e4 Make the scrollResponderScrollNativeHandleToKeyboard works on Android 2015-07-23 18:14:43 -08:00
Ben Alpert e01f90784f [ReactNative] Update core RN modules to work with React 0.14-beta1 2015-07-23 18:07:59 -08:00
Hedger Wang 8dd1256c25 [Navigation] Implements NavigationContextFuture 2015-07-22 10:50:51 -08:00
Hedger Wang 280347d66a [Navigator]: Add method `indexOf` and `slice` to NavigationRouteStack 2015-07-22 10:46:57 -08:00
Eric Vicenti 35aa9f3b97 [ReactNative] Remove idStack from Navigator
Summary:
We want to transition to NavigationRouteStack, so we need to simplify and remove all uses of idStack
2015-07-21 13:25:42 -08:00
Eric Vicenti 4f904b5d68 [ReactNative] Remove Navigator onItemRef
Summary:
Re-landing D2229686 after fixing bugs mentioned in D2250586

onItemRef is old and no longer needed now that the parent renders the scenes. This removes it from Navigator and all of our clients.

This is a breaking change to users of Navigator, but it is easy to transition to a ref in renderScene instead
2015-07-21 09:28:29 -08:00
Hedger Wang 6e2f07fb81 [Navigator] Add a callback that is called after emitting an event.
Summary:
While adeveloper requests the emitter to emit an event, the emitter
may not emit the event immediately instead of putting the request
into a queue and process it later.

This diff allows the developer to provide a callback which will be called
when the event has been emitted.

For instance:

```
class NavigationContext {
  push(nextRoute) {
    var nextStack = this._stack.push(nextRoute);
    this.emit(
      'change',
      {
        reason: 'push',
        nextStack: nextStack,
        nextRoute: nextRoute,
      },
      this._onPush
    );
  }

  _onPush(event){
    if (event.defaultPrevented) {
      return;
    }
    this._stack = event.nextStack;
    this.emit('change');
  }
}
```
2015-07-20 21:49:58 -08:00
Matheus Santos 6213950334 Added transitions 'VerticalUpSwipeJump' and 'VerticalDownSwipeJump' in…
Summary:
… NavigatorSceneConfigs
Closes https://github.com/facebook/react-native/pull/1822
Github Author: Matheus Santos <matheus.santos@struct.com.br>
2015-07-20 12:53:54 -08:00
Martín Bigio 95dc38929c [rn] revert D2201593 2015-07-20 11:48:08 -08:00
Martín Bigio 0d91b93aba [LAUNCH-BLOCKER] Revert JS callsite of D2201593 2015-07-20 11:48:07 -08:00
Eric Vicenti c28d33f3a2 [ReactNative] Remove dependencies on Navigator idStack
Summary:
idStack is going away soon. This removes all references to it. Looking at the internal state of navigator will make you have a bad time.

The biggest change is switching to the new component-freezing techinique in the navigation bars. This way we avoid dependence on the idStack to provide a scalar ID for each route.
2015-07-17 15:28:57 -08:00
Kevin Gozali 77a0cf27f2 [ReactNative] Revert onItemRef removal 2015-07-16 17:49:56 -08:00
Kevin Gozali 5ec60effea [ReactNative] revert 'unbreak navigation due to onItemRef removal' 2015-07-16 17:49:56 -08:00
Hedger Wang 326a66ba07 [ReactNative][Navigation]: Add method `preventDefault()` to `NavigationEvent` 2015-07-16 17:35:21 -08:00
Hedger Wang fca16fbe40 [ReactNative] unbreak navigation due to onItemRef removal 2015-07-16 13:41:20 -08:00
Mr Speaker 09236ccbe7 Allow horizontal ListView. Rename height -> size
Summary:
Infinite scrolling in horizontal ListViews. Rather than just using height and Y offset to determine when to load more rows, it checks `props.horizontal` and switches between width/height and offset X/Y accordingly.

This changed required some renaming. However, the only change external to `ListView.js` is exporting `contentSize` instead of `contentHeight` from the `getMetrics()` function. (This is not part of the API, but is used "for perf investigations or analytics" and isn't reference in the repo).

I believe this change works as expected (and the xcode tests pass) though it's possible that there may more complexity in this issue that I have overlooked.
Closes https://github.com/facebook/react-native/pull/1786
Github Author: Mr Speaker <mrspeaker@gmail.com>
2015-07-15 10:13:12 -08:00
Eric Vicenti c3e75393ab [ReactNative] Remove Navigator onItemRef
Summary:
onItemRef is old and no longer needed now that the parent renders the scenes. This removes it from Navigator and all of our clients.

This is a breaking change to users of Navigator, but it is easy to transition to a ref in renderScene instead
2015-07-14 14:56:16 -08:00
Martín Bigio 691a1dafd1 s/RKScrollViewManager/RCTScrollViewManager 2015-07-14 07:52:30 -08:00
Spencer Ahrens e5f7200213 [ReactNative] Fix crash in ListView 2015-07-13 12:36:56 -08:00
James Ide 9f07b9a2b6 [ListView] Operate on the true scroll responder instead of the scroll component
Summary:
When composing scroll views, `this.refs[SCROLLVIEW_REF]` may refer to another higher-order scroll component instead of a ScrollView. This can cause issues if you expect to need it to be a ScrollView backed by an RCTScrollView.

The solution is to call `getScrollResponder()` - as long as all higher-order scroll components implement this method, it will make its way down to the true ScrollView, which is what ListView wants here.

Closes https://github.com/facebook/react-native/pull/1927
Github Author: James Ide <ide@jameside.com>
2015-07-13 12:36:55 -08:00
Hedger Wang 21b98b23c9 [Navigator] Introducing NavigationRouteStack.
Summary:
Introducing the data structure NavigationRouteStack that focused on managing
navigation routes stack.

The goal is to make <Navigatior /> thinner by moving stack management logic into
its own class and make sure it's well-tested.

Teh next step will be cleaning up <Navigatior /> and add `NavigationRouteStack` to
`NavigationContext`.
2015-07-08 16:58:11 -08:00
Jani Evakallio b5c1cd7918 [Navigator] Guard `navigator.state.routeStack` from accidental mutation
Summary:
A minor improvement suggestion: `Navigator.getCurrentRoutes()` probably shouldn't return its `routeStack` backing array as-is, because the caller may mutate it, causing the internal state of the navigator to go out of sync. Instead a shallow copy of the routes should be returned.

I stumbled on this problem in my app by attempting to read the navigator state as follows:
```
let routes = Navigator.getCurrentRoutes();
let current = routes.pop();
let previous = routes.pop();
```

Which led to an exception at next navigation event.

CLA signed.

Closes https://github.com/facebook/react-native/pull/1888
Github Author: Jani Evakallio <jani.evakallio@gmail.com>
2015-07-08 12:49:52 -08:00
James Ide b3e0a702a7 [ListView] Allow different types of ScrollView to be composed
Summary:
This enables code like:
```js
<ListView renderScrollView={() => <CustomScrollView />} />
```

where CustomScrollView might be inverted or support pull-to-refresh, etc.
Closes https://github.com/facebook/react-native/pull/785
Github Author: James Ide <ide@jameside.com>
2015-07-08 02:35:29 -08:00
Martín Bigio 66d3f3c616 [rn] Keep native ListView child frames in sync on JS wrapper
Summary: At the moment the `ListView.js` `_childFrames` variable is only updated on scroll. As a consequence, `onChangeVisibleRows` won't get triggered for the initial render, nor any future render not trigered by scroll events. To fix this we need to make sure native and JS have the child frames in sync.
2015-07-07 07:40:56 -08:00
James Ide fe7edf0860 [ListView] Defer measurement one frame after componentDidMount to fix error
Summary:
When `UIManager.measure` is called from `componentDidMount` it causes the error "Attempted to measure layout but offset or dimensions were NaN". Deferring the layout by one frame solves this problem. Layout measurement is already asynchronous anyway, so I believe adding the `requestAnimationFrame` call doesn't affect the program's correctness.

Fixes #1749

Closes https://github.com/facebook/react-native/pull/1750
Github Author: James Ide <ide@jameside.com>

Test Plan:
 Load UIExplorer and no longer get a redbox that says "Attempted to measure layout but offset or dimensions were NaN".
2015-06-26 10:26:07 -08:00
Eric Vicenti e3e60983e6 [ReactNative] Navigator improved willFocus logic
Summary:
This makes sure to call willFocus before new scenes get mounted. This fixes cases where the keyboard is dismissed on willfocus events which incorrectly happens *after* the autofocus in a new scene. The keyboard was opening and getting immediately closed

@public

Test Plan: Test keyboard autofocus in new nav scenes on iOS
2015-06-25 14:45:23 -08:00
Eric Vicenti 7963add0d5 [ReactNative] Revamp Navigator scene cache strategy
Summary:
Updating range is too complicated. We can keep cached versions of the previously rendered scenes in a map.

@public

Test Plan: Verify that the active scene is the only thing that get re-rendered, and that rendering doesn't happen during transitions or gestures. Test navigation thouroughly in AdsManager
2015-06-25 10:36:49 -08:00
Alex Kotliarskyi 01d2df8c86 [ReactNative] NavigationContext-test mock fix for OSS 2015-06-24 13:37:46 -08:00
Eric Vicenti 0c38229e8e [Navigator] Fix overswipe to -1, move guard 2015-06-22 17:00:52 -08:00
Eric Vicenti d105ae7e51 [AdsManager] Fix Navigation focus events for logging 2015-06-22 16:44:32 -08:00
Spencer Ahrens 5b476d0e41 [ReactNative] Fix manual ListView loading
Summary:
@public

If something changes in the list view that should trigger more loads, it
wouldn't.  Example case is tap to load more - only the first new row would load,
but it wouldn't trigger a re-measure and subsequent layout of additional new
rows.

Test Plan: View More in Events works.
2015-06-22 13:37:30 -08:00
Hedger Wang 7f54506f96 <Navigator />: Fix the getter for `navigationContext`.
Summary:
@public
The current getter for `navigationContext` always return a static
context, and it should return an instance-based one, instead.

Test Plan:
Use console.log() in inspect that two different navigators do
have their own `navigationContext` created.
2015-06-22 12:02:55 -08:00
Hedger Wang 93e98da908 [Navigator]: Add a getter to get the current route that is focused from the navigation context. 2015-06-19 16:12:51 -08:00
Hedger Wang e78b8c40fe [oss][react-native] unbreak NavigationEventEmitter-test 2015-06-17 14:13:05 -08:00
Hedger Wang 0a875790f5 [Navigator]: Allow developer to observe the focus change events from the owner or the children
of the navigator component.

Summary:
Per offline discussion with @evv, we'd like to deprecate the `onDidFocus` and `onWillFocus`
API that makes it really hard for the descendent children of a navigator to observe its focus
change events.
@public

Since for now the descendent children do have access to the navigator via `this.props.navigator`,
this diff makes it easy to observe the focus change event by doing:

```
this.props.navigator.addListener('willfocus', this._onFocus);
```

The goal is to make the event system in navigator more useful and maintainable.

Test Plan:
Test Video: https://www.facebook.com/pxlcld/mrzS
1. jest:  ./Libraries/FBReactKit/js/runTests.js NavigationEventEmitter
2. Load UI Explorer: <Navigator />, see console logs that shows the focus change events fires.
2015-06-16 09:09:08 -08:00
James Ide 3393b86534 [ListView] Update curRenderedRowsCount when data source changes
Summary:
When a new data source is provided, update `curRenderedRowsCount` in addition to `prevRenderedRowsCount`. What was happening is that I had an empty data source, so `curRenderedRowsCount` and `prevRenderedRowsCount` both settled at zero after the first few frames and `curRenderedRowsCount` wasn't getting increased when the data source was updated.

I also changed the `setState` calls to use the transactional API since several of the new state values are computed from the old ones.

Maybe fixes #1547
Closes https://github.com/facebook/react-native/pull/1612
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-15 13:30:17 -08:00
Eric Vicenti f8482411f9 [AdsManager] Improve animation configurations 2015-06-10 23:35:52 -08:00
Eric Vicenti 4690983c10 [AdsManager|ReactNative] Remove contextual navigation from Navigator 2015-06-10 01:13:43 -08:00
Andy Street 0a3fca9520 [react_native] JS files from D2130816: [react_native] Don't render crumb container to texture 2015-06-09 03:09:17 -08:00
Eric Vicenti f6528171d0 [ReactNative] Fix navigator touch-blocking logic
Summary:
The logic for this is incorrect when the `state.transitionToIndex === 0`, and will return false and not capture the touch.

@public

Test Plan: Try to repro bugs on device and simulator
2015-06-08 11:20:12 -08:00
Eric Vicenti 219a7c1bfd [ReactNative] Navigator block touches on scene when navigating 2015-06-01 16:35:43 -08:00
Spencer Ahrens 34cef28a10 [ReactNative] kill setInterval in ListView 2015-06-01 13:34:06 -08:00
Alex Kotliarskyi 228dc5f936 [MAdMan] Possibly fix "Cannot find breadcrumb interpolators for -1" 2015-05-29 11:23:40 -08:00
Changgeng Li 84783dbac4 Add renderSeparator support to ListView 2015-05-26 15:20:29 -08:00
Eric Vicenti 5bad316678 [ReactNative] Navigator de-contextualize popToRoute 2015-05-22 11:56:55 -08:00
Eric Vicenti 62c556c785 [ReactNative] Navigator context setHandler refer by index 2015-05-22 11:44:49 -08:00
James Ide 7f51f9c8a9 [Navigator] Support the `ref` prop on scene roots
Summary:
Navigator overrides the `ref` prop of scene components so that it can call `onItemRef` and do internal bookkeeping. With callback refs, we can additionally call the original value of the `ref` prop as long as it's a function (that is, string refs are not supported). Note that the `ref` prop is moved to `reactElement.ref` out of `reactElement.props.ref`, which is why this diff accesses `child.ref`.

This diff adds support for callback refs and warns helpfully if a string ref was provided. It should be completely backwards compatible since scenes couldn't have been relying on the `ref` prop before.

cc @ericvicenti

Closes https://github.com/facebook/react-native/pull/1361
Github Author: James Ide <ide@jameside.com>

@public

Test Plan:
 Write a renderScene implementation that puts a callback ref on the root component:
```js
renderScene() {
  return <View ref={component => console.log('yes! this is called')} />;
}
```
2015-05-21 11:01:09 -08:00
Eric Vicenti c1609bcab8 [ReactNative] Navigator fix for sceneStyle
Summary:
Fixes https://github.com/facebook/react-native/issues/1332

When the absolute left position is not set to zero on a provided sceneStyle, scene enabling is broken and no scene will be visible when it is pushed. This was broken recently when the scene disabling was modified to push the scenes offscreen.

Closes https://github.com/facebook/react-native/pull/1347
Github Author: Eric Vicenti <evv@fb.com>

@public

Test Plan:  Tested when pushing a scene Navigator in the UIExplorer example while sceneStyle is set on the Navigator
2015-05-19 18:54:15 -08:00
Eric Vicenti 97137e8bcc [ReactNative] Navigator clean scenes popped with gesture
Summary:
Fixes https://github.com/facebook/react-native/issues/1252

Scenes dismissed/popped via a gesture were not being removed. This is probably a regression from an earlier refactor.

Test plan: log statements after scene focusing now reports that `navigator.getCurrentRoutes().length` lowers after gesture. Tested on UIExplorer Navigator example
Closes https://github.com/facebook/react-native/pull/1346
Github Author: Eric Vicenti <evv@fb.com>

@public

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-05-19 18:45:42 -08:00
Spencer Ahrens 11b515b1b0 [ReactNative] clean lint in all of Libraries/ 2015-05-19 13:47:04 -08:00
Zhao Han 40da7bb835 Add more documentation in ListViewDataSource
Summary:
ListViewDataSource's default data extractor can actually expect another data form:

`{ sectionID_1: [ <rowData1>, <rowData2>, ... ], ... }`
Closes https://github.com/facebook/react-native/pull/1285
Github Author: Zhao Han <cx.chenghai+github@gmail.com>

Test Plan: Changed the ListViewExample to make sure all three formats work.
2015-05-15 13:47:43 -08:00
Yuta Okazaki 75ed1dd49e Fix typo of function name in ListView documentation
Summary:
When I read documents, I usually 'search within page' to see where they talk about specific things.
So I found this fix to be pretty useful. Hope it'll be merged!
Closes https://github.com/facebook/react-native/pull/1146
Github Author: Yuta Okazaki <s04155yo@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-05-14 09:52:19 -08:00
Eric Vicenti 4b5385b2f0 [ReactNative] Fix Navigator resetTo race condition
Summary:
SetState can be somewhat racy. By the time the route state finishes, another resetTo has already happened, so the origional route is no longer in the stack. Hence the redbox invariant "Calling pop to route for a route that doesn't exist!"

This could also be fixed in product code by not calling resetTo rapidly, but the navigator should be resilient to such shenanigans

@public

Test Plan: Cannot get AdsManager crash t7031976
2015-05-13 12:17:31 -08:00
Ben Alpert a0440daf98 [react-native] Codemod .getNodeHandle, .getNativeNode to React.findNodeHandle 2015-05-13 13:24:37 -07:00
Logan Bernard 2ed2d20dfe FloatFromLeft animation
Summary:
float from left animation for Navigator.SceneConfigs

#1100
@ericvicenti
@ide
Closes https://github.com/facebook/react-native/pull/1249
Github Author: Logan Bernard <bernard.logan4@gmail.com>

@public

Test Plan: Video: https://drive.google.com/file/d/0B9HtmABaCcR0Zi1yNkl5UDhWbzg/view
2015-05-13 13:24:37 -07:00
James Ide 6a699302c8 [Navigator] Pass route into onItemRef
Summary:
The index alone isn't so useful; pass the route as well. (I am using this to implement componentWill/DidFocus in a library instead of onWill/DidFocus; #1153).

Closes https://github.com/facebook/react-native/pull/1154
Github Author: James Ide <ide@jameside.com>

@public

Test Plan:  Set up a navigator with a couple of scenes, and see that when onItemRef is called for each one, the route is passed in as the third argument.
2015-05-13 13:24:37 -07:00
Eric Vicenti 1a68585990 [ReactNative] Navigator fix rapid gesture breakage
Summary:
When gesturing rapidly between scenes, the navigator can get into an unresponsive state. A few minor fixes can avoid that case

@public

Test Plan: Rapid gestures on iOS device and simulator can no longer get into bad state
2015-05-13 13:24:36 -07:00
Eric Vicenti 02d875869a [ReactNative] Fix Navigator empty scene issue
Summary:
In some situations, when quickly swiping back to a scene we are transitioning from, the scene is blank/missing. This is fixed by adding a check for the active gesture when we hide the scenes.

@public

Test Plan: Can no longer reproduce on simulator when quickly swiping back to the scene we are transitioning from
2015-05-13 13:24:36 -07:00
Eric Vicenti aa19232609 [ReactNative] Fix case where scenes are not reset on gesture detaching
Summary:
Sometimes, when quicly backing out of a gesture, the scene isn't fully reset to the middle position and remains offset by a few pixels. This makes sure that never happens.

@public

Test Plan: Tested on iOS and I can no longer see the scenes stop when backing out of a gesture
2015-05-13 13:24:35 -07:00
Eric Vicenti a852227279 [ReactNative] Improve Navigator start gesture logic
Summary:
Previously it was possible for a gesture to be granted initiated if the start direction is not respected before the gesture detection distance gets reached, if the gesture direction is met eventually. This change ensures the gesture gets started in the right direction, otherwise the gesture action will set the responder.

@public

Test Plan: Fixes left-right swiping issue in AdsManager when a vertical swipe is intended.
2015-05-13 13:24:35 -07:00
Eric Vicenti 40e3f6ea8c [ReactNative] Navigator initialRoute default change
Summary:
The default initialRoute was the first route, but it makes more sense for the default initialRoute to be the last route in the initialRouteStack.

Updated the docs to reflect that.

@public

Test Plan: Updated call sites and checked that they work. Not many places use initialRouteStack yet.
2015-05-06 11:18:55 -08:00
Eric Vicenti 86cfcbc77e [ReactNative] Navigator fix opacity reset for presented scene
Summary:
jumpN will call enableScene for the dest scene, which makes sure the scene can be made visible, but we need to avoid resetting the opacity for it when it is already the presented scene. There is already a check to make sure we don't reset opacity for the transitioningFrom scene.

@public

Test Plan: Fixes the issue on Android device when jumping to a scene that is already presented
2015-05-05 14:30:29 -08:00
jmstout 929b2999c4 Fix a bug in the Navigator's gesture.edgeHitWidth implementation
Summary:
Should resolve #1081

cc @ericvicenti
Closes https://github.com/facebook/react-native/pull/1082
Github Author: jmstout <git@jmstout.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.

Revert Plan: This seems legit, but I'm not qualified to review.
2015-05-05 06:26:51 -08:00
Eric Vicenti 50de4a67b0 [ReactNative] Navigator use flattenStyle
Summary:
A hack was implemented in Navigator to do this manually, but there is a proper function to get these styles for setting native props

@public

Test Plan: Testing Navigator behavior on iOS and Android
2015-05-04 14:33:25 -08:00
Eric Vicenti 548a0a6a4f [ReactNative] Fix Navigator scene hiding logic
Summary:
Scenes with 0 opacity are being rendered on top of other scenes with full absolute positioning. On iOS this is fine, because the platform will not send touch events to a view with no opacity. On Android is poses a problem because the view on top, even with no opacity, is catching the touch events for the presented scene below.

This change enhances the scene enabling and hiding logic, has better naming, and improves the documentation of it.

@public

Test Plan: Tested transitions and gestures in slow motion on iOS and Android
2015-05-04 08:54:19 -08:00
Eric Vicenti c0d77dbe9c [ReactNative] Navigator pop specify route to pop
Summary:
Now you can pass a route to the pop function in the navigator context, and the Navigator will pop that scene off the stack and every scene that follows.

This changes the request API that bubbles up to the top-level navigator. The `pop` request had previously taken a route for `popToRoute`, but that is a more obscure use case. This makes the request API more closely match the context method naming.

@public

Test Plan: Verified this works by popping several routes in AdsManager. Experimented with UIExplorer Navigator example to make sure popToRoute still works as expected
2015-05-01 18:11:13 -08:00
Eric Vicenti 28e6e993c6 [ReactNative] Navigator focus handler context fix 2015-05-01 17:01:58 -08:00
Eric Vicenti 5453be2ab2 [ReactNative] Fix touch issue caused by D2036644 after swiping back 2015-05-01 16:15:28 -08:00
Eric Vicenti 6abf37b47e [ReactNative] Navigator.Interceptor handler arg fix 2015-05-01 14:20:09 -08:00
Eric Vicenti 76dc14684d [ReactNative] Navigator block touches to non-active scenes
Summary:
When tapping a link quickly, it will cause two scenes to be pushed on. This prevents against that case by swallowing touches for all non-active scenes.

@public

Test Plan: Can no longer double-push scenes
2015-04-30 15:49:37 -08:00
Eric Vicenti 08ec846176 [ReactNative] Fix logic in popToRoute 2015-04-29 20:52:32 -08:00
Andy Street c82c6a07ae [react_native] JS files from D2027859: [react_native] Fix ToTheLeft wizard transitions 2015-04-29 04:49:43 -08:00
Eric Vicenti 349f8b942a [ReactNative] Avoid Navigator invariant in edge case
Summary:
It is very rare, but sometimes there is no active gesture when the responder gets released. This will avoid a redbox in that case

@public

Test Plan: Saw the redbox. No longer see the redbox. Hardcoded missing activeGesture while responder and verified no redbox
2015-04-28 23:53:39 -08:00
Eric Vicenti 9209c444c7 [ReactNative] Androidized Navigator animations
Summary:
Added configurations for android-like animations, with gestures disabled.

@public

Test Plan: Tested on AdsManager Android
2015-04-28 13:10:49 -08:00
Eric Vicenti 8afdf30363 [ReactNative] Navigator refactor and improvements 2015-04-27 21:37:33 -08:00
Eric Vicenti ec3d70e738 [ReactNative] Quiet Navigator context warning 2015-04-27 17:31:12 -08:00
Eric Vicenti 6749f88650 [ReactNative] Fix Navigator resetTo 2015-04-27 17:18:52 -08:00
Eric Vicenti 36afc46274 [ReactNative] Fix for Navigator.replacePreviousAndPop 2015-04-23 14:19:44 -08:00
Eric Vicenti 7aa413d619 [ReactNative] Fix Android back btn regression from D2010265 2015-04-22 10:06:10 -08:00
Eric Vicenti 40eeaf5b37 [ReactNative] Navigator contextual popToRoute and imperitive vs contextual docs 2015-04-21 13:27:44 -08:00
Eric Vicenti 45c10ffc53 [ReactNative] Navigator touch grant bug from D2001635 2015-04-21 11:26:53 -08:00
Andy Street b0348edcae [react_native] JS files from D2001635: [react_native] Use hardware layers during adsmanager Navigator navigation 2015-04-21 04:10:52 -08:00
Philipp von Weitershausen dbe8e31c20 [ReactNative][Navigator] Remove another unnecessary use of absolute screen width 2015-04-17 15:02:48 -08:00
Eric Vicenti e382894ef3 [ReactNative] Navigator fix BackAndroid warning on iOS 2015-04-16 10:28:19 -08:00
Eric Vicenti b3a2d6c574 [ReactNative] Navigator initially render all scenes 2015-04-16 10:19:52 -08:00
Eric Vicenti 699a9c3e0c [ReactNative] Fix focusing of nested Navigators 2015-04-10 17:58:30 -08:00
Eric Vicenti 75d52b0f33 [ReactNative] Avoid navigator scene renders during transition 2015-04-10 15:13:00 -08:00
Eric Vicenti 50959dd42c [AdsManager|ReactNative] Switch to contextual request pop instead of parentNavigator 2015-04-10 12:54:07 -08:00
Eric Vicenti 839e533955 [ReactNative] Re-configure horizontal swipe animations 2015-04-08 21:13:32 -08:00
Philipp von Weitershausen ae76d3982b [MAdMan] Dimensions.get('window') considered harmful 2015-04-08 18:08:23 -08:00
Josh Levine be46ccf4c4 Navigator: Changed transitioner background color to 'transparent'
Summary:
... for setting the transition background color between scenes. For issue #563
Closes https://github.com/facebook/react-native/pull/654
Github Author: Josh Levine <josh.levine1@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-04-08 16:37:26 -08:00