Compare commits

...
443 Commits
Author SHA1 Message Date
Mike Grabowski 37cc5cfb0c [0.27.0] Bump version numbers 2016-06-06 10:21:36 +02:00
Eloy DuránandMike Grabowski 41fa6e7f45 Add C++ and standard v14 settings.
Summary:
This PR adds the C++ stdlib to the linker flags and sets the C++ standard that’s used to v14.

I have tested this with my app, without it any CP build would fail unless users add those flags to the generated projects themselves.

/cc grabbou
Closes https://github.com/facebook/react-native/pull/7800

Differential Revision: D3360421

fbshipit-source-id: 0a80030dd255f073a201acc6e1c846be114c2c2a
2016-06-06 10:19:25 +02:00
Konstantin Raev 8b734173d3 [0.27.0-rc3] Bump version numbers 2016-06-05 19:47:08 +01:00
Konstantin Raev 252102588d [0.27.0-rc.3] Bump version numbers 2016-06-05 17:19:23 +01:00
Martin Konicek 76003f3720 [0.27.0-rc2] Bump version numbers 2016-05-27 16:51:49 +01:00
Eric RozellandMartin Konicek 3cabf4f98f Update node-haste dependency to 2.12.0
Summary:
Update to node-haste 2.12.0 to support pass through configuration of supported platforms.
Closes https://github.com/facebook/react-native/pull/7660

Differential Revision: D3335034

Pulled By: mkonicek

fbshipit-source-id: d238b90a90d51654301d61251ceb26d183fef57a
2016-05-27 16:42:19 +01:00
Mike Grabowski bbccdd5b84 [0.27.0-rc1] Bump version numbers 2016-05-25 02:26:29 +02:00
David AurelioandMike Grabowski cacf6b1267 Respect original enumerability/writability when polyfilling globals
Summary:
Reuses the original property descriptor when overwriting / polyfilling globals to ensure enumerability and writability are the same
Closes https://github.com/facebook/react-native/pull/7704

Differential Revision: D3338119

Pulled By: davidaurelio

fbshipit-source-id: ab456324a3346cd3ec8b2c3e3a2378408c92087c
2016-05-25 01:55:58 +02:00
Konstantin RaevandMike Grabowski 934acd809d Made npm deployment to be independent of git tags cache
Summary:
Fixes npm deployment script as in https://circleci.com/gh/facebook/react-native/6745.

Example situation:
- admin is ready to release 0.26.0
- admin adds tag v0.26.0 and pushes to origin
- Circle CI build fails because of code error
- admin cherry-picks a fix and tags v0.26.0 again and pushes to origin
- Circle does not update local tag v0.26.0 because it already has it cached, compiles the code but fails to deploy to npm because v0.26.0 is not on branch HEAD from Circle point of view

The previous version of the script was checking the tags on current commit as well but it used the local branch tags.
This change fetches tags from `origin` fresh and allows us to redeploy the same version multiple times.
Closes https://github.com/facebook/react-native/pull/7619

Differential Revision: D3334469

fbshipit-source-id: b423fc19516dc4f5f7f2605224e62b8a378c8a7d
2016-05-25 01:53:59 +02:00
Marc HorowitzandMike Grabowski 24a806a9f1 Fix chrome debugging on android
Summary:
Java loadApplicationScript changed, but the C++ code in the
debug ProxyExecutor which called it did not.  This fixes the fbjni
method lookup.

fixes #7659

Reviewed By: AaaChiuuu

Differential Revision: D3331472

fbshipit-source-id: 33312dccc3c7687f51742e42f9e0397f9c925e76
2016-05-25 01:53:29 +02:00
James Ide 7d1b4d681a [React] Use React 15.1.0 and stop using the alpha 2016-05-23 11:16:31 -07:00
Mike Grabowski 0f9e31cce8 [0.27.0-rc] Bump version numbers 2016-05-20 20:23:00 +02:00
Hugo AgbononandFacebook Github Bot 0 bc634ea350 More helpful error message when react-native start is forgotten
Summary:
Developing with react-native on Linux, I found myself facing this message:

![chpao3jwuaehr_p jpg large](https://cloud.githubusercontent.com/assets/1598317/15032665/ae90ee88-1263-11e6-9acd-3fe261c08c28.jpeg)

The problem is actually quite simple: I hadn't used `react-native start` before starting `react-native run-android`, which caused this error, both on an emulator and a real Android device. As the message is currently unhelpful, but can be shown because of a simple mistake, I updated it.

~~Additionally, I clarified the fact that `react-native start` is still necessary on Linux, updating a title on the Linux and Windows Support documentation page.~~
Closes https://github.com/facebook/react-native/pull/7396

Differential Revision: D3305078

fbshipit-source-id: 2d87e02ff2ad15d8239fbcc0ada4a4e67b982e94
2016-05-20 09:13:27 -07:00
dmueller39andFacebook Github Bot 8 0aea74ebea Fixed incorrect rows reported in onChangeVisibleRows
Summary:
There is a bug in onChangeVisibleRows when the renderSeparator is not null. The _updateVisibleRows function does not account for the presence of separator frames in the  _childFrames array.

When renderSeparator is not null, increment the totalIndex an additional
time for each row that isn't the last in its section, or the last in the entire
list.

This continues a slightly brittle precedent of having a set of parallel conditions in render and _updateVisibleRows. (i.e. renderSectionHeader is used in both functions, in render as a condition to create a sectionHeader, and in _updateVisibleRows as a condition to increment the totalIndex.

Before change:
![yeeqnmvmif](https://cloud.githubusercontent.com/assets/9422359/14515342/38543952-01c7-11e6-984c-7c1a3fc3d820.gif)

After change:
![gzbrljclzm](https://cloud.githubusercontent.com/assets/9422359/14515340/3296e294-01c7-11e6-8ae9-1ad313600956.gif)

Built using https://gist.github.com/dmueller39/f95028f6fe8bd251944bb604e51f18b2
Closes https://github.com/facebook/react-native/pull/6965

Differential Revision: D3328001

Pulled By: vjeux

fbshipit-source-id: 977e54382ee07be7a432a54febafcae6acaae905
2016-05-20 08:13:23 -07:00
Alexander BlomandFacebook Github Bot 2 d6c2f5f3f1 Don't find module methods until needed
Reviewed By: astreet

Differential Revision: D3322974

fbshipit-source-id: 4cb47cc2ebdffd77b62c5d54e65574d44eba286e
2016-05-20 07:28:26 -07:00
Eric RozellandFacebook Github Bot 2 ef21d99ded Adds packager configuration to support windows platform
Summary:
This pull request is a prerequisite to enabling the react-native-windows platform extension.

In the Resolver component, we need to add 'windows' to the list of platforms that are allowed in the DependencyGraph.  We also need to add 'react-native-windows' (the name of the Windows platform extension NPM module) to the `providesModuleNodeModules` option. This allows the node_module folder check in the DependencyGraphHelper from node-haste to be bypassed for *.windows.js files in the Windows NPM package.

For good measure, I also included a change to blacklist.js to ensure .windows.js files are ignored when the packager is parameterized on a platform.
Closes https://github.com/facebook/react-native/pull/7639

Differential Revision: D3327771

Pulled By: mkonicek

fbshipit-source-id: d1080b045ff6aa0cbf05d8070ceb0eb4cdb6dceb
2016-05-20 05:28:38 -07:00
Mike GrabowskiandFacebook Github Bot 9 149d0b91c2 Merge rnpm into react-native
Summary:
This is initial (first step) in the merging process. For now, we are just going to move our code as is into `local-cli` folder (first commit). There were other tweaks made in separate commits to make it easier to go through the code as the diff is expected to be rather large. The purpose of this is to make it easier to start working in small batches and improving the CLI incrementally on a daily basis.

Current codebase will still leave in `rnpm` organisation on Github where we keep working on new features, bugs and ship releases to `npm` until we finish our integration and provide a nice interface for users to migrate (in case it changes at all)

Flow, Jest and npm will ignore this folder for now until we integrate it properly.

Tests are to be rewritten from mocha to jest in `rnpm/link`. We will hook them all up as soon as we start using them in local-cli.

For now, there's no point in having them running and possibly breaking the builds.

We will announce next steps with Kureev later this week
Closes https://github.com/facebook/react-native/pull/7550

Differential Revision: D3327772

Pulled By: mkonicek

fbshipit-source-id: 90faa4bd78476d93ed21b1253e0d95c755d28a30
2016-05-20 04:58:26 -07:00
Andrej BadinandFacebook Github Bot 9 00c77800c9 Improve Docs navigation on handheld devices.
Summary:
Fixes #7519

JS detects handheld device by sniffing UA string (very primitive detection). If on handheld device, event listener is registered. Event handler toggles Docs Navigation overlay after clicking on "Docs" nav button.
Original Docs Navigation panel is taken out of the natural page flow using pure CSS and is styled to look "good" on device.  As a result of this, Navigation overlay is ONLY visible when you are at Docs page, otherwise "Docs" nav button takes you Docs page first.

iPhone/iPad previews
![iphone](https://cloud.githubusercontent.com/assets/829963/15409630/f1a64b1a-1e15-11e6-92eb-f85c5cd06754.gif)
![ipad](https://cloud.githubusercontent.com/assets/829963/15409631/f1a6f952-1e15-11e6-8f5c-6f89f54e6814.gif)
Closes https://github.com/facebook/react-native/pull/7640

Differential Revision: D3325440

Pulled By: vjeux

fbshipit-source-id: a06b21d743d56bfea5db5b750836856c3af9bbe2
2016-05-20 02:50:08 -07:00
Fred LiuandFacebook Github Bot 4 3ccfb58701 Simplify SwipeableRow styling
Summary: - Removed some styling from `SwipeableRow` that wasn't doing much and made slide out view full height

Reviewed By: fkgozali

Differential Revision: D3322849

fbshipit-source-id: 811eee9032c142c61d303ae7e966d8ef7903adaf
2016-05-19 21:43:42 -07:00
Fred LiuandFacebook Github Bot 4 62e588bece Fix Android flash and iOS juttering
Summary:
Before:
- Android had the slideout row flash upon render due to it being rendered first
- iOS had the left side of each row load first, then rerender to show entire row when `scrollViewWidth` is available

Reason:
- Android was loading the slideout view first without an opacity check
- iOS was loading the swipeable view with width 0 first then stretching to `scrollViewWidth` when it was available via `onLayout`

Fix:
Render swipeable view with `flex: 1` then render slideout view

Reviewed By: fkgozali

Differential Revision: D3321466

fbshipit-source-id: 92a3b5e22034e06d05986ddb8c348796bafbbf34
2016-05-19 21:43:42 -07:00
Chris HopmanandFacebook Github Bot 2 830197847a Move more new bridge code into OSS
Reviewed By: mhorowitz

Differential Revision: D3296231

fbshipit-source-id: 5a05b1ddacdfecda067a08398dd5652df76c1f14
2016-05-19 18:58:53 -07:00
Spencer AhrensandFacebook Github Bot 5 5e91a2a312 Fix 95% of WindowedListView jumpiness
Summary:
- Replace some fixes that were accidentally lost in local rebase that prevent jumpiness when incremental is disabled.
- Require each row to have a key specified by the caller to prevent jumping because of accidental duplicates or unneeded/problematic row re-rendering because of legit re-ordering.

Reviewed By: steveluscher

Differential Revision: D3322006

fbshipit-source-id: 0019aab07cb1fe2b148a14b5818de53aa373eb50
2016-05-19 14:58:26 -07:00
Alexander BlomandFacebook Github Bot 9 942b9332b2 Make BugReporting not pull in native module on require
Reviewed By: astreet

Differential Revision: D3322838

fbshipit-source-id: 4f12fda213b6a4ab7b19d3dafad7f31eb627f85a
2016-05-19 12:58:21 -07:00
Konstantin RaevandFacebook Github Bot 3 6a34c9c3da Disabled flow in e2e test because it causes memory crashes
Summary: Closes https://github.com/facebook/react-native/pull/7620

Differential Revision: D3322029

fbshipit-source-id: e0406770d011956af6b47d15c5b49a68b1b611f5
2016-05-19 03:58:25 -07:00
Leonardo TegonandFacebook Github Bot 6 8a201b842a Fixes syntax typo in DirectManipulation section of docs
Summary:
Fixing JSX tag in DirectManipulation section of the docs
Closes https://github.com/facebook/react-native/pull/7622

Differential Revision: D3321130

fbshipit-source-id: e315529dc94c88597e4855a63ba6931301d4dba7
2016-05-18 19:43:39 -07:00
Spencer AhrensandFacebook Github Bot 2 838d8d4094 adaptive render window throughput
Summary:
Incremental rendering is a tradeoff between throughput and responsiveness because it yields. When we have plenty of
buffer (say 50% of the target), we render incrementally to keep the app responsive. If we are dangerously low on buffer
(say below 25%) we always disable incremental to try to catch up as fast as possible. In between, we only disable
incremental while actively scrolling since it's unlikely the user will try to press a button while scrolling.

This also optimizes some things then incremental is switching back and forth.

I played around with making the render window itself adaptive, but it seems pretty futile to predict - once the user
decides to scroll quickly in some direction, it's pretty much too late and increasing the render window size won't help
because we're already limited by the render throughput at that point.

Reviewed By: ericvicenti

Differential Revision: D3250916

fbshipit-source-id: 930d418522a3bf3e20083e60f6eb6f891497a2b8
2016-05-18 17:13:23 -07:00
Fred LiuandFacebook Github Bot 6 514677525a Prevent SwipeableRow bleed
Summary: Default image icon size for Quick Actions could cause slideout view to bleed over the slideable view. All styling has been removed and must now be passed in, thus allowing every caller to control size for best fit.

Reviewed By: furdei

Differential Revision: D3315696

fbshipit-source-id: 8f8b3d2cf7a005d42a18d434d9e0080c64597be0
2016-05-18 16:43:20 -07:00
Alexander BlomandFacebook Github Bot 7 dc6a44713d Refactor BugReporing to avoid multiple registers
Reviewed By: sahrens

Differential Revision: D3316146

fbshipit-source-id: 80df4ea73150ba6920a03fe336b3ddb207ba535a
2016-05-18 14:28:26 -07:00
Hedger WangandFacebook Github Bot 7 7db7f78dc7 Fork NavigationAnimatedView to NavigationTransitioner
Summary:
- Fork NavigationAnimatedView to NavigationTransitioner
- NavigationAnimatedView will soon be deprecated and we'd ask people to use NavigationTransitioner instead.

Difference between  NavigationTransitioner and NavigationAnimatedView

- prop `applyAnimation` is removed.
- new prop `configureTransition`, `onTransitionStart`, and `onTransitionEnd` are added.

tl;dr;

In NavigationAnimatedView, we `position` (an Animated.Value object) as a proxy of the
transtion which happens whenever the index of navigation state changes.

Because `position` does not change unless navigation index changes, it won't
be possible to build animations for actions that changes the  navigation state
without changing the index.

Also, we believe that the name `Transitioner` is a better name for this core component
that focuses on transitioning. Note that the actual animation work is done via
`<Animated.View />` returnd from the `renderScene` prop.

Reviewed By: ericvicenti

Differential Revision: D3302688

fbshipit-source-id: 720c3a4d3ccf97eb05b038baa44c9e780aad120b
2016-05-18 13:43:31 -07:00
Joe NoonandFacebook Github Bot 7 0e997c6eab fixes a bug where NavigationPropTypes.SceneRenderer was a plain object
Summary:
... used as both a shape and plain object.

this splits them out so both parts can be used as needed.

NavigationPropTypes.SceneRenderer is a PropTypes shape
NavigationPropTypes.SceneRendererProps is the plain object that makes up the shape.
Closes https://github.com/facebook/react-native/pull/7518

Differential Revision: D3317322

Pulled By: ericvicenti

fbshipit-source-id: e8a31e05130e6647b63f68dbef31bc874550948c
2016-05-18 13:13:29 -07:00
Marc HorowitzandFacebook Github Bot 5 6796f136f1 shut down JSC before quitting its thread
Differential Revision: D3280544

fbshipit-source-id: 2a3ef2c445aaa1b224ac391b020467e087c0b81d
2016-05-18 12:58:47 -07:00
Marc HorowitzandFacebook Github Bot 5 779314a413 Implement incremental module requires
Differential Revision: D3234844

fbshipit-source-id: 24615528ad6a049aad7c2dbb7ce55e8b034c79e7
2016-05-18 12:58:47 -07:00
Fred LiuandFacebook Github Bot 0 7f1346bfdd Top align quick action buttons
Summary: Top align the button icons

Reviewed By: fkgozali

Differential Revision: D3317805

fbshipit-source-id: b385f9f4e41db1253bb4d523cb07093c63e39da0
2016-05-18 12:43:24 -07:00
Alex KotliarskyiandFacebook Github Bot 0 858643dbdf Add transform-react-jsx-source to react-native preset
Summary:
Putting this up as request for comments.

The PR adds [transform-react-jsx-source](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source) to the list of plugins that come by default with the `react-native` preset. It will enable the use of a bunch of really cool tooling around JSX, however those are generally useful only in development mode. Is changing `react-native` preset the right thing to do in this case? Is there a way to enable this transform only in DEV? Should I add this somewhere else?
Closes https://github.com/facebook/react-native/pull/6351

Differential Revision: D3302906

Pulled By: frantic

fbshipit-source-id: 012d3a4142168f9f90d30d1686115d4dc3996eb9
2016-05-18 12:43:24 -07:00
Joel MarceyandFacebook Github Bot 3 18e1b1f197 Best effort selection of target platform and dev environment
Summary:
Right now, if you do a search and select a document in Getting Started, it will
always default to iOS/Mac. This adds a bit of JavaScript to do a best effort
selection based on the hashtags of the headers.

If a header is associated with multiple environments (e.g., Android Studio), we
just choose the first one. So it is not 100% perfect, but it is decent.

ref: https://github.com/facebook/react-native/issues/7574

** Test Plan **

Test locally by adding hash tags to the end of a doc URL and ensured that the toggler had the right
selection.

e.g., `http://localhost:8079/react-native/docs/getting-started.html#chocolatey` had `Android` and `Windows` chosen.
Closes https://github.com/facebook/react-native/pull/7608

Differential Revision: D3316802

Pulled By: JoelMarcey

fbshipit-source-id: 6e94d76725fb97b19b3708ddee8fba5df9350cdd
2016-05-18 09:13:24 -07:00
Konstantin RaevandFacebook Github Bot 2 42e517b7a3 Added timeouts to fs operations in packager
Reviewed By: davidaurelio

Differential Revision: D3316555

fbshipit-source-id: edf6e08569b6cb434219f4460367eec0827530fd
2016-05-18 08:43:24 -07:00
Mike GrabowskiandFacebook Github Bot 0 e3bbd300f6 Update upgrade command with 0.26 breaking changes
Summary:
Generally it feels that at some point we will just integrate `rnpm upgrade` directly here, but this is a super temporary quick workaround for the people upgrading to 0.26. We might want to change it later to 0.27 and update this message in case we have any other stuff to upgrade.

![screen shot 2016-05-18 at 14 28 47](https://cloud.githubusercontent.com/assets/2464966/15358460/df3b1b66-1d04-11e6-825c-fa18fa96ee6e.png)

It is supposed to work for 0.26.0, 0.26.1 and all the others up to 0.27.
Closes https://github.com/facebook/react-native/pull/7614

Differential Revision: D3316420

fbshipit-source-id: 3861b4228ee878464e18ba3de1f3e0c12d5f30d1
2016-05-18 07:28:52 -07:00
Konstantin RaevandFacebook Github Bot 2 921d0de2e8 Fixes NetowrkingModule construction with interceptors
Reviewed By: andreicoman11

Differential Revision: D3316229

fbshipit-source-id: 0dc5cce68b6649ebd2ff44c313ab94a0f5a06f66
2016-05-18 04:58:20 -07:00
RetroXeusPoktanandFacebook Github Bot 2 061151cdae Add QQ音乐 全民K歌 QQ空间 QQ to showcase
Summary:
Add QQ音乐 全民K歌 QQ空间 QQ to the showcase page
Closes https://github.com/facebook/react-native/pull/7582

Differential Revision: D3316209

fbshipit-source-id: 47e5ce7ec91fb5f4ff747e4ea9ea77476a49fdbc
2016-05-18 04:28:22 -07:00
Alex KotliarskyiandFacebook Github Bot 0 f203c5d78c Add "Open file" button to elements inspector
Summary:
Depends on #6351

Now you can open file directly from Elements Inspector!

Credit for the original implementation goes to jaredly

![zcichu7kem](https://cloud.githubusercontent.com/assets/192222/14573876/cb100f6e-030c-11e6-925f-6a6dff510145.gif)

**Test plan**

Made sure it doesn't crash the app with or without #6351 (i.e. can be merged safely before #6351 gets in).
Closes https://github.com/facebook/react-native/pull/7005

Differential Revision: D3313714

Pulled By: frantic

fbshipit-source-id: 3b80abd3e81a0db5ca5136e2d2c94c775fa04f3a
2016-05-17 20:58:25 -07:00
Joel MarceyandFacebook Github Bot 1 17be4c754e Core components tutorial
Summary:
Create the initial Core Components tutorial. The core components are `Text`, `Image`, `View`, `TextInput`, `ListView`.

1. Provide a summary for each core component, including a runnable sample.
2. Allow the tutorials for each component to be extended with more details and detailed examples, particularly after we add other tutorials (i.e., around state and props).
3. The samples should be runnable in a React Native simulator, if we can get that going in the docs.
4. Reorganize the docs sidebar to make the current Tutorial actually a Sample App, etc.
Closes https://github.com/facebook/react-native/pull/7593

Differential Revision: D3313563

Pulled By: JoelMarcey

fbshipit-source-id: cfe1d397d60822b8c531405d66b4e73694c7dbf9
2016-05-17 18:28:23 -07:00
Marc HorowitzandFacebook Github Bot 4 8199893574 Remove script argument to proxy loadApplicationScript
Summary:
The JSCExecutor API gets passed script data and a URL, but
the proxy's purpose in life is to load from the network, so the script
data is useless.  The code was failing to handle null script data, so
rather than just passing nullptr all the time, I removed the argument.
if there's a use case in the future for it, we can put it back.

Reviewed By: steveluscher

Differential Revision: D3312467

fbshipit-source-id: 986c48f1ef3c24e6b5569046ccb08d7864cdcd3d
2016-05-17 14:28:29 -07:00
Alexander BlomandFacebook Github Bot 1 0694a2991c Use infoLog instead of console.log
Reviewed By: sahrens

Differential Revision: D3304886

fbshipit-source-id: 79d3fd2b833380a18dfbee666f9bd5eaf25b0744
2016-05-17 12:43:40 -07:00
Alexander BlomandFacebook Github Bot 1 2a67f9b249 Move infoLog to OSS
Reviewed By: sahrens

Differential Revision: D3310270

fbshipit-source-id: 93261e6083a35e6869b384c8c230c861427e4060
2016-05-17 12:43:40 -07:00
Andrew JackandFacebook Github Bot 1 6bbaff2944 Upgrade to OkHttp3
Summary:
Update to [OkHttp](https://github.com/square/okhttp) to [OkHttp3](https://publicobject.com/2015/12/12/com-squareup-okhttp3/)

We must also update:
- Fresco to 0.10.0
- okio to 1.8.0

**Motivation**
Reasons for upgrading:
* Issue #4021
* "We discovered that RN Android sometimes fails to connect to the latest stable version of NGINX when HTTP/2 is enabled. We aren't seeing errors with other HTTP clients so we think it's specific to RN and OkHttp. Square has fixed several HTTP/2 bugs over the past eight months." - ide
* OkHttp3 will be maintained & improved, but OkHttp2 will only receive [security fixes](https://publicobject.com/2016/02/11/okhttp-certificate-pinning-vulnerability/)
* Cleaner APIs - "Get and Set prefixes are avoided"
* Deprecated/Removed - HttpURLConnection & Apache HTTP
* React Native apps are currently being forced to bundle two versions of OkHttp (v2 & v3), if another library uses v3
* Improved WebSocket performance - [CHANGELOG.md](https://github.com/square/okhttp/blob/master
Closes https://github.com/facebook/react-native/pull/6113

Reviewed By: andreicoman11, lexs

Differential Revision: D3292375

Pulled By: bestander

fbshipit-source-id: 7c7043eaa2ea63f95854108b401c4066098d67f7
2016-05-17 12:43:39 -07:00
Chris EvansandFacebook Github Bot 4 5047f6f54c Add Copy Stack button to Red Box (iOS)
Summary:
Added a button to the iOS Red Box to enable copying of the error and stack trace to the clipboard to make it easier to paste the error and stack into bug reports or other text windows. Clicking the Copy button on the bottom of the RedBox screen or pressing Cmd-Option-C keyboard shortcut in the simulator will copy the full stack trace as text to the iOS pasteboard and when in the simulator you can then hit Command-C to get the text to the Mac's pasteboard for pasting in your favorite reporting/tracking app.

No tests for this change - I don't see any tests to extend for the RCTRedBoxWindow class. No impact on APIs or core React Native functionality. I validated it by running test React Native apps with red box errors and both hitting the copy button or using the command key shortcut in the emulator to get the text of the stack to the iOS pasteboard.
![redboxcopybutton](https://cloud.githubusercontent.com/assets/7173455/15258992/7b1e849c-1903-11e6-8813-6e853db5db54.png)
Closes https://github.com/facebook/react-native/pull/7557

Differential Revision: D3311743

Pulled By: javache

fbshipit-source-id: 76d1ac8ab93f40696c6a2369dae2245194db095a
2016-05-17 12:28:21 -07:00
Victor CalvelloandFacebook Github Bot 1 d62f9612f2 Add 'Vorterix' app to Showcase
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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 please 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 tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/mas
Closes https://github.com/facebook/react-native/pull/7590

Differential Revision: D3310675

fbshipit-source-id: 8dc4d50eed9237988b409c336695568832c0fe34
2016-05-17 12:13:32 -07:00
Martín BigioandFacebook Github Bot 3 fdc6240018 Reset hasError flag after HMR request
Summary:
This got broken recently. As a result of this, when a module throws while being required, either by regular load or hot reload, the module object is marked as `hasError`. Form that point all subsequent HMR updates will fail because it will think the module failed while executing the factory but the failure could have been on an old run of an old factory.

The fix is very simple: just reset `hasError` to false when accepting a module.
Closes https://github.com/facebook/react-native/pull/7567

Differential Revision: D3310685

fbshipit-source-id: 2f0b48ab7432b7c221d0c88a019a28969a8862b2
2016-05-17 11:58:31 -07:00
Alexander BlomandFacebook Github Bot 5 7446d42d33 Delete jsc-internal
Reviewed By: dcaspi

Differential Revision: D3304892

fbshipit-source-id: fd7ac66c81c93785c3c7887a107c8f1df222aefa
2016-05-17 11:28:34 -07:00
Ben NhamandFacebook Github Bot 3 5bb5ea7135 Reload image without dispatch_async if completion handler is already on main thread
Summary:
This works with D3305161 to minimize image flashing. After D3305161, the completion handler passed to `-[RCTImageLoader loadImageWithoutClipping:size:scale:resizeMode:progressBlock:completionBlock:]` may be called back on the main queue in the case of a cached image. In this case, we want to set the image view's image property synchronously rather than on the next runloop iteration via dispatch_async. This minimizes the amount of image flashing the user sees when displaying a cached image.

The exception to this case is for blurred images. A blur can be an expensive (taking multiple ms on the CPU), so we always make sure to perform the blur off the main queue even if the image is cached and the callback came back on the main queue.

Reviewed By: nicklockwood

Differential Revision: D3310176

fbshipit-source-id: 6820782527b65e4956879cf06e8ed2c09c622a58
2016-05-17 10:43:30 -07:00
Adam ComellaandFacebook Github Bot 3 fe5c0d2d06 iOS: Enable views to be nested within <Text>
Summary:
Previously, only Text and Image could be nested within Text. Now, any
view can be nested within Text. One restriction of this feature is
that developers must give inline views a width and a height via
the style prop.

Previously, inline Images were supported by using iOS's built-in support
for rendering images with an NSAttributedString via NSTextAttachment.
However, NSAttributedString doesn't support rendering arbitrary views.

This change adds support for nesting views within Text by creating one
NSTextAttachment per inline view. The NSTextAttachments act as placeholders.
They are set to be the size of the corresponding view. After the text is
laid out, we query the text system to find out where it has positioned each
NSTextAttachment. We then position the views to be at those locations.

This commit also contains a change in `RCTShadowText.m`
`_setParagraphStyleOnAttributedString:heightOfTallestSubview:`. It now only sets
`lineHeight`, `textAlign`, and `writingDirection` when they've actua
Closes https://github.com/facebook/react-native/pull/7304

Differential Revision: D3269333

Pulled By: nicklockwood

fbshipit-source-id: 2b59f1c5445a4012f9c29df9f10f5010060ea517
2016-05-17 10:43:30 -07:00
Sean KelleyandFacebook Github Bot 2 908041b80b Round alpha channel when interpolating colors to the nearest thousandth.
Summary:
This fixes an issue where animations for values near zero could end up formatted
with exponents (e.g. `1.452e-10`), which is not valid for an `rgba` color spec.
This commit arbitrarily rounds it to the nearest thousandth to prevent this type
of formatting while still maintaining high-enough resolution in the alpha channel.

One way this could bubble up to the user is as PropType validation failures:

```
Failed propType: Invalid prop `backgroundColor` supplied to `RCTView`: rgba(0, 0, 0, 9.838983123336224e-7)
```
Closes https://github.com/facebook/react-native/pull/7597

Differential Revision: D3310941

Pulled By: vjeux

fbshipit-source-id: 0c95facaef5b69c021662af9fb6f268d890ecc3e
2016-05-17 10:13:29 -07:00
David AurelioandFacebook Github Bot 1 9092198b1b Terminate startup code with a null byte, too (indexed file random access bundles)
Reviewed By: javache

Differential Revision: D3310269

fbshipit-source-id: d0fbf5afd6baecf50ec568e8694a15c96e6a9c85
2016-05-17 09:58:44 -07:00
Alexander BlomandFacebook Github Bot 6 f71329946c Don't barf if property throws
Reviewed By: davidaurelio

Differential Revision: D3305125

fbshipit-source-id: 48143195cd1d48a9f99f4d93dfdf62b51ba6b4c1
2016-05-17 05:13:24 -07:00
Michał GregorczykandFacebook Github Bot 3 89b68419ff Add jsc initialization markers to cxx bridge
Reviewed By: lexs

Differential Revision: D3303919

fbshipit-source-id: 0dbbe89de9de165a9d7a1597be050f37ed10a878
2016-05-17 04:28:25 -07:00
Fred LiuandFacebook Github Bot 3 12fcacb58f Full width styling for quick actions
Summary: - Used absolute positioning to render full-width quick actions

Reviewed By: fkgozali

Differential Revision: D3302467

fbshipit-source-id: cdcac88b20eff7a71be1ab8bb39e6888216dad84
2016-05-17 01:43:27 -07:00
Thorben PrimkeandFacebook Github Bot 7 a52e684121 Updated Embed Into Existing Android App Readme
Summary:
Motivation: Fix the documentation so that others don't stumble.

**Test plan**: Integrating RN into an existing Android app doesn't cause the `ConnectivityManagerCompat` exception anymore.

 ---

The instructions where still pointing at maven central. This updates the dependency and provides instructions on how to reference the local maven folder in `node_modules`.
Closes https://github.com/facebook/react-native/pull/7586

Differential Revision: D3309932

fbshipit-source-id: 8e4fc4c0ae5641af886c9d9a0feb1c8172e94fcf
2016-05-16 23:43:22 -07:00
Tobias RitzauandFacebook Github Bot 1 ee77e50c4a Collapse native/{fb,jni,xplatinit} into one DSO
Reviewed By: dcolascione

Differential Revision: D3201488

fbshipit-source-id: 0cf965ee16e360329285d834a4c575d8f1061f15
2016-05-16 22:58:39 -07:00
Fred LiuandFacebook Github Bot 5 c779e233b6 Improve SwipeableListView performance
Summary:
- Removed unnecessary rerending of `SwipeableListView` by properly managing `SwipeableListViewDataSource`
- Simplified `SwipeableRow` logic and improved swiping performance
- Added bounce effect
- Locked `ListView` from being scrollable when `SwipeableRow` is being swiped; behaviour mirrors that of Android on iOS and significantly improves framerates

Reviewed By: fkgozali

Differential Revision: D3307599

fbshipit-source-id: 168b6b72ef1f9e47d0145cf9e1baecbab3564b84
2016-05-16 20:28:27 -07:00
Yu HuangandFacebook Github Bot 5 34907c3810 Fix List View _updateVisibleRows firing for all row component at view loading time issue
Summary:
Sometimes list view row components(even the ones unseen) have a frame but its x and y is 0 or uninitialized at view loading time, which will lead to _updateVisibleRows firing for all the row components incorrectly at loading time.
This is to make the code more defensive.

Reviewed By: sahrens

Differential Revision: D3308515

fbshipit-source-id: 0e30fdf10345629bfd9de3fe0ad641bb1903fe00
2016-05-16 18:28:21 -07:00
Gabe LeviandFacebook Github Bot 3 0c40f96c32 Upgrade to v0.25.0
Reviewed By: jeffmo

Differential Revision: D3308221

fbshipit-source-id: c17b5ed861cfc201b8bd36f9c01218da25960001
2016-05-16 17:13:23 -07:00
邓国梁andFacebook Github Bot 5 2bb4e69382 add showcase for xiaoxian
Summary:
RT
Closes https://github.com/facebook/react-native/pull/7082

Differential Revision: D3306415

Pulled By: mkonicek

fbshipit-source-id: d2d3bfca68a890e10393c3904bdff222ec414865
2016-05-16 13:13:28 -07:00
Yu Zheng(Sam)andFacebook Github Bot 1 67d9a7bae9 Mark SupportAlertFragment and AlertFragment as Public to fix crash is…
Summary:
Hi,
This changelist is for fixing a crash issue on Android devices. For detail please see, https://github.com/facebook/react-native/issues/7080

In short, the crash occurred when a RN app with a Alert dialog shown at front switches back after it is destroyed at background due to lack of phone memory.

My fix is to let those Alert fragment classes accessible from android.support.v4.app.Fragment instantiate() function, so that it won't crash. And since other UI will be reloaded whatever, mListener is set to null to avoid any callback happen.
Closes https://github.com/facebook/react-native/pull/7105

Differential Revision: D3212435

Pulled By: mkonicek

fbshipit-source-id: d900a33a4f0fd49258be94c277def55555ec8d73
2016-05-16 12:58:30 -07:00
Janic DuplessisandFacebook Github Bot 7 aac7f5b362 Fix tests buck build when running locally
Summary:
Got this error when trying to run instrumentation tests locally with `./scripts/run-android-local-integration-test.sh`

```
C:\Users\janic\Developer\react-native\ReactAndroid\src\androidTest\java\com\facebook\react\tests\DatePickerDialogTestCase.java:110: error: cannot access com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
    return (DialogFragment) getActivity().getSupportFragmentManager()
                                         ^
  class file for com.facebook.react.modules.core.DefaultHardwareBackBtnHandler not found
C:\Users\janic\Developer\react-native\ReactAndroid\src\androidTest\java\com\facebook\react\tests\ViewRenderingTestCase.java:82: error: cannot access com.facebook.react.touch.ReactInterceptingViewGroup
    assertEquals("Incorrect (or not applied) opacity", expectedOpacity, view.getAlpha());
                                                                            ^
  class file for com.facebook.react.touch.ReactInterceptingViewGroup not found
C:\Users\janic\Developer
Closes https://github.com/facebook/react-native/pull/7575

Differential Revision: D3306330

fbshipit-source-id: a6d8afd060b54d56f9e2b97f45b642d7b7f46209
2016-05-16 12:28:40 -07:00
Tore HanssenandFacebook Github Bot 0 df40f482b0 Callback with image height and width from IOSImagePicker
Reviewed By: javache

Differential Revision: D3301645

fbshipit-source-id: c771d491447f8ed9dc6c8685e273b99656336b0a
2016-05-16 11:13:23 -07:00
Martín BigioandFacebook Github Bot 3 6457effb7b Avoid clearing out factory on DEV mode
Summary:
grabbou pointed out this issue.

We recently started cleaning out the factory function after module are required to save some memory. This broke HMR on some edge cases because sometimes the factory function may need to be re-executed. This PR just wraps the optimization into `__DEV__` to make sure we don't use it while developing.
Closes https://github.com/facebook/react-native/pull/7568

Differential Revision: D3305120

Pulled By: martinbigio

fbshipit-source-id: 741cffbb327d118f0bd0ec34dc1af53d4f94880e
2016-05-16 10:43:21 -07:00
Alexander BlomandFacebook Github Bot 5 3fe2e6581c Remove duplicate install of nativeFlushQueueImmediate
Summary:
This was accidentally added twice.

**Test plan (required)**

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

Differential Revision: D3305537

Pulled By: astreet

fbshipit-source-id: 7d652f9c7762cb66715f1b7235a186513d9b938d
2016-05-16 10:28:45 -07:00
Martin KonicekandFacebook Github Bot 9 10429b5822 Test that Picker selection is updated correctly
Summary:
A React pull request broke the Picker: https://github.com/facebook/react/pull/6572
This pull request adds a test so that we prevent breakages like this in the future.

`PickerAndroidExample` in the UIExplorer before the breakage (video): https://vid.me/h5Rg
`PickerAndroidExample` in the UIExplorer after the breakage (video): https://vid.me/atFc

**Test plan**

`./scripts/run-android-local-integration-test.sh`

The test is failing, we can only merge this once React is fixed.

<img width="837" alt="screen shot 2016-05-04 at 5 13 31 pm" src="https://cloud.githubusercontent.com/assets/346214/15020827/aca8d718-121b-11e6-91f6-a338293d7d92.png">
Closes https://github.com/facebook/react-native/pull/7390

Differential Revision: D3305223

Pulled By: mkonicek

fbshipit-source-id: 89137812940c578efff3e76864ab7cadccc9f2ea
2016-05-16 09:13:28 -07:00
Nick LockwoodandFacebook Github Bot 9 d2934e58b3 Expose UIManager queue via a static function to prevent race conditions
Summary: Having UI modules access the shadowQueue via UIManager.methodQueue is fragile and leads to race conditions in startup, sometimes resulting in an error where the methodQueue is set twice, or not at all.

Reviewed By: javache

Differential Revision: D3304890

fbshipit-source-id: 7198d28314dbec798877fcaaf17ae017d50157e9
2016-05-16 08:13:21 -07:00
Naman GoelandFacebook Github Bot 4 1673e00e2b correct flow types
Summary:
The function should have optional arguments, but not nullable types.
Closes https://github.com/facebook/react-native/pull/7580

Differential Revision: D3304994

Pulled By: davidaurelio

fbshipit-source-id: 9918817429126ea16dd3076b61a3493c3a3a8388
2016-05-16 07:58:26 -07:00
Alexander BlomandFacebook Github Bot 4 f13322c820 Add support for dumping current React hierarchy
Reviewed By: sebmarkbage

Differential Revision: D3287391

fbshipit-source-id: 0ef1cd25a910dcc0a50ed52a2cc0ae702a9654f4
2016-05-16 07:28:29 -07:00
Alexander BlomandFacebook Github Bot 4 610cfdc819 Add support for custom files in BugReporting
Reviewed By: astreet

Differential Revision: D3287186

fbshipit-source-id: ce7000ac110b78a4fb94c66229046617c292675f
2016-05-16 07:28:29 -07:00
Pieter De BaetsandFacebook Github Bot 1 6a3fc86778 Remove 64-bit restriction from React Native tests
Reviewed By: majak

Differential Revision: D3298189

fbshipit-source-id: f25b223d677a0ec8e1a665dd54de685e00d497b8
2016-05-16 05:28:23 -07:00
David AurelioandFacebook Github Bot 3 2f41c56f59 change to fixed size offset table + indexed lookup
Reviewed By: javache

Differential Revision: D3281989

fbshipit-source-id: 52db9f441dd46024eafac46ae8d32b26640cad71
2016-05-16 04:43:24 -07:00
Nick LockwoodandFacebook Github Bot 1 516bf7bd94 Fixed NativeEventListener deregistration
Summary:
The `EmitterSubscription.remove()` method was previously calling `this.subscriber.removeSubscription(this)` directly, bypassing the mechanism in `NativeEventEmitter` that keeps track of the number of subscriptions.

This meant that native event modules (subclasses of `RCTEventEmitter`) would keep sending events even after all the listeners had been removed. This wasn't a huge overhead, since these modules are singletons and only send one message over the bridge per event, regardless of the number of listeners, but it's still undesirable.

This fixes the problem by routing the `EmitterSubscription.remove()` method through the `EventEmitter` so that `NativeEventEmitter` can apply the additional native calls.

I've also improved the architecture so that each `NativeEventEmitter` uses its own `EventEmitter`, but they currently all still share the same `EventSubscriptionVendor` so that legacy code which registers events via `RCTDeviceEventEmitter` still works.

Reviewed By: vjeux

Differential Revision: D3292361

fbshipit-source-id: d60e881d50351523d2112473703bea826641cdef
2016-05-16 04:13:56 -07:00
Alexander BlomandFacebook Github Bot 3 9a899bed65 Memoize lazy module configs
Reviewed By: javache

Differential Revision: D3293010

fbshipit-source-id: feab7bb0a1f8990baea9c0aca8c9c3cccbcb04e8
2016-05-16 03:58:23 -07:00
Dave MillerandFacebook Github Bot 8 ccef1b2941 More touch logging
Reviewed By: andreicoman11

Differential Revision: D3298518

fbshipit-source-id: 0ddbba5c05848ac164f6f1562b26609924978169
2016-05-16 02:58:21 -07:00
Shane O'SullivanandFacebook Github Bot 1 fa5d1fefa1 Make the root view background color explicit
Summary:
The default white background for the root view causes an unattractive flash when loading any app with a non-white background.  Almost every developer has to search for how to fix it.

This change makes the background color explicit in the file, so it can be easily change to match the color of the splash screen and the main screen without having to search for it.

**Test plan (required)**
Launched my app and it still has a white flash for the background before loading the app.  I changed the background colors to other values and the flash was that color.
Closes https://github.com/facebook/react-native/pull/7570

Differential Revision: D3303451

Pulled By: vjeux

fbshipit-source-id: 61dbab768095c430bcb583bafb57575a7d767e6f
2016-05-14 22:43:20 -07:00
Yao Bin ThenandFacebook Github Bot 2 433c0e8021 Add comments on NetInfo.js
Summary:
Further describe the methods available on NetInfo.

Question: How do I update the docs on the website?
Closes https://github.com/facebook/react-native/pull/7375

Differential Revision: D3303300

fbshipit-source-id: 4343d490f65e4e47b93f2c98a645cb675d2cf708
2016-05-14 21:50:24 -07:00
David AurelioandFacebook Github Bot 2 e34c9c4e5f Include forwarding modules into npm package
Reviewed By: bestander

Differential Revision: D3301666

fbshipit-source-id: 723d87f1df217f0f1f78661bb6c41a9bbfab6814
2016-05-14 16:28:26 -07:00
Spencer AhrensandFacebook Github Bot 3 c2a8e52d72 Fix source map utils
Reviewed By: javache

Differential Revision: D3302496

fbshipit-source-id: de15a289497119c7f600b8796452fc9573ea7394
2016-05-14 10:43:30 -07:00
Marc HorowitzandFacebook Github Bot 8 3a2d024514 avoid waiting on the main thread just to send a notification
Reviewed By: nicklockwood

Differential Revision: D3234837

fbshipit-source-id: 587a68df7d08999d4357583ba3160b315bd85239
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 9e9dfd2ac9 Introduce non-copyable JSBigString for managing large strings efficiently
Reviewed By: astreet

Differential Revision: D3234836

fbshipit-source-id: 2b95b585dc1215988b88cf0d609c778a95b362a1
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 f433ed716c Make the pattern for adding systrace sections more concise
Reviewed By: astreet

Differential Revision: D3234834

fbshipit-source-id: 73e191deb4dd0e06d4c242e46a582051d4bcc9ba
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 267264f1ec Add a bunch more systrace logging
Reviewed By: tadeuzagallo

Differential Revision: D3234831

fbshipit-source-id: 177f9b987e938c59d50fc07bce01fb5c912652e7
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 86f2eb18e5 Support JS Systrace on all platforms
Reviewed By: tadeuzagallo

Differential Revision: D3234830

fbshipit-source-id: 94cc870d47d620c8bd8d35f83d0b017e5ddba90d
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 b7fe8e68be Finer granularity systracing
Reviewed By: astreet

Differential Revision: D3234826

fbshipit-source-id: 900ab93b847949413a134a87a20b0d826c58da3d
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 86e18ace94 make RCTFBSystrace actually work
Reviewed By: tadeuzagallo

Differential Revision: D3234824

fbshipit-source-id: 9f2f7efd6877fe7b9096dedecb311d226eae7bc8
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 418e16f711 Support flow events in RCTProfile
Summary: Add begin/end async flow to the callbacks for external profiling

Reviewed By: tadeuzagallo

Differential Revision: D3234812

fbshipit-source-id: cdbe46883fd566d50a04de9ad67f947876a78a0c
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 05832c3469 Catch any std::exception from unbundling
Reviewed By: davidaurelio

Differential Revision: D3148408

fbshipit-source-id: 78dc47e1b092cb7fd06307d505a795d2009cee4d
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 448b48ca85 remove useless text from js errors
Reviewed By: astreet

Differential Revision: D3127112

fbshipit-source-id: 56ee9da8cd7d409c7b13864e6d4cc863146d19f0
2016-05-13 17:29:00 -07:00
Marc HorowitzandFacebook Github Bot 8 7762297f77 add supportsWebWorkers
Reviewed By: lexs

Differential Revision: D3149754

fbshipit-source-id: 58bce886aff526bc7152eaca2f43a654dcb5ad2a
2016-05-13 17:29:00 -07:00
Adam ComellaandFacebook Github Bot 6 03edc75b56 iOS: Provide correct animation function for hiding keyboard
Summary:
Currently, `7 << 16` is used as the animation easing function for both the showing and hiding of the keyboard.

Instead, `7 << 16` should be used for showing the keyboard and `6 << 16` for hiding the keyboard.

For details, see: http://stackoverflow.com/questions/18870447/how-to-use-the-default-ios7-uianimation-curve/19439283#19439283

**Test plan (required)**

Testing animating the position of a view to coordinate with the keyboard hiding and showing and it looks good.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/7372

Differential Revision: D3300464

Pulled By: nicklockwood

fbshipit-source-id: 3fdc161f709de11deb7de511aad28767f5d80bd6
2016-05-13 15:43:22 -07:00
Arno FortelnyandFacebook Github Bot 3 cac5ce3b93 RefreshControl on initial render will not beginRefresh when refreshing state is false
Summary:
There's an edge case in the `RefreshControl` which causes it to show as refreshing when the state is set to false. When the component is initialized with `refreshing` set to `true` on initial render but set to `false` before `layoutSubviews` is called, it will call `beginRefresh` and ignore its state. That's because `layoutSubviews` never checks if `_currentRefreshingState` is in fact still `true`, it merely assumes it is.

This is fixed by simply doing a check for `_currentRefreshingState` before entering `beginRefresh` from `layoutSubviews`.
Closes https://github.com/facebook/react-native/pull/7556

Differential Revision: D3300124

fbshipit-source-id: d1dce8612e2c03b1f14284d513803d00af4b5c8a
2016-05-13 14:43:26 -07:00
Hedger WangandFacebook Github Bot 4 8975bb8e70 didFocus event should fired after transition finishes.
Summary:
For now, we emit `didFocus` event before fully resetting the transition and
hiding the stale scenes, so handler for `didFocus` event does not get the right
scenes in place. We should emit the didFocus event after resetting the transition and
hiding the stale scenes.

Reviewed By: ericvicenti

Differential Revision: D3299002

fbshipit-source-id: 6a79528097aabc4f61d4dba322820c228c889a84
2016-05-13 12:58:24 -07:00
Jimmy MayoukouandFacebook Github Bot 3 2849bafbc3 Fix typo in ViewPagerAndroid.android.js
Summary: Closes https://github.com/facebook/react-native/pull/7456

Differential Revision: D3299061

fbshipit-source-id: 417995191d675e2ae625926df93412c660d1931a
2016-05-13 11:58:23 -07:00
Nathan SpaunandFacebook Github Bot 5 b67d4a20d7 Add FpsListener to React Scroll Views
Summary:
We want to give people the ability to log scroll performance (including Fb).
This adds an interface that can be enabled and disabled from the react scroll views.
This is a prerequisite to implementing the actual framerate logger that will log dropped
frames while scrolling in prod.

Reviewed By: astreet

Differential Revision: D3283588

fbshipit-source-id: ed9736cb9ed3f441511647f36b1460092bd91e56
2016-05-13 11:28:21 -07:00
Olivier NotteghemandFacebook Github Bot 1 fd376660df Fix race condition when clicks are received on react root view and react context is pending
Reviewed By: astreet

Differential Revision: D3297574

fbshipit-source-id: 27ac81342d19947e9425a845d7ef7c73cc4cf090
2016-05-13 09:43:22 -07:00
Niklas LindroosandFacebook Github Bot 4 cc683bc088 Fixed a few language errors in the Introducing Hot Reloading blog post.
Summary:
Have completed the CLA.
Closes https://github.com/facebook/react-native/pull/7552

Differential Revision: D3298347

Pulled By: vjeux

fbshipit-source-id: 1945a3d266b19ad66d03e03e8f36baf44ca804b8
2016-05-13 08:58:24 -07:00
Dave MillerandFacebook Github Bot 6 e491f7d5c6 Reverted commit D3292369
Reviewed By: andreicoman11

Differential Revision: D3292369

fbshipit-source-id: 1a41d845ff46c44544f37d85e8154557a979a4ff
2016-05-13 04:28:27 -07:00
qingfengandFacebook Github Bot 6 1322e06cb2 Add "SAY a Short Video Community" app to the showcase.
Summary:
SAY is "Q & A community-based short video", All based react native development

- You can shoot video
- Video Filters can be switched
- Private chat

![image](https://cloud.githubusercontent.com/assets/18495/15239741/7a1152be-1917-11e6-9c93-0e75b3a7bd60.png)

![image](https://cloud.githubusercontent.com/assets/18495/15239758/ae7a08c0-1917-11e6-82ea-f0f998785bd6.png)

![image](https://cloud.githubusercontent.com/assets/18495/15239776/c89b5588-1917-11e6-8962-5803865a02b4.png)

![image](https://cloud.githubusercontent.com/assets/18495/15239783/d0500670-1917-11e6-9699-708b1d9ebceb.png)
Closes https://github.com/facebook/react-native/pull/7547

Differential Revision: D3297728

fbshipit-source-id: 3ef57a8042c5de34d56ce4fcde1b62cccbb3f422
2016-05-13 01:58:34 -07:00
Matt McnameeandFacebook Github Bot 6 b66f098193 Added 'Whisky Journal' to Showcase
Summary: Closes https://github.com/facebook/react-native/pull/7541

Differential Revision: D3297739

fbshipit-source-id: fc87f1b409cffe26049292ca7cfb421cf0fb1c26
2016-05-13 01:58:34 -07:00
Olivier NotteghemandFacebook Github Bot 4 99b106658f Reverted commit D3278698
Summary:
= Breaking Change (for experimental features) =

Major API changes in  NavigationAnimatedView

= New prop `transition` for scene renderer

In NavigationAnimatedView, we should not use `position` as a proxy of the
transtion which happens whenever navigation state changes.

Because `position` does not change unless navigation index changes, it won't
be possible to build animations for actions that replace navigation state
without changing the index.

This diff introduces an abstract prop `transition` that is exposed to the scene
renderers.

= Replace `applyAnimation` with `configureTransition`.

Expose a new optional prop  `configureTransition` that allows people to configure
transitions easily.

For instance, to configure the transition, do this:

```
function configureTransition() {
  return {
    dutation: 123,
    easing: Easing.easeInOut,
  };
}

```
<NavigationAnimatedView configureTransition={configureTransition) />

```

Reviewed By: ericvicenti

Differential Revision: D3278698

fbshipit-source-id: b790b92e0fabb42488ff1135b1c37a3f0e9420f7
2016-05-12 18:58:45 -07:00
Konstantin RaevandFacebook Github Bot 9 588183b166 Increased timeouts and retries for instrumentation tests
Summary:
Tests fail quite often but retries seem to help.
Closes https://github.com/facebook/react-native/pull/7537

Differential Revision: D3295833

fbshipit-source-id: e74be5d62b7fb9c1859477e51bf18fe3d1d25ce4
2016-05-12 17:43:35 -07:00
David AurelioandFacebook Github Bot 5 b4e970f6c3 Use continuous module IDs for random access bundles
Reviewed By: bestander

Differential Revision: D3292980

fbshipit-source-id: ab5791d31add42a26cf55a0309564330c383eaa2
2016-05-12 17:28:25 -07:00
Fred LiuandFacebook Github Bot 6 3f1cd5aa4e Center align text on Android
Summary: Center align text on Android

Reviewed By: fkgozali

Differential Revision: D3295222

fbshipit-source-id: c707d1102c8aa86aa04dc9b34a4746b1ff1543bc
2016-05-12 16:09:30 -07:00
Christopher ChedeauandFacebook Github Bot 5 90663bcb12 Add link to the survey at the bottom of the page
Summary:
![simulator screen shot may 11 2016 3 03 14 pm](https://cloud.githubusercontent.com/assets/197597/15198889/3374abe6-178f-11e6-95e5-378004ea45aa.png)

<img width="1333" alt="screen shot 2016-05-11 at 3 03 25 pm" src="https://cloud.githubusercontent.com/assets/197597/15198886/2e545a8a-178f-11e6-8fd1-975ca700e49b.png">
Closes https://github.com/facebook/react-native/pull/7524

Reviewed By: JoelMarcey

Differential Revision: D3293684

Pulled By: vjeux

fbshipit-source-id: c0e7d138040eae49c6b7f7398de8d50f0ed2f564
2016-05-12 14:43:22 -07:00
Alexander BlomandFacebook Github Bot 7 e4bb9f52e5 Move all hooks over to new helper
Reviewed By: astreet

Differential Revision: D3292927

fbshipit-source-id: baafa6ded3872391ae1319b2855b2616ec79c2ad
2016-05-12 14:33:28 -07:00
Alexander BlomandFacebook Github Bot 7 cafd63440a Add helper for installing method as hook
Reviewed By: astreet

Differential Revision: D3292457

fbshipit-source-id: 590637dbf868097214ca9cb7b9a6543dc48a898f
2016-05-12 14:33:28 -07:00
Reem HelouandFacebook Github Bot 2 a53d0f99dd Add an array of scrollviewlisteners in RCTScrollableProtocol
Summary: We are deprecating nativeScrollDelegate property in RCTScrollableProtocol in favor of a scrollListener api. To register/unregister from scroll events use the addScrollListener/removeScrollListener methods

Reviewed By: javache

Differential Revision: D3278218

fbshipit-source-id: 54373cae8e9f8efa7cdbd40c51bcf21d368acf75
2016-05-12 12:17:20 -07:00
Fred LiuandFacebook Github Bot 5 853074d1ee Pass along scrollResponder()
Summary: Allows calls to `scrollResponder()` without crashing

Reviewed By: fkgozali

Differential Revision: D3293272

fbshipit-source-id: c46d99c0d7430a37fc364fa3aaf77dd192d7ab37
2016-05-12 11:49:24 -07:00
Konstantin RaevandFacebook Github Bot 2 2c3ca4c058 Open sourced 4 more instrumentation tests for RN Android
Summary:
More instrumentation tests in OSS means less work for FB engineers to investigate if a PR breaks some internal tests.

+ increased timeouts and retries for OSS tests runner

Reviewed By: andreicoman11

Differential Revision: D3292582

fbshipit-source-id: 3f8aa4d3536450ea3af7acff044b9bb62be0f9db
2016-05-12 10:52:30 -07:00
Dave MillerandFacebook Github Bot 4 31c8b3bd61 Add some defensive loggin in Android touch handling
Reviewed By: andreicoman11

Differential Revision: D3292369

fbshipit-source-id: 43315f7d8e81f1a0ec238c08c3cb689e6648fd0b
2016-05-12 10:01:21 -07:00
Dave MillerandFacebook Github Bot 0 f2c1868b56 Update the timestamp we send in touch events to be the more accurate timestamp we use
Summary: Use the more accurate timestamp that we have computed for the touch event rather than the event timestamp that Android provides.

Reviewed By: andreicoman11

Differential Revision: D3292705

fbshipit-source-id: dad082ab74406d391481d16cdac19629751aa1eb
2016-05-12 09:40:26 -07:00
Nick LockwoodandFacebook Github Bot 6 2525feb37f Updated Websocket to use new event system
Reviewed By: javache

Differential Revision: D3292473

fbshipit-source-id: f9a9e0a1b5a12f7fa8b36ebdba88405370f91c54
2016-05-12 08:30:24 -07:00
Michał GregorczykandFacebook Github Bot 3 cd691e2cc2 Let jsc know it will run web worker
Reviewed By: astreet

Differential Revision: D3287543

fbshipit-source-id: 2a9de938feec417aef34c0ff26f138730b32929f
2016-05-12 08:13:21 -07:00
Martin KralikandFacebook Github Bot 6 44bf85a041 different coalescing key for touchCancel events
Summary:
On iPad we may get two touch cancel events in direct succession. They would have the same coalescing key, which would result in unsuccesful attempt to coalesce them.
This diff fixes it by making sure two cancel events cannot have the same coalescing key.

(An alternative fix would be implementing coalescing logic for cancel events, but that sounds more complicated. It would be neccessary if there is a legit scenario where big number of cancel events are emitted in succesion.)

Reviewed By: javache

Differential Revision: D3292405

fbshipit-source-id: 1f269771dc81fdd637cf6ac3ee4725e5e2fec679
2016-05-12 08:11:24 -07:00
Konstantin RaevandFacebook Github Bot 1 428c563c75 Revert "Fix RefreshControl race condition"
Summary:
This reverts commit 8fbce3099d.
Reverts https://github.com/facebook/react-native/pull/7317 because it breaks instrumentation tests https://circleci.com/gh/facebook/react-native/6521
Closes https://github.com/facebook/react-native/pull/7529

Differential Revision: D3292461

fbshipit-source-id: 7dcde05adefe41e6b3c28697fccfa232a45f0742
2016-05-12 04:50:25 -07:00
Pieter De BaetsandFacebook Github Bot 1 1b5b5d9c5b Improve error handling in route generation script
Reviewed By: sam-swarr

Differential Revision: D3282748

fbshipit-source-id: 17301c6639a7517d1171a67567f220471020b78d
2016-05-12 04:29:24 -07:00
Konstantin RaevandFacebook Github Bot 1 9b56ff6bab Open sourced ProgressBarTest
Reviewed By: andreicoman11

Differential Revision: D3287396

fbshipit-source-id: 1a814b72ebcb5d13106c6a612b341f217c4dc5a6
2016-05-12 04:07:08 -07:00
Ben RothandFacebook Github Bot 1 36b085422d Correctly test for HMR parameter in the bundle URL
Summary: Closes https://github.com/facebook/react-native/pull/7525

Differential Revision: D3292314

Pulled By: javache

fbshipit-source-id: 04090f7f1253e055278a6774f7e135833ae3d6f6
2016-05-12 03:30:23 -07:00
Sakari TuominenandFacebook Github Bot 3 85d2086321 Fix a bug, if clipData is null we can not ask getItemCount() from it
Summary:
I ran into problems when using Clipboard.getString() in Android. The method seems to work fine when there is *something* in the clipboard, but when it's empty the app crashes. I think I've tracked down the bug to ClipboardModule.java@58.

When clipData is null, the promise is resolved with an empty string. However, after that the rest of the block is executed. There should be a return or an 'else if' like in my pr.

Screenshot of the error message when clipboard is empty:

![image](https://cloud.githubusercontent.com/assets/7509183/15206922/44bd2094-182b-11e6-9400-6a59c513de24.png)
Closes https://github.com/facebook/react-native/pull/7527

Differential Revision: D3292232

fbshipit-source-id: d2191286c49ee31233203fab4648449964b9d950
2016-05-12 01:45:21 -07:00
Hedger WangandFacebook Github Bot 0 55c308615a Expose a new prop transition for scene renderer.
Summary:
= Breaking Change (for experimental features) =

Major API changes in  NavigationAnimatedView

= New prop `transition` for scene renderer

In NavigationAnimatedView, we should not use `position` as a proxy of the
transtion which happens whenever navigation state changes.

Because `position` does not change unless navigation index changes, it won't
be possible to build animations for actions that replace navigation state
without changing the index.

This diff introduces an abstract prop `transition` that is exposed to the scene
renderers.

= Replace `applyAnimation` with `configureTransition`.

Expose a new optional prop  `configureTransition` that allows people to configure
transitions easily.

For instance, to configure the transition, do this:

```
function configureTransition() {
  return {
    dutation: 123,
    easing: Easing.easeInOut,
  };
}

```
<NavigationAnimatedView configureTransition={configureTransition) />

```

Reviewed By: ericvicenti

Differential Revision: D3278698

fbshipit-source-id: 25ebad286d8b41f46c35c0f32d6023ebd01f19e7
2016-05-11 18:45:31 -07:00
Fred LiuandFacebook Github Bot 9 763e9cce27 SwipeableListView quick actions
Summary:
- Implemented a quick actions template to allow children buttons to be rendered in the slideout of `SwipeableListView`
- Implemented `QuickActionsButton` to allow buttons to be used in the slideout view

Reviewed By: fkgozali

Differential Revision: D3271946

fbshipit-source-id: b7c7412f44be64dea7084ca36c4b0f4f3842b008
2016-05-11 18:02:20 -07:00
Janic DuplessisandFacebook Github Bot 8 8fbce3099d Fix RefreshControl race condition
Summary:
There was a race condition with `SwipeRefreshLayout` that cause the `RefreshControl` to keep refreshing when it shouldn't.

It was caused because we have to use `post` to set the refreshing state otherwise it doesn't work when setting `refreshing=true` on initial mount. What happened is that `post` doesn't guarantee the order the runnables will be called so calling post with `refreshing=true` followed by `refreshing=false` caused the `resfreshing=false` runnable to be called before the `resfreshing=true` one. This made it stay in refreshing state when it should not.

```
D/test    ( 6171): setRefreshing true
W/ReactNativeJS( 6171): false
D/test    ( 6171): setRefreshing false
D/test    ( 6171): setRefreshing post false
D/test    ( 6171): setRefreshing post true
```

This change adds an instance variable and uses it in the `post` runnable to make sure the last set value is always used.

**Test plan (required)**
Tested that it fixed the issue in the [original issue app](https://github.com/digisqu
Closes https://github.com/facebook/react-native/pull/7317

Differential Revision: D3290464

Pulled By: andreicoman11

fbshipit-source-id: 15cabcfc6d2f191443be96e8845b924ce66c369f
2016-05-11 17:16:23 -07:00
Joel MarceyandFacebook Github Bot 9 20c8899b31 Revert "Add docs survey link to site header"
Summary:
This reverts commit 4a7f2192f9.

Adding the link breaks mobile
Closes https://github.com/facebook/react-native/pull/7520

Differential Revision: D3290347

Pulled By: JoelMarcey

fbshipit-source-id: 950db67eb14b5fe8816d4c782b32d233a8697ae7
2016-05-11 17:09:20 -07:00
Kevin JohnsonandFacebook Github Bot 8 31250ad150 Ability to disable/lock the android ViewPager scroll from props
Summary:
This is a nice feature to have.

I've tested this by copying and renaming the ViewPager java and javascript files from the react-native repo and including them in a project. Whats the best way to test this directly from the repo?
Closes https://github.com/facebook/react-native/pull/5968

Differential Revision: D3240651

Pulled By: mkonicek

fbshipit-source-id: 5f1d157216df4f3314915496188a92aec1b85e91
2016-05-11 16:51:17 -07:00
Hedger WangandFacebook Github Bot 1 c3714d7ed7 Kill <NavigationView />
Summary:
= Breaking Change (for experimental features) =

<NavigationView /> serves no obvious benefit and it's costly to maintain it.

- its features could be completely replaced by NavigationAnimatedView without
  enabling the transtion animation.

- it could also be replaced with a simple view and normal scene renderer.

Reviewed By: ericvicenti

Differential Revision: D3280547

fbshipit-source-id: 4ac3dbe92ceb9107a1f6e77a78bd6021485e78a9
2016-05-11 16:23:26 -07:00
Alexander BlomandFacebook Github Bot 2 0934470676 Remove JS config completely
Reviewed By: astreet

Differential Revision: D3276230

fbshipit-source-id: b3ab7e7dc149696b7db1049613fbb6a2a19bc8fb
2016-05-11 11:39:20 -07:00
Joel MarceyandFacebook Github Bot 7 4a7f2192f9 Add docs survey link to site header
Summary:
**Test plan**

Tested locally to see link in header bar and that it takes you to survey.

![screenshot 2016-05-11 08 21 11](https://cloud.githubusercontent.com/assets/3757713/15186299/593fd4f6-1751-11e6-847f-ea73ce4e2809.png)
Closes https://github.com/facebook/react-native/pull/7514

Differential Revision: D3287859

fbshipit-source-id: 48dfdbae74622330f192d5763c5e47025f1887b1
2016-05-11 11:05:52 -07:00
Nick LockwoodandFacebook Github Bot 0 9ee1f37bad Added native event emitter
Summary:
This is a solution for the problem I raised in https://www.facebook.com/groups/react.native.community/permalink/768218933313687/

I've added a new native base class, `RCTEventEmitter` as well as an equivalent JS class/module `NativeEventEmitter` (RCTEventEmitter.js and EventEmitter.js were taken already).

Instead of arbitrary modules sending events via `bridge.eventDispatcher`, the idea is that any module that sends events should now subclass `RCTEventEmitter`, and provide an equivalent JS module that subclasses `NativeEventEmitter`.

JS code that wants to observe the events should now observe it via the specific JS module rather than via `RCTDeviceEventEmitter` directly. e.g. to observer a keyboard event, instead of writing:

    const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
    RCTDeviceEventEmitter.addListener('keyboardWillShow', (event) => { ... });

You'd now write:

    const Keyboard = require('Keyboard');
    Keyboard.addListener('keyboardWillShow', (event) => { ... });

Within a component, you can also use the `Subscribable.Mixin` as you would previously, but instead of:

     this.addListenerOn(RCTDeviceEventEmitter, 'keyboardWillShow', ...);

Write:

    this.addListenerOn(Keyboard, 'keyboardWillShow', ...);

This approach allows the native `RCTKeyboardObserver` module to be created lazily the first time a listener is added, and to stop sending events when the last listener is removed. It also allows us to validate that the event strings being observed and omitted match the supported events for that module.

As a proof-of-concept, I've converted the `RCTStatusBarManager` and `RCTKeyboardObserver` modules to use the new system. I'll convert the rest in a follow up diff.

For now, the new `NativeEventEmitter` JS module wraps the `RCTDeviceEventEmitter` JS module, and just uses the native `RCTEventEmitter` module for bookkeeping. This allows for full backwards compatibility (code that is observing the event via `RCTDeviceEventEmitter` instead of the specific module will still work as expected, albeit with a warning). Once all legacy calls have been removed, this could be refactored to something more elegant internally, whilst maintaining the same public interface.

Note: currently, all device events still share a single global namespace, since they're really all registered on the same emitter instance internally. We should move away from that as soon as possible because it's not intuitive and will likely lead to strange bugs if people add generic events such as "onChange" or "onError" to their modules (which is common practice for components, where it's not a problem).

Reviewed By: javache

Differential Revision: D3269966

fbshipit-source-id: 1412daba850cd373020e1086673ba38ef9193050
2016-05-11 06:27:29 -07:00
Spencer AhrensandFacebook Github Bot 1 2d43663ac8 Remove cruft from ScrollView
Reviewed By: dmmiller

Differential Revision: D3287077

fbshipit-source-id: dfc238469bce540d69c38d3e17c87163e10d7b23
2016-05-11 05:22:20 -07:00
楚怀andFacebook Github Bot 6 4b4c040af7 fix FPSGraph label setText not execute on main thread
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

Explain the **motivation** for making this change. What existing problem does the pull request solve?
as apple states, all UIKit methods should execute on main thread, while FPSGraph is not.

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 please 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 tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests"
Closes https://github.com/facebook/react-native/pull/7500

Differential Revision: D3287011

Pulled By: tadeuzagallo

fbshipit-source-id: 23c4248c8dc65d337afb12626e597dfb6a621e96
2016-05-11 04:11:25 -07:00
Spencer AhrensandFacebook Github Bot 8 892e509a0c Fix flow and lint for ScrollView
Summary:
- getScrollResponder returns a...ScrollView!
- no more var
- no more string refs

Reviewed By: spicyj

Differential Revision: D3286596

fbshipit-source-id: d9e6e0a318eadd2521c9f5c69d2ec368f1d7b626
2016-05-11 03:00:27 -07:00
Fred LiuandFacebook Github Bot 6 052cd7eb8a SwipeableListView
Summary:
- Updated SwipeableListView to be much more performant by checking `rowHasChanged` more vigorously
- New `SwipeableListViewDataSource` used to mask implementation details from caller

Reviewed By: fkgozali

Differential Revision: D3272172

fbshipit-source-id: 02f66ed7fce7d587118ad7d82b20f8e78db44b7b
2016-05-11 00:25:20 -07:00
Alex LeventerandFacebook Github Bot 8 a0384dad3c Add Splash to Showcase
Summary:
Add an additional react native app to the showcase page.
Closes https://github.com/facebook/react-native/pull/7499

Differential Revision: D3286553

fbshipit-source-id: f057217b4db6cb1134e15abbca1067483066a68e
2016-05-10 23:25:48 -07:00
Alex LedakandFacebook Github Bot 0 2a150cc30a Update name & app icon for 'New Music' app
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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 please 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 tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/mas
Closes https://github.com/facebook/react-native/pull/7420

Differential Revision: D3286539

fbshipit-source-id: a7df51f0ae485a0c9efa52ec47e8ac023a2319bf
2016-05-10 23:23:30 -07:00
ztodorovicandFacebook Github Bot 1 3abccd9640 Add "Nabava.net" app to the showcase.
Summary: Closes https://github.com/facebook/react-native/pull/7486

Differential Revision: D3286537

fbshipit-source-id: 1057fea7baa8f42470239c78834c5af41f1450ac
2016-05-10 23:20:21 -07:00
Elijah WindsorandFacebook Github Bot 3 574e81e8cb Adding clapit to showcase
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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 please 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 tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/mas
Closes https://github.com/facebook/react-native/pull/7494

Differential Revision: D3286536

fbshipit-source-id: cb6be7717d977017ae7b1a297543c3269bceb53b
2016-05-10 23:17:23 -07:00
Dan SeethalerandFacebook Github Bot 5 a053f53860 Typo fix.
Summary: Closes https://github.com/facebook/react-native/pull/7487

Differential Revision: D3286538

fbshipit-source-id: 4c989e7a444b1f93ac4bc27131e25b93305b1148
2016-05-10 22:45:21 -07:00
nemothecaptandFacebook Github Bot 2 df9a2b20a1 React.PropTypes.oneOf accepts array as parameter, non-array given
Summary:
React.PropTypes.oneOf accepts array as parameter, non-array given. this make the app throw a warning.
Closes https://github.com/facebook/react-native/pull/7498

Differential Revision: D3285737

fbshipit-source-id: 3d86b4b36d696e054f9225d7e3a9eddf91477813
2016-05-10 21:04:23 -07:00
Ben AlpertandFacebook Github Bot 8 a95405f419 Update to React 15.1.0-alpha.1
Reviewed By: zpao

Differential Revision: D3283057

fbshipit-source-id: c37ea3818597e5c0f37ed3c7502c791c02183ea8
2016-05-10 15:58:24 -07:00
Olivier NotteghemandFacebook Github Bot 5 68b2f49a31 Improves react image loading handlers to mimic iOS behavior
Reviewed By: vjeux

Differential Revision: D3283011

fbshipit-source-id: acb04f8b2ccbab99a59040a7ca70aa46cbf73faa
2016-05-10 14:17:27 -07:00
Joel MarceyandFacebook Github Bot 8 c1f0ce283c Getting Started Cleanup
Summary:
1. Remove note about upgrading Homebrew packages. That was kind of noisy.
2. Use local images instead of those stored on Akamai.
3. Add wording for modifying test project about actually opening a file.
4. Add note about keeping initial defaults for Android Studio install in tact.

Tested site locally. Images and new wording appeared as expected.
Closes https://github.com/facebook/react-native/pull/7477

Reviewed By: vjeux

Differential Revision: D3281639

Pulled By: JoelMarcey

fbshipit-source-id: ca956d97293ac3793431cb54f3560ee3e52c0dce
2016-05-10 11:17:27 -07:00
Martin KralikandFacebook Github Bot 5 1b00534793 improve view clipping
Summary:
Previously we had an issue where we would clip visible views during an animation, like swiping back a VC.
The root cause was mismatch between a view's frame and what is visible on screen. This happens because during an animation the frame (and other properties) of the animated view has final values, even that it's not yet rendered at that position.

This diff fixes this issue by not looking for a clippingView above the react root view, since the animation for VC transitions happens at view higher above the root view.

Reviewed By: javache

Differential Revision: D3281655

fbshipit-source-id: 996b1a9f223c5b2274dd3d7c05b8936612af05ba
2016-05-10 10:51:24 -07:00
David AurelioandFacebook Github Bot 2 ce0594dece Add forwarding modules for modules required by React
Reviewed By: bestander

Differential Revision: D3281736

fbshipit-source-id: e061d3ec0b0d9ca4d3ee8234757457617dd6c985
2016-05-10 10:31:24 -07:00
David AurelioandFacebook Github Bot 3 d5ceb4175b Allow already loaded modules to be require’d by name string in dev mode
Summary:
The code to require modules by their name (rather than their numeric ID) was buggy, because it didn’t check whether the module factory was already executed and the module already existed.

This diff checks the already loaded modules, too, when loading modules by name.

Reviewed By: lexs

Differential Revision: D3281350

fbshipit-source-id: cef236e152fe5484f21c877d6cee37433fa11c76
2016-05-10 09:37:20 -07:00
Andy StreetandFacebook Github Bot 9 f1d12f6b38 Make runJSBundle synchronous
Summary: This is called on the JS thread so we don't need to post a runnable.

Reviewed By: lexs

Differential Revision: D3281388

fbshipit-source-id: ff292a710442c0b84c6ee31a2644a5c2ea650dc9
2016-05-10 09:21:24 -07:00
Andy StreetandFacebook Github Bot 1 1c31aea83f Update "This shouldn't be possible. Congratulations." error message
Summary: Apparently this *is* possible. Congratulations to me.

Reviewed By: nicklockwood

Differential Revision: D3281361

fbshipit-source-id: 53c6ab83d959aa8a77880f4f772a7a7d7ccf4950
2016-05-10 09:17:23 -07:00
Tadeu ZagalloandFacebook Github Bot 3 65af925501 Avoid text relocations on arm trampoline
Summary:
fixes #7337

`ldr reg, =symbol` will cause a text relocation, which will fail to link if that's not allowed (which is the default for dynamic libraries).

Reviewed By: jspahrsummers

Differential Revision: D3281518

fbshipit-source-id: a057b4b9a54d568c8753a9dcd00365a86c7d93b0
2016-05-10 09:09:19 -07:00
Konstantin RaevandFacebook Github Bot 1 4c3286f2a2 Made UIManager set displayContstants
Reviewed By: andreicoman11

Differential Revision: D3281309

fbshipit-source-id: f5568f2127e7e26dcbd77b3845092346ac06c0db
2016-05-10 08:34:31 -07:00
Nurym KudaibergenandFacebook Github Bot 3 ff7f260ce9 Updated Babel supported transformations link
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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 please 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 tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/mas
Closes https://github.com/facebook/react-native/pull/7485

Differential Revision: D3281418

Pulled By: vjeux

fbshipit-source-id: 287b66f1ed9690bf488cf646f8eaf02e2956caa5
2016-05-10 06:53:20 -07:00
Andy StreetandFacebook Github Bot 3 6ec5b953cb Red box c++ exceptions thrown while executing sync hooks
Summary: Also adds support for creating JS Error objects. When we clean up the way global functions are installed on JSC, we'll be able to use this pattern to auto-catch all c++ exceptions at this level.

Reviewed By: lexs

Differential Revision: D3276663

fbshipit-source-id: bf3561690013019a25e2be5a4d1b69ba9e002c72
2016-05-10 05:03:30 -07:00
Pieter De BaetsandFacebook Github Bot 6 ca1caf2713 Enable no-duplicate-props lint rule
Reviewed By: davidaurelio

Differential Revision: D3281234

fbshipit-source-id: 1b382694ad7a647464add4d1c856e7dde472205d
2016-05-10 05:00:24 -07:00
Tomas RoosandFacebook Github Bot 9 cd9271567f Add flow directive to index.android.js
Summary:
iOS template contains flow directive in top comment. Android should too for consistency.
Closes https://github.com/facebook/react-native/pull/7482

Differential Revision: D3281131

fbshipit-source-id: d9a77196faed5e41753d09768721e1da1e6cc60a
2016-05-10 03:11:21 -07:00
Jimmy MayoukouandFacebook Github Bot 2 d3e5a96b15 Fix tintColor prop platform in Image
Summary:
`tintColor`, even in style, works on Android; this must be some old comment but that confused me when reading the docs.

**Test plan:**
- Launched website locally
Closes https://github.com/facebook/react-native/pull/7465

Differential Revision: D3278166

fbshipit-source-id: 4e986e0f2a9ba05de4404b93d28687596fbb4fad
2016-05-09 15:29:24 -07:00
James IdeandFacebook Github Bot 3 6d1790a625 Add li.st (Android) to the showcase
Summary: Closes https://github.com/facebook/react-native/pull/7478

Differential Revision: D3277536

fbshipit-source-id: 92a48007a5bd0c5e981c9b8956a045b7af4b1b40
2016-05-09 13:38:24 -07:00
Martin KonicekandFacebook Github Bot 3 128d93b8aa Revert Android websocket: Include cookies with request
Summary:
This reverts the commit https://github.com/facebook/react-native/commit/bf8b5499bba92e607be40c0ae0f12feffbfcc706
Pull request: https://github.com/facebook/react-native/pull/6851
Internal Phabricator revision: D3257466

See the pull request for discussion.

Reviewed By: bestander

Differential Revision: D3277433

fbshipit-source-id: 623f93e1bce47ac156ffab154c57495b85ffa936
2016-05-09 13:37:29 -07:00
Nikhilesh SigatapuandFacebook Github Bot 4 d4f6f61a96 Increase the stack size for the React queue on older Android phones
Summary:
Older Android devices don't have a large stack by default and with about 16 levels of views the app will crash. Modern Android devices are fine so we can continue to use the system defaults while using a 2MB stack on older Android devices.
Closes https://github.com/facebook/react-native/pull/7416

Differential Revision: D3276805

Pulled By: astreet

fbshipit-source-id: a7b31a1be62e13f333148ca0908eb01a11aa4562
2016-05-09 11:48:23 -07:00
Nick LockwoodandFacebook Github Bot 6 963a53b1a7 Fixed XHR tests
Summary:
The XMLHttpRequest jest tests were attempting to call a private method in XMLHttpRequestBase.js (denoted by an _ prefix).

JS doesn't actually have any language-level support for private methods, the use of _ prefix is just a convention. But to prevent casually calling private methods externally, we have a transform that mangles the names of prefixed methods so that that attempting to call them will fail.

Using a double _ bypasses this name-mangling mechanism, while still making it clear that the method is intended to be private.

Reviewed By: javache

Differential Revision: D3276261

fb-gh-sync-id: e0c17e1003d2df09d1a16f78ae9d95bef923d74e
fbshipit-source-id: e0c17e1003d2df09d1a16f78ae9d95bef923d74e
2016-05-09 10:36:24 -07:00
Will FongandFacebook Github Bot 9 e737891242 Add troubleshooting and modification for linux
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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 please 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 tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/mas
Closes https://github.com/facebook/react-native/pull/7471

Differential Revision: D3276360

Pulled By: JoelMarcey

fb-gh-sync-id: 30edd7086a3c4b88695dc91af76ef56d43306ce9
fbshipit-source-id: 30edd7086a3c4b88695dc91af76ef56d43306ce9
2016-05-09 09:58:19 -07:00
Atif MansoorandFacebook Github Bot 2 146df61775 Fix bug on GettingStarted.md page when clicking nav buttons in FF
Summary:
Hi,
The [commit](https://github.com/facebook/react-native/commit/156d3ed7a290a7d0576c7e6d2b3fc03681d71ee9?_pjax=%23js-repo-pjax-container) by JoelMarcey is much appreciated.  However, when you click on the nav buttons in Firefox (v46.0.1, I'm on El-Capitan), it will switch the content but also navigate you to the React-Native homepage.  This doesn't happen in Chrome, so that's how it probably slipped through.
I propose these changes to fix that.

**Test plan**
Tested locally on FF and Chrome on El-Capitan
Closes https://github.com/facebook/react-native/pull/7435

Differential Revision: D3276285

Pulled By: vjeux

fb-gh-sync-id: c9a14059e609297fe273d02fe6c0a5f98ec7060c
fbshipit-source-id: c9a14059e609297fe273d02fe6c0a5f98ec7060c
2016-05-09 09:42:21 -07:00
Eric VicentiandFacebook Github Bot 0 b24d471fb2 Backed out D3033933
Reviewed By: hedgerwang

Differential Revision: D3273603

fb-gh-sync-id: e013fd3efd793960d076d2a01447b2a11f483ede
fbshipit-source-id: e013fd3efd793960d076d2a01447b2a11f483ede
2016-05-09 08:33:18 -07:00
Pieter De BaetsandFacebook Github Bot 3 57ceeafd4f Move UI-specific logic from NativeModules to UIManager
Summary: Move all requires of UIManager to UIManager.js, so we can load the view manager configuration lazily when UIManager is required.

Reviewed By: majak

Differential Revision: D3270147

fb-gh-sync-id: 8208ee8d5919102ea5345e7031af47ee78162fe0
fbshipit-source-id: 8208ee8d5919102ea5345e7031af47ee78162fe0
2016-05-09 08:21:19 -07:00
Nick LockwoodandFacebook Github Bot 2 ed1ee9bc0f Fixed crash due to inserting a nil object into an array
Summary: Fixed a crash where making a network request with unrecognized/unsupported scheme would crash by attempting to insert a nil RCTNetworkTask into an array.

Reviewed By: javache

Differential Revision: D3275810

fb-gh-sync-id: be208c6bf87d882209901b850dcc25da4ba79a08
fbshipit-source-id: be208c6bf87d882209901b850dcc25da4ba79a08
2016-05-09 08:18:47 -07:00
Jesse SesslerandFacebook Github Bot 5 191d278fda Modal Status Bar Translucent
Summary:
Currently the Modal component on Android is rendered below the Status Bar, which changes it's color to grey, and in the UIExplorer example the backdrop is just formatted to look the same color. In some scenarios users may want to preserve the color of their status bar and make it look as though the modal is appearing on top. This PR allows for that.

This GIF shows current behavior and new behavior with the translucentStatusBar prop set to true.

![](http://g.recordit.co/BSX5g9obRC.gif)

I've updated the UIExplorer app to demonstrate and the docs as shown below

![image](https://cloud.githubusercontent.com/assets/4265163/14742854/500e1292-086c-11e6-9275-71808b0cbed7.png)

Thanks!
Closes https://github.com/facebook/react-native/pull/7157

Differential Revision: D3264497

Pulled By: dmmiller

fb-gh-sync-id: 61346d99414d331d3420f44a4c5f6341b0973be6
fbshipit-source-id: 61346d99414d331d3420f44a4c5f6341b0973be6
2016-05-09 07:08:22 -07:00
Alexander BlomandFacebook Github Bot 1 abca466037 Remove name property from native modules
Reviewed By: javache

Differential Revision: D3275674

fb-gh-sync-id: 7c100c78576b48f3163c37b93499dd54da73b96c
fbshipit-source-id: 7c100c78576b48f3163c37b93499dd54da73b96c
2016-05-09 05:46:23 -07:00
Will FongandFacebook Github Bot 7 28cc8c9776 Fix typo (.bash instead of .bashrc)
Summary: Closes https://github.com/facebook/react-native/pull/7464

Differential Revision: D3275748

fb-gh-sync-id: a59e6f54425906c4018f122174a86d80afa021eb
fbshipit-source-id: a59e6f54425906c4018f122174a86d80afa021eb
2016-05-09 05:42:19 -07:00
Pieter De BaetsandFacebook Github Bot 5 d7de68241f Index UIManager.Commands correctly
Reviewed By: nicklockwood

Differential Revision: D3275652

fb-gh-sync-id: a38e9cf6a46f2aa373b4948aa419b42af402c784
fbshipit-source-id: a38e9cf6a46f2aa373b4948aa419b42af402c784
2016-05-09 05:25:23 -07:00
Andy StreetandFacebook Github Bot 7 54f7ae1c02 Force react applications to be explicitly unmounted
Summary:
We previously were unmounting the react application unconditionally when the ReactRootView#onDetachedFromWindow. This is nice in that it automatically allows us to reclaim memory, but there are many scenarios where a ReactRootView can be embedded in another piece of UI that detaches its children as part of its normal function (e.g. ListView, RecyclerView, ViewPager, etc).

As such, we will now enforce that the hosting Activity/Fragment/??? explicitly calls unmountReactApplication in the same way it calls startReactApplication. For Applications extending ReactActivity/AbstractReactActivity, this will happen automatically in onDestroy.

Reviewed By: foghina

Differential Revision: D3265161

fb-gh-sync-id: 4d49b0c41256213f00874f57e784aa8741dbf394
fbshipit-source-id: 4d49b0c41256213f00874f57e784aa8741dbf394
2016-05-09 04:09:29 -07:00
UnoDeTantosandFacebook Github Bot 9 f7ce0c1c2f Adds progressViewOffset to RefreshControl
Summary:
Add the possibility to define a progress view top offset to RefreshControl on android. As i comment in #6740, contentInset does the trick on IOS.

Looking android documentation seems that exists a possible solution:
http://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html#setProgressViewOffset(boolean, int, int)

This pull request implement that but keeping it simple, only a top offset.

For example, now we could put navigation bar over the scrollview (or listview) and define a progressViewOffset on RefreshView in order to start behind the navigation. At this point we could make some kind of coordinator layout to hide/show navigation on scroll.

To maintain the default behavior, start point is equal to start point minus progress circle diameter in order to create that progress circle before the start point.
Closes https://github.com/facebook/react-native/pull/6759

Differential Revision: D3240664

Pulled By: mkonicek

fb-gh-sync-id: ccf866272e871811c1c6dcc2a34f5c217967feee
fbshipit-source-id: ccf866272e871811c1c6dcc2a34f5c217967feee
2016-05-09 01:51:22 -07:00
MIYOKAWA, NobuyoshiandFacebook Github Bot 8 2953a1a02e replace XCode to Xcode.
Summary:
Fixing very trivial typos.  'XCode' should be 'Xcode'.
Closes https://github.com/facebook/react-native/pull/7451

Differential Revision: D3275295

fb-gh-sync-id: 440972364229ca980e5211277baa342a20ac5d94
fbshipit-source-id: 440972364229ca980e5211277baa342a20ac5d94
2016-05-08 23:14:53 -07:00
Janic DuplessisandFacebook Github Bot 5 9aa37e8fb2 Make RefreshControl properly controlled by JS
Summary:
There was an issue with the way we made `RefreshControl` a controlled component when react doesn't render synchronously. This fixes the issue by using the same technique used in the commit 0cd2904b23 for`PickerAndroid`

**Test plan (required)**

Tested normal behaviour and tested that if not setting the `refreshing` prop to `true` during the `onRefresh` callback that the `RefreshControl` stops refreshing immediately. Also made sure that `setNativeProps` is only called if needed when the native refreshing state is not in sync with JS.

Fix #7414
Closes https://github.com/facebook/react-native/pull/7445

Differential Revision: D3274981

fb-gh-sync-id: a1b9d46329f552984e33d11fa0e29ad6da689511
fbshipit-source-id: a1b9d46329f552984e33d11fa0e29ad6da689511
2016-05-08 17:03:18 -07:00
Alessandro NadalinandFacebook Github Bot 1 b88d9d2380 Fixed typo
Summary: Closes https://github.com/facebook/react-native/pull/7448

Differential Revision: D3274779

fb-gh-sync-id: ae50ff1939778663af2f212fd510ed04ea640bb2
fbshipit-source-id: ae50ff1939778663af2f212fd510ed04ea640bb2
2016-05-08 11:47:49 -07:00
wusuopuandFacebook Github Bot 9 17f08070e8 Animated: Implement toJSON method of Animated
Summary:
Fix issue https://github.com/facebook/react-native/issues/7441
Closes https://github.com/facebook/react-native/pull/7442

Differential Revision: D3274594

fb-gh-sync-id: 720d7dcdaa97a2ee5235547bad6ba020398b57d2
fbshipit-source-id: 720d7dcdaa97a2ee5235547bad6ba020398b57d2
2016-05-08 01:09:21 -07:00
Ben AlpertandFacebook Github Bot 3 0cd2904b23 Fix Android picker controlling
Reviewed By: mkonicek

Differential Revision: D3261602

fb-gh-sync-id: da67d28420c5d855d672b481deeb92fa8b5d017c
fbshipit-source-id: da67d28420c5d855d672b481deeb92fa8b5d017c
2016-05-07 15:52:19 -07:00
Milan PavlikandFacebook Github Bot 9 0fab691e6f Remove default argument syntax on getVersionedGithubPath()
Summary:
Removes ES6 syntax of default arguments to fix website building as per #7434. [More info](https://github.com/facebook/react-native/pull/7434).
Closes https://github.com/facebook/react-native/pull/7439

Differential Revision: D3274206

fb-gh-sync-id: 3a8f5950ead91cf59c27fd384e97bf9587005398
fbshipit-source-id: 3a8f5950ead91cf59c27fd384e97bf9587005398
2016-05-07 14:10:33 -07:00
Milan PavlikandFacebook Github Bot 3 1d101f4236 Add versions to GitHub source links in documentation. #7428
Summary:
Documentation references to source code on GitHub should point to their respective versions in order to avoid confusion and prevent broken links when the master branch differs from the currently viewed version. [More details](https://github.com/facebook/react-native/issues/7428)

Originally links pointed to a hardcoded master branch on GitHub. The change augments the GitHub url to point to a respective branch of the code. The new urls are as follows:

next: `https://github.com/facebook/react-native/blob/master/<path>`
stable: `https://github.com/facebook/react-native/blob/0.25-stable/<path>`

The website module currently does not have a unit test setup. As a result, I performed the following tests:

1. Start the server with `RN_VERSION=next` and verified all links point to _master_
<img width="945" alt="screen shot 2016-05-07 at 14 10 58" src="https://cloud.githubusercontent.com/assets/1419286/15092307/ee66fb32-145d-11e6-92a0-d03169e517c2.png">
2. Start the server
Closes https://github.com/facebook/react-native/pull/7434

Differential Revision: D3274000

Pulled By: vjeux

fb-gh-sync-id: 70d766984d6b0835f0a18928d6831fd2c82b6c7b
fbshipit-source-id: 70d766984d6b0835f0a18928d6831fd2c82b6c7b
2016-05-07 08:36:21 -07:00
Alexander BlomandFacebook Github Bot 3 c6d3ca858e Avoid bounce to same message queue
Reviewed By: astreet

Differential Revision: D3269661

fb-gh-sync-id: b22ea45de9e9ddbe8471f10e9c475a5746aec34e
fbshipit-source-id: b22ea45de9e9ddbe8471f10e9c475a5746aec34e
2016-05-07 02:36:28 -07:00
SokovikovandFacebook Github Bot 8 ff431734a4 Revert "Revert "fix border style without borderRadius""
Summary: Closes https://github.com/facebook/react-native/pull/7389

Differential Revision: D3269828

Pulled By: mkonicek

fb-gh-sync-id: 896789fcc76953a035cf8701d3a90211b92b6b80
fbshipit-source-id: 896789fcc76953a035cf8701d3a90211b92b6b80
2016-05-06 09:23:22 -07:00
prabakarvijiandFacebook Github Bot 5 d03d455cc4 Add Reach24 App to React Native showcase
Summary:
Submitting PR for adding Reach24 App to React Native showcase
Closes https://github.com/facebook/react-native/pull/7294

Differential Revision: D3245068

Pulled By: mkonicek

fb-gh-sync-id: a3eb316279f1c96dd2da33566730f690229405cf
fbshipit-source-id: a3eb316279f1c96dd2da33566730f690229405cf
2016-05-06 08:56:18 -07:00
David AurelioandFacebook Github Bot 7 0c90ab493f Add Random Access Module file names to stack traces
Reviewed By: javache

Differential Revision: D3269450

fb-gh-sync-id: 41b2013d4422c2bcafa7628321d4626fd40aac5d
fbshipit-source-id: 41b2013d4422c2bcafa7628321d4626fd40aac5d
2016-05-06 05:54:23 -07:00
Alexander BlomandFacebook Github Bot 5 097f59112f Make MessageQueue.RemoteModules lazy
Reviewed By: javache

Differential Revision: D3252400

fb-gh-sync-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
fbshipit-source-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
2016-05-06 04:14:23 -07:00
Adam ComellaandFacebook Github Bot 2 deef8aade2 ScrollView: Always fire onScroll event for the resting scroll position
Summary:
When throttling scroll events with `scrollEventThrottle`, `onScroll`
is not guaranteed to be fired for the final scroll position
of the `ScrollView`. This can cause a component to render UI that
is consistent with the resting scroll position of the `ScrollView`.

This commit guarantees that an `onScroll` event will be fired for
the resting scroll position of the `ScrollView`.

**Test plan (required)**

Verified commit fixes a reduced repro. Also tested fix in a larger app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/7366

Differential Revision: D3269303

Pulled By: javache

fb-gh-sync-id: f68ecb7e9c18d1ac255c6f872fb7eb4aadd07799
fbshipit-source-id: f68ecb7e9c18d1ac255c6f872fb7eb4aadd07799
2016-05-06 03:19:27 -07:00
Adam ComellaandFacebook Github Bot 3 4d2c72b977 NavigatorIOS: Expose interactivePopGestureEnabled property
Summary:
Previously, the back swipe navigation gesture would be enabled when the navigation bar is shown and disabled when the navigation bar is hidden.

This change enables developers to control the back swipe gesture independently of the visibility of the navigation bar. An example use case would be that an app wants to render a custom navigation bar so it sets `navigationBarHidden` to true and it wants to enable the back swipe gesture so it sets `interactivePopGestureEnabled` to true.

**Test plan (required)**

- Created a test app to verify setting `interactivePopGestureEnabled` to `true` and `false` with the navigation bar both hidden and shown.
- Verified prop works in a larger app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/7369

Differential Revision: D3269304

Pulled By: javache

fb-gh-sync-id: ec4324f6517cec4b4fc4f62c4394dc9208a8af6a
fbshipit-source-id: ec4324f6517cec4b4fc4f62c4394dc9208a8af6a
2016-05-06 03:18:20 -07:00
Fred LiuandFacebook Github Bot 5 2132ad1441 Swipeable list view enhancements
Summary:
- Removes "flickering" on first load
- Takes in Map<rowID, slideoutView> to display customs slideout view in `SwipeableRowListView`

Reviewed By: furdei

Differential Revision: D3267262

fb-gh-sync-id: a89806138b9172b3c184cc117504e205632a36d0
fbshipit-source-id: a89806138b9172b3c184cc117504e205632a36d0
2016-05-05 20:45:24 -07:00
Joel MarceyandFacebook Github Bot 0 156d3ed7a2 Refactor getting started navigation and information based on platform
Summary:
This simplifies the Quick Start section of the React Native documentation into
two pages. A Getting Started and a Tutorial.

The Getting Started page uses some CSS and Javascript magic (thanks vjeux for
the initial infra for this!!) to allow selection between platforms and have
instructions for Getting Started with React Native be shown according to the
selection -- all within the same page, realtime. A much cleaner interface.

I have made a pretty large presentation and information overhaul for each
platform as well. For example, requiring Android Studio for Android
development to make the Android SDK and build tools installation easier.
I added more screenshots to the Android sections since they are more complicated
than the more straightforward iOS. Screenshots for Android for Windows, Linux and
iOS are available now.

Some of the other pages such as `GettingStartedOnLinux` are now obsolete and deleted.

** Test Plan **

Tested locally and navigation works.
Closes https://github.com/facebook/react-native/pull/7418

Differential Revision: D3268621

Pulled By: vjeux

fb-gh-sync-id: 65f9181c9f959fadeffd254efddc5b64816eb1f4
fbshipit-source-id: 65f9181c9f959fadeffd254efddc5b64816eb1f4
2016-05-05 20:26:22 -07:00
Joel Marcey 359b381796 Revert "Refactor getting started navigation and information based on platform"
This reverts commit 0ea020d823.

fb-gh-sync-id: f46c4a1f927128fd34c2f8ce4be4c275468f2355
fbshipit-source-id: f46c4a1f927128fd34c2f8ce4be4c275468f2355
2016-05-05 18:49:33 -07:00
Joel Marcey 0ea020d823 Refactor getting started navigation and information based on platform
Summary:
This simplifies the Quick Start section of the React Native documentation into
two pages. A Getting Started and a Tutorial.

The Getting Started page uses some CSS and Javascript magic (thanks @vjeux for
the initial infra for this!!) to allow selection between platforms and have
instructions for Getting Started with React Native be shown according to the
selection -- all within the same page, realtime. A much cleaner interface.

I have made a pretty large presentation and information overhaul for each
platform as well. For example, requiring Android Studio for Android
development to make the Android SDK and build tools installation easier.
I added more screenshots to the Android sections since they are more complicated
than the more straightforward iOS. Screenshots for Android for Windows, Linux and
iOS are available now.

Some of the other pages such as `GettingStartedOnLinux` are now obsolete and deleted.

Test Plan:
Video demo (it's a 1m20s or so, peruse at your pace): https://www.facebook.com/pxlcld/nKW3

Inspection

Reviewers: lacker, bestander, mkonicek, vjeux

Reviewed By: vjeux

Subscribers: cdykes, vjeux, mjohnston, sema, balpert, tomocchino, hramos, caabernathy, jpearce

Differential Revision: https://phabricator.intern.facebook.com/D3265822

Signature: t1:3265822:1462479878:5453ec81808b59fd71c288b6cc79268fccd921bc
2016-05-05 18:40:47 -07:00
Jeff BowenandFacebook Github Bot 0 b1892e6099 Explain custom configuration debugging gotcha
Summary:
Debugging tools won't work if you're using a custom configuration and Cocoapods and didn't specify the configuration to be a `debug` configuration using the `xcodeproj` setting in your Podfile. When integrating React Native into an existing Xcode project, this is a common situation to encounter.

See https://github.com/facebook/react-native/issues/2246#issuecomment-217187621
Closes https://github.com/facebook/react-native/pull/7407

Differential Revision: D3268032

fb-gh-sync-id: f46c4a1f927128fd34c2f8ce4be4c275468f2355
fbshipit-source-id: f46c4a1f927128fd34c2f8ce4be4c275468f2355
2016-05-05 18:00:19 -07:00
Eric VicentiandFacebook Github Bot 4 14eb427a80 Kill NavigationExperimental Containers
Summary:
The containers in NavigationExperimental are not appropraite because the state should be held by the app's architecture, be it redux, flux, or simple component state.

This diff moves the examples over to simple component state, but there are several other examples of how to use NavigationAnimatedView and the navigation reducers with redux:

- https://github.com/jlyman/RN-NavigationExperimental-Redux-Example
- Switching the f8 app with redux to navigation experimental: https://github.com/fbsamples/f8app/pull/14

Reviewed By: hedgerwang

Differential Revision: D3219911

fb-gh-sync-id: eb0b323e2c165c32027fbd00dc6197ad441d6552
fbshipit-source-id: eb0b323e2c165c32027fbd00dc6197ad441d6552
2016-05-05 16:52:19 -07:00
Russell PorterandFacebook Github Bot 9 a412fd1504 Remove unused generated strings.xml files
Differential Revision: D3265330

fb-gh-sync-id: a0ca96e4c3db63051dc3c09ca99d492fb3624b51
fbshipit-source-id: a0ca96e4c3db63051dc3c09ca99d492fb3624b51
2016-05-05 16:08:26 -07:00
Sebastian GronewoldandFacebook Github Bot 9 07767e86a3 Navigator - velocity override
Summary:
This code change allows changing the transition velocity of the navigator
when switching views.

Whats the use case? If you have different types of
animations your animations might also need different transition velocities.
Closes https://github.com/facebook/react-native/pull/5439

Differential Revision: D3264719

Pulled By: ericvicenti

fb-gh-sync-id: 1bc0a1191ed3bd51b624acd161c3ee77fd748d72
fbshipit-source-id: 1bc0a1191ed3bd51b624acd161c3ee77fd748d72
2016-05-05 15:06:47 -07:00
Konstantin RaevandFacebook Github Bot 3 1958e93f3a Fixed instrumentation test runner OK sniffing
Summary:
Fixed regex that looks for OK sign

**Test plan (required)**

- circle CI results
Closes https://github.com/facebook/react-native/pull/7410

Differential Revision: D3265016

fb-gh-sync-id: 1eba7297116d31f8bf3393733141058cf6a7454a
fbshipit-source-id: 1eba7297116d31f8bf3393733141058cf6a7454a
2016-05-05 12:54:02 -07:00
Eric VicentiandFacebook Github Bot 6 472f815e45 NavigationExperimental: Add key to NavigationSceneRendererProps
Summary:
This should simplify the renderScene usage a bit because the react key is required and this will make sure they are rendered with the right key automatically.

It changes the string to make sure people do not rely on this API for anything else.

Reviewed By: javache

Differential Revision: D3033933

fb-gh-sync-id: 036424af28693be32c3a3290f5c6667a6a6a04ac
fbshipit-source-id: 036424af28693be32c3a3290f5c6667a6a6a04ac
2016-05-05 11:58:26 -07:00
Fred LiuandFacebook Github Bot 8 2a7f6aeda7 Swipeable row container
Reviewed By: hedgerwang

Differential Revision: D3263983

fb-gh-sync-id: f77bb3dd7771c16e1f26398171b7784e3d89cb1d
fbshipit-source-id: f77bb3dd7771c16e1f26398171b7784e3d89cb1d
2016-05-05 11:49:29 -07:00
Hedger WangandFacebook Github Bot 6 b1cd1cba32 Fix propType check for NavigationCard.
Summary:
the prop type check for NavigationCard -> SceneView -> sceneRendererProps is wrong.
Fix it.

Reviewed By: ericvicenti

Differential Revision: D3265049

fb-gh-sync-id: 16e89c932f0f962db4b6a647d62d255ba98f6156
fbshipit-source-id: 16e89c932f0f962db4b6a647d62d255ba98f6156
2016-05-05 11:39:29 -07:00
Konstantin RaevandFacebook Github Bot 2 b824722501 Fixed nvm for travis CI
Summary:
NVM started failing on Travis
Closes https://github.com/facebook/react-native/pull/7411

Differential Revision: D3265199

fb-gh-sync-id: 6c80210cafb0ec6510073ce913a36eb7edcac2c6
fbshipit-source-id: 6c80210cafb0ec6510073ce913a36eb7edcac2c6
2016-05-05 11:25:28 -07:00
Hedger WangandFacebook Github Bot 4 ef44781f3d Kill NavigationLegacyNavigator.
Summary:
NavigationLegacyNavigator was originally created to help people to migrate to the new
navigation library without API changes. Therefore we'd have to port all the old APIs that
don't necessarily seem align well with the new navigation library.

Consider the production usage of NavigationLegacyNavigator does not exist, it's better
to kill it and we'd just rename the `Navigator` to `NavigatorDeprecated` later instead.

Reviewed By: ericvicenti

Differential Revision: D3263704

fb-gh-sync-id: a851fda1516d694cb7d119f5a1344f8fc676f7fd
fbshipit-source-id: a851fda1516d694cb7d119f5a1344f8fc676f7fd
2016-05-05 10:56:41 -07:00
Jimmy MayoukouandFacebook Github Bot 2 dd8caf4cf2 Implement returnKeyType/returnKeyLabel on Android
Summary:
This PR implements [`returnKeyType`](http://facebook.github.io/react-native/docs/textinput.html#returnkeytype) on Android.

It is implemented with [`EditText.setImeOptions()`](http://developer.android.com/reference/android/widget/TextView.html#setImeOptions(int)) that allows us to specify options on an input, in this case change the return button icon. To be noted that it is also possible to specify a string instead of an icon with [`EditText.setImeActionLabel()`](http://developer.android.com/reference/android/widget/TextView.html#setImeActionLabel(java.lang.CharSequence, int)) while being 2 different things I added both of these behaviors in this PR since it was mostly at the same place/component.

**Problems encountered :**

- All the `ReactEditText`s were set to `IME_ACTION_DONE` by default ([reference](https://github.com/Bhullnatik/react-native/blob/a2157dbbe06e10e628900e9d4443948893623126/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java#L78)). I'm not sure
Closes https://github.com/facebook/react-native/pull/6905

Differential Revision: D3264755

Pulled By: dmmiller

fb-gh-sync-id: 4a090e31b620a245847c06ba1895cfea02e88d0f
fbshipit-source-id: 4a090e31b620a245847c06ba1895cfea02e88d0f
2016-05-05 10:22:19 -07:00
Christine AbernathyandFacebook Github Bot 1 02af7b57d0 Display platform-specific examples
Summary:
Rebased https://github.com/facebook/react-native/pull/7048

Sending a new PR to check that tests pass.

After adding simulator examples, it appears that some don't show up, ex:
http://facebook.github.io/react-native/docs/text.html#content

This is due to the fact that these examples are split into two platform-specific files. For this reason, the example code isn't being shown. The examples are also missing for TextInput.

**Test plan**

`cd website; npm install; npm start`

![screen shot 2016-05-05 at 12 25 41 pm](https://cloud.githubusercontent.com/assets/346214/15042571/08ee77e8-12bd-11e6-98a6-967dc5fefa07.png)

![screen shot 2016-05-05 at 12 25 20 pm](https://cloud.githubusercontent.com/assets/346214/15042573/119778f4-12bd-11e6-8cdd-fbf217223d45.png)

![screen shot 2016-05-05 at 12 25 35 pm](https://cloud.githubusercontent.com/assets/346214/15042570/071ae992-12bd-11e6-9cf6-5aaba5e7fa17.png)
Closes https://github.com/facebook/react-native/pull/7406

Differential Revision: D3264567

Pulled By: mkonicek

fb-gh-sync-id: cfb73eaed56a7b5c6c84ce313e113393d152e9a1
fbshipit-source-id: cfb73eaed56a7b5c6c84ce313e113393d152e9a1
2016-05-05 09:10:26 -07:00
Damien VarronandFacebook Github Bot 2 75c71cfbff Add instruction on how to have access to the bot in IssueGuidelines.md
Summary: Closes https://github.com/facebook/react-native/pull/7402

Differential Revision: D3264577

fb-gh-sync-id: 10c0e1f9f8eedf0b53e1b6c93f6aff61883169f6
fbshipit-source-id: 10c0e1f9f8eedf0b53e1b6c93f6aff61883169f6
2016-05-05 08:46:54 -07:00
Konstantin RaevandFacebook Github Bot 7 457e348081 Open sourced SwipeRefreshLayoutRecordingModule
Reviewed By: dmmiller

Differential Revision: D3264212

fb-gh-sync-id: 8790200a0d3c47050d6a91c906854b3a55640829
fbshipit-source-id: 8790200a0d3c47050d6a91c906854b3a55640829
2016-05-05 08:17:34 -07:00
Andy StreetandFacebook Github Bot 0 a1ba0918ab Protect against JS module call race condition while initializing react instance
Summary: Fixes a race condition where JS module functions could be called in between ##initializeWithInstance(catalystInstance);## and ##CatalystInstance#runJSBundle##, before the BatchedBridge in JS was set up. We now guarantee that all JS module methods that are called after `ReactContext#hasActiveCatalystInstance()` returns true will have the batched bridge created and ready to use.

Reviewed By: lexs

Differential Revision: D3258651

fb-gh-sync-id: 66e66533cc86d185e7c865376d6a5cdc6520d2d4
fbshipit-source-id: 66e66533cc86d185e7c865376d6a5cdc6520d2d4
2016-05-05 05:52:19 -07:00
Andy StreetandFacebook Github Bot 9 a69b883537 Simplify ReactRootView
Summary:
I need to do some refactoring of what happens when a ReactRootView is attached/detached from the window. In doing so, I found ReactRootView is way more complicated than it needs to be and very hard to understand. This simplifies it while maintaining functionality.

Basically:
- When you start a react application, if the root view is measured, we attach it to the instance.
- If it wasn't measured, we do nothing
- In onMeasure, if we have a ReactInstanceManager, but are not attached to it, attach to it.

None of this needs to depend on whether we're attached to the window or whether an attach is scheduled afaict.

Reviewed By: dmmiller

Differential Revision: D3260056

fb-gh-sync-id: 974c19ed75a07f83299472f75346bd6be7414128
fbshipit-source-id: 974c19ed75a07f83299472f75346bd6be7414128
2016-05-05 05:07:28 -07:00
Dave MillerandFacebook Github Bot 7 a3146e41a2 Add pagingEnabled to HorizontalScrollView
Summary:
This adds support for pagingEnabled to the HorizontalScrollView.

This is an initial implementation.

Because Android doesn't provide great details about what is happening with a scroll view after you are done touching it, we have some post touch handling.  This is kicked off either by touch up or a fling call.
Once we are doing that handling, we start a runnable that basically checks if we are still scrolling.  If we are, we just schedule that runnable again and check a frame later.  If we are done scrolling (no onScrollChanged since we last fired), we could be in one of two states, the fling is done or we are done snapping to the page boundary.  If we are in the fling done case, we then check if we need to scroll to a page boundary.  If so, we call smoothScrollTo and schedule ourself to check onScroll events again until done with that scroll.  If we are done with both (either we only did momentum scroll or we did that and then snapped to page), we can then fire the final event and stop checking.  This logic is all in handlePostTouchScrolling.

Because of the decision to only do page scrolling after momentum ends, we do allow you to scroll through with momentum a number of pages and the transition can be a little strange where it stops a sec and then slides to be page aligned.  As a follow up, we can probably smooth that up by changing the value we pass to super.fling() that would adjust it to be let momentum carry it to the page boundary.

Reviewed By: weicool

Differential Revision: D3207608

fb-gh-sync-id: 02f62970ed9a5e3a5f9c0d959402756bc4b3699e
fbshipit-source-id: 02f62970ed9a5e3a5f9c0d959402756bc4b3699e
2016-05-05 04:14:22 -07:00
Chris GeirmanandFacebook Github Bot 2 a26afd2d73 clarify highlightRow usage with UIExplorer example
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

> From the existing documentation, it's not clear how one would make use of the highlightRow attribute of ListView.renderRow. Special thanks to halilb for his assistance.

Example: When "Adding a function to do X", explain why it is necessary to have a way to do X.

**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.

> Here's a screenshot of the UIExplorer with a row highlighted (using the FB Blue Color)
> <img width="466" alt="2016-03-16_1944" src="https://cloud.githubusercontent.com/assets/1640318/13835020/49b5b38c-ebb1-11e5-98fa-17201fd3db92.png">

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTIN
Closes https://github.com/facebook/react-native/pull/6495

Differential Revision: D3264092

Pulled By: nicklockwood

fb-gh-sync-id: 9608e8a66387f527b872928a3595ca4d17736b82
fbshipit-source-id: 9608e8a66387f527b872928a3595ca4d17736b82
2016-05-05 03:43:47 -07:00
Fred LiuandFacebook Github Bot 8 d037840158 SwipeableRow fix
Reviewed By: fkgozali

Differential Revision: D3261975

fb-gh-sync-id: f0c75aca1b16f810420a78271937777c5068c9d2
fbshipit-source-id: f0c75aca1b16f810420a78271937777c5068c9d2
2016-05-04 19:51:18 -07:00
Fred LiuandFacebook Github Bot 3 9b1a3c79e9 Swipeable row component
Reviewed By: furdei

Differential Revision: D3259527

fb-gh-sync-id: c2503476eb708add8753de8c00d0c3f5f3058474
fbshipit-source-id: c2503476eb708add8753de8c00d0c3f5f3058474
2016-05-04 15:49:20 -07:00
Pieter De BaetsandFacebook Github Bot 9 e76998531c upgrade graceful-fs to v4.1.3 (2)
Reviewed By: bestander

Differential Revision: D3260213

fb-gh-sync-id: a23a275d022006dd44c993217385a3fe6d6ff88c
fbshipit-source-id: a23a275d022006dd44c993217385a3fe6d6ff88c
2016-05-04 13:58:29 -07:00
Pieter De BaetsandFacebook Github Bot 9 c4e79a4f54 upgrade node-haste to v2.11.0
Reviewed By: davidaurelio

Differential Revision: D3259486

fb-gh-sync-id: 220378ca5d2b83d30b196a2a825a9becaf6b2b32
fbshipit-source-id: 220378ca5d2b83d30b196a2a825a9becaf6b2b32
2016-05-04 13:58:28 -07:00
Adam ErnstandFacebook Github Bot 2 3105dc8d6e Reverted commit D3259193
Reviewed By: davidaurelio

Differential Revision: D3259193

fb-gh-sync-id: 563d40261fb0b1c1def2e0c33f6197d858a1c54a
fbshipit-source-id: 563d40261fb0b1c1def2e0c33f6197d858a1c54a
2016-05-04 12:12:27 -07:00
David AurelioandFacebook Github Bot 5 7518c2f827 upgrade graceful-fs to v4.1.3
Reviewed By: davidaurelio

Differential Revision: D3259193

fb-gh-sync-id: d3f956fb1dc555df1bd5938a428c61de99b2fd95
fbshipit-source-id: d3f956fb1dc555df1bd5938a428c61de99b2fd95
2016-05-04 11:27:19 -07:00
Konstantin RaevandFacebook Github Bot 7 110d1587ae Added stability to OSS instrumentation tests
Summary:
This change makes all instrumentation tests to be executed in sequence in independent retriable processes.

With a new test being open sourced recently our CI stability degraded.
This PR should bring back stability because tests won't affect each other and will have shorter lifetime
Closes https://github.com/facebook/react-native/pull/7353

Differential Revision: D3259081

fb-gh-sync-id: 48ccdb5dbd561d416526497ff474378db9ca3c60
fbshipit-source-id: 48ccdb5dbd561d416526497ff474378db9ca3c60
2016-05-04 10:59:33 -07:00
Pieter De BaetsandFacebook Github Bot 2 2760df761d Cleanup InitializeJavascriptAppEngine
Reviewed By: davidaurelio

Differential Revision: D3235141

fb-gh-sync-id: 86fc844c5e9d9ea57d504696bac30671c2079e7a
fbshipit-source-id: 86fc844c5e9d9ea57d504696bac30671c2079e7a
2016-05-04 10:50:32 -07:00
Jean-Richard LaiandFacebook Github Bot 4 2310494f32 Fix distanceFilter caching for LocationObserver
Summary:
Allow changing distanceFilter after _locationManager has been initialized.

There is 2 reasons for this PR:
- When calling `getCurrentPosition`, `_observerOptions` is possibly not set properly ( as it is set only in `startObserving`), in this case it would have default values so `distanceFilter` will be 0 in this case ( which can be the right value but we should be more explicit about it, `kCLDistanceFilterNone` or `RCT_DEFAULT_LOCATION_ACCURACY`):
<img width="961" alt="screen shot 2016-04-14 at 8 44 09 pm" src="https://cloud.githubusercontent.com/assets/159813/14551465/6aa8791a-0288-11e6-9c98-1687357f8c2a.png">
- Another issue is that `distanceFilter` is cached so it can't be changed afterwards:

```javascript
let options;
options = {
  enableHighAccuracy: true,
  distanceFilter: 20,
};

this.watchId = this.geolocation.watchPosition(
  () => { },
  () => { },
  options,
);

// => sets distanceFilter to 20

this.geolocation.clearWatch(this.watchId);

options = {
  enableHighAccuracy:
Closes https://github.com/facebook/react-native/pull/6987

Differential Revision: D3258956

fb-gh-sync-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725
fbshipit-source-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725
2016-05-04 10:35:30 -07:00
Alexander BlomandFacebook Github Bot 4 041185edfd Let JS modules use strings instead of ids on Android
Reviewed By: nicklockwood

Differential Revision: D3229626

fb-gh-sync-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
fbshipit-source-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
2016-05-04 10:29:26 -07:00
David AurelioandFacebook Github Bot 5 5071907b27 Add verbose module names to dev builds
Summary:
This intends to make the devx story better after switching to numeric module IDs:

- `require('<verbose-name>)` works again for dev builds
- In dev builds, Systrace will use the verbose names of modules for markers

Reviewed By: bestander

Differential Revision: D3253318

fb-gh-sync-id: 3425d5086ce28634653a6c8c7f5f11afa1614902
fbshipit-source-id: 3425d5086ce28634653a6c8c7f5f11afa1614902
2016-05-04 09:33:22 -07:00
Martin KonicekandFacebook Github Bot 6 00167e4956 Add scripts for running tests locally
Summary:
I was going to add an integration test and realized it would be useful to have an easy way to run these test locally. Added scripts and documented how to use them.

**Test plan**

`./scripts/run-android-local-unit-tests.sh`

<img width="786" alt="screen shot 2016-05-04 at 3 55 26 pm" src="https://cloud.githubusercontent.com/assets/346214/15018667/7f4981cc-1212-11e6-9fcb-12493c29015c.png">

`./scripts/run-android-local-integration-tests.sh`

<img width="772" alt="screen shot 2016-05-04 at 3 57 23 pm" src="https://cloud.githubusercontent.com/assets/346214/15018677/90b54810-1212-11e6-83d4-58530eb41d79.png">

Buck check by replacing `which buck` by `which duck` in the scripts:

<img width="805" alt="screen shot 2016-05-04 at 4 09 37 pm" src="https://cloud.githubusercontent.com/assets/346214/15018696/aa008262-1212-11e6-9a22-173507cd771f.png">

Checked the website renders fine:

`cd website; npm install; npm start`

![screen shot 2016-05-04 at 4 05 23 pm](https://cloud.githubusercontent.com/asse
Closes https://github.com/facebook/react-native/pull/7386

Differential Revision: D3258717

fb-gh-sync-id: 023eb9fdb59b00f9507e2e0694ad0934bb564c03
fbshipit-source-id: 023eb9fdb59b00f9507e2e0694ad0934bb564c03
2016-05-04 08:58:18 -07:00
Nick LockwoodandFacebook Github Bot 7 e72163f0f2 Added explicit init to observer modules
Summary:
Modules which call JS methods directly, or use `sendDeviceEventWithName:`, can trigger effects in JS without ever being referenced from the JS code. This breaks some assumptions in my earlier diff about when modules can be lazily loaded.

Pending a better solution, I've put explicit `init` methods in these modules to ensure they are eagerly initialized (the downside to this is that they'll still be initialized even if they are never used).

Reviewed By: javache

Differential Revision: D3258232

fb-gh-sync-id: f925bc2e5339c1fbfcc244d4613062c5ab848fc2
fbshipit-source-id: f925bc2e5339c1fbfcc244d4613062c5ab848fc2
2016-05-04 07:07:24 -07:00
Pieter De BaetsandFacebook Github Bot 3 a9a90aa2f0 Fix RCTProfileHookModules instantiating all modules
Reviewed By: tadeuzagallo

Differential Revision: D3235048

fb-gh-sync-id: bdcd72fb241c5136e884c1705e027f178939970b
fbshipit-source-id: bdcd72fb241c5136e884c1705e027f178939970b
2016-05-04 06:55:30 -07:00
Lim Chee AunandFacebook Github Bot 1 aebf4db45a Update HackerWeb in showcase
Summary:
Tiny little update: adding another blog post link on [how I build the Android app](http://cheeaun.com/blog/2016/05/building-hackerweb-android/).
Closes https://github.com/facebook/react-native/pull/7331

Differential Revision: D3258039

fb-gh-sync-id: f33a0b77f32cf18377741e0771db4189479350f3
fbshipit-source-id: f33a0b77f32cf18377741e0771db4189479350f3
2016-05-04 05:41:25 -07:00
Konstantin RaevandFacebook Github Bot 7 ec5016ad8f Fixed path to regenerator-runtime
Summary:
Since 0.8.43 regenerator has regenerator-runtime dependency.
Fixes one js test in trunk
Closes https://github.com/facebook/react-native/pull/7351

Reviewed By: davidaurelio

Differential Revision: D3252699

Pulled By: bestander

fb-gh-sync-id: cedb122eb8e9f3a5e40a5313482bc2282511c71e
fbshipit-source-id: cedb122eb8e9f3a5e40a5313482bc2282511c71e
2016-05-04 05:19:31 -07:00
David AurelioandFacebook Github Bot 5 46d98e1d68 remove support for process.platform
Reviewed By: javache

Differential Revision: D3252666

fb-gh-sync-id: af0e4987c34f43ec2472cbdf52fc112b81050513
fbshipit-source-id: af0e4987c34f43ec2472cbdf52fc112b81050513
2016-05-04 02:51:26 -07:00
Krzysztof MagieraandFacebook Github Bot 7 6c80f886ae Fix setValue to work properly on natively driven nodes
Summary:
This change fixes an issue with calling `setValue` for natively driven nodes. As of now an attempt to call this method from JS would trigger an error "Attempting to run JS driven animation on animated". That is because for natively animated nodes we don't allow for `setNativeProps` to be executed and method `_flush` is now responsible for triggering that call. To fix the issue we add extra flag to `_updateValue` method that indicates if we should be "flushing" updated values using `setNativeProps` and we pass an appropriate value depending on the status of the node (native/non-native). Note that in animation callback we always pass `true` - that is because natively driven animations will never call into that callback.

**Test Plan**
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Closes https://github.com/facebook/react-native/pull/7138

Differential Revision: D3257696

fb-gh-sync-id: 13ec26bc36b56b3208f4279a95532bbe60551087
fbshipit-source-id: 13ec26bc36b56b3208f4279a95532bbe60551087
2016-05-04 02:48:22 -07:00
jsdevelandFacebook Github Bot 0 d4cc5b53c7 Setting current working directory for dev server.
Summary:
* This allows `react-native` to work for users on fedora.
* `react-native run-android` was failing because the launch packager script was unable to find packager.sh (see `source` in `man bash`).
* This change sets cwd for the dev server when run with `run-android`.
Closes https://github.com/facebook/react-native/pull/7316

Differential Revision: D3255866

fb-gh-sync-id: 88f6b18f7c61636ce8fecef77f7f4e60b1d9a637
fbshipit-source-id: 88f6b18f7c61636ce8fecef77f7f4e60b1d9a637
2016-05-04 02:45:29 -07:00
Thierry DEN HARTOGandFacebook Github Bot 1 80fc98cd61 Add new application "Chemin de Fer de Provence"
Summary: Closes https://github.com/facebook/react-native/pull/7357

Differential Revision: D3258040

fb-gh-sync-id: 65580e81d293ddf2e371879b85ab32fe4edfeee1
fbshipit-source-id: 65580e81d293ddf2e371879b85ab32fe4edfeee1
2016-05-04 02:13:28 -07:00
Damien VarronandFacebook Github Bot 6 048775c34b add damusnet to React Native GitHub Issue Task Force
Summary: Closes https://github.com/facebook/react-native/pull/7354

Differential Revision: D3257999

fb-gh-sync-id: 102d761d3aac50a8bcef82bcd1ce5919a5681dbf
fbshipit-source-id: 102d761d3aac50a8bcef82bcd1ce5919a5681dbf
2016-05-04 01:08:21 -07:00
Griffin SmithandFacebook Github Bot 8 5723915eaa Remove all null values for request headers
Summary:
NSMutableURLRequest appears to be running `[headerValue count]` on every value of the NSDictionary that `allHTTPHeaderFields` is set to, meaning that any `null` values passed to headers in an XHR throw an exception.  This differs from the implementation of XHR in browsers, which just ignore any `null` values for headers.

PR doesn't currently include tests, happy to add those if this is something you'd consider merging
Closes https://github.com/facebook/react-native/pull/6903

Differential Revision: D3256727

fb-gh-sync-id: 58e8db9c86a1fe7fbd95cba7dcf916957d179e0c
fbshipit-source-id: 58e8db9c86a1fe7fbd95cba7dcf916957d179e0c
2016-05-03 23:42:26 -07:00
Caio HamamuraandFacebook Github Bot 3 9ca8c09d62 Removed repeated "To"
Summary:
Just a simple word repetition fix in docs.
Closes https://github.com/facebook/react-native/pull/7352

Differential Revision: D3257587

fb-gh-sync-id: a54f38f3bbed9b50cb9c1f8a35d5718bad3deb33
fbshipit-source-id: a54f38f3bbed9b50cb9c1f8a35d5718bad3deb33
2016-05-03 21:55:24 -07:00
Anshul AgarwalandFacebook Github Bot 4 60ee25c554 Correct activity request code
Summary:
Change activity request code to IMAGE_PICKER_REQUEST in currentActivity.startActivityForResult(chooserIntent, IMAGE_PICKER_REQUEST);
Closes https://github.com/facebook/react-native/pull/7347

Differential Revision: D3257586

fb-gh-sync-id: fc92fb0bd3a66371fac22234b8a8b693a23fbf24
fbshipit-source-id: fc92fb0bd3a66371fac22234b8a8b693a23fbf24
2016-05-03 21:50:27 -07:00
Srikanth K HariandFacebook Github Bot 1 bf8b5499bb android websocket: include cookies with request
Summary:
Previously cookie headers weren't sending on websocket connection requests for android.
This commit fixes the issue.
Closes https://github.com/facebook/react-native/pull/6851

Differential Revision: D3257466

fb-gh-sync-id: 4225d11c8c6efd09493ef938a65f024dcbaff749
fbshipit-source-id: 4225d11c8c6efd09493ef938a65f024dcbaff749
2016-05-03 21:12:29 -07:00
James IdeandFacebook Github Bot 8 861dfb5d71 Update Exponent logo and links
Summary: Closes https://github.com/facebook/react-native/pull/7371

Differential Revision: D3257406

fb-gh-sync-id: 45d8800e84c19444ab0b2f24311b019e377fc776
fbshipit-source-id: 45d8800e84c19444ab0b2f24311b019e377fc776
2016-05-03 21:08:20 -07:00
DigeffandFacebook Github Bot 7 785cc07589 Change the Debug Menu string from Debug/Stop JS Remotely to Debug/Stop Remote JS
Summary:
Changed debug menu string as requested in: https://github.com/facebook/react-native/pull/5683 by ide and matthewwithanm

![image](https://cloud.githubusercontent.com/assets/14098140/14967128/ab9ca244-106a-11e6-9168-c8e36285dfb1.png)
Closes https://github.com/facebook/react-native/pull/7334

Differential Revision: D3256730

fb-gh-sync-id: 0265d684ef2e216956a0d0a1bdb5295c58126853
fbshipit-source-id: 0265d684ef2e216956a0d0a1bdb5295c58126853
2016-05-03 20:47:23 -07:00
Chris HopmanandFacebook Github Bot 5 24fe8b7e92 Move xplat bridge core to OSS
Reviewed By: mhorowitz

Differential Revision: D3237829

fb-gh-sync-id: 348c7d1e2810400c1259e3d99c2d026da4a39816
fbshipit-source-id: 348c7d1e2810400c1259e3d99c2d026da4a39816
2016-05-03 19:30:48 -07:00
Spencer AhrensandFacebook Github Bot 5 1d802da7d2 Fix JSWatchdog reset
Reviewed By: ericvicenti

Differential Revision: D3249690

fb-gh-sync-id: 00221d7b3a669b0feb2061b5f6e703339c147172
fbshipit-source-id: 00221d7b3a669b0feb2061b5f6e703339c147172
2016-05-03 19:20:26 -07:00
David AurelioandFacebook Github Bot 6 ee5a1deb0b @ignore-signedsource [react-native-packager] use a single require implementation
Reviewed By: javache, bestander

Differential Revision: D3252718

fb-gh-sync-id: bfd85acc28dd6e2df72a3227743514cb6f8c32f1
fbshipit-source-id: bfd85acc28dd6e2df72a3227743514cb6f8c32f1
2016-05-03 15:19:17 -07:00
Konstantin RaevandFacebook Github Bot 2 1fb8643cb6 Fixes NPE in setFontWeight method
Summary:
We have a crash in prod t11090540, urgent fix same way as in setFontStyle
Closes https://github.com/facebook/react-native/pull/7362

Reviewed By: foghina

Differential Revision: D3254158

Pulled By: dmmiller

fb-gh-sync-id: a497d0d4d0e4df9284e328ebb14fee74ba2f899b
fbshipit-source-id: a497d0d4d0e4df9284e328ebb14fee74ba2f899b
2016-05-03 14:38:18 -07:00
Eric VicentiandFacebook Github Bot 2 bb39a2e9da Reduce extra rendering in NavigationCard
Summary: This adds a new SceneView with a shouldComponentUpdate policy of only re-rendering when the scene's state changes. This allows avoidance of extra re-renders. Results in a much smoother back-swipe gesture because we no longer re-render scenes as we transition from gesture to animation.

Reviewed By: hedgerwang

Differential Revision: D3219545

fb-gh-sync-id: 7c04e0e4ebb40d1e57ef7af11e2e54adf4f52aa0
fbshipit-source-id: 7c04e0e4ebb40d1e57ef7af11e2e54adf4f52aa0
2016-05-03 13:31:18 -07:00
Dave MillerandFacebook Github Bot 8 20d53b1f23 Have Modal dismiss Dialog when the ReactInstance goes away
Reviewed By: angelahess

Differential Revision: D3252808

fb-gh-sync-id: 1f3085412f409581f161cf2151b251e818851d84
fbshipit-source-id: 1f3085412f409581f161cf2151b251e818851d84
2016-05-03 13:29:29 -07:00
Charles DickandFacebook Github Bot 2 0a7a228fbb Fix crash in adsmanager login by nolonger assuming only one react context exists at once
Reviewed By: lexs

Differential Revision: D3252624

fb-gh-sync-id: e1d1c914be4e0caab953478f12441b440bd1f894
fbshipit-source-id: e1d1c914be4e0caab953478f12441b440bd1f894
2016-05-03 13:28:23 -07:00
Nick LockwoodandFacebook Github Bot 4 34ec6a91a9 Move setBridge: off main thread
Summary:
Previously, if a module implemented `setBridge:` we assumed that it needs to be initialised on the main thread. This assumption was not really warranted however, and it was a barrier to deferring module initialization.

This diff tweaks the rules so that only modules that override `init` or `constantsToExport**` are assumed to require main thread initialization, and others can be created lazily when they are first used.

WARNING: this will be a breaking change to any 3rd party modules that are assuming `setBridge:` is called on the main thread. Those modules should be rewritten to move any code that requires the main thread into `init` or `constantsToExport` instead.

`**` We will also be examining whether `constantsToExport` can be done lazily, but for now any module that uses it will still be created eagerly when the bridge starts up.

Reviewed By: javache

Differential Revision: D3240682

fb-gh-sync-id: 48f309e3158bbccb52141032baf70def3e609371
fbshipit-source-id: 48f309e3158bbccb52141032baf70def3e609371
2016-05-03 09:09:21 -07:00
Yedidya KennardandFacebook Github Bot 1 55c8158c44 Corrected bug that put the UTI instead of mimeType in retrieved assets
Summary:
This pull request corrects a bug  found in `RCTAssetsLibraryRequestHandler` which used the asset UTI as the mimeType.

The code for finding the mimeType is based on the implementation used in `RCTImageLoader` and `RCTImageUtils`.
Closes https://github.com/facebook/react-native/pull/7349

Differential Revision: D3252796

Pulled By: nicklockwood

fb-gh-sync-id: b9303a99333e4744dfe23045f4a2755307305772
fbshipit-source-id: b9303a99333e4744dfe23045f4a2755307305772
2016-05-03 08:53:34 -07:00
Kelvin SherlockandFacebook Github Bot 3 46ba1532fd babel-preset - transform-es2015-constants was replaced by check-es2015-constants.
Summary:
The babel plugin transform-es2015-constants was replaced by check-es2015-constants.

References:

T2970
rBW0a3b3b03dbcfc8d1e809a0eaf6270eec8de80763
T3053

This patch updates the babel preset to use check-es2015-constants which should be more future-proof and will receive bug fixes.
Closes https://github.com/facebook/react-native/pull/6943

Reviewed By: davidaurelio

Differential Revision: D3189222

Pulled By: bestander

fb-gh-sync-id: a5ec23e297e1d3591d51641dd567049f4310b107
fbshipit-source-id: a5ec23e297e1d3591d51641dd567049f4310b107
2016-05-03 06:43:27 -07:00
Konstantin RaevandFacebook Github Bot 0 1b9b3ba58c Stabilise tests in SandCastle and prepare for OSS
Reviewed By: mkonicek

Differential Revision: D3244884

fb-gh-sync-id: d96dddca65175a90ee70aeb1c7530cea04860f61
fbshipit-source-id: d96dddca65175a90ee70aeb1c7530cea04860f61
2016-05-03 06:04:46 -07:00
Urban CvekandFacebook Github Bot 6 50c2467905 Enable setting color of text and images on unselected tabs
Summary:
Hi,
This PR Solves this issue #3083.
This PR solves the problem of default color on TabBar being always grey. Which looks great if the barTintColor is unchanged. However if we set the barTintColor to something else (like blue in example) text and icons become quite unreadable.
![simulator screen shot 27 apr 2016 21 58 40](https://cloud.githubusercontent.com/assets/12081272/14866402/e51c7120-0cc3-11e6-9570-097b686c160f.png)

Commit (c206417) - Enable setting color of unselected tabs
Solves this issue with a prop (unselectedTintColor) on TabBarIOS to which you just pass a color like you can for barTintColor and tintColor.
This leaves us with a result that is on second picture. Notice the color of text on tabs.
![simulator screen shot 27 apr 2016 21 59 06](https://cloud.githubusercontent.com/assets/12081272/14866419/f77aa7e2-0cc3-11e6-8c90-33209009bc09.png)

Or change it to yellow for demonstrating purposes
![simulator screen shot 27 apr 2016 21 59 13](https://cloud.githubusercontent.com/assets/1208
Closes https://github.com/facebook/react-native/pull/7264

Differential Revision: D3240924

Pulled By: nicklockwood

fb-gh-sync-id: 14a0de28abd064756320b7a74f128c255caa6b12
fbshipit-source-id: 14a0de28abd064756320b7a74f128c255caa6b12
2016-05-03 05:40:29 -07:00
Simon Friis VindumandFacebook Github Bot 7 3e181b85b0 Change "paste" to "type"
Summary:
* Copy-pasting into a terminal _can_ be dangerous. [See this](https://thejh.net/misc/website-terminal-copy-paste). Thus I've changed "paste" to "type". People are probably going to do this anyway but there is not need to suggest copy-pasting `sudo`commands.
* `sudo` is not required to do a global npm install (of course you can do it). Thus I've removed the "sudo" for the flow install command. This is consistent with the general getting started page where `sudo` isn't used in front of `npm install -g` either.
Closes https://github.com/facebook/react-native/pull/7330

Differential Revision: D3252286

fb-gh-sync-id: 7d4580b6bf828e4a833e02365045f3bb9276cfef
fbshipit-source-id: 7d4580b6bf828e4a833e02365045f3bb9276cfef
2016-05-03 01:34:16 -07:00
Hedger WangandFacebook Github Bot 4 8ac03077c9 better way to manage pointerEvents for NavigationCard.
Reviewed By: fkgozali

Differential Revision: D3250602

fb-gh-sync-id: 6b20d283f8854d0e137800c37595fc014a78e338
fbshipit-source-id: 6b20d283f8854d0e137800c37595fc014a78e338
2016-05-02 19:17:24 -07:00
Jason PradoandFacebook Github Bot 1 79c5322233 Reverted commit D3205106
Summary:
THis addresses the issue as reported at
https://github.com/facebook/react-native/issues/6732

Use a higher order component `NavigationPointerEventsContainer` to manager the
prop `pointerEvents` for `NavigationCard`.

The idea is that the scene's content should not be interactive while the scene is
transitioning.

Reviewed By: ericvicenti

Differential Revision: D3205106

fb-gh-sync-id: db7172941155f34447495199d2c029f5c7e75f30
fbshipit-source-id: db7172941155f34447495199d2c029f5c7e75f30
2016-05-02 14:22:30 -07:00
Hedger WangandFacebook Github Bot 4 5966ccbcad better way to manage pointerEvents for NavigationCard.
Summary:
THis addresses the issue as reported at
https://github.com/facebook/react-native/issues/6732

Use a higher order component `NavigationPointerEventsContainer` to manager the
prop `pointerEvents` for `NavigationCard`.

The idea is that the scene's content should not be interactive while the scene is
transitioning.

Reviewed By: ericvicenti

Differential Revision: D3205106

fb-gh-sync-id: c0fd22e8c8b83a5952351c5a3a302b2fca5ba5de
fbshipit-source-id: c0fd22e8c8b83a5952351c5a3a302b2fca5ba5de
2016-05-02 12:57:23 -07:00
Mark OswaldandFacebook Github Bot 4 bb06536616 call bundle with reset-cache true as default from standard project
Summary:
addition to #7297

When called from an upstarting app, the bundling process should always be called with a cleared cache. That avoids possible problems with cached files.
Closes https://github.com/facebook/react-native/pull/7324

Differential Revision: D3247420

fb-gh-sync-id: 503ad39cb36455512ccea1af7618e89a80942f0c
fbshipit-source-id: 503ad39cb36455512ccea1af7618e89a80942f0c
2016-05-02 08:03:19 -07:00
Damien BrugneandFacebook Github Bot 8 8f295f16b1 Add donut.me chat apps to showcase
Summary:
Adding donut.me chat iOS/Android apps to showcase.
Closes https://github.com/facebook/react-native/pull/7326

Differential Revision: D3247330

fb-gh-sync-id: e90cb89fd673461b15b5389ff180640dff1f0606
fbshipit-source-id: e90cb89fd673461b15b5389ff180640dff1f0606
2016-05-02 04:23:25 -07:00
SangYeob Bono YuandFacebook Github Bot 9 94a2a9dcde Change app name
Summary: Closes https://github.com/facebook/react-native/pull/7321

Differential Revision: D3247327

fb-gh-sync-id: a9c5a69179724b377e95e0e82861795dab3c8db3
fbshipit-source-id: a9c5a69179724b377e95e0e82861795dab3c8db3
2016-05-02 04:13:19 -07:00
Joshua PinterandFacebook Github Bot 9 449a81264b Add keys to hash as you need them.
Summary:
Just showing a hash of values is misleading. Makes the user think you can just pass in the values without the keys.
Closes https://github.com/facebook/react-native/pull/7310

Differential Revision: D3245834

fb-gh-sync-id: 39220ed7720e3ff402f2c2ba8bebdefb96bfa203
fbshipit-source-id: 39220ed7720e3ff402f2c2ba8bebdefb96bfa203
2016-04-30 20:40:28 -07:00
Joshua PinterandFacebook Github Bot 6 4bbd64931b Indicate width and height params are being passed to onContentSizeChange.
Summary:
I had to do a little trial and error to find this out. Would be helpful to have it in the docs.

I'm not sure if there's a standard wording or format you prefer for indicating handler function params.
Closes https://github.com/facebook/react-native/pull/7312

Differential Revision: D3245838

fb-gh-sync-id: 89433c036f7287d9efb69605180734dbc4df4df3
fbshipit-source-id: 89433c036f7287d9efb69605180734dbc4df4df3
2016-04-30 18:28:22 -07:00
Sawyer HoodandFacebook Github Bot 7 9425bcff8f Updated a warning string in upgrade.js
Summary:
I inserted an 'in' in the warning message that is displayed when the user's package.json file doesn't have a valid version number for react native.

Test plan
---------------
-run upgrade.js on a project with an invalid version number.
Closes https://github.com/facebook/react-native/pull/7314

Differential Revision: D3245839

fb-gh-sync-id: e38f3be0884d8c75f9610faced85d5c81c24a49e
fbshipit-source-id: e38f3be0884d8c75f9610faced85d5c81c24a49e
2016-04-30 18:21:17 -07:00
Janic DuplessisandFacebook Github Bot 7 f8f9362c05 Reverted commit D3242754
Summary:
This separates the babel config of the local-cli and the packager from the one used by the transforms of the packager since it doesn't run in the same environment and the local-cli/packager doesn't require react specific transforms and runs in node 4 so we can also avoid some es2015 transforms that node already supports.

I had to move the code in cli.js so it can still run in node 0.12 that doesn't support `const` since it is no longer transformed.

**Test plan**
Run the local-cli on node 0.12 and there should be a message saying that it requires at least node 4.
Run the local-cli on node 4 and 5 and everything should work the same as before.

I was also hoping for some perf gains but there was nothing noticeable. I did benchmark the babel-register call and it stayed pretty much the same. As for runtime performance it can help if there are optimisations for es2015 features in node.
Closes https://github.com/facebook/react-native/pull/6155

Differential Revision: D3242754

Pulled By: eczarny

fb-gh-sync-id: 6cd349e284b7d92a1b2cc8b5c0e26adbfb0d9a2f
fbshipit-source-id: 6cd349e284b7d92a1b2cc8b5c0e26adbfb0d9a2f
2016-04-30 16:54:31 -07:00
Janic DuplessisandFacebook Github Bot 6 19429f79b2 Use a separate babel config for the local-cli and the packager
Summary:
This separates the babel config of the local-cli and the packager from the one used by the transforms of the packager since it doesn't run in the same environment and the local-cli/packager doesn't require react specific transforms and runs in node 4 so we can also avoid some es2015 transforms that node already supports.

I had to move the code in cli.js so it can still run in node 0.12 that doesn't support `const` since it is no longer transformed.

**Test plan**
Run the local-cli on node 0.12 and there should be a message saying that it requires at least node 4.
Run the local-cli on node 4 and 5 and everything should work the same as before.

I was also hoping for some perf gains but there was nothing noticeable. I did benchmark the babel-register call and it stayed pretty much the same. As for runtime performance it can help if there are optimisations for es2015 features in node.
Closes https://github.com/facebook/react-native/pull/6155

Differential Revision: D3242754

Pulled By: davidaurelio

fb-gh-sync-id: 02880c841c10562d5f107e1c975d668e55cc619f
fbshipit-source-id: 02880c841c10562d5f107e1c975d668e55cc619f
2016-04-30 16:25:24 -07:00
Zeeshan MughalandFacebook Github Bot 2 69d5ddd349 Showcase: Add Trump Blocker
Summary: Closes https://github.com/facebook/react-native/pull/6944

Differential Revision: D3245656

fb-gh-sync-id: bab7f4d0dfba1c628e6be8a0b9f369d9f1ef8f70
fbshipit-source-id: bab7f4d0dfba1c628e6be8a0b9f369d9f1ef8f70
2016-04-30 14:40:21 -07:00
Sebastian MarkbageandFacebook Github Bot 0 ba8878d12c Update react package to stable release
Summary:
react-native is about to do a branch cut for the next stable release. We want
this version to use a stable release of react so we released one.

This should be the same as the previous alpha. The is mostly changes to DOM / testing and not RN:

https://github.com/facebook/react/commits/15.0.2-dev

AFAIK there are no behavior changes to RN.

I had to add ReactPropTransferer from downstream since this moved out of React Core and into www.

Reviewed By: zpao

Differential Revision: D3245046

fb-gh-sync-id: 7e460315699fd5bff36d89751ce94edb75dd4733
fbshipit-source-id: 7e460315699fd5bff36d89751ce94edb75dd4733
2016-04-30 11:58:32 -07:00
Spencer AhrensandFacebook Github Bot 6 2c3576a50a Refactor connection/list stuff
Reviewed By: devknoll

Differential Revision: D3233991

fb-gh-sync-id: bd10dd2856da6b8fb3bac7a8ec3a7e34eeb58f80
fbshipit-source-id: bd10dd2856da6b8fb3bac7a8ec3a7e34eeb58f80
2016-04-30 10:28:55 -07:00
David AurelioandFacebook Github Bot 9 34dd17cae5 Add encoding/hash signature to JS files
Reviewed By: tadeuzagallo

Differential Revision: D3241028

fb-gh-sync-id: 737ae64cf3a3f4f121076dbfe933d5fe71e07817
fbshipit-source-id: 737ae64cf3a3f4f121076dbfe933d5fe71e07817
2016-04-30 09:44:23 -07:00
Alessandro NadalinandFacebook Github Bot 0 8d3d8b3440 Update the PR template
Summary:
Added a link to the contributing.md -- there's a bunch of stuff there that's not mentioned in this template.
Closes https://github.com/facebook/react-native/pull/6899

Differential Revision: D3245105

fb-gh-sync-id: 4d462dded04cf83afdd9b6dddcbc45aa7ecd7cd9
fbshipit-source-id: 4d462dded04cf83afdd9b6dddcbc45aa7ecd7cd9
2016-04-29 21:15:25 -07:00
Dale JeffersonandFacebook Github Bot 6 d3fe668e97 Add Calor - Field Pro to the showcase
Summary:
The Calor Field Pro app is an Enterprise React Native iPad application and is not available on the app store, so I link to our website has been provided.
Closes https://github.com/facebook/react-native/pull/7090

Differential Revision: D3245081

fb-gh-sync-id: 9a4d5c581514933b45fcbf8823aec61587cfaaa0
fbshipit-source-id: 9a4d5c581514933b45fcbf8823aec61587cfaaa0
2016-04-29 21:12:25 -07:00
Igor AvramovicandFacebook Github Bot 0 850ce649d4 Render top back and back button on search results
Differential Revision: D3238568

fb-gh-sync-id: d28eee4cefb88a4b43fd3c16357de3443aec6bc5
fbshipit-source-id: d28eee4cefb88a4b43fd3c16357de3443aec6bc5
2016-04-29 17:59:22 -07:00
Konstantin RaevandFacebook Github Bot 5 0c590b325d Revert "fix border style without borderRadius"
Summary:
Subj broke ObjC snapshot tests

This reverts commit 58876d5a03.
Closes https://github.com/facebook/react-native/pull/7303

Differential Revision: D3243670

fb-gh-sync-id: acef6bc7a50b0fa7dc112b88407644e8226d6f85
fbshipit-source-id: acef6bc7a50b0fa7dc112b88407644e8226d6f85
2016-04-29 16:37:23 -07:00
Janic DuplessisandFacebook Github Bot 9 169cfb5a52 Remove the need for allowTopLevelThis in transform-es2015-modules-commonjs
Summary:
This make the transform behave closer to the standard for modules.

This removes the few places that a top level this was used to refer to the global space. It also clean up the usage of `GLOBAL` to use `global` instead as this is what is used everywhere else in the code base. We still define `GLOBAL` for compatibility with other modules.

**Test plan**
Clear the packager cache to make sure the transforms run again. (node ./local-cli/cli.js start --reset-cache).
Run the Movies example (UIExplorer is broken atm) and make sure there are no errors.
Closes https://github.com/facebook/react-native/pull/6255

Differential Revision: D3037227

Pulled By: mkonicek

fb-gh-sync-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
fbshipit-source-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
2016-04-29 16:15:34 -07:00
Sebastian MarkbageandFacebook Github Bot 5 373537b281 Deprecate transformMatrix and decomposedMatrix
Summary:
transformMatrix only worked on iOS and there is an equivalent API that (mostly)
works cross platform.

decomposedMatrix could technically be passed on Android but it wasn't document and explicitly flagged as not working.

My goal is to deprecate both uses and then the only supported API is the `transform: [{ matrix: ... }]` form.

The only difference is that on Android the matrix gets decomposed.

Currently there is some special cased magic that renames transform -> transformMatrix or decomposedMatrix depending on platform.

https://github.com/facebook/react/blob/master/src/renderers/native/ReactNative/ReactNativeAttributePayload.js#L50

Therefore I'm adding an alias for both native platforms called just "transform".

Next I'll swap over the JS to always target the name "transform". The only difference is how the value is marshalled over the bridge in processTransform.

To do this, I have to clean up a few callers. Mostly that's just swapping to the new API.

For buildInterpolator this is a bit trickier but this fixes it for all our use cases (which is only the Navigator in AdsManager).

Reviewed By: vjeux

Differential Revision: D3239960

fb-gh-sync-id: 838edb6644c6cdd0716834f712042f226ff3136f
fbshipit-source-id: 838edb6644c6cdd0716834f712042f226ff3136f
2016-04-29 14:19:25 -07:00
Jeff MorrisonandFacebook Github Bot 5 7e9720f0ae Deploy Flow 0.24.0 to fbsource
Reviewed By: gabelevi

Differential Revision: D3241183

fb-gh-sync-id: a40da6d4d30abf720d0f95d76be803d669fc92c3
fbshipit-source-id: a40da6d4d30abf720d0f95d76be803d669fc92c3
2016-04-29 13:43:27 -07:00
Satyajit SahooandFacebook Github Bot 1 06b2d9c4fd Import from React in JavaScriptEnvironment
Summary:
cc sebmarkbage
Closes https://github.com/facebook/react-native/pull/7300

Differential Revision: D3241837

Pulled By: sebmarkbage

fb-gh-sync-id: 48491192ba215d402ebbe4c77124dc75c6f0e0b8
fbshipit-source-id: 48491192ba215d402ebbe4c77124dc75c6f0e0b8
2016-04-29 11:49:24 -07:00
Ronak PatelandFacebook Github Bot 8 edf5d85be0 Passing current activity while creating react instance manager
Reviewed By: astreet

Differential Revision: D3236602

fb-gh-sync-id: efbac8f0d8c770f2edf6fb447498e650302d98c7
fbshipit-source-id: efbac8f0d8c770f2edf6fb447498e650302d98c7
2016-04-29 11:46:23 -07:00
Mark OswaldandFacebook Github Bot 3 90f9f48498 add reset-cache command to bundle
Summary:
Currently the `react-native bundle` has no option to reset the file cache. For example changing the .babelrc has no effect on the bundling process. `react-native start` has it already implemented, so this is just a small addition.

**Test plan (required)**

the issue:

- `react-native init` a new project
- run `react-native bundle` (should work as expected)
- create `.babelrc` with empty object ```{}```
- rerun `react-native bundle`
- should fail now with `Unexptected token` (no babel plugins configured)
 - if not failing, your cache already hit (clear $TMPDIR to get the error)
- delete .babelrc and rerun `bundle`
- still failing, but it should went back to normal
- delete your $TMPDIR contents
- works again

The option `--reset-cache` should fix that
Closes https://github.com/facebook/react-native/pull/7297

Differential Revision: D3241259

Pulled By: davidaurelio

fb-gh-sync-id: 0ed5b58aa1f021d72021f4c80fbc57d2e7e8181f
fbshipit-source-id: 0ed5b58aa1f021d72021f4c80fbc57d2e7e8181f
2016-04-29 10:38:29 -07:00
David AurelioandFacebook Github Bot 6 cccb8db175 Unify source map approach for RA bundles on iOS/Android
Reviewed By: javache

Differential Revision: D3229780

fb-gh-sync-id: a3148d7626b32a2e6803ae8c35ac75025a992a32
fbshipit-source-id: a3148d7626b32a2e6803ae8c35ac75025a992a32
2016-04-29 10:16:22 -07:00
Spencer AhrensandFacebook Github Bot 5 6cae8b7c02 Optimize WindowedListView
Summary:
Reduce re-renders by only looking at `props.data` that we're actually going to render and tracking if `this._rowFrames`
is dirty.

Differential Revision: D3195163

fb-gh-sync-id: 1e17ab410a312a37d4a93b84ea51ca32c3ede839
fbshipit-source-id: 1e17ab410a312a37d4a93b84ea51ca32c3ede839
2016-04-29 10:15:29 -07:00
Shawn WilsherandFacebook Github Bot 1 856f9e9fed Add --version to local-cli/cli.js
Summary:
[Buck](https://buckbuild.com) has a concept of a versioned tool.  In order to
properly use RN with Buck, the `cli.js` script should return the proper version
when passed `--version`.

Reviewed By: astreet

Differential Revision: D3197207

fb-gh-sync-id: 12ea35587cf492eb89d7dd102e93bdd26bc813c0
fbshipit-source-id: 12ea35587cf492eb89d7dd102e93bdd26bc813c0
2016-04-29 09:25:32 -07:00
Dave MillerandFacebook Github Bot 9 850befa3cd Remove unused code
Reviewed By: davidaurelio

Differential Revision: D3240927

fb-gh-sync-id: b9ecb5269026314905a22eae3b32fd546574c5ef
fbshipit-source-id: b9ecb5269026314905a22eae3b32fd546574c5ef
2016-04-29 08:48:19 -07:00
Erem ZeitandFacebook Github Bot 8 2b191bfab7 Update docs for creating an android native view
Summary:
Doc changes only.  Updating example code to reflect the new requirements discussed in this [issue](https://github.com/facebook/react-native/issues/4605).

In short, in the JS code that registers your new native view, you need to explicitly include the `propTypes` that come default for views or else you get an error.
Closes https://github.com/facebook/react-native/pull/7281

Differential Revision: D3240654

Pulled By: mkonicek

fb-gh-sync-id: f7571ce7435c5b241a17af2822e7e350ce3186cb
fbshipit-source-id: f7571ce7435c5b241a17af2822e7e350ce3186cb
2016-04-29 08:16:23 -07:00
Kudo ChienandFacebook Github Bot 0 708443e50c Add biideal app to showcase
Summary:
Add biideal app to showcase which is my first RN app.
Closes https://github.com/facebook/react-native/pull/7263

Differential Revision: D3240862

Pulled By: mkonicek

fb-gh-sync-id: ba76bc19382f22f03516c02c4e01d48c53ee70f4
fbshipit-source-id: ba76bc19382f22f03516c02c4e01d48c53ee70f4
2016-04-29 07:37:20 -07:00
Charles DickandFacebook Github Bot 5 24b2990467 Capture heap from the dev menu
Reviewed By: foghina

Differential Revision: D3229856

fb-gh-sync-id: c6321cfb309c93572a51bba625d63246a75f0254
fbshipit-source-id: c6321cfb309c93572a51bba625d63246a75f0254
2016-04-29 07:35:22 -07:00
alvarombandFacebook Github Bot 2 84e696867b Added badge icon number and alert action
Summary:
Added support for setting an optional badge icon number and alert action when using local notifications.
Closes https://github.com/facebook/react-native/pull/2931

Differential Revision: D3212448

Pulled By: mkonicek

fb-gh-sync-id: 063efcdd259b2a43f39812f57a71e8489ab33653
fbshipit-source-id: 063efcdd259b2a43f39812f57a71e8489ab33653
2016-04-29 05:37:27 -07:00
Martin KonicekandFacebook Github Bot 5 12caa363a1 Remove 'react-native link'
Summary:
`react-native link` was an early experiment, [rnpm](https://github.com/rnpm/rnpm) does this much better. After merging this PR we should merge rnpm so that `react-native link` works again :)

grabbou Kureev Just making some space here :)

This reverts 4e5a2bc079.

**Test Plan**

e2e tests on Travis and CircleCI
Closes https://github.com/facebook/react-native/pull/7290

Differential Revision: D3240702

Pulled By: mkonicek

fb-gh-sync-id: 6aac83fac599ba3db0dd0a7ac48653ebabd93491
fbshipit-source-id: 6aac83fac599ba3db0dd0a7ac48653ebabd93491
2016-04-29 05:27:28 -07:00
Jagdeep NagpalandFacebook Github Bot 0 3d0d426d46 Renamed --flavor to --variant
Summary:
This small update to runAndroid.js which renames --flavor to --variant.
~~`react-native run-android --flavor=staging`~~

~~doesn't work as it needs build type as well~~

~~so at present it needs to be like this~~

~~`react-native run-android --flavor=stagingDebug`~~

~~it looks messy, instead if we want to use the original spec then Debug must be concatenated to the end all the time as run-android was speced to trigger only debug builds~~
Closes https://github.com/facebook/react-native/pull/7036

Differential Revision: D3240692

Pulled By: mkonicek

fb-gh-sync-id: ef4570797b53ac8f76d0b86a263916ac5bdb0581
fbshipit-source-id: ef4570797b53ac8f76d0b86a263916ac5bdb0581
2016-04-29 05:18:24 -07:00
Jean RegisserandFacebook Github Bot 6 0045e07928 Updated iOS native UI component events documentation
Summary:
Documentation on iOS about triggering events from native components was outdated.

Let me know what you think.
Closes https://github.com/facebook/react-native/pull/6739

Differential Revision: D3240665

Pulled By: mkonicek

fb-gh-sync-id: f62d52bebd58aae6f93388734338ef74ae536ec5
fbshipit-source-id: f62d52bebd58aae6f93388734338ef74ae536ec5
2016-04-29 05:11:59 -07:00
Konstantin RaevandFacebook Github Bot 6 f99786cc89 Made SandCastle run the same Instrumentation Tests that are open sourced and are running on CI
Reviewed By: mkonicek

Differential Revision: D3229774

fb-gh-sync-id: 48239e8898eb011ad767bf102aa65025351363c6
fbshipit-source-id: 48239e8898eb011ad767bf102aa65025351363c6
2016-04-29 05:11:59 -07:00
SokovikovandFacebook Github Bot 4 58876d5a03 fix border style without borderRadius
Summary:
closes #6721 closes #3159
before(without borderRadius)
![bug](https://cloud.githubusercontent.com/assets/1488195/14235087/fcf79f8a-f9eb-11e5-9d44-7ab1d131be24.jpg)

after
![fix](https://cloud.githubusercontent.com/assets/1488195/14235067/8cf128b4-f9eb-11e5-8170-ad3a146d6104.jpg)
Closes https://github.com/facebook/react-native/pull/6789

Differential Revision: D3240657

Pulled By: mkonicek

fb-gh-sync-id: 4eb8f72d7278d880297fb73653ef530719af3d5b
fbshipit-source-id: 4eb8f72d7278d880297fb73653ef530719af3d5b
2016-04-29 04:53:29 -07:00
David AurelioandFacebook Github Bot 9 8375778496 Upgrade node-haste to 2.10.1
Reviewed By: bestander

Differential Revision: D3238180

fb-gh-sync-id: 06d62a5855864301a5480e349cfec2c0a2d5b79f
fbshipit-source-id: 06d62a5855864301a5480e349cfec2c0a2d5b79f
2016-04-29 04:44:32 -07:00
Janic DuplessisandFacebook Github Bot 0 891b87e7fb Launch the packager with react-native run-android on Windows
Summary:
Adds support for launching the packager in a new window on Windows.

**Test plan (required)**

Tested that the packager is launched in a completely independent process. This means that exiting the `react-native run-android` command should not close the packager window and it should exit properly when completed even if the packager window is still opened. Pretty much made sure it behaves exactly like on mac.

Also tested that an error in the packager will not close the window immediately to show the error stack trace.
Closes https://github.com/facebook/react-native/pull/7129

Differential Revision: D3240628

Pulled By: mkonicek

fb-gh-sync-id: 007582250536481d2b2376f9a201f8f415fc1080
fbshipit-source-id: 007582250536481d2b2376f9a201f8f415fc1080
2016-04-29 04:14:22 -07:00
Dave MillerandFacebook Github Bot 1 3a5457cd7c Add support for setChildren
Summary: This adds support for UIManager.setChildren on Android like D2757388 added for iOS.

Reviewed By: andreicoman11

Differential Revision: D3235369

fb-gh-sync-id: b538556ec4abdb606f9be26d1b74734046bca0cd
fbshipit-source-id: b538556ec4abdb606f9be26d1b74734046bca0cd
2016-04-29 04:03:24 -07:00
Kudo ChienandFacebook Github Bot 0 3f0207d7b5 Fix textShadowOffset error without width or height
Summary:
textShadowOffset design is `ReactPropTypes.shape({width: ReactPropTypes.number, height: ReactPropTypes.number})`, so either width or height is optional.
Unfortunately, in Android implementation, it is my bad not handling optional case and lead to an exception.
Thanks kohver for reporting [this issue](https://github.com/facebook/react-native/pull/4975#issuecomment-213006641)

**Test plan (required)**

*Before this fix*
1. Modify TextExample.android.js to `<Text style={{fontSize: 20, textShadowOffset: {height: 10}, textShadowRadius: 1, textShadowColor: '#00cccc'}}>` which really raise a redbox.

*After this fix*
1. Test original TextExample.android.js textShadowOffset works well.
2. Modify TextExample.android.js to `<Text style={{fontSize: 20, textShadowOffset: {height: 10}, textShadowRadius: 1, textShadowColor: '#00cccc'}}>` which works well without redbox.
Closes https://github.com/facebook/react-native/pull/7119

Differential Revision: D3240607

Pulled By: mkonicek

fb-gh-sync-id: b13221ae1586594890b0f4aa644ace7c0d5d6c58
fbshipit-source-id: b13221ae1586594890b0f4aa644ace7c0d5d6c58
2016-04-29 03:50:29 -07:00
Joshua PinterandFacebook Github Bot 4 5e5cbda682 Show default activeOpacity value in docs.
Summary:
Useful to know what the default value without having to dig into the library code.
Closes https://github.com/facebook/react-native/pull/7247

Differential Revision: D3228728

Pulled By: mkonicek

fb-gh-sync-id: 433ca41d5395bbfb0c4887641a9e8b99c87b5e2b
fbshipit-source-id: 433ca41d5395bbfb0c4887641a9e8b99c87b5e2b
2016-04-29 03:45:26 -07:00
Alex LedakandFacebook Github Bot 6 cea37b460f Add 'New Music' app to showcase
Summary: Closes https://github.com/facebook/react-native/pull/7285

Differential Revision: D3240438

fb-gh-sync-id: 02304618215c46197fa5d7547ffdb950502bcf28
fbshipit-source-id: 02304618215c46197fa5d7547ffdb950502bcf28
2016-04-29 01:18:29 -07:00
Jesse SesslerandFacebook Github Bot 1 2bb1c263db Modal Animation Types
Summary:
Currently the Modal component uses the slide up / down animation for presenting and hiding the Modal with no options. This PR gives users a choice to use a fade in / out animation or the current slide animation (slide is the default). Android and iOS.

![](http://g.recordit.co/nfJSg487Ox.gif)  ![](http://g.recordit.co/QHGDuUFbPy.gif)

I've updated the UIExplorer and documentation.

![image](https://cloud.githubusercontent.com/assets/4265163/14743130/0bd8282c-086e-11e6-93eb-3d344431337d.png)

Thanks!
Closes https://github.com/facebook/react-native/pull/7156

Differential Revision: D3237809

Pulled By: javache

fb-gh-sync-id: 813e56ada8b19990dc5018527dc3a81b2c8b349a
fbshipit-source-id: 813e56ada8b19990dc5018527dc3a81b2c8b349a
2016-04-28 16:00:32 -07:00
Philipp von WeitershausenandFacebook Github Bot 2 b5f14ea8f1 Make XMLHttpRequest and XMLHttpRequest.upload proper EventTargets
Summary:
So far, XHR only supports a few `onfoo` event handlers, not the entier `EventTarget` interface (`addEventListener`, `removeEventListener`). It also doesn't support the `upload` object on Android -- for no good reason. Even if we don't send any events there yet, there's no reason we have to break consuming code that wants to register an event handler there. This PR rectifies all that.

Fortunately, adding proper `EventTarget` support is very easy thanks to `event-target-shim`. We already use it in our WebSocket implementation. It transparently handles the `addEventListener('foo', ...)` as well as `onfoo` APIs, so when you dispatch an event on the event target, the right handlers will be invoked. The event object is wrapped so that `event.target` is set properly. Basically, it's a super easy way to make us conform to the spec.

Also added a bit of polish here and there, using ES2015 class property goodness to consolidate a lot of Flow property definitions with the corresponding property initializers.

**T
Closes https://github.com/facebook/react-native/pull/7017

Reviewed By: fkgozali

Differential Revision: D3202021

Pulled By: martinbigio

fb-gh-sync-id: 2b007682074356c75c774fab337672918b6c4355
fbshipit-source-id: 2b007682074356c75c774fab337672918b6c4355
2016-04-28 15:59:26 -07:00
Michael OrtizandFacebook Github Bot 9 13acd7ed7e Reverted commit D3234404
Summary:
**Motivation**: Arc drawing has been broken on Android for some time. dgladkov submitted a PR, which ended up having a bug and was never merged. This PR should fix that bug as well as provide screenshots to prove it works.

**Reproducing the Bug:** dgladkov made a simple test app which helps to illustrate the bug. The repo can be found [here](https://github.com/dgladkov/RNArtArcDrawingBug). The demo app illustrates that on iOS, wedges are drawn correctly, but Android only draws full circles. [Direct Link to iOS Before](https://github.com/dgladkov/RNArtArcDrawingBug/blob/master/images/ios.png). [Direct Link to Android Before](https://github.com/dgladkov/RNArtArcDrawingBug/blob/master/images/android.png).

**Proof The Bug is Fixed:** [Here is a direct link to Android After pic.](http://i.imgur.com/9dTU2Xn.png) You can see the wedges match the iOS Before screenshot.

**What went wrong:** dgladkov's solution relied on Java's modulus, which in fact, implements modulus in a non-standard way. Modulus should a
Closes https://github.com/facebook/react-native/pull/7049

Differential Revision: D3234404

Pulled By: spicyj

fb-gh-sync-id: 6b85eb42389da6c344ec9723c7f81f61473246b0
fbshipit-source-id: 6b85eb42389da6c344ec9723c7f81f61473246b0
2016-04-28 15:48:26 -07:00
Pieter De BaetsandFacebook Github Bot 9 26d0ce929f Error handling for concrete JS executor
Reviewed By: adamjernst

Differential Revision: D3235189

fb-gh-sync-id: a6d545a6b0b388c52305e2936371776d579460cd
fbshipit-source-id: a6d545a6b0b388c52305e2936371776d579460cd
2016-04-28 13:42:30 -07:00
Bruno BarbieriandFacebook Github Bot 9 41e89b4129 fontFamily, fontStyle and fontWeight support for TextInput
Summary:
fontFamily, fontWeight and fontStyle properties are being ignored for TextInput.

There's an additional issue that happens when you add secureTextEntry={true}  it overrides the current font preferences (because it defaults to monospace) so we have to reapply it.
Master right now:

![screen shot 2016-03-21 at 6 21 05 pm](https://cloud.githubusercontent.com/assets/1247834/13936110/c25ffea8-ef91-11e5-8d71-1b0a55184e24.png)

Demo after the fix:

![5ux4bpjfwh](https://cloud.githubusercontent.com/assets/1247834/13935865/0f2ca8be-ef90-11e5-82c7-d5a2dd33b70e.gif)
Closes https://github.com/facebook/react-native/pull/6564

Differential Revision: D3081623

Pulled By: bestander

fb-gh-sync-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
fbshipit-source-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
2016-04-28 13:22:22 -07:00
Jean RegisserandFacebook Github Bot 7 037e9ba945 Fixed unable to open red box stack frame in editor when running on iOS device
Summary:
Hi,

I noticed touching stack frames from the red box when running from an iOS device wouldn't open my editor (was working fine from the simulator).
Here's a fix.

Let me know if everything looks correct.

Thanks,
Closes https://github.com/facebook/react-native/pull/7088

Differential Revision: D3235102

Pulled By: javache

fb-gh-sync-id: 06e6c3f9164e987ea9bf71d16fe360dc37036c8d
fbshipit-source-id: 06e6c3f9164e987ea9bf71d16fe360dc37036c8d
2016-04-28 11:39:18 -07:00
David AurelioandFacebook Github Bot 6 e6bafca39e Improve constant inlining, add process.platform
Reviewed By: bestander

Differential Revision: D3235716

fb-gh-sync-id: f9019ec0042827e409fa84ba74f4c426ccad1519
fbshipit-source-id: f9019ec0042827e409fa84ba74f4c426ccad1519
2016-04-28 11:23:21 -07:00
Nathan SpaunandFacebook Github Bot 4 4e05d00f0d Prefetch images in Group mall and reactions icons
Reviewed By: ericvicenti

Differential Revision: D3227821

fb-gh-sync-id: b7a8c3e6e82604b98ec0d25eaab0c3b4c95bd683
fbshipit-source-id: b7a8c3e6e82604b98ec0d25eaab0c3b4c95bd683
2016-04-28 11:12:21 -07:00
Nick LockwoodandFacebook Github Bot 6 8cfa6b6ea6 Deprecated customDirectEventTypes, and removed from RCTScrollViewManager
Summary: Using customDirectEventTypes or customBubblingEventTypes causes a viewmanager to be initialized at app start. This diff deprecates those methods and removes their usage from RCTScrollViewManager.

Reviewed By: majak

Differential Revision: D3218973

fb-gh-sync-id: 295bef3be9623b49b0cdcbf8a56e10d9b28126d9
fbshipit-source-id: 295bef3be9623b49b0cdcbf8a56e10d9b28126d9
2016-04-28 07:44:19 -07:00
Pieter De BaetsandFacebook Github Bot 7 b2c8281316 Remove ImmediateImplementation, always use globals
Summary: We always define these globals in InitializeJavaScriptAppEngine, so the fallback mechanism here is never required as far as I can tell.

Reviewed By: davidaurelio

Differential Revision: D3235061

fb-gh-sync-id: 92007f87c84073e32bfa946df8ee81083f6842ec
fbshipit-source-id: 92007f87c84073e32bfa946df8ee81083f6842ec
2016-04-28 07:06:20 -07:00
Pieter De BaetsandFacebook Github Bot 4 c7eb47fd8c Enable console.debug
Summary: Apparently what we're using for console.trace is not really the same as what Chrome does (we don't log a stacktrace). Add `console.debug` with the same functionality as `console.trace`, just so we don't crash between browser and local execution.

Reviewed By: davidaurelio

Differential Revision: D3235053

fb-gh-sync-id: 4bed17ac8aa4c8c100f15cf0aabbc25101c913c1
fbshipit-source-id: 4bed17ac8aa4c8c100f15cf0aabbc25101c913c1
2016-04-28 07:02:29 -07:00
Pieter De BaetsandFacebook Github Bot 9 e195bf9495 Fix RCTJavaScriptContextCreatedNotification
Summary: The notification was previously sent from a block that only existed if RCT_DEV. This makes us always send this notification.

Reviewed By: majak

Differential Revision: D3235070

fb-gh-sync-id: bf3488d439bc2253fd12cbb10f670f54bb37eb6e
fbshipit-source-id: bf3488d439bc2253fd12cbb10f670f54bb37eb6e
2016-04-28 06:59:21 -07:00
David AurelioandFacebook Github Bot 9 e3c18c3990 Upgrade to node-haste@2.10.0 and allow to specify extra node modules
Summary: This upgrades to node-haste@2.10.0 and allows to expose folders as additional node modules from rn-cli.config.js

Reviewed By: bestander

Differential Revision: D3232595

fb-gh-sync-id: dffca66fec55a79a2b3af1d6ec1b8799b2bbcf59
fbshipit-source-id: dffca66fec55a79a2b3af1d6ec1b8799b2bbcf59
2016-04-28 06:33:27 -07:00
Pieter De BaetsandFacebook Github Bot 1 feda8ce2ee Clean up RCTEventDispatcher code
Reviewed By: majak

Differential Revision: D3175583

fb-gh-sync-id: c751c9dc79edfd9cb6073a2ff5dd743a03334bc4
fbshipit-source-id: c751c9dc79edfd9cb6073a2ff5dd743a03334bc4
2016-04-28 05:48:21 -07:00
Charles DickandFacebook Github Bot 4 f6d9a9097f Add heap snapshot to fbandroid JSC
Reviewed By: michalgr

Differential Revision: D3168026

fb-gh-sync-id: 123c9caa1ae7792cfa93590de4832b76c8178edb
fbshipit-source-id: 123c9caa1ae7792cfa93590de4832b76c8178edb
2016-04-28 05:31:19 -07:00
David AurelioandFacebook Github Bot 1 8c1b773e4d Show columns in redboxes
Reviewed By: foghina

Differential Revision: D3229814

fb-gh-sync-id: 0e1c3692e0780287d5e31dbd24fa3145eb0882ec
fbshipit-source-id: 0e1c3692e0780287d5e31dbd24fa3145eb0882ec
2016-04-28 03:58:23 -07:00
Thomas LeplusandFacebook Github Bot 9 f323b02eff Fix ClassCastException
Summary: Closes https://github.com/facebook/react-native/pull/7225

Differential Revision: D3234878

Pulled By: dmmiller

fb-gh-sync-id: 00f36f3c45e3492026729175e393812879149773
fbshipit-source-id: 00f36f3c45e3492026729175e393812879149773
2016-04-28 03:19:19 -07:00
Michael OrtizandFacebook Github Bot 9 1af47603cf Fix ReactNativeART arc drawing on Android
Summary:
**Motivation**: Arc drawing has been broken on Android for some time. dgladkov submitted a PR, which ended up having a bug and was never merged. This PR should fix that bug as well as provide screenshots to prove it works.

**Reproducing the Bug:** dgladkov made a simple test app which helps to illustrate the bug. The repo can be found [here](https://github.com/dgladkov/RNArtArcDrawingBug). The demo app illustrates that on iOS, wedges are drawn correctly, but Android only draws full circles. [Direct Link to iOS Before](https://github.com/dgladkov/RNArtArcDrawingBug/blob/master/images/ios.png). [Direct Link to Android Before](https://github.com/dgladkov/RNArtArcDrawingBug/blob/master/images/android.png).

**Proof The Bug is Fixed:** [Here is a direct link to Android After pic.](http://i.imgur.com/9dTU2Xn.png) You can see the wedges match the iOS Before screenshot.

**What went wrong:** dgladkov's solution relied on Java's modulus, which in fact, implements modulus in a non-standard way. Modulus should a
Closes https://github.com/facebook/react-native/pull/7049

Differential Revision: D3234404

Pulled By: spicyj

fb-gh-sync-id: 4974b818dc49d9d16f2483c49b462c459a8bb479
fbshipit-source-id: 4974b818dc49d9d16f2483c49b462c459a8bb479
2016-04-27 22:18:27 -07:00
Christoph PojerandFacebook Github Bot 8 d363b1f2e2 Update Jest APIs on fbsource
Reviewed By: javache

Differential Revision: D3229435

fb-gh-sync-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
fbshipit-source-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
2016-04-27 19:16:32 -07:00
Howard YehandFacebook Github Bot 4 192ab663b7 Fix 302 ImageLoader caching problem on iOS
Summary:
+ Fixes https://github.com/facebook/react-native/issues/5616
+ Bug RNPlay Demo: https://rnplay.org/apps/Eg2goQ

Test demo loads a Tumblr avatar image using a URL that 301 to a CDN. Try to edit and save the file to trigger image reloads.

The 302 image request succeeds the first time:

<img width="318" alt="screen shot 2016-04-27 at 9 37 03 am" src="https://cloud.githubusercontent.com/assets/50120/14860038/b2c04e8a-0c5b-11e6-9edf-78309048368b.png">

But it fails for subsequent loads. You should see:

<img width="307" alt="screen shot 2016-04-27 at 9 37 22 am" src="https://cloud.githubusercontent.com/assets/50120/14860048/b756e170-0c5b-11e6-9031-8f3cca8f2994.png">

+ The first image is a 302, only succeeds to load the first time.
+ The second image in the column adds a nonce as request parameter to render caching ineffective (but still a 302), and the problem doesn't occur.
+ The last image is the canonical url location (200).

Although NSURLSession hand
Closes https://github.com/facebook/react-native/pull/7262

Differential Revision: D3231702

Pulled By: javache

fb-gh-sync-id: 364fcf9819188c63310768411d49e6431b2a01d3
fbshipit-source-id: 364fcf9819188c63310768411d49e6431b2a01d3
2016-04-27 14:40:30 -07:00
Philipp von WeitershausenandFacebook Github Bot 4 8891f22f88 Fix WebSocket compatibility with event-target-shim ^1.0.5
Summary:
event-target-shim versions before 1.1.0 do not support taking an array for `EventTarget`. react-native requires `^1.0.5`, so this fixes compatibility with those earlier versions.

**Test Plan:** ran WebSocket UIExplorer example with earlier version of event-target-shim.
Closes https://github.com/facebook/react-native/pull/7261

Differential Revision: D3230881

Pulled By: martinbigio

fb-gh-sync-id: 6a22d58841a4b401a200fece64d13a70043fb09a
fbshipit-source-id: 6a22d58841a4b401a200fece64d13a70043fb09a
2016-04-27 12:26:23 -07:00
Dave MillerandFacebook Github Bot 7 57c40d9a6f Fix crash caused by accessibility being turned on and using a Modal
Summary: When the ModalHostView is added as a child of whatever view holds it, if accessibility is turned on, Android will walk up to the root and then walk all children of the child and verify that they are indeed children of the root.  Since ModalHostView actually adds its children to a new ReactDialogViewGroup which has the Dialog as a parent, there is a disagreement about the tree deep in the bowels of View when it performs that walk.  The trick is to stop from adding the children of the ModalHostView when walking for accessibility.  The accessibility of those children views are properly handled by the hosting Dialog.

Reviewed By: andreicoman11

Differential Revision: D3230033

fb-gh-sync-id: 1e5ac334c996b1d5f50c75ded60805d8b871477a
fbshipit-source-id: 1e5ac334c996b1d5f50c75ded60805d8b871477a
2016-04-27 10:16:25 -07:00
Alexander BlomandFacebook Github Bot 9 9a3a082225 Make polyfills and globals lazy
Summary:
This avoids requiring things that may never be used at all by the application such as WebSocket or Geolocation. It also stops us from asking for native modules
before we actually start the application enabling us to potentially be more lazy in the future.

Reviewed By: davidaurelio

Differential Revision: D3212802

fb-gh-sync-id: 70cf0d1a85f39fedc47758e5eb5df789a511bc9b
fbshipit-source-id: 70cf0d1a85f39fedc47758e5eb5df789a511bc9b
2016-04-27 09:57:20 -07:00
Nick LockwoodandFacebook Github Bot 9 9547a98a68 Fixed deadlock during app startup
Summary:
Now that we support initializing the bridge off the main thread, some of the assumptions in the bridge setup process are no longer safe.

In particular we were assuming that the JS executor and injected modules could always be synchronously initialized within bridge init, but that is only safe if those modules don't need to be set up on the main thread.

The setup for those modules was sync-dispatching to the main thread if bridge init happened on a background thread, and this lead to a deadlock under certain circumstances.

Reviewed By: javache

Differential Revision: D3224162

fb-gh-sync-id: 7319b70f541a46ef932cfe4f776e7e192f3ce1e8
fbshipit-source-id: 7319b70f541a46ef932cfe4f776e7e192f3ce1e8
2016-04-27 09:09:23 -07:00
Andy StreetandFacebook Github Bot 6 6a2603745e Fix build break of react native exopackage apps
Reviewed By: lexs

Differential Revision: D3229733

fb-gh-sync-id: e74a2d4fbbdf019f898f87a05bdbd31b4e233463
fbshipit-source-id: e74a2d4fbbdf019f898f87a05bdbd31b4e233463
2016-04-27 08:02:24 -07:00
Andy StreetandFacebook Github Bot 2 50d8d46733 Add ability to expose sync hooks from Java to JS
Summary:
This only works for the new cxx bridge (hopefully open sourcing soon!).

This diff allows Java native modules to expose synchronous hooks to JS via the ReactSyncHook annotation. The methods will appear in JS on the native module object (e.g. you would do `require('UIManager').mySyncHook('foo');`) which allows us to enforce that required native modules are installed at build time. In order to support remote debugging, both the args and return type must be JSON serializable (so that we can go back across to the device to resolve synchronous hooks).

Follow ups will be integration tests, adding support for return types besides void, and adding support for remote debugging.

Reviewed By: mhorowitz

Differential Revision: D3218794

fb-gh-sync-id: 7e3366a8254276f5a55eb806287419287ca9182b
fbshipit-source-id: 7e3366a8254276f5a55eb806287419287ca9182b
2016-04-27 07:51:28 -07:00
Pieter De BaetsandFacebook Github Bot 2 171c7230b1 Simplify message passing in JSC-executor
Reviewed By: tadeuzagallo

Differential Revision: D3179792

fb-gh-sync-id: 96b7c91209ccac745e0f64def0095efd6b1184ed
fbshipit-source-id: 96b7c91209ccac745e0f64def0095efd6b1184ed
2016-04-27 06:35:27 -07:00
Felix OghinaandFacebook Github Bot 1 fb76154b42 handle null args array in proxy invocation handler
Reviewed By: astreet

Differential Revision: D3212837

fb-gh-sync-id: 1a66de68cc13758a41514e4bef6808b818b9682e
fbshipit-source-id: 1a66de68cc13758a41514e4bef6808b818b9682e
2016-04-27 02:28:19 -07:00
sunnylqmandFacebook Github Bot 3 131970dc5a Android Support Repository -> Local Maven repository for Support Libr…
Summary: Closes https://github.com/facebook/react-native/pull/7249

Differential Revision: D3229302

fb-gh-sync-id: 83596604c1c1546249babb421898aa5bd9c7e5c1
fbshipit-source-id: 83596604c1c1546249babb421898aa5bd9c7e5c1
2016-04-27 01:29:28 -07:00
Alex KotliarskyiandFacebook Github Bot 7 8295d27a90 Fix usage of react-native cli inside package.json scripts
Summary:
IIRC we made `wrong-react-native` to warn people in case they installed `react-native` globally (instead of `react-native-cli` what the guide suggests). To do that we added `bin` entry to React Native's `package.json` that points to `local-cli/wrong-react-native.js`

However, this means that if we have a project that uses `react-native` package and has call to `react-native` CLI inside its package.json, npm will execute *local* override (which just prints a confusing in this context error message).

In fact, the template we generate with `react-native init` has `react-native start` as `start` script, which makes it useless. Let's fix it by making `wrong-react-native` script smarter – it can detect that it has been executed from local `node_modules` and run the actual CLI.

cc vjeux ide
Closes https://github.com/facebook/react-native/pull/7243

Differential Revision: D3226645

Pulled By: frantic

fb-gh-sync-id: be094eb0e70e491da4ebefc2abf11cff56c4c5b7
fbshipit-source-id: be094eb0e70e491da4ebefc2abf11cff56c4c5b7
2016-04-26 15:42:35 -07:00
Spencer AhrensandFacebook Github Bot 1 b5d9bf0fb2 merge InteractionManager stuff back into PanResponder
Reviewed By: bestander

Differential Revision: D3224519

fb-gh-sync-id: d041214b68fedfdd6b01aa2b710b02381c29dcfa
fbshipit-source-id: d041214b68fedfdd6b01aa2b710b02381c29dcfa
2016-04-26 13:19:22 -07:00
Steven LuscherandFacebook Github Bot 6 dad39eb502 Move Number polyfills into the /polyfills/ directory
Reviewed By: vjeux

Differential Revision: D3223317

fb-gh-sync-id: a49a14f217b27d6542b65c4780c557e73da2443f
fbshipit-source-id: a49a14f217b27d6542b65c4780c557e73da2443f
2016-04-26 11:24:42 -07:00
Konstantin RaevandFacebook Github Bot 1 2eef115161 Revert "Add subviewStyle prop to NavigationHeader"
Summary:
This reverts commit 1dc82a9e5f.

Breaks OSS tests
Closes https://github.com/facebook/react-native/pull/7232

Differential Revision: D3223972

Pulled By: bestander

fb-gh-sync-id: fea7ec4a1c13d328a7bbda9fcd3f201a7007081e
fbshipit-source-id: fea7ec4a1c13d328a7bbda9fcd3f201a7007081e
2016-04-26 06:10:24 -07:00
Nick LockwoodandFacebook Github Bot 9 c1aff6b116 Removed exported constants for fixed-size views
Summary: Creating a view instance just to get the default view size is quite expensive, and affects startup time for the bridge as it must be done on the main thread. I've removed these cases and simply hard-coded the sizes in the JS file. This will need to be updated if the view sizes ever change, but in practice that's very unlikely.

Reviewed By: javache

Differential Revision: D3218917

fb-gh-sync-id: 91a21dabb6046c5d4d5d0bec0845415cb3628ec3
fbshipit-source-id: 91a21dabb6046c5d4d5d0bec0845415cb3628ec3
2016-04-26 04:21:39 -07:00
Pavlo KushnirandFacebook Github Bot 2 036199d3f7 Use std::string in folly::dynamic
Reviewed By: joeg, snarkmaster

Differential Revision: D3189410

fb-gh-sync-id: 9bb9090ca6012ac32ba9fb79041b26ec4888781f
fbshipit-source-id: 9bb9090ca6012ac32ba9fb79041b26ec4888781f
2016-04-26 02:28:30 -07:00
Ben HoytandFacebook Github Bot 9 77b3f86d89 Clarify that nested text formatting also works on Android
Summary:
This is a documentation-only change: currently the docs imply that nested text formatting only works on iOS (via `NSAttributedString`). But the code (and my tests!) indicate it also works fine on Android via `SpannableString`, so clarify this in the documentation for the `Text` component.
Closes https://github.com/facebook/react-native/pull/7215

Differential Revision: D3223732

fb-gh-sync-id: 4e796e493ba6c48f05b812a12761ddb3851e06e1
fbshipit-source-id: 4e796e493ba6c48f05b812a12761ddb3851e06e1
2016-04-26 00:58:21 -07:00
Spencer AhrensandFacebook Github Bot 2 667d278119 Only grab InteractionManager handle in PanResponder, not all touches
Summary:
Previously, `InteractionManager` was baked in at the lowest level to all touches via `ResponderEventPlugin`,
which meant that any time a finger was touching the screen, `InteractionManager` would be locked. This included while
doing 100% native scrolls, and thus would block progress from Relay, Incremental, or anything else scheduling events
through `InteractionManager`.

This diff switches to only bake it into `PanResponder` (and it remains hooked into `Animated` as before) which are the
main two cases where we need 60fps JS execution and want to queue up slower tasks.

This is done with a reusable higher-order-responder `InteractionManager.createResponderClass`.

Depends on FYI https://github.com/facebook/react/pull/6587, https://github.com/facebook/react/pull/6584

Reviewed By: sebmarkbage

Differential Revision: D3210951

fb-gh-sync-id: 682d21ac5cff704673b63d5942a903a3d8912835
fbshipit-source-id: 682d21ac5cff704673b63d5942a903a3d8912835
2016-04-26 00:23:30 -07:00
Steven LuscherandFacebook Github Bot 8 c05169d8b7 Add a Number.isNaN polyfill
Reviewed By: sahrens

Differential Revision: D3222299

fb-gh-sync-id: 601283fb0b140bb305181ea381907e62286f7a37
fbshipit-source-id: 601283fb0b140bb305181ea381907e62286f7a37
2016-04-25 23:15:18 -07:00
Sebastian MarkbageandFacebook Github Bot 7 6f43d1f2cb Codemod import React from 'react-native'
Reviewed By: spicyj

Differential Revision: D3223162

fb-gh-sync-id: 0b1af846afe17cdf8b2c2ca7f31f1197cde752c0
fbshipit-source-id: 0b1af846afe17cdf8b2c2ca7f31f1197cde752c0
2016-04-25 22:08:46 -07:00
Sebastian MarkbageandFacebook Github Bot 8 8e43b24a36 Update React to alpha.3
Summary:
Sync new React fixes.

Includes...

https://github.com/facebook/react/pull/6584
https://github.com/facebook/react/pull/6587
https://github.com/facebook/react/pull/6588
https://github.com/facebook/react/pull/6590

Since this require PanResponder to be restored I also included D3210771 here.

Reviewed By: spicyj

Differential Revision: D3221285

fb-gh-sync-id: cbb6b1dd0fd0443d246957ceb94b6a424c09c24e
fbshipit-source-id: cbb6b1dd0fd0443d246957ceb94b6a424c09c24e
2016-04-25 20:38:26 -07:00
Mike GrabowskiandFacebook Github Bot 1 edf8888fb9 Platform.select method
Summary:
Kudos to frantic for this amazing idea! Works really well (yet so simple!)

Basically we had a discussion with vjeux and frantic and others in the PR #7033 how to handle platform-specific stylesheets in a similar to F8 app way.

There were quite a few nice ideas there, however that one seems to be the smallest yet the most powerful.

Basically there's a `Platform.select` method that given an object, will select a `obj[Platform.OS]` value.

It works with styles:
`Platform.select({ ios: {}, android: {} })`

with messages:
`<Text>{Platform.select({ ios: 'Check the App Store', android: 'Check Google Play' })}</Text>`

and also works well with components (similar to Wallmart idea of <PlatformSwitch />) - relevant example included in diff.
Closes https://github.com/facebook/react-native/pull/7220

Differential Revision: D3221709

Pulled By: vjeux

fb-gh-sync-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
fbshipit-source-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
2016-04-25 16:32:20 -07:00
Hedger WangandFacebook Github Bot 8 24f44558f6 Fix initial scenes rendering for NavigationPagerStyleInterpolator
Summary:
The initial layout used to render scenes does not contain the actual
width and height measured and causes the issue as described at
https://github.com/ericvicenti/navigation-rfc/issues/61

The fix is to update the layout and re-render scenes once layout
is modified. Also scenes renderer should also consider the case that
when the layout is not measured yet.

Reviewed By: ericvicenti

Differential Revision: D3203245

fb-gh-sync-id: 4de89b9b43bc993d7c970c831458bd31c094073e
fbshipit-source-id: 4de89b9b43bc993d7c970c831458bd31c094073e
2016-04-25 15:37:38 -07:00
Scott FoggoandFacebook Github Bot 4 50d6de9448 Check if either array is null before diffing
Reviewed By: sebmarkbage

Differential Revision: D3219392

fb-gh-sync-id: fd6ef2e2c2d7b661a06c857b25b007701340e20a
fbshipit-source-id: fd6ef2e2c2d7b661a06c857b25b007701340e20a
2016-04-25 13:28:31 -07:00
Chris HopmanandFacebook Github Bot 8 860b7ddc35 Don't defer dispatching of events while paused
Reviewed By: astreet

Differential Revision: D3186718

fb-gh-sync-id: 888c6e0cc0b52edbbc6b9e0cb285ce1a2d1bf987
fbshipit-source-id: 888c6e0cc0b52edbbc6b9e0cb285ce1a2d1bf987
2016-04-25 12:47:21 -07:00
Dave MillerandFacebook Github Bot 4 8e7ea1179a Fix Popover location in Events
Reviewed By: andreicoman11

Differential Revision: D3219054

fb-gh-sync-id: cc25bd63be284ae7e8232652936a67fd792feabc
fbshipit-source-id: cc25bd63be284ae7e8232652936a67fd792feabc
2016-04-25 10:15:21 -07:00
Christian MeunierandFacebook Github Bot 6 1dc82a9e5f Add subviewStyle prop to NavigationHeader
Summary:
Implements: #7204

Pinging ericvicenti for review.
Closes https://github.com/facebook/react-native/pull/7214

Differential Revision: D3219306

Pulled By: ericvicenti

fb-gh-sync-id: becd1dada2557b7fb2c345bac2098094fa6d2144
fbshipit-source-id: becd1dada2557b7fb2c345bac2098094fa6d2144
2016-04-25 10:12:25 -07:00
Tadeu ZagalloandFacebook Github Bot 3 c5307a6e7c Bringing fbsystrace to iOS 8's JSC
Reviewed By: michalgr

Differential Revision: D3163295

fb-gh-sync-id: 3cc2083accc4ba6947efc631f3574412022b1e1f
fbshipit-source-id: 3cc2083accc4ba6947efc631f3574412022b1e1f
2016-04-25 09:45:24 -07:00
Alexander BlomandFacebook Github Bot 9 69c083b27d Add WebView integration example to cookies example
Reviewed By: dmmiller

Differential Revision: D3207659

fb-gh-sync-id: f87d70d53de9a8215bb593502368d16251ebb358
fbshipit-source-id: f87d70d53de9a8215bb593502368d16251ebb358
2016-04-25 09:44:26 -07:00
David AurelioandFacebook Github Bot 6 61c53d4939 Jest: Un-blacklist React main module
Summary:
testing jest for react 15

Closes #7212
Closes https://github.com/facebook/react-native/pull/7213

Differential Revision: D3219118

fb-gh-sync-id: 6a0fe9f3b404274779e39e037bb88d0e6ce36cfd
fbshipit-source-id: 6a0fe9f3b404274779e39e037bb88d0e6ce36cfd
2016-04-25 09:07:28 -07:00
Konstantin RaevandFacebook Github Bot 5 7d9fe365a7 Fixed e2e tests for HMR
Summary:HMR e2e test red-screened because of the wrong path to react.

**Test plan (required)**

Make sure e2e tests pass
Closes https://github.com/facebook/react-native/pull/7209

Reviewed By: mkonicek

Differential Revision: D3218896

Pulled By: bestander

fb-gh-sync-id: 8c5c4ceda34bd2d273e9de16ed670592d1fde3b9
fbshipit-source-id: 8c5c4ceda34bd2d273e9de16ed670592d1fde3b9
2016-04-25 08:12:30 -07:00
Konstantin RaevandFacebook Github Bot 9 a8d2079022 Optimise e2e tests retries
Summary:Implemented smarter retries for e2e tests

E2e tests consist of two expensive and flaky steps: npm installation and tests execution.
Our CI is configured to retry a command 3 times before terminating the test.
In current setup if one of the steps fail the whole test is restarted.

This change adds ad-hoc ability to retry flaky bits of e2e script independently.
This will make tests fail faster when code gets broken while increasing the chances to succeed in case of random false errors.
Closes https://github.com/facebook/react-native/pull/7184

Differential Revision: D3218927

fb-gh-sync-id: 9be8343484bb28aa3601b651db70fc55aa840e61
fbshipit-source-id: 9be8343484bb28aa3601b651db70fc55aa840e61
2016-04-25 07:16:20 -07:00
Konstantin RaevandFacebook Github Bot 6 a2ee5bd307 Fixed HMR for React Native Android
Summary:Needs to be published to npm and version be updated in RN
Closes https://github.com/facebook/react-native/pull/7208

Differential Revision: D3218870

Pulled By: davidaurelio

fb-gh-sync-id: 1caac6eb79be16f2e3ed230f413835341c7291dc
fbshipit-source-id: 1caac6eb79be16f2e3ed230f413835341c7291dc
2016-04-25 06:31:25 -07:00
Nick LockwoodandFacebook Github Bot 2 37f4ec6e16 Removed placeholder image logic
Summary: To prevent layout popping, when inserting images inside text we would render a blank placeholder image while the real image was loading. It turns out that this isn't necessary, as we can just specify the size of the image without having an actual image to display.

Reviewed By: javache

Differential Revision: D3212766

fb-gh-sync-id: e98851b32a2d0ae809fc0a4be47e6b77f3b17996
fbshipit-source-id: e98851b32a2d0ae809fc0a4be47e6b77f3b17996
2016-04-25 03:31:19 -07:00
Christoph PojerandFacebook Github Bot 5 0bf737ff0a Update to 11.0.1
Reviewed By: kassens

Differential Revision: D3183738

fb-gh-sync-id: 07be9e1d60413a6d929b15cd72eeba416a6bfc6d
fbshipit-source-id: 07be9e1d60413a6d929b15cd72eeba416a6bfc6d
2016-04-25 01:16:23 -07:00
Janic DuplessisandFacebook Github Bot 7 baa3668160 Add support for delete animation in LayoutAnimation on iOS
Summary:This adds support for delete view animations in LayoutAnimation for iOS. It supports the same properties as the create animation (alpha, scale).

This allows making simple animations when removing a view which is normally hard to do in React since we need to not remove the view node immediately.

**Test plan**
Tested add/removing views in the UIExample explorer with and without setting a LayoutAnimation. Also tested that the completion callback still works properly. Tested that user interation during the animation is properly disabled.

![layout-anim2](https://cloud.githubusercontent.com/assets/2677334/14595471/86fb1654-050d-11e6-8b38-fe45cc2dcd71.gif)

I also plan to work on improving the doc for LayoutAnimation as well as making this PR for android too.
Closes https://github.com/facebook/react-native/pull/6779

Differential Revision: D3215525

Pulled By: sahrens

fb-gh-sync-id: 526120acd371c8d1af433e8f199cfed336183775
fbshipit-source-id: 526120acd371c8d1af433e8f199cfed336183775
2016-04-25 00:19:25 -07:00
Nick Smith ♞andFacebook Github Bot 5 23918692ac Fix 'React not found' issue
Summary:Fix React not found by importing React.
Closes https://github.com/facebook/react-native/pull/7201

Differential Revision: D3218119

fb-gh-sync-id: 8834df556d8358cfb511dddaf911ac9144c4e1e9
fbshipit-source-id: 8834df556d8358cfb511dddaf911ac9144c4e1e9
2016-04-24 16:27:25 -07:00
Jeff ChienandFacebook Github Bot 5 475f1b5796 Reverted commit D3126513
Summary:Using TouchableNativeFeedback has been a problem for me because the ripples it makes don't follow the child view's border radii so the ripples stick out of the child view's rounded corners. This PR should fix this problem with a minor caveat: this only works for TouchableNativeFeedback.Ripple and not TouchableNativeFeedback.SelectableBackground. I searched how I could apply corner radius to selectableItemBackground and it doesn't seem to be possible (the prevalent advice is to create the ripple manually which is equivalent to using TNF.Ripple in our case), though I could be wrong.

I added [an example to UIExplorer (TouchableExample)](http://i.imgur.com/CHY9xjW.png). This is my first PR to this repo so let me know if something's wrong. Cheers!
Closes https://github.com/facebook/react-native/pull/6515

Differential Revision: D3126513

Pulled By: AaaChiuuu

fb-gh-sync-id: 4a00e7177ee4ffd8dffeca143f4f43f08c99b5a1
fbshipit-source-id: 4a00e7177ee4ffd8dffeca143f4f43f08c99b5a1
2016-04-24 15:45:19 -07:00
Mike GrabowskiandFacebook Github Bot 6 02578df4f7 Fallback for textAlign: justify
Summary:Fixes #5408 as per ide and vjeux suggestions here https://github.com/facebook/react-native/issues/529#issuecomment-107328799

Could've been probably done in a single `if` clause, but this is more explicit and leaves potential place for future implementation (if we ever decide to do so)
Closes https://github.com/facebook/react-native/pull/7197

Differential Revision: D3217740

Pulled By: vjeux

fb-gh-sync-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6
fbshipit-source-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6
2016-04-24 11:29:23 -07:00
Mike GrabowskiandFacebook Github Bot 5 7102fd079a Document ListView.DataSource #410
Summary:Fixes #410
Closes https://github.com/facebook/react-native/pull/7193

Differential Revision: D3217718

fb-gh-sync-id: c05c9e3d67863c064f8e1102090614c6ba7e3127
fbshipit-source-id: c05c9e3d67863c064f8e1102090614c6ba7e3127
2016-04-24 08:13:21 -07:00
him ➚andFacebook Github Bot 7 3f1165dfc6 Fix 'Can't find variable: React'
Summary:Border example throws "Can't find variable: React" error.

This simply includes React (using old 'require' syntax to keep syntax consistent)
Closes https://github.com/facebook/react-native/pull/7194

Differential Revision: D3217714

fb-gh-sync-id: 7ba5251cd64a9bfeceff67a2f8f089e25b3d9465
fbshipit-source-id: 7ba5251cd64a9bfeceff67a2f8f089e25b3d9465
2016-04-24 07:13:29 -07:00
Ian MacLeodandFacebook Github Bot 5 7721a24f38 Expose NavigationPropTypes via NavigationExperimental.PropTypes
Summary:Useful for building components that compose navigation components
Closes https://github.com/facebook/react-native/pull/6644

Differential Revision: D3217681

fb-gh-sync-id: 94907fed1692f2dc6603a5fbdf3a032906e3f74d
fbshipit-source-id: 94907fed1692f2dc6603a5fbdf3a032906e3f74d
2016-04-24 04:46:26 -07:00
Allan JiangandFacebook Github Bot 5 216cbb4065 Add Kiwiship app
Summary:Add Kiwiship app to showcase page.

Kiwiship app is powered purely by RN and currently available on iOS platform.
Closes https://github.com/facebook/react-native/pull/7169

Differential Revision: D3217526

fb-gh-sync-id: beeaa8453cfcb53bd6c4ffab02b7d827798f42e4
fbshipit-source-id: beeaa8453cfcb53bd6c4ffab02b7d827798f42e4
2016-04-23 23:14:22 -07:00
Mike GrabowskiandFacebook Github Bot 7 881eda20d2 Update UIExplorer <Text /> example to respect ultralight font
Summary:Fixes #6735

On font sizes smaller than 20, iOS will swap SystemFont to SF version optimised for smaller sizes which does not have ultralight and thin. That results in ultralight and light example to be rendered with the same weight.

Bumping to `20` makes it render differently as per below screenshot https://cloud.githubusercontent.com/assets/2464966/14622260/0789e500-05c9-11e6-920a-8c948a5b79b4.png
Closes https://github.com/facebook/react-native/pull/7044

Differential Revision: D3212565

Pulled By: mkonicek

fb-gh-sync-id: 5ffad136c7f4126c271366640c89673f30a99218
fbshipit-source-id: 5ffad136c7f4126c271366640c89673f30a99218
2016-04-23 18:24:23 -07:00
Mike GrabowskiandFacebook Github Bot 6 f022681a1e Implement Text onLongPress
Summary:Fixes #5855

Tested with `UIExplorer`, first <Text> is the `onPress`, second is the `onLongPress`.
Closes https://github.com/facebook/react-native/pull/7099

Differential Revision: D3212436

Pulled By: mkonicek

fb-gh-sync-id: 0a1cbcd4eaf39ad4fe67d861c3be2e042e1acb27
fbshipit-source-id: 0a1cbcd4eaf39ad4fe67d861c3be2e042e1acb27
2016-04-23 18:14:20 -07:00
Konstantin RaevandFacebook Github Bot 3 ea8f584184 fixed website generation code (refer some API that is now in React codebase)
Summary:vjeux spicyj this fixes website generation because these API are now in React.

I would refer React file but it seems fragile because it is a thirdparty dependency now.
How do we document thirdparty API?
Closes https://github.com/facebook/react-native/pull/7163

Differential Revision: D3216771

fb-gh-sync-id: b0653a0bbe0f84dc509f74d185f494ac343405a8
fbshipit-source-id: b0653a0bbe0f84dc509f74d185f494ac343405a8
2016-04-23 07:57:24 -07:00
James IdeandFacebook Github Bot 9 f5130c8073 Exit with the error status code from xcodebuild
Summary:See https://github.com/supermarin/xcpretty#usage -- xcpretty will suppress xcodebuild's status code so we need to add `&& exit ${PIPESTATUS[0]}`.
Closes https://github.com/facebook/react-native/pull/7172

Differential Revision: D3216731

fb-gh-sync-id: 942fd213105cc365d1d9a9c4d146441c044dd506
fbshipit-source-id: 942fd213105cc365d1d9a9c4d146441c044dd506
2016-04-23 04:19:22 -07:00
Krzysztof MagieraandFacebook Github Bot 9 dd244f5530 Support for Animated.interpolate
Summary:This change adds native animated support for Animated.interpolate

Animated.interpolate allows for defining nodes that outputs an interpolated value of their input node based on the interpolation node configuration. For now native animated implementation only supports a linear interpolation for a given input and output ranges (ranges can consists of multiple segments). Native interpolation node is compatible with the JS implementation with the exception that not all attributes that can be used in JS are supported. Before we migrate interpolation node from JS->native we verify that only supported props are used.

**Test Plan**
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/7141

Differential Revision: D3216546

fb-gh-sync-id: 29876e33956615c6370ca4d332abe048f8dba5b8
fbshipit-source-id: 29876e33956615c6370ca4d332abe048f8dba5b8
2016-04-23 02:37:28 -07:00
Konstantin RaevandFacebook Github Bot 3 a31e87b3f2 temporarily disable broken OSS CI tests to save CI capacity
Summary:Fix progress tracking via t10955118
Closes https://github.com/facebook/react-native/pull/7162

Differential Revision: D3216683

fb-gh-sync-id: 100de7a245bb7e7de741d96f3f0a7d4871b97311
fbshipit-source-id: 100de7a245bb7e7de741d96f3f0a7d4871b97311
2016-04-23 02:01:19 -07:00
James IdeandFacebook Github Bot 2 6fac6db4d4 Use xcodebuild and delete "Framework Search Paths" for Xcode 7.3 to un-stall the tests
Summary:The Obj-C tests were stalling when we updated TravisCI to use the OS X image with Xcode 7.3 and iOS 9.3.

On my own MBP with Xcode 7.3 the tests stall as well. Running `./scripts/objc-test.sh` prints out a warning near the end, which says `ld` couldn't find a Frameworks folder under the iPhoneSimulator9.3 SDK directory. Indeed, this directory doesn't exist on my computer. When creating a brand new project with unit tests and UI tests, both test targets don't specify "Framework Search Paths" so I don't think we need to specify it anymore.
Closes https://github.com/facebook/react-native/pull/7168

Differential Revision: D3216524

fb-gh-sync-id: 3097bda98d78289ecdba86801bcd461f3311ac47
fbshipit-source-id: 3097bda98d78289ecdba86801bcd461f3311ac47
2016-04-22 23:04:19 -07:00
Spencer AhrensandFacebook Github Bot 7 09a34f4d0f Integrate RelayConnection with RNFeed
Reviewed By: ericvicenti

Differential Revision: D2750242

fb-gh-sync-id: fa72d67f554823128bf62786b34e5b9592dc7c89
fbshipit-source-id: fa72d67f554823128bf62786b34e5b9592dc7c89
2016-04-22 22:48:18 -07:00
Sebastian MarkbageandFacebook Github Bot 5 248879f5a3 Fix react-native.js.flow
Summary:We no longer forward React onto this object. We only forward the ReactNative
module onto it.

We also deprecated the addons so they'll all warn. We'll remove it
completely soon.
Closes https://github.com/facebook/react-native/pull/7136

Reviewed By: gabelevi

Differential Revision: D3211809

Pulled By: sebmarkbage

fb-gh-sync-id: 77aaa909dca5e2522cfaa7b4ca361fabc614be58
fbshipit-source-id: 77aaa909dca5e2522cfaa7b4ca361fabc614be58
2016-04-22 18:02:28 -07:00
Rui ChenandFacebook Github Bot 4 862136a398 Revert the suspicious text input change for now
Reviewed By: nickholub

Differential Revision: D3213682

fb-gh-sync-id: 5b3090864c4c50f307de22493c9a7a8cb4687621
fbshipit-source-id: 5b3090864c4c50f307de22493c9a7a8cb4687621
2016-04-22 17:34:28 -07:00
Alexey LangandFacebook Github Bot 6 8aa82d3b33 Add flag "-lc++" for all checked-in projects
Reviewed By: bestander

Differential Revision: D3214654

fb-gh-sync-id: cb07b439156ab5ff1f909f69c766c09da2a027c6
fbshipit-source-id: cb07b439156ab5ff1f909f69c766c09da2a027c6
2016-04-22 16:23:18 -07:00
Alexander MicklewrightandFacebook Github Bot 5 3881694892 Fix a bug in asset server when using relative project roots
Summary:This PR fixes a bug where when using relative roots for the packager server, asset paths would be deemed invalid by the recently introduced security check. Resolving the root to an absolute path fixes that problem.

I'd be happy to write a regression test for this but I had a hard time setting up a mock file system with relative paths. If it is required, some help would be appreciated...
Closes https://github.com/facebook/react-native/pull/7161

Differential Revision: D3214840

fb-gh-sync-id: 08e13fb9f94a98206fd2d090f74a8b63ba2bf80f
fbshipit-source-id: 08e13fb9f94a98206fd2d090f74a8b63ba2bf80f
2016-04-22 16:06:21 -07:00
Omar CarpinteyroandFacebook Github Bot 7 4b907d2312 Adding new app NTH on Showcases
Summary:My update is to the app showcase on the react native website, adding my :NTH iOS app (in alphabetical order). :NTH App can test the equations of the CSS Selectors.

:NTH App: https://itunes.apple.com/us/app/nth/id1102663176?mt=8
Showcase: https://facebook.github.io/react-native/showcase.html
Closes https://github.com/facebook/react-native/pull/7042

Differential Revision: D3212549

Pulled By: mkonicek

fb-gh-sync-id: f19866f1d2ac53fb7f1295ff5155db2d690bb9b4
fbshipit-source-id: f19866f1d2ac53fb7f1295ff5155db2d690bb9b4
2016-04-22 11:52:27 -07:00
Felix OghinaandFacebook Github Bot 8 ed7d13bf57 Backed out D3190875
Reviewed By: astreet

Differential Revision: D3212319

fb-gh-sync-id: 2b93bf83c2e7f687ad1762a199c9a150862395ff
fbshipit-source-id: 2b93bf83c2e7f687ad1762a199c9a150862395ff
2016-04-22 11:24:40 -07:00
Felix OghinaandFacebook Github Bot 8 7946160733 refactor BugReporting to use RCTDeviceEventEmitter
Reviewed By: sahrens

Differential Revision: D3212300

fb-gh-sync-id: 3a61d620320dd1c0254bf3b836601d5bbfbc4c0d
fbshipit-source-id: 3a61d620320dd1c0254bf3b836601d5bbfbc4c0d
2016-04-22 11:24:40 -07:00
Mike GrabowskiandFacebook Github Bot 7 cbdf026628 Fix/spaces in showcase
Summary:There's space missing:
<img width="126" alt="screen shot 2016-04-22 at 09 30 54" src="https://cloud.githubusercontent.com/assets/2464966/14734757/f037e25c-086c-11e6-8ac7-70251103ce42.png">

After:
<img width="135" alt="screen shot 2016-04-22 at 09 31 12" src="https://cloud.githubusercontent.com/assets/2464966/14734762/f9537428-086c-11e6-9109-473be6e778c9.png">
Closes https://github.com/facebook/react-native/pull/7142

Differential Revision: D3212913

Pulled By: mkonicek

fb-gh-sync-id: 2a5bbe600093c08d672b0e156a4af56004c18115
fbshipit-source-id: 2a5bbe600093c08d672b0e156a4af56004c18115
2016-04-22 11:09:26 -07:00
Labeeb PanampullanandFacebook Github Bot 0 446d7b7c17 Fixed array bounds error in MapView
Summary: fixed a case where MapView could crash due to a race condition

Differential Revision: D3207304

fb-gh-sync-id: a63918d160258d76fce5d56994100a63f4c5fb68
fbshipit-source-id: a63918d160258d76fce5d56994100a63f4c5fb68
2016-04-22 10:59:29 -07:00
Mike GrabowskiandFacebook Github Bot 9 7192984c13 Update Debugging.md
Summary:Fixes #7131

I believe it's easier if we just link to this file so it's less confusing what to edit actually. I was originally thinking about linking to specific line, but that will be hard to keep in sync.
Closes https://github.com/facebook/react-native/pull/7139

Differential Revision: D3212912

Pulled By: mkonicek

fb-gh-sync-id: 4f272d8bc922b273b961707d9ebf18a3efda31be
fbshipit-source-id: 4f272d8bc922b273b961707d9ebf18a3efda31be
2016-04-22 10:54:21 -07:00
Alexey LangandFacebook Github Bot 0 5b090dd52c Add .mm to React.podspec
Reviewed By: javache

Differential Revision: D3212710

fb-gh-sync-id: 1ab4a3d5943e154b1662b638d8c7c4b9c6ad2476
fbshipit-source-id: 1ab4a3d5943e154b1662b638d8c7c4b9c6ad2476
2016-04-22 10:16:46 -07:00
Pieter De BaetsandFacebook Github Bot 1 09f1e8293a Prevent measuring text in RCTShadowText child nodes
Summary: We only measure text at the root node, we shouldn't be trying to build a text storage later on for tree lower in the shadow node tree.

Reviewed By: nicklockwood

Differential Revision: D3212614

fb-gh-sync-id: 574fa7f2c029ca9ad2d5fabe7bbb148157f85ca7
fbshipit-source-id: 574fa7f2c029ca9ad2d5fabe7bbb148157f85ca7
2016-04-22 10:14:29 -07:00
Radek CzemerysandFacebook Github Bot 8 dfd1c7dd6a Making sinopia setup easier for the user
Summary:Simply installing `sinopia` does not create a config file (or even a
directory when it should be placed). Running `sinopia` for the first time
generates a default config file so it?s easier for the user to
configure it properly.
Closes https://github.com/facebook/react-native/pull/7146

Differential Revision: D3212613

Pulled By: mkonicek

fb-gh-sync-id: e1a2bbd8311a93b4d8a230902dd8031c85a205c3
fbshipit-source-id: e1a2bbd8311a93b4d8a230902dd8031c85a205c3
2016-04-22 09:26:24 -07:00
Eyal EizenbergandFacebook Github Bot 1 994745efbe Added Samanage to the showcase
Summary:Added the Samanage iOS React Native app to the showcase.
Closes https://github.com/facebook/react-native/pull/7112

Differential Revision: D3212588

Pulled By: mkonicek

fb-gh-sync-id: 79bf7faf31ac9f2129d19a39f3131b6df381360a
fbshipit-source-id: 79bf7faf31ac9f2129d19a39f3131b6df381360a
2016-04-22 09:18:21 -07:00
Tanguy AntoineandFacebook Github Bot 4 ab2113c324 Update PushNotificationIOS documentation
Summary:* add sample for localNotification listener
Closes https://github.com/facebook/react-native/pull/7114

Differential Revision: D3212587

Pulled By: mkonicek

fb-gh-sync-id: 1251a5563cf4254c4de491d45aafe8d1c24aeb0f
fbshipit-source-id: 1251a5563cf4254c4de491d45aafe8d1c24aeb0f
2016-04-22 09:16:21 -07:00
Jeff ChienandFacebook Github Bot 2 e438954938 Modify TouchableNativeFeedback (Ripple) to follow borderRadius
Summary:Using TouchableNativeFeedback has been a problem for me because the ripples it makes don't follow the child view's border radii so the ripples stick out of the child view's rounded corners. This PR should fix this problem with a minor caveat: this only works for TouchableNativeFeedback.Ripple and not TouchableNativeFeedback.SelectableBackground. I searched how I could apply corner radius to selectableItemBackground and it doesn't seem to be possible (the prevalent advice is to create the ripple manually which is equivalent to using TNF.Ripple in our case), though I could be wrong.

I added [an example to UIExplorer (TouchableExample)](http://i.imgur.com/CHY9xjW.png). This is my first PR to this repo so let me know if something's wrong. Cheers!
Closes https://github.com/facebook/react-native/pull/6515

Differential Revision: D3126513

Pulled By: mkonicek

fb-gh-sync-id: 1d3e92243abf9706132ae47c485d9e04a9b47d81
fbshipit-source-id: 1d3e92243abf9706132ae47c485d9e04a9b47d81
2016-04-22 09:07:50 -07:00
Raul AscencioandFacebook Github Bot 8 44d36f7c5f removing xterm from linux spawn
Summary:Simply removing the xterm spawn from android packager, since you can archive exactly the same results using the standard shell 😄
Closes https://github.com/facebook/react-native/pull/7077

Differential Revision: D3212548

Pulled By: mkonicek

fb-gh-sync-id: 8cc03d2708614f64e1394ca738e5de0ba631deb9
fbshipit-source-id: 8cc03d2708614f64e1394ca738e5de0ba631deb9
2016-04-22 09:01:22 -07:00
Alexey LangandFacebook Github Bot 6 db34d72d3c Fix OSS tests
Reviewed By: bestander

Differential Revision: D3212520

fb-gh-sync-id: 9c54c0dbfdfa4a7c133851b9262e8b6716ac7336
fbshipit-source-id: 9c54c0dbfdfa4a7c133851b9262e8b6716ac7336
2016-04-22 08:40:28 -07:00
Andrew GrayandFacebook Github Bot 0 774296b263 Implemented stopLoading
Summary:**Motivation:** In my app, I'm using a WebView that loads content from my mobile site.  What I want to do is when a user presses a link on the loaded page, I want to stop the WebView's request, hijack the URL and open the URL in a new WebView, pushed to the top of the navigator stack.  To me, this gives the overall app a more native feel, instead of implementing a rudimentary navbar on the main WebView to go back.

**Attempted Workarounds:** I've attempted to get similar functionality by capturing the onNavigationStateChange event in the WebView, and then within calling goBack + pushing the new view to the navigator stack.  From a functionality standpoint, this works.  However, from a UI standpoint, the user can clearly see the webview change states to a new page + go back before having the new view pushed on top of their nav stack.
Closes https://github.com/facebook/react-native/pull/6886

Differential Revision: D3212447

Pulled By: mkonicek

fb-gh-sync-id: 05911e583d9ba54ddbd54a772153c80ed227731e
fbshipit-source-id: 05911e583d9ba54ddbd54a772153c80ed227731e
2016-04-22 08:15:25 -07:00
Alexey LangandFacebook Github Bot 8 32a89493fb Fix leaked cookieMap in RCTJSCExecutor
Reviewed By: javache

Differential Revision: D3207245

fb-gh-sync-id: 1263974e2f94175cd4bf190cec446b88b5273aca
fbshipit-source-id: 1263974e2f94175cd4bf190cec446b88b5273aca
2016-04-22 06:44:26 -07:00
Pieter De BaetsandFacebook Github Bot 5 8b1726bdad Improve error handling in require-unbundle
Reviewed By: davidaurelio

Differential Revision: D3207450

fb-gh-sync-id: 35247c265e35976dcee9fca4215403efa604479e
fbshipit-source-id: 35247c265e35976dcee9fca4215403efa604479e
2016-04-22 06:18:26 -07:00
Mike GrabowskiandFacebook Github Bot 9 9bae30f8b5 Add cla command
Summary:Hey,

Adding a `cla` command to bot so that we can ping users that forgot about it more conveniently. I am not really sure if that's everything we have to do in order for the bot to use it - but just wanted to give it a go.

Differential Revision: D3212234

fb-gh-sync-id: 5f75f88694b21b883e7da2af41d4e389fb828839
fbshipit-source-id: 5f75f88694b21b883e7da2af41d4e389fb828839
2016-04-22 04:24:24 -07:00
Mike GrabowskiandFacebook Github Bot 3 a963f91021 Document how to disable YellowBox
Summary:As mentioned in #7121 by javache, this can already be disabled. Might be useful if users upgrade to 0.25 and want to hide warnings about wrong React imported (something they can't really control until community upgrades).

This should be mentioned in the release notes once it's merged.
Closes https://github.com/facebook/react-native/pull/7140

Differential Revision: D3212212

fb-gh-sync-id: 7a7afa2b7925e16d6ebfd20f4fe26d1cb9d603e5
fbshipit-source-id: 7a7afa2b7925e16d6ebfd20f4fe26d1cb9d603e5
2016-04-22 04:13:29 -07:00
Dan CaspiandFacebook Github Bot 4 fcac6e081d Support for WITH_JSC_MEMORY_PRESSURE in iOS 8's JSC.
Reviewed By: lexs

Differential Revision: D3162471

fb-gh-sync-id: 1fb1584ccfa507c5697958ce8837f637fa8a301c
fbshipit-source-id: 1fb1584ccfa507c5697958ce8837f637fa8a301c
2016-04-22 00:45:25 -07:00
Krzysztof MagieraandFacebook Github Bot 8 cd11738819 Support for stopping animations that run on UI thread.
Summary:This change extends animated native module API with `stopAnimation` method that is responsible for interrupting actively running animation as a reslut of a JS call. In order for the `stopAnimation` to understand `animationId` argument I also had to add `animationId` to `startAnimation` method. As JS thread runs in parallel to the thread which executes the animation there is a chance that JS may call `stopAnimation` after the animation has finished. Because of that we are not doing any checks on the `animationId` parameter passed to `stopAnimation` in native and if the animation does not exists in the registry we ignore that call.

**Test Plan**
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/7058

Differential Revision: D3211906

fb-gh-sync-id: 3761509651de36a550b00d33e2a631c379d3900f
fbshipit-source-id: 3761509651de36a550b00d33e2a631c379d3900f
2016-04-22 00:02:25 -07:00
Christopher DroandFacebook Github Bot 2 63adb48dc4 Add Zack Story 'rt2zz'
Summary:/cc rt2zz
Closes https://github.com/facebook/react-native/pull/7000

Differential Revision: D3184798

fb-gh-sync-id: b1f4eab40db7c753f7e3773502852bf9a0d05861
fbshipit-source-id: b1f4eab40db7c753f7e3773502852bf9a0d05861
2016-04-21 22:44:24 -07:00
glevi@fb.comandFacebook Github Bot 0 91d4a093ea Fix or suppress errors in react-native
Reviewed By: jeffmo

Differential Revision: D3209973

fb-gh-sync-id: bdc9b4afc0b187b1b16fa6bfb1c34adb4089ab81
fbshipit-source-id: bdc9b4afc0b187b1b16fa6bfb1c34adb4089ab81
2016-04-21 19:47:24 -07:00
Angela HessandFacebook Github Bot 4 5a93877673 Add ability to disable scroll on android ViewPager
Summary: Similar to ScrollView, adds ability to set scrollEnabled={false}, which prevents dragging. Paging is still possible by updating initialPage.

Reviewed By: AaaChiuuu

Differential Revision: D3209743

fb-gh-sync-id: ce4140323a03f2257a9bb310c7285418b01abae7
fbshipit-source-id: ce4140323a03f2257a9bb310c7285418b01abae7
2016-04-21 19:43:27 -07:00
Lim Chee AunandFacebook Github Bot 0 a0f6704d44 Update HackerWeb in showcase
Summary:Add Android app and blog post link.
Closes https://github.com/facebook/react-native/pull/7128

Differential Revision: D3211037

fb-gh-sync-id: 3d310d7f21f181755b6c473263433a157837cfc9
fbshipit-source-id: 3d310d7f21f181755b6c473263433a157837cfc9
2016-04-21 19:04:23 -07:00
Dan CaspiandFacebook Github Bot 1 c6c72ddad4 Set RNFeed to use iOS 8's JSC. Working but missing features.
Reviewed By: lexs

Differential Revision: D3162414

fb-gh-sync-id: d7eb65969486eddd623501e5eaa07f957088a846
fbshipit-source-id: d7eb65969486eddd623501e5eaa07f957088a846
2016-04-21 19:00:30 -07:00
Ben AlpertandFacebook Github Bot 8 9be37ca60e Update to 15.0.2-alpha.2
Reviewed By: zpao

Differential Revision: D3210045

fb-gh-sync-id: 6a1862c8f5f1f759e002cc9663719cb55723c342
fbshipit-source-id: 6a1862c8f5f1f759e002cc9663719cb55723c342
2016-04-21 17:25:29 -07:00
Spencer AhrensandFacebook Github Bot 2 47dff23fe4 Change "Hide/Show" Inspector to "Toggle"
Summary:The JS and native state can get out of sync if you reload JS while inspecting, so don't even bother trying on
native.

Reviewed By: lexs

Differential Revision: D3203020

fb-gh-sync-id: a3b7294bb0c28c0508f508be53d3ef895a7195b0
fbshipit-source-id: a3b7294bb0c28c0508f508be53d3ef895a7195b0
2016-04-21 16:57:20 -07:00
Ben NhamandFacebook Github Bot 8 91dcc9ac8e Fix autocomplete in rich-text editing mode for CJK text input
Summary:This fixes autocomplete for CJK text input by making sure that the `<Text>` nodes that JS controls to produce attributed text matches the text view's attributed text as much as possible. This is done by giving the disconnected `<Text>` child the same style as the `<TextInput>` parent.

This works because `-[RKTextView performPendingTextUpdate]` avoids setting the attributedText property on textView if the JS attributedText and textView attributedText are equal. This is important because setting attributedText on a text view clears the autocomplete state (markedText property) on a text view, breaking autocomplete for multistage input styles like CJK with a phonetic keyboard.

Reviewed By: nicklockwood

Differential Revision: D3207513

fb-gh-sync-id: 02e582ea5f15191974f15a65ebc1820401715f8d
fbshipit-source-id: 02e582ea5f15191974f15a65ebc1820401715f8d
2016-04-21 12:10:25 -07:00
Sebastian MarkbageandFacebook Github Bot 4 47a470a97c Move React Core Integration to a Dependency
Summary:Adding the react native renderer dependency and various fixes to support React 15.

Don't use dispatchID for touchableHandleResponderGrant

This callback argument was removed because "IDs" no longer exist. Instead, we'll
use the tag from the event target.

The corresponding PR on React Core is: https://github.com/facebook/react/pull/6338

Reviewed By: spicyj

Differential Revision: D3159788

fb-gh-sync-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
fbshipit-source-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
2016-04-21 09:28:23 -07:00
Alexey LangandFacebook Github Bot 4 033e7c80bf Support the bytecode cache for FBReactKit
Reviewed By: javache

Differential Revision: D3174040

fb-gh-sync-id: 8d1c43a55ec8764e5b51f13663613b0f7a4a581e
fbshipit-source-id: 8d1c43a55ec8764e5b51f13663613b0f7a4a581e
2016-04-21 08:59:43 -07:00
Pieter De BaetsandFacebook Github Bot 1 2b69ec2589 Provide initial size to Modal
Reviewed By: majak

Differential Revision: D3202211

fb-gh-sync-id: 83a1d3d52df0dc68483639393ab64fd6f1281cb3
fbshipit-source-id: 83a1d3d52df0dc68483639393ab64fd6f1281cb3
2016-04-21 08:57:19 -07:00
Mike GrabowskiandFacebook Github Bot 7 0de8962e16 Do not make RCTDevLoadingView a keyWindow
Summary:Hey,

I have been going through some UIAlert related issues in the repo trying to fix them, and one of the steps to start reproducing them was to put `Alert.alert()` call right inside `componentDidMount`.

However, I've started noticing strange bugs as long as I didn't set 1second timeout.

Started digging in deeper, and I've noticed the `UIAlert` gets attached to the `RCTWindow()` mainViewController.

However - since RCTDevLoadingView adds a `keyWindow`, that is the window that will be returned at the time of the call and the window `UIAlert` will be attached to.

To visualise that better - you can take a look at these two frames when app is being loaded:
<img width="371" alt="screen shot 2016-04-20 at 22 02 45" src="https://cloud.githubusercontent.com/assets/2464966/14688596/ae8d292c-0743-11e6-8aeb-e45da391b5b5.png">
<img width="371" alt="screen shot 2016-04-20 at 22 02 58" src="https://cloud.githubusercontent.com/assets/2464966/14688599/b30798e8-0743-11e6-951a-463fe7324c56.png">

AFAIK we do
Closes https://github.com/facebook/react-native/pull/7098

Differential Revision: D3207395

Pulled By: javache

fb-gh-sync-id: f8dca063573ac6f2a0ec497138b2ed0a7b27788b
fbshipit-source-id: f8dca063573ac6f2a0ec497138b2ed0a7b27788b
2016-04-21 07:02:27 -07:00
David AurelioandFacebook Github Bot 4 d8b87b232d Allow for falsy module exports
Reviewed By: javache

Differential Revision: D3207353

fb-gh-sync-id: 3e23eb9cc9facea7993ce684f87ff4b7b0003a1c
fbshipit-source-id: 3e23eb9cc9facea7993ce684f87ff4b7b0003a1c
2016-04-21 06:49:20 -07:00
Martin KonicekandFacebook Github Bot 0 bc32e06e56 Add an option to load the Boost library from the filesystem
Summary:Building React Native for Android from source the first time is quite slow. A large part of the time is spent downloading the Boost C++ library. If the code is already present on the system, there's no need to download it.
**Test plan**

CircleCI tests on this pull request. The env variable is not defined on CircleCI so this pull request should have no effect.
Closes https://github.com/facebook/react-native/pull/7116

Differential Revision: D3207397

Pulled By: mkonicek

fb-gh-sync-id: 3454947f6c90fda0d8d2cbb17a1af518e45b47fd
fbshipit-source-id: 3454947f6c90fda0d8d2cbb17a1af518e45b47fd
2016-04-21 06:48:22 -07:00
Alexander KotliarskyiandFacebook Github Bot 2 ec25a6b3f4 Add F8 app to showcase
Summary: Closes https://github.com/facebook/react-native/pull/7104

Differential Revision: D3207372

Pulled By: mkonicek

fb-gh-sync-id: bbfb51a9b16a50fd99adfb4e9cd8372ad2021f1d
fbshipit-source-id: bbfb51a9b16a50fd99adfb4e9cd8372ad2021f1d
2016-04-21 06:47:34 -07:00
Martin KonicekandFacebook Github Bot 9 cfa45be2fc Support non-standard path of Android Support Repository
Summary:This is needed in cases when the Android Support Repository is on a non-standard path.

**Test plan (required)**

CircleCI tests on this pull request.
Closes https://github.com/facebook/react-native/pull/7096

Differential Revision: D3207267

Pulled By: mkonicek

fb-gh-sync-id: 7539407f485341352faadc3b07d2c1459e0527f5
fbshipit-source-id: 7539407f485341352faadc3b07d2c1459e0527f5
2016-04-21 05:13:34 -07:00
Viktor ErikssonandFacebook Github Bot 8 8b314726e9 Option to not store credentials in file
Summary:**Motivation:** I don't like storing credentials in config files and a safer solution is to store them in the Keychain Access app.

Therefore I added a link that describes how one may go about to store the passwords in the Keychain Access app in OSX instead.

Found a [stackoverflow post](http://stackoverflow.com/a/24480579/1836121) but it wasn't very detailed so I decided to write it up myself. I understand if you have some policy against external links to blogs and I guess we could link to the stackoverflow explanation then instead.
Closes https://github.com/facebook/react-native/pull/7089

Differential Revision: D3207215

fb-gh-sync-id: 8011b55efe41ec6d54ad665e0e6a79cb9d806779
fbshipit-source-id: 8011b55efe41ec6d54ad665e0e6a79cb9d806779
2016-04-21 04:08:23 -07:00
Nick LockwoodandFacebook Github Bot 8 362738a776 Fixed some issues with zero fontSizeMultiplier causing RCTSHadowText measure function to return an infinite height
Summary:The default value for fontSizeMultiplier was zero. Although this was usually overriden with the correct value (typically 1.0), it sometimes wasn't resulting in a divide-by-zero in the text height calculation.

This diff corrects that bug by setting 1.0 as the default, and guarding against zero values being set.

I also fixed some suspicious logic that seemed to assume the result of BOOL && CGFloat would be 0 or the CGFloat value, which is true in JS but not in C (it would always be 0 or 1).

Reviewed By: javache

Differential Revision: D3179196

fb-gh-sync-id: cc09b104c9087fc1a2f45d8d3f70af221c2ad823
fbshipit-source-id: cc09b104c9087fc1a2f45d8d3f70af221c2ad823
2016-04-21 03:57:18 -07:00
Spencer AhrensandFacebook Github Bot 9 99705440a0 Fix some warnings.
Reviewed By: AaaChiuuu

Differential Revision: D3206005

fb-gh-sync-id: 88c0cec6b88479fac747a7ef6a677df30c282089
fbshipit-source-id: 88c0cec6b88479fac747a7ef6a677df30c282089
2016-04-20 20:45:22 -07:00
Mike GrabowskiandFacebook Github Bot 0 9d7b537dd4 Mention native code in Linking docs
Summary:Fixes #5925
Closes https://github.com/facebook/react-native/pull/7101

Differential Revision: D3206134

fb-gh-sync-id: e65ae97c32685d6acc08be2019dd2da902e01bc9
fbshipit-source-id: e65ae97c32685d6acc08be2019dd2da902e01bc9
2016-04-20 19:23:19 -07:00
Janic DuplessisandFacebook Github Bot 9 51310b0669 Bump babel-preset-react-native version
Summary:To include a missing part of the fix to HMR on Windows that was done in 0.25rc. See https://github.com/facebook/react-native/commit/c61100d0ceb4b71c86f01f35d7464d2d8a02b342. Will need to also publish to npm.

cc ide grabbou
Closes https://github.com/facebook/react-native/pull/7076

Differential Revision: D3199977

fb-gh-sync-id: b97da3c91d3723eaa40f63550e053d224689d517
fbshipit-source-id: b97da3c91d3723eaa40f63550e053d224689d517
2016-04-20 18:14:21 -07:00
HorcruxandFacebook Github Bot 3 4e5c85b6bb [ART]fix stroke bug
Summary:Fix a stroke bug.
Stroke path will be coverd by fill layer.
Fix it by stroke path after fill is done
Closes https://github.com/facebook/react-native/pull/7092

Differential Revision: D3203188

Pulled By: spicyj

fb-gh-sync-id: 9b950372822da4dc520552c0c31aa3435750a0a3
fbshipit-source-id: 9b950372822da4dc520552c0c31aa3435750a0a3
2016-04-20 12:50:29 -07:00
Martin KralikandFacebook Github Bot 0 85f7569ce6 fix incorrect layout for modal
Summary:We had an issue where a rendered modal would not end up using the full screen size, but a size computed based on its initial content.
Which is a small spinner in case of RelayContainer. So rarely we would end up with cut off view like this:
{F60650629}

This diff fixes this behavior by wrapping the content in another view. That makes the modal's wrapping VC's view resize just once when it's initially created. (Resize for the wrapping VC's view happened previously when the modal's content resized, which got us in the bad state.)

Reviewed By: javache

Differential Revision: D3202299

fb-gh-sync-id: 7c4dc1dbb27654292d07aef5916aa31df5cd4302
fbshipit-source-id: 7c4dc1dbb27654292d07aef5916aa31df5cd4302
2016-04-20 11:20:26 -07:00
Martin KralikandFacebook Github Bot 1 eff673572e pass flexiblity to shadowrootview on its creation
Reviewed By: javache

Differential Revision: D3177404

fb-gh-sync-id: 2116628461e37e9f1d1b3cbc6d6560675cadee7e
fbshipit-source-id: 2116628461e37e9f1d1b3cbc6d6560675cadee7e
2016-04-20 10:53:21 -07:00
Pieter De BaetsandFacebook Github Bot 3 5cdfe0f4b1 Report JSC errors as JS exceptions
Summary:When JSC throws an error on startup (e.g. a SyntaxError) or when invoking a method that is not caught by RCTExceptionsManager, we previously just reported is a native error, with a (useless) native stack trace in the redbox. This changes that behaviour to report a JS stacktrace.

The same issue was previously reported here: https://github.com/facebook/react-native/pull/5677

Reviewed By: majak

Differential Revision: D3037387

fb-gh-sync-id: 06f8333e0eb50dcef0b26284754262301b8a5f08
fbshipit-source-id: 06f8333e0eb50dcef0b26284754262301b8a5f08
2016-04-20 09:13:29 -07:00
Philipp von WeitershausenandFacebook Github Bot 8 ed930b4710 Add support for sending binary data in websockets
Summary:This is a reprise of #6327, but with iOS 7.0 compatibility and less `package.json` changes.

**Test Plan:** Load WebSocketExample in UIExplorer app and start websocket test server script (both provided in #6889) and test sending binary data on both iOS and Android
Closes https://github.com/facebook/react-native/pull/6961

Differential Revision: D3202022

Pulled By: mkonicek

fb-gh-sync-id: 38843d0a9c0172971c5c70a5139ded04042b280a
fbshipit-source-id: 38843d0a9c0172971c5c70a5139ded04042b280a
2016-04-20 08:53:25 -07:00
Spencer AhrensandFacebook Github Bot 7 ad15b74aae cleanup and open source JS BugReporting module
Summary:This is just the JS part of a bug reporting module that can be used with a pure JS flow or a native reporting
flow. It's handy for grabbing data from a bunch of random components, like the ids of the rows that are visible in a
list view at the time the bug is reported, or a description of the current navigation stack.

It's initialized in `AppRegistry` so it's always ready to go and bug reports will always include the universal
`runApplication` info, but won't actually do anything by default unless `collectExtraData` is called.

Note: some apps may call `runApplication` multiple times if they have multiple react native root views. This will just
overwrite the source so it will just report the most recently mounted one.

Reviewed By: foghina

Differential Revision: D3200203

fb-gh-sync-id: 8ed45fc9b289e8d9c50d3c85926213bd245d3ecc
fbshipit-source-id: 8ed45fc9b289e8d9c50d3c85926213bd245d3ecc
2016-04-20 08:09:07 -07:00
Dave MillerandFacebook Github Bot 9 eb21b25e2d Fix Popover.android to bubble events correctly
Reviewed By: andreicoman11, fkgozali

Differential Revision: D3197104

fb-gh-sync-id: 882f85175f87200b7aef1ca4204d6dfb6c4c4c69
fbshipit-source-id: 882f85175f87200b7aef1ca4204d6dfb6c4c4c69
2016-04-20 00:59:27 -07:00
Hedger WangandFacebook Github Bot 0 6731de7b45 Fix NavigationView.
Reviewed By: ericvicenti

Differential Revision: D3200293

fb-gh-sync-id: 3ffc7053b11f926461c45e19651d07295ca3ae72
fbshipit-source-id: 3ffc7053b11f926461c45e19651d07295ca3ae72
2016-04-19 19:56:21 -07:00
Mike GrabowskiandFacebook Github Bot 2 91a52421d4 Strip shebang when present in JS files
Summary:Fixes #7034
Closes https://github.com/facebook/react-native/pull/7073

Differential Revision: D3199816

fb-gh-sync-id: 2099dd1f81b030933794be6a592a697cec3627d0
fbshipit-source-id: 2099dd1f81b030933794be6a592a697cec3627d0
2016-04-19 18:09:22 -07:00
Elliot LyndeandFacebook Github Bot 7 7e515f8d4a Wait longer for debugger proxy
Reviewed By: yuzhi

Differential Revision: D3198412

fb-gh-sync-id: fe11f74b2a019accc24b08162746ce4793a49b90
fbshipit-source-id: fe11f74b2a019accc24b08162746ce4793a49b90
2016-04-19 17:13:25 -07:00
Hedger WangandFacebook Github Bot 1 81c62c5f41 Fix initial scenes rendering.
Summary:The initial layout used to render scenes does not contain the actual
width and height measured and causes the issue as described at
https://github.com/ericvicenti/navigation-rfc/issues/61

The fix is to update the layout and re-render scenes once layout
is modified. Also scenes renderer should also consider the case that
when the layout is not measured yet.

Reviewed By: ericvicenti

Differential Revision: D3162143

fb-gh-sync-id: 197574329d3849cad2a21e07e1bd5e800f74c3ea
fbshipit-source-id: 197574329d3849cad2a21e07e1bd5e800f74c3ea
2016-04-19 15:57:20 -07:00
Spencer AhrensandFacebook Github Bot 1 ecae44aaae Fix potential "Should never unset includeInLayout" invariant
Reviewed By: devknoll

Differential Revision: D3194174

fb-gh-sync-id: 67d065ea90f8416a5fc7e3651c68350f895f9639
fbshipit-source-id: 67d065ea90f8416a5fc7e3651c68350f895f9639
2016-04-19 13:55:26 -07:00
Krzysztof MagieraandFacebook Github Bot 0 ec5dfbf8c7 Support for Animated.multiply node
Summary:This change adds native animated support for Animated.multiply nodes.

Animated.multiply allows for defining nodes that would output a product of values of the input nodes.

**Test Plan**
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/7071

Differential Revision: D3197663

fb-gh-sync-id: 35f64244a2482c487a81e5e7cd08f3c0e56d9b78
fbshipit-source-id: 35f64244a2482c487a81e5e7cd08f3c0e56d9b78
2016-04-19 13:20:20 -07:00
Pieter De BaetsandFacebook Github Bot 1 3e2a3ca466 Move RCTJSCExecutorTests to ReactKitBenchmarks
Reviewed By: jspahrsummers

Differential Revision: D3192966

fb-gh-sync-id: 2c0caef1217545a131396326546d610e345db597
fbshipit-source-id: 2c0caef1217545a131396326546d610e345db597
2016-04-19 11:37:28 -07:00
Pavlo TkachandFacebook Github Bot 5 dbac1d891a Update showcase.js
Summary:Added new app in showcase.js
Closes https://github.com/facebook/react-native/pull/6912

Differential Revision: D3196473

fb-gh-sync-id: 8c06763907e5bf998c0f0edd832fd1f032ece35c
fbshipit-source-id: 8c06763907e5bf998c0f0edd832fd1f032ece35c
2016-04-19 09:20:24 -07:00
Tadeu ZagalloandFacebook Github Bot 5 887c275bcf Free modules' factories after caching module
Summary:The require functions will keep the generate bytecode + lexical environment in
memory unnecessarily, since we can be sure that it will be executed at most once

Reviewed By: davidaurelio

Differential Revision: D3168257

fb-gh-sync-id: 038e1bc08abea94ee52d0390b6aced5fb652f493
fbshipit-source-id: 038e1bc08abea94ee52d0390b6aced5fb652f493
2016-04-19 08:13:24 -07:00
Dave MillerandFacebook Github Bot 9 551c154261 Remove RKModal and Portal
Reviewed By: andreicoman11

Differential Revision: D3192529

fb-gh-sync-id: 4ea5d9d3e3b4f435e86a5dba4ddb7812f8d00fbc
fbshipit-source-id: 4ea5d9d3e3b4f435e86a5dba4ddb7812f8d00fbc
2016-04-19 07:42:29 -07:00
Thom DixonandFacebook Github Bot 4 d586daad51 Fix red screen due to ref being undefined in PullRefreshViewAndroid
Summary:This fixes the error
`undefined is not an object (evaluating 'this.refs[NATIVE_REF].setNativeProps')`, which seems to occur when the refresh fails (in our case due to CORS).

![screen shot 2016-03-16 at 12 23 52](https://cloud.githubusercontent.com/assets/461514/13826121/1f8b0aaa-eb73-11e5-81e3-b2c60e536bf0.png)
Closes https://github.com/facebook/react-native/pull/6489

Differential Revision: D3172217

fb-gh-sync-id: 5ba3b2653685888f5358ef32b01b441757eff7c8
fbshipit-source-id: 5ba3b2653685888f5358ef32b01b441757eff7c8
2016-04-19 06:58:22 -07:00
MikePodgorniyandFacebook Github Bot 5 d72f151bfc Add Emoji Poetry to showcase.js
Summary:Emoji Poetry app for showcase page
Closes https://github.com/facebook/react-native/pull/6879

Differential Revision: D3196123

fb-gh-sync-id: f9db698c64c7d9077ce359f28d6dd10ff49f7d8b
fbshipit-source-id: f9db698c64c7d9077ce359f28d6dd10ff49f7d8b
2016-04-19 06:52:22 -07:00
Konstantin RaevandFacebook Github Bot 6 a5e50de1a7 fixed website deployment condition logic
Summary:Rookie mistake I made.

**Test plan (required)**

See that https://circleci.com/gh/facebook/react-native/5462 succeeds deploying the website correctly.
Closes https://github.com/facebook/react-native/pull/7063

Differential Revision: D3196198

fb-gh-sync-id: 14fdc94fad0b1e5ff74cc90bb89d2bd1bf29bfa3
fbshipit-source-id: 14fdc94fad0b1e5ff74cc90bb89d2bd1bf29bfa3
2016-04-19 06:43:23 -07:00
anbackandFacebook Github Bot 7 1d9c7a47fd added veckopengen app to showcase js
Summary:added app to website/showcase.js that is built with React Native.
Closes https://github.com/facebook/react-native/pull/7018

Differential Revision: D3196127

Pulled By: mkonicek

fb-gh-sync-id: e4f29f00eaf2f8cd1eab53fe83822c6480baa511
fbshipit-source-id: e4f29f00eaf2f8cd1eab53fe83822c6480baa511
2016-04-19 05:30:19 -07:00
Joshua SierlesandFacebook Github Bot 0 1c6d815a88 Use latest simulator by not specifying the OS version
Summary:Appetize asked for this so they can better support us, since they will usually have more simulators available for the latest versions.
Closes https://github.com/facebook/react-native/pull/7061

Differential Revision: D3196110

Pulled By: mkonicek

fb-gh-sync-id: 2406ab6e1ee352f0148957e851d7f483a2182f90
fbshipit-source-id: 2406ab6e1ee352f0148957e851d7f483a2182f90
2016-04-19 05:16:20 -07:00
Mike GrabowskiandFacebook Github Bot 0 5e27ff2b27 Updates to release notes
Summary:Quite a few updates, some of them were mainly styling ones (please tell me to either revert them or update if they do not match the style guide!).

Clarified test steps and improved release scripts so that they are easier to read.

I have also removed a note about tags and CircleCi pushing a release since that's already done for us by a `update-oss-version`.

Another update is that we now mention steps to check that are printed by `test-manual-e2e.sh` as I have noticed they were recently updated, so better to just clarify they are printed out.
Closes https://github.com/facebook/react-native/pull/7041

Differential Revision: D3196122

Pulled By: mkonicek

fb-gh-sync-id: d3f87e6340ef3cddd4719902a05231072f05a287
fbshipit-source-id: d3f87e6340ef3cddd4719902a05231072f05a287
2016-04-19 05:12:20 -07:00
Mike GrabowskiandFacebook Github Bot 4 d9349a7b79 Update imports in generated projects
Summary:Fixes warnings when React API is used by requiring 'react-native'.
Closes https://github.com/facebook/react-native/pull/7060

Differential Revision: D3196109

Pulled By: mkonicek

fb-gh-sync-id: b47afc138cd7909ad53c0d67a65e3a124b87134b
fbshipit-source-id: b47afc138cd7909ad53c0d67a65e3a124b87134b
2016-04-19 05:11:27 -07:00
Nick LockwoodandFacebook Github Bot 5 546d140ec7 Fix array bounds crash in MapView
Summary: Under some circumstances, the calloutIndex might be > number of callout views, (possibly due to a race condition?). This prevents that from crashing.

Reviewed By: tadeuzagallo

Differential Revision: D3196010

fb-gh-sync-id: 6485e64c682937431cb8598d7f3f42e8d37eeff1
fbshipit-source-id: 6485e64c682937431cb8598d7f3f42e8d37eeff1
2016-04-19 05:03:22 -07:00
Leland RichardsonandFacebook Github Bot 7 e9398c7926 Whitelist the 'pdf' extension in the packager
Summary:The WebView component in iOS currently does not support displaying PDFs without providing a remote URI or manually including the assets in the xcodeproj itself. This is because the packager has not whitelisted the 'pdf' extension.

I've gone ahead and whitelisted the 'pdf extension according to the recommendation by nicklockwood

GH comment: https://github.com/facebook/react-native/issues/1846#issuecomment-199302488
Closes https://github.com/facebook/react-native/pull/7004

Differential Revision: D3196019

Pulled By: nicklockwood

fb-gh-sync-id: 10a86a9232095f98f277506141de0b8af5b21ab4
fbshipit-source-id: 10a86a9232095f98f277506141de0b8af5b21ab4
2016-04-19 03:52:27 -07:00
Krzysztof MagieraandFacebook Github Bot 8 b5375bdc09 Support for Animated.add
Summary:This change adds suport native animated support for Animated.add.

Animated.add lets you declare node that outputs a sum of it input nodes.

**Test Plan**
Play with the following playground app: https://gist.github.com/39de37faf07480fcd7d1
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/6641

Differential Revision: D3195963

fb-gh-sync-id: bb1e1a36821a0e071ad0e7d0fa99ce0d6b088b0a
fbshipit-source-id: bb1e1a36821a0e071ad0e7d0fa99ce0d6b088b0a
2016-04-19 02:58:21 -07:00
Angela HessandFacebook Github Bot 3 64d5da7754 Replace opacity console error with warning
Summary: This error message is remarkably aggressive relative to the severity of the issue, particularly since the pattern in question is used / necessary throughout the codebase. Animated ReactART components with set opacities trigger this error, and opacity coming from the style prop is not respected.

Reviewed By: sahrens

Differential Revision: D3177554

fb-gh-sync-id: 96061d5ff526177814996b28e4394e6649839582
fbshipit-source-id: 96061d5ff526177814996b28e4394e6649839582
2016-04-18 18:53:20 -07:00
TETRA2000andFacebook Github Bot 8 978fa488ec add space between words
Summary: Closes https://github.com/facebook/react-native/pull/7045

Differential Revision: D3194558

fb-gh-sync-id: 57691d4d54bbe2bdce6abf885b6aa0f341f12644
fbshipit-source-id: 57691d4d54bbe2bdce6abf885b6aa0f341f12644
2016-04-18 18:29:23 -07:00
Philipp von WeitershausenandFacebook Github Bot 0 ebb44d202b Clean up and simplify WebSocket implementation on the JS side
Summary:- Get rid of no longer necessary WebSocket.js v WebSocketBase.js split
- Use `EventTarget(list, of, events)` as base class to auto-generate `oneventname` getters/setters that get invoked along with other event handlers
- Type annotation `any` considered harmful, especially when we can easily spell out the actual type
- Throw in some `const` goodness for free

**Test Plan:** Launch UIExplorer example app, supplied `websocket_test_server` script, and try different combinations of sending and receiving text and binary data on both iOS and Android.
Closes https://github.com/facebook/react-native/pull/6889

Differential Revision: D3184835

Pulled By: mkonicek

fb-gh-sync-id: f21707f4e97aa5a79847f5157e0a9f132a1a01cd
fbshipit-source-id: f21707f4e97aa5a79847f5157e0a9f132a1a01cd
2016-04-18 15:43:25 -07:00
John DoeandFacebook Github Bot 5 0fa48c00a9 Adding helium to showcase.js
Summary:Show my app : Helium

Helium is an app where people can discover the best of what others are up to in their free time .
Closes https://github.com/facebook/react-native/pull/7035

Differential Revision: D3191805

Pulled By: mkonicek

fb-gh-sync-id: 03117821a6bce1924415b68df9ad8a2770acb930
fbshipit-source-id: 03117821a6bce1924415b68df9ad8a2770acb930
2016-04-18 11:50:26 -07:00
Micha? GregorczykandFacebook Github Bot 9 fd35ddcc65 Store lock file in persistent directory.
Reviewed By: tadeuzagallo

Differential Revision: D3190827

fb-gh-sync-id: 42dd65bccd7c248989475f68c81061079e3601a4
fbshipit-source-id: 42dd65bccd7c248989475f68c81061079e3601a4
2016-04-18 11:45:39 -07:00
Mike GrabowskiandFacebook Github Bot 3 1bee3467ad Update releasing guide
Summary:This is WIP as I am going through release steps. Submitting few ideas.

List:
- NDK is actually needed in the first step for the e2e scripts to run.
Closes https://github.com/facebook/react-native/pull/7038

Differential Revision: D3191761

Pulled By: mkonicek

fb-gh-sync-id: e6bd51b3c339ed430086f4e21a3b3e6c3864f06f
fbshipit-source-id: e6bd51b3c339ed430086f4e21a3b3e6c3864f06f
2016-04-18 11:35:24 -07:00
Martin KonicekandFacebook Github Bot 7 5bb6926e40 Simplify manual testing steps when doing the release
Summary:Quite a few of these steps are now tested automatically on Android thanks to bestander.

**Test plan**

Just visual inspection of the code :)
Closes https://github.com/facebook/react-native/pull/7037

Differential Revision: D3191678

fb-gh-sync-id: 54702a772c5c149bdd3f05d6f4ca257bc6f27090
fbshipit-source-id: 54702a772c5c149bdd3f05d6f4ca257bc6f27090
2016-04-18 11:32:28 -07:00
Philipp von WeitershausenandFacebook Github Bot 8 20cae51a8f Add support for receiving binary type data (ArrayBuffer)
Summary:This brings the same functionality that's already present on iOS, introduced in #4483, to Android: convert binary payloads to base64 strings and send them to JS land that way, where they'll be turned into an ArrayBuffer.

**Test Plan:** Used test server from #6889 (in `--binary` mode) to send some binary data to the Android UIExplorer example (also from #6889). Verified it's received correctly as `ArrayBuffer`.
Closes https://github.com/facebook/react-native/pull/6868

Differential Revision: D3184797

Pulled By: mkonicek

fb-gh-sync-id: e78c640c43b3e41a75ddba79acc04e5eaab5667d
fbshipit-source-id: e78c640c43b3e41a75ddba79acc04e5eaab5667d
2016-04-18 11:12:28 -07:00
Felix OghinaandFacebook Github Bot 7 a3ef44b4ba throw IllegalArgumentException instead of AssertionError when JS module is not found
Reviewed By: astreet

Differential Revision: D3190875

fb-gh-sync-id: ac34872d8d36247a8bb28bdfbf985ebcdadd4e33
fbshipit-source-id: ac34872d8d36247a8bb28bdfbf985ebcdadd4e33
2016-04-18 10:01:19 -07:00
947 changed files with 28809 additions and 13253 deletions
+5 -3
View File
@@ -221,17 +221,19 @@
"react/display-name": 0,
"react/jsx-boolean-value": 0,
"react/jsx-no-duplicate-props": 2,
"react/jsx-no-undef": 1,
"react/jsx-sort-props": 0,
"react/jsx-uses-react": 0,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/no-did-mount-set-state": [1, "allow-in-func"],
"react/no-did-update-set-state": [1, "allow-in-func"],
"react/no-multi-comp": 0,
"react/no-string-refs": 1,
"react/no-unknown-property": 0,
"react/prop-types": 0,
"react/react-in-jsx-scope": 0,
"react/react-in-jsx-scope": 1,
"react/self-closing-comp": 1,
"react/wrap-multilines": 0
"react/wrap-multilines": 0,
}
}
+7 -6
View File
@@ -15,8 +15,6 @@
# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs/lib/Map.js
.*/node_modules/fbjs/lib/fetch.js
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
.*/node_modules/fbjs/lib/ErrorUtils.js
# Flow has a built-in definition for the 'react' module which we prefer to use
@@ -48,6 +46,9 @@
# Ignore BUCK generated folders
.*\.buckd/
# Ignore RNPM
.*/local-cli/rnpm/.*
.*/node_modules/is-my-json-valid/test/.*\.json
.*/node_modules/iconv-lite/encodings/tables/.*\.json
.*/node_modules/y18n/test/.*\.json
@@ -81,15 +82,15 @@ esproposal.class_instance_fields=enable
munge_underscores=true
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
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\)$' -> 'RelativeImageStub'
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\\.\\(2[0-3]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-3]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
[version]
0.23.0
^0.25.0
+3
View File
@@ -49,3 +49,6 @@ node_modules
# OS X
.DS_Store
# Test generated files
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
+2
View File
@@ -0,0 +1,2 @@
# rnpm
/local-cli/rnpm
+3 -4
View File
@@ -3,13 +3,12 @@ language: objective-c
osx_image: xcode7.3
install:
- brew update
- brew reinstall nvm xctool
- mkdir -p /Users/travis/build/facebook/.nvm
- export NVM_DIR="/Users/travis/build/facebook/.nvm"
- brew install nvm
- source $(brew --prefix nvm)/nvm.sh
# testing with npm@2 for diversity, Circle tests with npm@3
- nvm install 4.4.0
- nvm install 4.4.3
- rm -Rf "${TMPDIR}/jest_preprocess_cache"
- npm config set spin=false
- npm config set progress=false
@@ -17,7 +16,7 @@ install:
script:
- if [[ "$TEST_TYPE" = objc ]]; then travis_retry ./scripts/objc-test.sh; fi
- if [[ "$TEST_TYPE" = e2e-objc ]]; then travis_retry node ./scripts/run-ci-e2e-tests.js --ios --js; fi
- if [[ "$TEST_TYPE" = e2e-objc ]]; then node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3; fi
- if [[ "$TEST_TYPE" = js ]]; then npm run flow check; fi
- if [[ "$TEST_TYPE" = js ]]; then npm test -- --maxWorkers=1; fi
+8 -2
View File
@@ -267,7 +267,10 @@
INFOPLIST_FILE = "$(SRCROOT)/2048/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = 2048;
};
@@ -285,7 +288,10 @@
INFOPLIST_FILE = "$(SRCROOT)/2048/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = 2048;
};
-3
View File
@@ -45,9 +45,6 @@ var MovieCell = React.createClass({
onShowUnderlay={this.props.onHighlight}
onHideUnderlay={this.props.onUnhighlight}>
<View style={styles.row}>
{/* $FlowIssue #7363964 - There's a bug in Flow where you cannot
* omit a property or set it to undefined if it's inside a shape,
* even if it isn't required */}
<Image
source={getImageSource(this.props.movie, 'det')}
style={styles.cellImage}
-3
View File
@@ -34,9 +34,6 @@ var MovieScreen = React.createClass({
return (
<ScrollView contentContainerStyle={styles.contentContainer}>
<View style={styles.mainSection}>
{/* $FlowIssue #7363964 - There's a bug in Flow where you cannot
* omit a property or set it to undefined if it's inside a shape,
* even if it isn't required */}
<Image
source={getImageSource(this.props.movie, 'det')}
style={styles.detailsImage}
@@ -357,7 +357,10 @@
INFOPLIST_FILE = "$(SRCROOT)/Movies/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Movies;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../Libraries/**";
@@ -376,7 +379,10 @@
INFOPLIST_FILE = "$(SRCROOT)/Movies/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Movies;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../Libraries/**";
@@ -3,7 +3,7 @@
*/
'use strict';
jest.dontMock('../getImageSource');
jest.unmock('../getImageSource');
var getImageSource = require('../getImageSource');
@@ -327,7 +327,10 @@
INFOPLIST_FILE = "$(SRCROOT)/TicTacToe/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = TicTacToe;
};
@@ -345,7 +348,10 @@
INFOPLIST_FILE = "$(SRCROOT)/TicTacToe/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = TicTacToe;
};
+1
View File
@@ -13,6 +13,7 @@
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
StyleSheet,
+1
View File
@@ -13,6 +13,7 @@
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
Image,
@@ -0,0 +1,171 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @flow
*/
'use strict';
const React = require('react');
const ReactNative = require('react-native');
const {
LayoutAnimation,
StyleSheet,
Text,
View,
TouchableOpacity,
} = ReactNative;
const AddRemoveExample = React.createClass({
getInitialState() {
return {
views: [],
};
},
componentWillUpdate() {
LayoutAnimation.easeInEaseOut();
},
_onPressAddView() {
this.setState((state) => ({views: [...state.views, {}]}));
},
_onPressRemoveView() {
this.setState((state) => ({views: state.views.slice(0, -1)}));
},
render() {
const views = this.state.views.map((view, i) =>
<View key={i} style={styles.view}>
<Text>{i}</Text>
</View>
);
return (
<View style={styles.container}>
<TouchableOpacity onPress={this._onPressAddView}>
<View style={styles.button}>
<Text>Add view</Text>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={this._onPressRemoveView}>
<View style={styles.button}>
<Text>Remove view</Text>
</View>
</TouchableOpacity>
<View style={styles.viewContainer}>
{views}
</View>
</View>
);
},
});
const GreenSquare = () =>
<View style={styles.greenSquare}>
<Text>Green square</Text>
</View>;
const BlueSquare = () =>
<View style={styles.blueSquare}>
<Text>Blue square</Text>
</View>;
const CrossFadeExample = React.createClass({
getInitialState() {
return {
toggled: false,
};
},
_onPressToggle() {
LayoutAnimation.easeInEaseOut();
this.setState((state) => ({toggled: !state.toggled}));
},
render() {
return (
<View style={styles.container}>
<TouchableOpacity onPress={this._onPressToggle}>
<View style={styles.button}>
<Text>Toggle</Text>
</View>
</TouchableOpacity>
<View style={styles.viewContainer}>
{
this.state.toggled ?
<GreenSquare /> :
<BlueSquare />
}
</View>
</View>
);
},
});
const styles = StyleSheet.create({
container: {
flex: 1,
},
button: {
borderRadius: 5,
backgroundColor: '#eeeeee',
padding: 10,
marginBottom: 10,
},
buttonText: {
fontSize: 16,
},
viewContainer: {
flex: 1,
flexDirection: 'row',
flexWrap: 'wrap',
},
view: {
height: 54,
width: 54,
backgroundColor: 'red',
margin: 8,
alignItems: 'center',
justifyContent: 'center',
},
greenSquare: {
width: 150,
height: 150,
backgroundColor: 'green',
alignItems: 'center',
justifyContent: 'center',
},
blueSquare: {
width: 150,
height: 150,
backgroundColor: 'blue',
alignItems: 'center',
justifyContent: 'center',
},
});
exports.title = 'Layout Animation';
exports.description = 'Layout animation';
exports.examples = [{
title: 'Add and remove views',
render(): ReactElement {
return <AddRemoveExample />;
},
}, {
title: 'Cross fade views',
render(): ReactElement {
return <CrossFadeExample />;
},
}];
+18 -7
View File
@@ -58,17 +58,20 @@ var ListViewSimpleExample = React.createClass({
dataSource={this.state.dataSource}
renderRow={this._renderRow}
renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />}
renderSeparator={(sectionID, rowID) => <View key={`${sectionID}-${rowID}`} style={styles.separator} />}
renderSeparator={this._renderSeperator}
/>
</UIExplorerPage>
);
},
_renderRow: function(rowData: string, sectionID: number, rowID: number) {
_renderRow: function(rowData: string, sectionID: number, rowID: number, highlightRow: (sectionID: number, rowID: number) => void) {
var rowHash = Math.abs(hashCode(rowData));
var imgSource = THUMB_URLS[rowHash % THUMB_URLS.length];
return (
<TouchableHighlight onPress={() => this._pressRow(rowID)}>
<TouchableHighlight onPress={() => {
this._pressRow(rowID);
highlightRow(sectionID, rowID);
}}>
<View>
<View style={styles.row}>
<Image style={styles.thumb} source={imgSource} />
@@ -96,6 +99,18 @@ var ListViewSimpleExample = React.createClass({
this._genRows(this._pressData)
)});
},
_renderSeperator: function(sectionID: number, rowID: number, adjacentRowHighlighted: bool) {
return (
<View
key={`${sectionID}-${rowID}`}
style={{
height: adjacentRowHighlighted ? 4 : 1,
backgroundColor: adjacentRowHighlighted ? '#3B5998' : '#CCCCCC',
}}
/>
);
}
});
var THUMB_URLS = [
@@ -130,10 +145,6 @@ var styles = StyleSheet.create({
padding: 10,
backgroundColor: '#F6F6F6',
},
separator: {
height: 1,
backgroundColor: '#CCCCCC',
},
thumb: {
width: 64,
height: 64,
+18 -8
View File
@@ -66,7 +66,7 @@ var Button = React.createClass({
var ModalExample = React.createClass({
getInitialState() {
return {
animated: true,
animationType: 'none',
modalVisible: false,
transparent: false,
};
@@ -76,8 +76,8 @@ var ModalExample = React.createClass({
this.setState({modalVisible: visible});
},
_toggleAnimated() {
this.setState({animated: !this.state.animated});
_setAnimationType(type) {
this.setState({animationType: type});
},
_toggleTransparent() {
@@ -91,18 +91,21 @@ var ModalExample = React.createClass({
var innerContainerTransparentStyle = this.state.transparent
? {backgroundColor: '#fff', padding: 20}
: null;
var activeButtonStyle = {
backgroundColor: '#ddd'
};
return (
<View>
<Modal
animated={this.state.animated}
animationType={this.state.animationType}
transparent={this.state.transparent}
visible={this.state.modalVisible}
onRequestClose={() => {this._setModalVisible(false)}}
>
<View style={[styles.container, modalBackgroundStyle]}>
<View style={[styles.innerContainer, innerContainerTransparentStyle]}>
<Text>This modal was presented {this.state.animated ? 'with' : 'without'} animation.</Text>
<Text>This modal was presented {this.state.animationType === 'none' ? 'without' : 'with'} animation.</Text>
<Button
onPress={this._setModalVisible.bind(this, false)}
style={styles.modalButton}>
@@ -111,10 +114,17 @@ var ModalExample = React.createClass({
</View>
</View>
</Modal>
<View style={styles.row}>
<Text style={styles.rowTitle}>Animated</Text>
<Switch value={this.state.animated} onValueChange={this._toggleAnimated} />
<Text style={styles.rowTitle}>Animation Type</Text>
<Button onPress={this._setAnimationType.bind(this, 'none')} style={this.state.animationType === 'none' ? activeButtonStyle : {}}>
none
</Button>
<Button onPress={this._setAnimationType.bind(this, 'slide')} style={this.state.animationType === 'slide' ? activeButtonStyle : {}}>
slide
</Button>
<Button onPress={this._setAnimationType.bind(this, 'fade')} style={this.state.animationType === 'fade' ? activeButtonStyle : {}}>
fade
</Button>
</View>
<View style={styles.row}>
@@ -1,165 +0,0 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
NavigationExperimental,
StyleSheet,
ScrollView,
Text,
TouchableHighlight,
TouchableOpacity
} = ReactNative;
var _getRandomRoute = function() {
return {
title: '#' + Math.ceil(Math.random() * 1000),
};
};
var Navigator = NavigationExperimental.LegacyNavigator;
class NavButton extends React.Component {
render() {
return (
<TouchableHighlight
style={styles.button}
underlayColor="#B5B5B5"
onPress={this.props.onPress}>
<Text style={styles.buttonText}>{this.props.text}</Text>
</TouchableHighlight>
);
}
}
var BreadcrumbNavSample = React.createClass({
componentWillMount: function() {
this._navBarRouteMapper = {
rightContentForRoute: function(route, navigator) {
return null;
},
titleContentForRoute: function(route, navigator) {
return (
<TouchableOpacity
onPress={() => navigator.push(_getRandomRoute())}>
<Text style={styles.titleText}>{route.title}</Text>
</TouchableOpacity>
);
},
iconForRoute: function(route, navigator) {
return (
<TouchableOpacity
onPress={() => { navigator.popToRoute(route); }}
style={styles.crumbIconPlaceholder}
/>
);
},
separatorForRoute: function(route, navigator) {
return (
<TouchableOpacity
onPress={navigator.pop}
style={styles.crumbSeparatorPlaceholder}
/>
);
}
};
},
_renderScene: function(route, navigator) {
return (
<ScrollView style={styles.scene}>
<NavButton
onPress={() => { navigator.push(_getRandomRoute()); }}
text="Push"
/>
<NavButton
onPress={() => { navigator.immediatelyResetRouteStack([_getRandomRoute(), _getRandomRoute()]); }}
text="Reset w/ 2 scenes"
/>
<NavButton
onPress={() => { navigator.popToTop(); }}
text="Pop to top"
/>
<NavButton
onPress={() => { navigator.replace(_getRandomRoute()); }}
text="Replace"
/>
<NavButton
onPress={() => { this.props.navigator.pop(); }}
text="Close breadcrumb example"
/>
</ScrollView>
);
},
render: function() {
return (
<Navigator
style={styles.container}
initialRoute={_getRandomRoute()}
renderScene={this._renderScene}
navigationBar={
<Navigator.BreadcrumbNavigationBar
routeMapper={this._navBarRouteMapper}
/>
}
/>
);
},
});
var styles = StyleSheet.create({
scene: {
paddingTop: 50,
flex: 1,
},
button: {
backgroundColor: 'white',
padding: 15,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#CDCDCD',
},
buttonText: {
fontSize: 17,
fontWeight: '500',
},
container: {
overflow: 'hidden',
backgroundColor: '#dddddd',
flex: 1,
},
titleText: {
fontSize: 18,
color: '#666666',
textAlign: 'center',
fontWeight: 'bold',
lineHeight: 32,
},
crumbIconPlaceholder: {
flex: 1,
backgroundColor: '#666666',
},
crumbSeparatorPlaceholder: {
flex: 1,
backgroundColor: '#aaaaaa',
},
});
module.exports = BreadcrumbNavSample;
@@ -1,219 +0,0 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
NavigationExperimental,
StyleSheet,
ScrollView,
TabBarIOS,
Text,
TouchableHighlight,
View,
} = ReactNative;
var _getRandomRoute = function() {
return {
randNumber: Math.ceil(Math.random() * 1000),
};
};
var Navigator = NavigationExperimental.LegacyNavigator;
class NavButton extends React.Component {
render() {
return (
<TouchableHighlight
style={styles.button}
underlayColor="#B5B5B5"
onPress={this.props.onPress}>
<Text style={styles.buttonText}>{this.props.text}</Text>
</TouchableHighlight>
);
}
}
var ROUTE_STACK = [
_getRandomRoute(),
_getRandomRoute(),
_getRandomRoute(),
];
var INIT_ROUTE_INDEX = 1;
class JumpingNavBar extends React.Component {
constructor(props) {
super(props);
this.state = {
tabIndex: props.initTabIndex,
};
}
handleWillFocus(route) {
var tabIndex = ROUTE_STACK.indexOf(route);
this.setState({ tabIndex, });
}
render() {
return (
<View style={styles.tabs}>
<TabBarIOS>
<TabBarIOS.Item
icon={require('image!tabnav_notification')}
selected={this.state.tabIndex === 0}
onPress={() => {
this.props.onTabIndex(0);
this.setState({ tabIndex: 0, });
}}>
<View />
</TabBarIOS.Item>
<TabBarIOS.Item
icon={require('image!tabnav_list')}
selected={this.state.tabIndex === 1}
onPress={() => {
this.props.onTabIndex(1);
this.setState({ tabIndex: 1, });
}}>
<View />
</TabBarIOS.Item>
<TabBarIOS.Item
icon={require('image!tabnav_settings')}
selected={this.state.tabIndex === 2}
onPress={() => {
this.props.onTabIndex(2);
this.setState({ tabIndex: 2, });
}}>
<View />
</TabBarIOS.Item>
</TabBarIOS>
</View>
);
}
}
var JumpingNavSample = React.createClass({
render: function() {
return (
<Navigator
debugOverlay={false}
style={styles.appContainer}
ref={(navigator) => {
this._navigator = navigator;
}}
initialRoute={ROUTE_STACK[INIT_ROUTE_INDEX]}
initialRouteStack={ROUTE_STACK}
renderScene={this.renderScene}
configureScene={() => ({
...Navigator.SceneConfigs.HorizontalSwipeJump,
})}
navigationBar={
<JumpingNavBar
ref={(navBar) => { this.navBar = navBar; }}
initTabIndex={INIT_ROUTE_INDEX}
routeStack={ROUTE_STACK}
onTabIndex={(index) => {
this._navigator.jumpTo(ROUTE_STACK[index]);
}}
/>
}
/>
);
},
renderScene: function(route, navigator) {
var backBtn;
var forwardBtn;
if (ROUTE_STACK.indexOf(route) !== 0) {
backBtn = (
<NavButton
onPress={() => {
navigator.jumpBack();
}}
text="jumpBack"
/>
);
}
if (ROUTE_STACK.indexOf(route) !== ROUTE_STACK.length - 1) {
forwardBtn = (
<NavButton
onPress={() => {
navigator.jumpForward();
}}
text="jumpForward"
/>
);
}
return (
<ScrollView style={styles.scene}>
<Text style={styles.messageText}>#{route.randNumber}</Text>
{backBtn}
{forwardBtn}
<NavButton
onPress={() => {
navigator.jumpTo(ROUTE_STACK[1]);
}}
text="jumpTo middle route"
/>
<NavButton
onPress={() => {
this.props.navigator.pop();
}}
text="Exit Navigation Example"
/>
<NavButton
onPress={() => {
this.props.navigator.push({
message: 'Came from jumping example',
});
}}
text="Nav Menu"
/>
</ScrollView>
);
},
});
var styles = StyleSheet.create({
button: {
backgroundColor: 'white',
padding: 15,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#CDCDCD',
},
buttonText: {
fontSize: 17,
fontWeight: '500',
},
appContainer: {
overflow: 'hidden',
backgroundColor: '#dddddd',
flex: 1,
},
messageText: {
fontSize: 17,
fontWeight: '500',
padding: 15,
marginTop: 50,
marginLeft: 15,
},
scene: {
flex: 1,
paddingTop: 20,
backgroundColor: '#EAEAEA',
},
tabs: {
height: 50,
}
});
module.exports = JumpingNavSample;
@@ -1,220 +0,0 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
NavigationExperimental,
ScrollView,
StyleSheet,
Text,
TouchableHighlight,
} = ReactNative;
var BreadcrumbNavSample = require('./BreadcrumbNavSample');
var NavigationBarSample = require('./NavigationBarSample');
var JumpingNavSample = require('./JumpingNavSample');
var Navigator = NavigationExperimental.LegacyNavigator;
class NavButton extends React.Component {
render() {
return (
<TouchableHighlight
style={styles.button}
underlayColor="#B5B5B5"
onPress={this.props.onPress}>
<Text style={styles.buttonText}>{this.props.text}</Text>
</TouchableHighlight>
);
}
}
class NavMenu extends React.Component {
render() {
return (
<ScrollView style={styles.scene}>
<Text style={styles.messageText}>{this.props.message}</Text>
<NavButton
onPress={() => {
this.props.navigator.push({
message: 'Swipe right to dismiss',
sceneConfig: Navigator.SceneConfigs.FloatFromRight,
});
}}
text="Float in from right"
/>
<NavButton
onPress={() => {
this.props.navigator.push({
message: 'Swipe down to dismiss',
sceneConfig: Navigator.SceneConfigs.FloatFromBottom,
});
}}
text="Float in from bottom"
/>
<NavButton
onPress={() => {
this.props.navigator.pop();
}}
text="Pop"
/>
<NavButton
onPress={() => {
this.props.navigator.popToTop();
}}
text="Pop to top"
/>
<NavButton
onPress={() => {
this.props.navigator.push({ id: 'navbar' });
}}
text="Navbar Example"
/>
<NavButton
onPress={() => {
this.props.navigator.push({ id: 'jumping' });
}}
text="Jumping Example"
/>
<NavButton
onPress={() => {
this.props.navigator.push({ id: 'breadcrumbs' });
}}
text="Breadcrumbs Example"
/>
<NavButton
onPress={() => {
this.props.onExampleExit();
}}
text="Exit <LegacyNavigator> Example"
/>
</ScrollView>
);
}
}
var TabBarExample = React.createClass({
statics: {
title: '<LegacyNavigator> (Experimental)',
description: 'Experimental navigator that ports the API of the current ' +
'Navigator component',
},
renderScene: function(route, nav) {
switch (route.id) {
case 'navbar':
return <NavigationBarSample navigator={nav} />;
case 'breadcrumbs':
return <BreadcrumbNavSample navigator={nav} />;
case 'jumping':
return <JumpingNavSample navigator={nav} />;
default:
return (
<NavMenu
message={route.message}
navigator={nav}
onExampleExit={this.props.onExampleExit}
/>
);
}
},
render: function() {
return (
<Navigator
ref={this._setNavigatorRef}
style={styles.container}
initialRoute={{ message: 'First Scene', }}
renderScene={this.renderScene}
configureScene={(route) => {
if (route.sceneConfig) {
return route.sceneConfig;
}
return Navigator.SceneConfigs.FloatFromBottom;
}}
/>
);
},
componentWillUnmount: function() {
this._listeners && this._listeners.forEach(listener => listener.remove());
},
_setNavigatorRef: function(navigator) {
if (navigator !== this._navigator) {
this._navigator = navigator;
if (navigator) {
var callback = (event) => {
console.log(
`LegacyNavigator: event ${event.type}`,
{
route: JSON.stringify(event.data.route),
target: event.target,
type: event.type,
}
);
};
// Observe focus change events from the owner.
this._listeners = [
navigator.navigationContext.addListener('willfocus', callback),
navigator.navigationContext.addListener('didfocus', callback),
];
}
}
},
});
var styles = StyleSheet.create({
messageText: {
fontSize: 17,
fontWeight: '500',
padding: 15,
marginTop: 50,
marginLeft: 15,
},
container: {
flex: 1,
},
button: {
backgroundColor: 'white',
padding: 15,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#CDCDCD',
},
buttonText: {
fontSize: 17,
fontWeight: '500',
},
scene: {
flex: 1,
paddingTop: 20,
backgroundColor: '#ccc',
}
});
TabBarExample.external = true;
module.exports = TabBarExample;
@@ -1,202 +0,0 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
NavigationExperimental,
ScrollView,
StyleSheet,
Text,
TouchableHighlight,
TouchableOpacity,
} = ReactNative;
var Navigator = NavigationExperimental.LegacyNavigator;
class NavButton extends React.Component {
render() {
return (
<TouchableHighlight
style={styles.button}
underlayColor="#B5B5B5"
onPress={this.props.onPress}>
<Text style={styles.buttonText}>{this.props.text}</Text>
</TouchableHighlight>
);
}
}
var NavigationBarRouteMapper = {
LeftButton: function(route, navigator, index, navState) {
if (index === 0) {
return null;
}
var previousRoute = navState.routeStack[index - 1];
return (
<TouchableOpacity
onPress={() => navigator.pop()}
style={styles.navBarLeftButton}>
<Text style={[styles.navBarText, styles.navBarButtonText]}>
{previousRoute.title}
</Text>
</TouchableOpacity>
);
},
RightButton: function(route, navigator, index, navState) {
return (
<TouchableOpacity
onPress={() => navigator.push(newRandomRoute())}
style={styles.navBarRightButton}>
<Text style={[styles.navBarText, styles.navBarButtonText]}>
Next
</Text>
</TouchableOpacity>
);
},
Title: function(route, navigator, index, navState) {
return (
<Text style={[styles.navBarText, styles.navBarTitleText]}>
{route.title} [{index}]
</Text>
);
},
};
function newRandomRoute() {
return {
title: '#' + Math.ceil(Math.random() * 1000),
};
}
var NavigationBarSample = React.createClass({
componentWillMount: function() {
var navigator = this.props.navigator;
var callback = (event) => {
console.log(
`NavigationBarSample : event ${event.type}`,
{
route: JSON.stringify(event.data.route),
target: event.target,
type: event.type,
}
);
};
// Observe focus change events from this component.
this._listeners = [
navigator.navigationContext.addListener('willfocus', callback),
navigator.navigationContext.addListener('didfocus', callback),
];
},
componentWillUnmount: function() {
this._listeners && this._listeners.forEach(listener => listener.remove());
},
render: function() {
return (
<Navigator
debugOverlay={false}
style={styles.appContainer}
initialRoute={newRandomRoute()}
renderScene={(route, navigator) => (
<ScrollView style={styles.scene}>
<Text style={styles.messageText}>{route.content}</Text>
<NavButton
onPress={() => {
navigator.immediatelyResetRouteStack([
newRandomRoute(),
newRandomRoute(),
newRandomRoute(),
]);
}}
text="Reset w/ 3 scenes"
/>
<NavButton
onPress={() => {
this.props.navigator.pop();
}}
text="Exit NavigationBar Example"
/>
</ScrollView>
)}
navigationBar={
<Navigator.NavigationBar
routeMapper={NavigationBarRouteMapper}
style={styles.navBar}
/>
}
/>
);
},
});
var styles = StyleSheet.create({
messageText: {
fontSize: 17,
fontWeight: '500',
padding: 15,
marginTop: 50,
marginLeft: 15,
},
button: {
backgroundColor: 'white',
padding: 15,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#CDCDCD',
},
buttonText: {
fontSize: 17,
fontWeight: '500',
},
navBar: {
backgroundColor: 'white',
},
navBarText: {
fontSize: 16,
marginVertical: 10,
},
navBarTitleText: {
color: '#373E4D',
fontWeight: '500',
marginVertical: 9,
},
navBarLeftButton: {
paddingLeft: 10,
},
navBarRightButton: {
paddingRight: 10,
},
navBarButtonText: {
color: '#5890FF',
},
scene: {
flex: 1,
paddingTop: 20,
backgroundColor: '#EAEAEA',
},
});
module.exports = NavigationBarSample;
@@ -37,10 +37,9 @@ const {
Card: NavigationCard,
Header: NavigationHeader,
Reducer: NavigationReducer,
RootContainer: NavigationRootContainer,
} = NavigationExperimental;
const NavigationBasicReducer = NavigationReducer.StackReducer({
const ExampleReducer = NavigationReducer.StackReducer({
getPushedReducerForAction: (action) => {
if (action.type === 'push') {
return (state) => state || {key: action.key};
@@ -58,37 +57,41 @@ const NavigationBasicReducer = NavigationReducer.StackReducer({
});
class NavigationAnimatedExample extends React.Component {
constructor(props, context) {
super(props, context);
this.state = ExampleReducer();
}
componentWillMount() {
this._renderCard = this._renderCard.bind(this);
this._renderHeader = this._renderHeader.bind(this);
this._renderNavigation = this._renderNavigation.bind(this);
this._renderScene = this._renderScene.bind(this);
this._renderTitleComponent = this._renderTitleComponent.bind(this);
this._handleAction = this._handleAction.bind(this);
}
_handleAction(action): boolean {
if (!action) {
return false;
}
const newState = ExampleReducer(this.state, action);
if (newState === this.state) {
return false;
}
this.setState(newState);
return true;
}
handleBackAction(): boolean {
return this._handleAction({ type: 'BackAction', });
}
render() {
return (
<NavigationRootContainer
reducer={NavigationBasicReducer}
ref={navRootContainer => { this.navRootContainer = navRootContainer; }}
persistenceKey="NavigationAnimExampleState"
renderNavigation={this._renderNavigation}
/>
);
}
handleBackAction() {
return (
this.navRootContainer &&
this.navRootContainer.handleNavigation(NavigationRootContainer.getBackAction())
);
}
_renderNavigation(navigationState, onNavigate) {
if (!navigationState) {
return null;
}
return (
<NavigationAnimatedView
navigationState={navigationState}
navigationState={this.state}
style={styles.animatedView}
onNavigate={this._handleAction}
renderOverlay={this._renderHeader}
applyAnimation={(pos, navState) => {
Animated.timing(pos, {toValue: navState.index, duration: 500}).start();
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -22,12 +29,10 @@ const {
} = ReactNative;
const NavigationExampleRow = require('./NavigationExampleRow');
const {
RootContainer: NavigationRootContainer,
Reducer: NavigationReducer,
} = NavigationExperimental;
const StackReducer = NavigationReducer.StackReducer;
const NavigationBasicReducer = NavigationReducer.StackReducer({
const ExampleReducer = NavigationReducer.StackReducer({
getPushedReducerForAction: (action) => {
if (action.type === 'push') {
return (state) => state || {key: action.key};
@@ -45,47 +50,51 @@ const NavigationBasicReducer = NavigationReducer.StackReducer({
});
const NavigationBasicExample = React.createClass({
getInitialState: function() {
return ExampleReducer();
},
render: function() {
return (
<NavigationRootContainer
reducer={NavigationBasicReducer}
persistenceKey="NavigationBasicExampleState"
ref={navRootContainer => { this.navRootContainer = navRootContainer; }}
renderNavigation={(navState, onNavigate) => {
if (!navState) { return null; }
return (
<ScrollView style={styles.topView}>
<NavigationExampleRow
text={`Current page: ${navState.children[navState.index].key}`}
/>
<NavigationExampleRow
text={`Push page #${navState.children.length}`}
onPress={() => {
onNavigate({ type: 'push', key: 'page #' + navState.children.length });
}}
/>
<NavigationExampleRow
text="pop"
onPress={() => {
onNavigate(NavigationRootContainer.getBackAction());
}}
/>
<NavigationExampleRow
text="Exit Basic Nav Example"
onPress={this.props.onExampleExit}
/>
</ScrollView>
);
}}
/>
<ScrollView style={styles.topView}>
<NavigationExampleRow
text={`Current page: ${this.state.children[this.state.index].key}`}
/>
<NavigationExampleRow
text={`Push page #${this.state.children.length}`}
onPress={() => {
this._handleAction({ type: 'push', key: 'page #' + this.state.children.length });
}}
/>
<NavigationExampleRow
text="pop"
onPress={() => {
this._handleAction({ type: 'BackAction' });
}}
/>
<NavigationExampleRow
text="Exit Basic Nav Example"
onPress={this.props.onExampleExit}
/>
</ScrollView>
);
},
handleBackAction: function() {
return (
this.navRootContainer &&
this.navRootContainer.handleNavigation(NavigationRootContainer.getBackAction())
);
_handleAction(action) {
if (!action) {
return false;
}
const newState = ExampleReducer(this.state, action);
if (newState === this.state) {
return false;
}
this.setState(newState);
return true;
},
handleBackAction() {
return this._handleAction({ type: 'BackAction' });
},
});
@@ -33,18 +33,15 @@ const {
const {
CardStack: NavigationCardStack,
StateUtils: NavigationStateUtils,
RootContainer: NavigationRootContainer,
} = NavigationExperimental;
function createReducer(initialState) {
return (currentState, action) => {
return (currentState = initialState, action) => {
switch (action.type) {
case 'RootContainerInitialAction':
return initialState;
case 'push':
return NavigationStateUtils.push(currentState, {key: action.key});
case 'BackAction':
case 'back':
case 'pop':
return currentState.index > 0 ?
@@ -67,35 +64,46 @@ class NavigationCardStackExample extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {isHorizontal: true};
this.state = {
isHorizontal: true,
navState: ExampleReducer(undefined, {}),
};
}
componentWillMount() {
this._renderNavigation = this._renderNavigation.bind(this);
this._renderScene = this._renderScene.bind(this);
this._toggleDirection = this._toggleDirection.bind(this);
this._handleAction = this._handleAction.bind(this);
}
render() {
return (
<NavigationRootContainer
reducer={ExampleReducer}
renderNavigation={this._renderNavigation}
<NavigationCardStack
direction={this.state.isHorizontal ? 'horizontal' : 'vertical'}
navigationState={this.state.navState}
onNavigate={this._handleAction}
renderScene={this._renderScene}
style={styles.main}
/>
);
}
_renderNavigation(navigationState, onNavigate) {
return (
<NavigationCardStack
direction={this.state.isHorizontal ? 'horizontal' : 'vertical'}
navigationState={navigationState}
onNavigate={onNavigate}
renderScene={this._renderScene}
style={styles.main}
/>
);
_handleAction(action): boolean {
if (!action) {
return false;
}
const newState = ExampleReducer(this.state.navState, action);
if (newState === this.state.navState) {
return false;
}
this.setState({
navState: newState,
});
return true;
}
handleBackAction(): boolean {
return this._handleAction({ type: 'BackAction', });
}
_renderScene(/*NavigationSceneRendererProps*/ props) {
@@ -36,11 +36,8 @@ const {
const {
CardStack: NavigationCardStack,
Container: NavigationContainer,
Header: NavigationHeader,
Reducer: NavigationReducer,
RootContainer: NavigationRootContainer,
View: NavigationView,
} = NavigationExperimental;
@@ -177,6 +174,7 @@ class ExampleTabScreen extends React.Component {
<NavigationCardStack
style={styles.tabContent}
navigationState={this.props.navigationState}
onNavigate={this.props.onNavigate}
renderOverlay={this._renderHeader}
renderScene={this._renderScene}
/>
@@ -225,40 +223,42 @@ class ExampleTabScreen extends React.Component {
);
}
}
ExampleTabScreen = NavigationContainer.create(ExampleTabScreen);
class NavigationCompositionExample extends React.Component {
navRootContainer: NavigationRootContainer;
render() {
return (
<NavigationRootContainer
reducer={ExampleAppReducer}
persistenceKey="NavigationCompositionState"
ref={navRootContainer => { this.navRootContainer = navRootContainer; }}
renderNavigation={this.renderApp.bind(this)}
/>
);
state: NavigationParentState;
constructor() {
super();
this.state = ExampleAppReducer(undefined, {});
}
handleAction(action: Object): boolean {
if (!action) {
return false;
}
const newState = ExampleAppReducer(this.state, action);
if (newState === this.state) {
return false;
}
this.setState(newState);
return true;
}
handleBackAction(): boolean {
return (
this.navRootContainer &&
this.navRootContainer.handleNavigation(NavigationRootContainer.getBackAction())
);
return this.handleAction({ type: 'BackAction' });
}
renderApp(navigationState: NavigationParentState, onNavigate: Function) {
if (!navigationState) {
render() {
if (!this.state) {
return null;
}
return (
<View style={styles.topView}>
<ExampleMainView
navigationState={navigationState}
navigationState={this.state}
onExampleExit={this.props.onExampleExit}
onNavigate={this.handleAction.bind(this)}
/>
<NavigationExampleTabBar
tabs={navigationState.children}
index={navigationState.index}
tabs={this.state.children}
index={this.state.index}
onNavigate={this.handleAction.bind(this)}
/>
</View>
);
@@ -266,34 +266,35 @@ class NavigationCompositionExample extends React.Component {
}
class ExampleMainView extends React.Component {
_renderScene: NavigationSceneRenderer;
_renderScene: Function;
_handleNavigation: Function;
componentWillMount() {
this._renderScene = this._renderScene.bind(this);
this._handleNavigation = this._handleNavigation.bind(this);
}
render() {
return (
<NavigationView
navigationState={this.props.navigationState}
style={styles.tabsContent}
renderScene={this._renderScene}
/>
<View style={styles.tabsContent}>
{this._renderScene()}
</View>
);
}
_renderScene(props: NavigationSceneRendererProps): ReactElement {
const {scene} = props;
_renderScene(): ReactElement {
const {navigationState} = this.props;
const childState = navigationState.children[navigationState.index];
return (
<ExampleTabScreen
key={'tab_screen' + scene.key}
navigationState={scene.navigationState}
onNavigate={this._handleNavigation.bind(this, scene.key)}
key={'tab_screen' + childState.key}
navigationState={childState}
onNavigate={this._handleNavigation}
/>
);
}
_handleNavigation(tabKey, action) {
_handleNavigation(action: Object) {
if (ExampleExitAction.match(action)) {
this.props.onExampleExit();
return;
@@ -302,8 +303,6 @@ class ExampleMainView extends React.Component {
}
}
ExampleMainView = NavigationContainer.create(ExampleMainView);
const styles = StyleSheet.create({
topView: {
flex: 1,
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -13,24 +20,20 @@
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
NavigationExperimental,
StyleSheet,
Text,
TouchableOpacity,
View,
} = ReactNative;
const NavigationExperimental = require('NavigationExperimental');
const React = require('react');
const StyleSheet = require('StyleSheet');
const Text = require('Text');
const TouchableOpacity = require('TouchableOpacity');
const View = require('View');
const {
Container: NavigationContainer,
Reducer: NavigationReducer,
} = NavigationExperimental;
const {
JumpToAction,
} = NavigationReducer.TabsReducer;
var NavigationExampleTabBar = React.createClass({
const NavigationExampleTabBar = React.createClass({
render: function() {
return (
<View style={styles.tabBar}>
@@ -39,7 +42,7 @@ var NavigationExampleTabBar = React.createClass({
);
},
_renderTab: function(tab, index) {
var textStyle = [styles.tabButtonText];
const textStyle = [styles.tabButtonText];
if (this.props.index === index) {
textStyle.push(styles.selectedTabButtonText);
}
@@ -58,8 +61,6 @@ var NavigationExampleTabBar = React.createClass({
},
});
NavigationExampleTabBar = NavigationContainer.create(NavigationExampleTabBar);
const styles = StyleSheet.create({
tabBar: {
height: 50,
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -13,22 +20,19 @@
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
AsyncStorage,
ScrollView,
StyleSheet,
View,
} = ReactNative;
var NavigationExampleRow = require('./NavigationExampleRow');
const AsyncStorage = require('AsyncStorage');
const NavigationExampleRow = require('./NavigationExampleRow');
const React = require('react');
const ScrollView = require('ScrollView');
const StyleSheet = require('StyleSheet');
const View = require('View');
/*
* Heads up! This file is not the real navigation example- only a utility to switch between them.
*
* To learn how to use the Navigation API, take a look at the following example files:
*/
var EXAMPLES = {
const EXAMPLES = {
'Tabs': require('./NavigationTabsExample'),
'Basic': require('./NavigationBasicExample'),
'Animated Example': require('./NavigationAnimatedExample'),
@@ -37,9 +41,9 @@ var EXAMPLES = {
'Tic Tac Toe': require('./NavigationTicTacToeExample'),
};
var EXAMPLE_STORAGE_KEY = 'NavigationExperimentalExample';
const EXAMPLE_STORAGE_KEY = 'NavigationExperimentalExample';
var NavigationExperimentalExample = React.createClass({
const NavigationExperimentalExample = React.createClass({
statics: {
title: 'Navigation (Experimental)',
description: 'Upcoming navigation APIs and animated navigation views',
@@ -74,7 +78,7 @@ var NavigationExperimentalExample = React.createClass({
},
_renderMenu: function() {
var exitRow = null;
let exitRow = null;
if (this.props.onExampleExit) {
exitRow = (
<NavigationExampleRow
@@ -130,7 +134,7 @@ var NavigationExperimentalExample = React.createClass({
return this._renderMenu();
}
if (EXAMPLES[this.state.example]) {
var Component = EXAMPLES[this.state.example];
const Component = EXAMPLES[this.state.example];
return (
<Component
onExampleExit={this._exitInnerExample}
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -22,8 +29,6 @@ const {
View,
} = ReactNative;
const {
Container: NavigationContainer,
RootContainer: NavigationRootContainer,
Reducer: NavigationReducer,
} = NavigationExperimental;
@@ -55,7 +60,6 @@ class ExmpleTabPage extends React.Component {
);
}
}
ExmpleTabPage = NavigationContainer.create(ExmpleTabPage);
const ExampleTabsReducer = NavigationReducer.TabsReducer({
tabReducers: [
@@ -66,36 +70,40 @@ const ExampleTabsReducer = NavigationReducer.TabsReducer({
});
class NavigationTabsExample extends React.Component {
constructor() {
super();
this.state = ExampleTabsReducer(undefined, {});
}
render() {
return (
<NavigationRootContainer
reducer={ExampleTabsReducer}
persistenceKey="NAV_EXAMPLE_STATE_TABS"
ref={navRootContainer => { this.navRootContainer = navRootContainer; }}
renderNavigation={(navigationState) => {
if (!navigationState) { return null; }
return (
<View style={styles.topView}>
<ExmpleTabPage
tabs={navigationState.children}
index={navigationState.index}
onExampleExit={this.props.onExampleExit}
/>
<NavigationExampleTabBar
tabs={navigationState.children}
index={navigationState.index}
/>
</View>
);
}}
/>
<View style={styles.topView}>
<ExmpleTabPage
tabs={this.state.children}
index={this.state.index}
onExampleExit={this.props.onExampleExit}
onNavigate={this.handleAction.bind(this)}
/>
<NavigationExampleTabBar
tabs={this.state.children}
index={this.state.index}
onNavigate={this.handleAction.bind(this)}
/>
</View>
);
}
handleAction(action) {
if (!action) {
return false;
}
const newState = ExampleTabsReducer(this.state, action);
if (newState === this.state) {
return false;
}
this.setState(newState);
return true;
}
handleBackAction() {
return (
this.navRootContainer &&
this.navRootContainer.handleNavigation(NavigationRootContainer.getBackAction())
);
return this.handleAction({ type: 'BackAction' });
}
}
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -16,19 +23,11 @@
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
NavigationExperimental,
StyleSheet,
Text,
TouchableHighlight,
View,
} = ReactNative;
const {
Container: NavigationContainer,
RootContainer: NavigationRootContainer,
} = NavigationExperimental;
const React = require('react');
const StyleSheet = require('StyleSheet');
const Text = require('Text');
const TouchableHighlight = require('TouchableHighlight');
const View = require('View');
type GameGrid = Array<Array<?string>>;
@@ -41,7 +40,7 @@ function parseGame(game: string): GameGrid {
for (let i = 0; i < 3; i++) {
const row = Array(3);
for (let j = 0; j < 3; j++) {
const turnIndex = gameTurns.indexOf(rowLetterMap[i]+j);
const turnIndex = gameTurns.indexOf(rowLetterMap[i] + j);
if (turnIndex === -1) {
row[j] = null;
} else {
@@ -60,13 +59,13 @@ function playTurn(game: string, row: number, col: number): string {
function getWinner(gameString: string): ?string {
const game = parseGame(gameString);
for (var i = 0; i < 3; i++) {
for (let i = 0; i < 3; i++) {
if (game[i][0] !== null && game[i][0] === game[i][1] &&
game[i][0] === game[i][2]) {
return game[i][0];
}
}
for (var i = 0; i < 3; i++) {
for (let i = 0; i < 3; i++) {
if (game[0][i] !== null && game[0][i] === game[1][i] &&
game[0][i] === game[2][i]) {
return game[0][i];
@@ -88,8 +87,8 @@ function isGameOver(gameString: string): boolean {
return true;
}
const game = parseGame(gameString);
for (var i = 0; i < 3; i++) {
for (var j = 0; j < 3; j++) {
for (let i = 0; i < 3; i++) {
for (let j = 0; j < 3; j++) {
if (game[i][j] === null) {
return false;
}
@@ -157,10 +156,9 @@ function GameEndOverlay(props) {
</View>
);
}
GameEndOverlay = NavigationContainer.create(GameEndOverlay);
function TicTacToeGame(props) {
var rows = parseGame(props.game).map((cells, row) =>
const rows = parseGame(props.game).map((cells, row) =>
<View key={'row' + row} style={styles.row}>
{cells.map((player, col) =>
<Cell
@@ -184,11 +182,11 @@ function TicTacToeGame(props) {
</View>
<GameEndOverlay
game={props.game}
onNavigate={props.onNavigate}
/>
</View>
);
}
TicTacToeGame = NavigationContainer.create(TicTacToeGame);
const GameActions = {
Turn: (row, col) => ({type: 'TicTacToeTurnAction', row, col }),
@@ -208,21 +206,34 @@ function GameReducer(lastGame: ?string, action: Object): string {
return lastGame;
}
type AppState = {
game: string,
};
class NavigationTicTacToeExample extends React.Component {
static GameView = TicTacToeGame;
static GameReducer = GameReducer;
static GameActions = GameActions;
_handleAction: Function;
state: AppState;
constructor() {
super();
this._handleAction = this._handleAction.bind(this);
this.state = {
game: ''
};
}
_handleAction(action: Object) {
const newState = GameReducer(this.state.game, action);
if (newState !== this.state.game) {
this.setState({
game: newState,
});
}
}
render() {
return (
<NavigationRootContainer
reducer={GameReducer}
persistenceKey="TicTacToeGameState"
renderNavigation={(game) => (
<TicTacToeGame
game={game}
onExampleExit={this.props.onExampleExit}
/>
)}
<TicTacToeGame
game={this.state && this.state.game}
onExampleExit={this.props.onExampleExit}
onNavigate={this._handleAction}
/>
);
}
@@ -43,11 +43,17 @@ var Button = React.createClass({
class NotificationExample extends React.Component {
componentWillMount() {
// Add listener for push notifications
PushNotificationIOS.addEventListener('notification', this._onNotification);
// Add listener for local notifications
PushNotificationIOS.addEventListener('localNotification', this._onLocalNotification);
}
componentWillUnmount() {
// Remove listener for push notifications
PushNotificationIOS.removeEventListener('notification', this._onNotification);
// Remove listener for local notifications
PushNotificationIOS.removeEventListener('localNotification', this._onLocalNotification);
}
render() {
@@ -57,6 +63,11 @@ class NotificationExample extends React.Component {
onPress={this._sendNotification}
label="Send fake notification"
/>
<Button
onPress={this._sendLocalNotification}
label="Send fake local notification"
/>
</View>
);
}
@@ -72,9 +83,31 @@ class NotificationExample extends React.Component {
});
}
_sendLocalNotification() {
require('RCTDeviceEventEmitter').emit('localNotificationReceived', {
aps: {
alert: 'Sample local notification',
badge: '+1',
sound: 'default',
category: 'REACT_NATIVE'
},
});
}
_onNotification(notification) {
AlertIOS.alert(
'Notification Received',
'Push Notification Received',
'Alert message: ' + notification.getMessage(),
[{
text: 'Dismiss',
onPress: null,
}]
);
}
_onLocalNotification(notification){
AlertIOS.alert(
'Local Notification Received',
'Alert message: ' + notification.getMessage(),
[{
text: 'Dismiss',
+2
View File
@@ -54,6 +54,7 @@ var TabBarExample = React.createClass({
render: function() {
return (
<TabBarIOS
unselectedTintColor="yellow"
tintColor="white"
barTintColor="darkslateblue">
<TabBarIOS.Item
@@ -81,6 +82,7 @@ var TabBarExample = React.createClass({
</TabBarIOS.Item>
<TabBarIOS.Item
icon={require('./flux.png')}
renderAsOriginal
title="More"
selected={this.state.selectedTab === 'greenTab'}
onPress={() => {
+15 -7
View File
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -155,19 +162,19 @@ exports.examples = [
render: function() {
return (
<View>
<Text style={{fontWeight: '100'}}>
<Text style={{fontSize: 20, fontWeight: '100'}}>
Move fast and be ultralight
</Text>
<Text style={{fontWeight: '200'}}>
<Text style={{fontSize: 20, fontWeight: '200'}}>
Move fast and be light
</Text>
<Text style={{fontWeight: 'normal'}}>
<Text style={{fontSize: 20, fontWeight: 'normal'}}>
Move fast and be normal
</Text>
<Text style={{fontWeight: 'bold'}}>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>
Move fast and be bold
</Text>
<Text style={{fontWeight: '900'}}>
<Text style={{fontSize: 20, fontWeight: '900'}}>
Move fast and be ultrabold
</Text>
</View>
@@ -415,12 +422,13 @@ exports.examples = [
);
},
}, {
title: 'Inline images',
title: 'Inline views',
render: function() {
return (
<View>
<Text>
This text contains an inline image <Image source={require('./flux.png')} style={{width: 30, height: 11, resizeMode: 'cover'}}/>. Neat, huh?
This text contains an inline blue view <View style={{width: 25, height: 25, backgroundColor: 'steelblue'}} /> and
an inline image <Image source={require('./flux.png')} style={{width: 30, height: 11, resizeMode: 'cover'}}/>. Neat, huh?
</Text>
</View>
);
@@ -407,6 +407,31 @@ exports.examples = [
);
}
},
{
title: 'fontFamily, fontWeight and fontStyle',
render: function() {
return (
<View>
<TextInput
style={[styles.singleLine, {fontFamily: 'sans-serif'}]}
placeholder="Custom fonts like Sans-Serif are supported"
/>
<TextInput
style={[styles.singleLine, {fontFamily: 'sans-serif', fontWeight: 'bold'}]}
placeholder="Sans-Serif bold"
/>
<TextInput
style={[styles.singleLine, {fontFamily: 'sans-serif', fontStyle: 'italic'}]}
placeholder="Sans-Serif italic"
/>
<TextInput
style={[styles.singleLine, {fontFamily: 'serif'}]}
placeholder="Serif"
/>
</View>
);
}
},
{
title: 'Passwords',
render: function() {
@@ -506,4 +531,43 @@ exports.examples = [
return <TokenizedTextExample />;
}
},
{
title: 'Return key',
render: function() {
var returnKeyTypes = [
'none',
'go',
'search',
'send',
'done',
'previous',
'next',
];
var returnKeyLabels = [
'Compile',
'React Native',
];
var examples = returnKeyTypes.map((type) => {
return (
<TextInput
key={type}
returnKeyType={type}
placeholder={'returnKeyType: ' + type}
style={styles.singleLine}
/>
);
});
var types = returnKeyLabels.map((type) => {
return (
<TextInput
key={type}
returnKeyLabel={type}
placeholder={'returnKeyLabel: ' + type}
style={styles.singleLine}
/>
);
});
return <View>{examples}{types}</View>;
}
},
];
@@ -955,10 +955,6 @@
004D28A61AAF61C70097A701 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
HEADER_SEARCH_PATHS = (
"$(inherited)",
@@ -972,12 +968,6 @@
"$(inherited)",
"$(PROJECT_DIR)/UIExplorerUnitTests",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
XCTest,
"-ObjC",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
@@ -986,10 +976,6 @@
004D28A71AAF61C70097A701 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../../React/**",
@@ -1002,12 +988,6 @@
"$(inherited)",
"$(PROJECT_DIR)/UIExplorerUnitTests",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
XCTest,
"-ObjC",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
@@ -1027,7 +1007,6 @@
INFOPLIST_FILE = "$(SRCROOT)/UIExplorer/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp;
PRODUCT_NAME = UIExplorer;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -1053,7 +1032,6 @@
INFOPLIST_FILE = "$(SRCROOT)/UIExplorer/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp;
PRODUCT_NAME = UIExplorer;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -1071,10 +1049,6 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@@ -1083,12 +1057,6 @@
INFOPLIST_FILE = UIExplorerIntegrationTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
XCTest,
"-ObjC",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.React.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIExplorer.app/UIExplorer";
@@ -1101,20 +1069,10 @@
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = UIExplorerIntegrationTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
XCTest,
"-ObjC",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.React.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIExplorer.app/UIExplorer";
@@ -1178,6 +1136,10 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
);
SDKROOT = iphoneos;
WARNING_CFLAGS = (
"-Wextra",
@@ -1236,6 +1198,10 @@
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
);
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
+8 -3
View File
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -25,9 +32,7 @@ export type UIExplorerExampleAction = {
openExample: string;
};
import type {BackAction} from 'NavigationRootContainer';
export type UIExplorerAction = BackAction | UIExplorerListWithFilterAction | UIExplorerExampleAction;
export type UIExplorerAction = UIExplorerListWithFilterAction | UIExplorerExampleAction;
function ExampleListWithFilter(filter: ?string): UIExplorerListWithFilterAction {
return {
+66 -68
View File
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -16,29 +23,24 @@
*/
'use strict';
const AppRegistry = require('AppRegistry');
const AsyncStorage = require('AsyncStorage');
const BackAndroid = require('BackAndroid');
const Dimensions = require('Dimensions');
const DrawerLayoutAndroid = require('DrawerLayoutAndroid');
const Linking = require('Linking');
const React = require('react');
const ReactNative = require('react-native');
const {
AppRegistry,
BackAndroid,
Dimensions,
DrawerLayoutAndroid,
NavigationExperimental,
StyleSheet,
ToolbarAndroid,
View,
StatusBar,
} = ReactNative;
const {
RootContainer: NavigationRootContainer,
} = NavigationExperimental;
const StatusBar = require('StatusBar');
const StyleSheet = require('StyleSheet');
const ToolbarAndroid = require('ToolbarAndroid');
const UIExplorerExampleList = require('./UIExplorerExampleList');
const UIExplorerList = require('./UIExplorerList');
const UIExplorerNavigationReducer = require('./UIExplorerNavigationReducer');
const UIExplorerStateTitleMap = require('./UIExplorerStateTitleMap');
const URIActionMap = require('./URIActionMap');
const View = require('View');
var DRAWER_WIDTH_LEFT = 56;
const DRAWER_WIDTH_LEFT = 56;
type Props = {
exampleFromAppetizeParams: string,
@@ -49,14 +51,13 @@ type State = {
};
class UIExplorerApp extends React.Component {
_handleOpenInitialExample: Function;
_handleAction: Function;
_renderDrawerContent: Function;
state: State;
constructor(props: Props) {
super(props);
this._handleOpenInitialExample = this._handleOpenInitialExample.bind(this);
this.state = {
initialExampleUri: props.exampleFromAppetizeParams,
};
this._handleAction = this._handleAction.bind(this);
this._renderDrawerContent = this._renderDrawerContent.bind(this);
}
componentWillMount() {
@@ -64,38 +65,28 @@ class UIExplorerApp extends React.Component {
}
componentDidMount() {
// There's a race condition if we try to navigate to the specified example
// from the initial props at the same time the navigation logic is setting
// up the initial navigation state. This hack adds a delay to avoid this
// scenario. So after the initial example list is shown, we then transition
// to the initial example.
setTimeout(this._handleOpenInitialExample, 500);
Linking.getInitialURL().then((url) => {
AsyncStorage.getItem('UIExplorerAppState', (err, storedString) => {
const exampleAction = URIActionMap(this.props.exampleFromAppetizeParams);
const urlAction = URIActionMap(url);
const launchAction = exampleAction || urlAction;
if (err || !storedString) {
const initialAction = launchAction || {type: 'InitialAction'};
this.setState(UIExplorerNavigationReducer(null, initialAction));
return;
}
const storedState = JSON.parse(storedString);
if (launchAction) {
this.setState(UIExplorerNavigationReducer(storedState, launchAction));
return;
}
this.setState(storedState);
});
});
}
render() {
return (
<NavigationRootContainer
persistenceKey="UIExplorerStateNavState"
ref={navRootRef => { this._navigationRootRef = navRootRef; }}
reducer={UIExplorerNavigationReducer}
renderNavigation={this._renderApp.bind(this)}
linkingActionMap={URIActionMap}
/>
);
}
_handleOpenInitialExample() {
if (this.state.initialExampleUri) {
const exampleAction = URIActionMap(this.state.initialExampleUri);
if (exampleAction && this._navigationRootRef) {
this._navigationRootRef.handleNavigation(exampleAction);
}
}
this.setState({initialExampleUri: null});
}
_renderApp(navigationState, onNavigate) {
if (!navigationState) {
if (!this.state) {
return null;
}
return (
@@ -110,42 +101,42 @@ class UIExplorerApp extends React.Component {
this._overrideBackPressForDrawerLayout = false;
}}
ref={(drawer) => { this.drawer = drawer; }}
renderNavigationView={this._renderDrawerContent.bind(this, onNavigate)}
renderNavigationView={this._renderDrawerContent}
statusBarBackgroundColor="#589c90">
{this._renderNavigation(navigationState, onNavigate)}
{this._renderApp()}
</DrawerLayoutAndroid>
);
}
_renderDrawerContent(onNavigate) {
_renderDrawerContent() {
return (
<View style={styles.drawerContentWrapper}>
<UIExplorerExampleList
list={UIExplorerList}
displayTitleRow={true}
disableSearch={true}
onNavigate={(action) => {
this.drawer && this.drawer.closeDrawer();
onNavigate(action);
}}
onNavigate={this._handleAction}
/>
</View>
);
}
_renderNavigation(navigationState, onNavigate) {
if (navigationState.externalExample) {
var Component = UIExplorerList.Modules[navigationState.externalExample];
_renderApp() {
const {
externalExample,
stack,
} = this.state;
if (externalExample) {
const Component = UIExplorerList.Modules[externalExample];
return (
<Component
onExampleExit={() => {
onNavigate(NavigationRootContainer.getBackAction());
this._handleAction({ type: 'BackAction' });
}}
ref={(example) => { this._exampleRef = example; }}
/>
);
}
const {stack} = navigationState;
const title = UIExplorerStateTitleMap(stack.children[stack.index]);
const index = stack.children.length <= 1 ? 1 : stack.index;
@@ -178,6 +169,7 @@ class UIExplorerApp extends React.Component {
title={title}
/>
<UIExplorerExampleList
onNavigate={this._handleAction}
list={UIExplorerList}
{...stack.children[0]}
/>
@@ -185,6 +177,17 @@ class UIExplorerApp extends React.Component {
);
}
_handleAction(action: Object): boolean {
this.drawer && this.drawer.closeDrawer();
const newState = UIExplorerNavigationReducer(this.state, action);
if (this.state !== newState) {
this.setState(newState);
AsyncStorage.setItem('UIExplorerAppState', JSON.stringify(this.state));
return true;
}
return false;
}
_handleBackButtonPress() {
if (this._overrideBackPressForDrawerLayout) {
// This hack is necessary because drawer layout provides an imperative API
@@ -200,12 +203,7 @@ class UIExplorerApp extends React.Component {
) {
return true;
}
if (this._navigationRootRef) {
return this._navigationRootRef.handleNavigation(
NavigationRootContainer.getBackAction()
);
}
return false;
return this._handleAction({ type: 'BackAction' });
}
}
+51 -44
View File
@@ -23,6 +23,8 @@
*/
'use strict';
const AsyncStorage = require('AsyncStorage');
const Linking = require('Linking');
const React = require('react');
const ReactNative = require('react-native');
const UIExplorerList = require('./UIExplorerList.ios');
@@ -42,7 +44,6 @@ const {
const {
CardStack: NavigationCardStack,
Header: NavigationHeader,
RootContainer: NavigationRootContainer,
} = NavigationExperimental;
import type { NavigationSceneRendererProps } from 'NavigationTypeDefinition';
@@ -55,81 +56,86 @@ type Props = {
exampleFromAppetizeParams: string,
};
type State = {
initialExampleUri: ?string,
type State = UIExplorerNavigationState & {
externalExample?: string,
};
class UIExplorerApp extends React.Component {
_navigationRootRef: ?NavigationRootContainer;
_renderNavigation: Function;
_renderOverlay: Function;
_renderScene: Function;
_renderCard: Function;
_renderTitleComponent: Function;
_handleOpenInitialExample: Function;
_handleAction: Function;
state: State;
constructor(props: Props) {
super(props);
this._handleOpenInitialExample = this._handleOpenInitialExample.bind(this);
this.state = {
initialExampleUri: props.exampleFromAppetizeParams,
};
}
componentWillMount() {
this._renderNavigation = this._renderNavigation.bind(this);
this._handleAction = this._handleAction.bind(this);
this._renderOverlay = this._renderOverlay.bind(this);
this._renderScene = this._renderScene.bind(this);
this._renderTitleComponent = this._renderTitleComponent.bind(this);
}
componentDidMount() {
// There's a race condition if we try to navigate to the specified example
// from the initial props at the same time the navigation logic is setting
// up the initial navigation state. This hack adds a delay to avoid this
// scenario. So after the initial example list is shown, we then transition
// to the initial example.
setTimeout(this._handleOpenInitialExample, 500);
Linking.getInitialURL().then((url) => {
AsyncStorage.getItem('UIExplorerAppState', (err, storedString) => {
const exampleAction = URIActionMap(this.props.exampleFromAppetizeParams);
const urlAction = URIActionMap(url);
const launchAction = exampleAction || urlAction;
if (err || !storedString) {
const initialAction = launchAction || {type: 'InitialAction'};
this.setState(UIExplorerNavigationReducer(null, initialAction));
return;
}
const storedState = JSON.parse(storedString);
if (launchAction) {
this.setState(UIExplorerNavigationReducer(storedState, launchAction));
return;
}
this.setState(storedState);
});
});
Linking.addEventListener('url', (url) => {
this._handleAction(URIActionMap(url));
});
}
render() {
return (
<NavigationRootContainer
persistenceKey="UIExplorerState"
reducer={UIExplorerNavigationReducer}
ref={navRootRef => { this._navigationRootRef = navRootRef; }}
renderNavigation={this._renderNavigation}
linkingActionMap={URIActionMap}
/>
);
}
_handleOpenInitialExample() {
if (this.state.initialExampleUri) {
const exampleAction = URIActionMap(this.state.initialExampleUri);
if (exampleAction && this._navigationRootRef) {
this._navigationRootRef.handleNavigation(exampleAction);
}
_handleAction(action: Object) {
if (!action) {
return;
}
const newState = UIExplorerNavigationReducer(this.state, action);
if (this.state !== newState) {
this.setState(newState);
AsyncStorage.setItem('UIExplorerAppState', JSON.stringify(this.state));
}
this.setState({initialExampleUri: null});
}
_renderNavigation(navigationState: UIExplorerNavigationState, onNavigate: Function) {
if (!navigationState) {
render() {
if (!this.state) {
return null;
}
if (navigationState.externalExample) {
var Component = UIExplorerList.Modules[navigationState.externalExample];
if (this.state.externalExample) {
const Component = UIExplorerList.Modules[this.state.externalExample];
return (
<Component
onExampleExit={() => {
onNavigate(NavigationRootContainer.getBackAction());
this._handleAction({ type: 'BackAction' });
}}
/>
);
}
const {stack} = navigationState;
return (
<NavigationCardStack
navigationState={stack}
navigationState={this.state.stack}
style={styles.container}
renderOverlay={this._renderOverlay}
renderScene={this._renderScene}
onNavigate={this._handleAction}
/>
);
}
@@ -156,6 +162,7 @@ class UIExplorerApp extends React.Component {
if (state.key === 'AppList') {
return (
<UIExplorerExampleList
onNavigate={this._handleAction}
list={UIExplorerList}
style={styles.exampleContainer}
{...state}
@@ -194,9 +201,9 @@ AppRegistry.registerComponent('UIExplorerApp', () => UIExplorerApp);
UIExplorerList.ComponentExamples.concat(UIExplorerList.APIExamples).forEach((Example: UIExplorerExample) => {
const ExampleModule = Example.module;
if (ExampleModule.displayName) {
var Snapshotter = React.createClass({
const Snapshotter = React.createClass({
render: function() {
var Renderable = UIExplorerExampleList.makeRenderable(ExampleModule);
const Renderable = UIExplorerExampleList.makeRenderable(ExampleModule);
return (
<SnapshotViewIOS>
<Renderable />
+24 -25
View File
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -15,26 +22,20 @@
*/
'use strict';
const ListView = require('ListView');
const React = require('react');
const ReactNative = require('react-native');
const StyleSheet = require('StyleSheet');
const Text = require('Text');
const TextInput = require('TextInput');
const TouchableHighlight = require('TouchableHighlight');
const View = require('View');
const UIExplorerActions = require('./UIExplorerActions');
const {
ListView,
NavigationExperimental,
StyleSheet,
Text,
TextInput,
TouchableHighlight,
View,
} = ReactNative;
const createExamplePage = require('./createExamplePage');
const {
Container: NavigationContainer,
} = NavigationExperimental;
import type {
UIExplorerExample,
} from './UIExplorerList.ios'
} from './UIExplorerList.ios';
const ds = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2,
@@ -54,6 +55,13 @@ class UIExplorerExampleList extends React.Component {
}) {
}
static makeRenderable(example: any): ReactClass<any> {
return example.examples ?
createExamplePage(null, example) :
example;
}
render(): ?ReactElement {
const filterText = this.props.filter || '';
const filterRegex = new RegExp(String(filterText), 'i');
@@ -154,20 +162,11 @@ class UIExplorerExampleList extends React.Component {
}
_handleRowPress(exampleKey: string): void {
this.props.onNavigate(UIExplorerActions.ExampleAction(exampleKey))
this.props.onNavigate(UIExplorerActions.ExampleAction(exampleKey));
}
}
function makeRenderable(example: any): ReactClass<any> {
return example.examples ?
createExamplePage(null, example) :
example;
}
UIExplorerExampleList = NavigationContainer.create(UIExplorerExampleList);
UIExplorerExampleList.makeRenderable = makeRenderable;
var styles = StyleSheet.create({
const styles = StyleSheet.create({
listContainer: {
flex: 1,
},
@@ -138,12 +138,6 @@ static ControlBlock propertiesUpdateBlock()
- (void)setUp
{
#if __LP64__
RCTAssert(NO, @"Tests should be run on 32-bit device simulators (e.g. iPhone 5)");
#endif
NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion;
RCTAssert((version.majorVersion == 8 && version.minorVersion >= 3) || version.majorVersion >= 9, @"Tests should be run on iOS 8.3+, found %zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion);
_runner = RCTInitRunnerForApp(@"IntegrationTests/RCTRootViewIntegrationTestApp", nil);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 KiB

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 153 KiB

@@ -31,12 +31,6 @@
- (void)setUp
{
#if __LP64__
RCTAssert(NO, @"Tests should be run on 32-bit device simulators (e.g. iPhone 5)");
#endif
NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion;
RCTAssert((version.majorVersion == 8 && version.minorVersion >= 3) || version.majorVersion >= 9, @"Tests should be run on iOS 8.3+, found %zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion);
_runner = RCTInitRunnerForApp(@"IntegrationTests/IntegrationTestsApp", nil);
}
@@ -32,12 +32,6 @@
- (void)setUp
{
#if __LP64__
RCTAssert(NO, @"Tests should be run on 32-bit device simulators (e.g. iPhone 5)");
#endif
NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion;
RCTAssert((version.majorVersion == 8 && version.minorVersion >= 3) || version.majorVersion >= 9, @"Tests should be run on iOS 8.3+, found %zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion);
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerApp.ios", nil);
_runner.recordMode = NO;
}
+10 -2
View File
@@ -40,8 +40,8 @@ var ComponentExamples: Array<UIExplorerExample> = [
module: require('./ModalExample'),
},
{
key: 'PickerAndroidExample',
module: require('./PickerAndroidExample'),
key: 'PickerExample',
module: require('./PickerExample'),
},
{
key: 'ProgressBarAndroidExample',
@@ -138,6 +138,10 @@ const APIExamples = [
key: 'LinkingExample',
module: require('./LinkingExample'),
},
{
key: 'LayoutAnimationExample',
module: require('./LayoutAnimationExample'),
},
{
key: 'LayoutExample',
module: require('./LayoutExample'),
@@ -174,6 +178,10 @@ const APIExamples = [
key: 'VibrationExample',
module: require('./VibrationExample'),
},
{
key: 'WebSocketExample',
module: require('./WebSocketExample'),
},
{
key: 'XHRExample',
module: require('./XHRExample'),
+25 -6
View File
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -20,7 +27,7 @@ export type UIExplorerExample = {
module: Object;
};
var ComponentExamples: Array<UIExplorerExample> = [
const ComponentExamples: Array<UIExplorerExample> = [
{
key: 'ActivityIndicatorIOSExample',
module: require('./ActivityIndicatorIOSExample'),
@@ -69,6 +76,10 @@ var ComponentExamples: Array<UIExplorerExample> = [
key: 'NavigatorIOSExample',
module: require('./NavigatorIOSExample'),
},
{
key: 'PickerExample',
module: require('./PickerExample'),
},
{
key: 'PickerIOSExample',
module: require('./PickerIOSExample'),
@@ -131,7 +142,7 @@ var ComponentExamples: Array<UIExplorerExample> = [
},
];
var APIExamples: Array<UIExplorerExample> = [
const APIExamples: Array<UIExplorerExample> = [
{
key: 'AccessibilityIOSExample',
module: require('./AccessibilityIOSExample'),
@@ -144,6 +155,10 @@ var APIExamples: Array<UIExplorerExample> = [
key: 'AdSupportIOSExample',
module: require('./AdSupportIOSExample'),
},
{
key: 'AlertExample',
module: require('./AlertExample').AlertExample,
},
{
key: 'AlertIOSExample',
module: require('./AlertIOSExample'),
@@ -192,6 +207,10 @@ var APIExamples: Array<UIExplorerExample> = [
key: 'ImageEditingExample',
module: require('./ImageEditingExample'),
},
{
key: 'LayoutAnimationExample',
module: require('./LayoutAnimationExample'),
},
{
key: 'LayoutExample',
module: require('./LayoutExample'),
@@ -204,10 +223,6 @@ var APIExamples: Array<UIExplorerExample> = [
key: 'NavigationExperimentalExample',
module: require('./NavigationExperimental/NavigationExperimentalExample'),
},
{
key: 'NavigationExperimentalLegacyNavigatorExample',
module: require('./NavigationExperimental/LegacyNavigator/LegacyNavigatorExample'),
},
{
key: 'NetInfoExample',
module: require('./NetInfoExample'),
@@ -248,6 +263,10 @@ var APIExamples: Array<UIExplorerExample> = [
key: 'VibrationExample',
module: require('./VibrationExample'),
},
{
key: 'WebSocketExample',
module: require('./WebSocketExample'),
},
{
key: 'XHRExample',
module: require('./XHRExample.ios'),
@@ -133,52 +133,4 @@ RCTAssertEqualSizes(a.size, b.size); \
RCTAssertEqualRects(expected, result);
}
- (void)testPlaceholderImage
{
CGSize size = {45, 22};
CGFloat expectedScale = 1.0;
UIImage *image = RCTGetPlaceholderImage(size, nil);
RCTAssertEqualSizes(size, image.size);
XCTAssertEqual(expectedScale, image.scale);
}
- (void)testPlaceholderNonintegralSize
{
CGSize size = {3.0/2, 7.0/3};
CGFloat expectedScale = 6;
CGSize pixelSize = {
round(size.width * expectedScale),
round(size.height * expectedScale)
};
UIImage *image = RCTGetPlaceholderImage(size, nil);
RCTAssertEqualSizes(size, image.size);
XCTAssertEqual(pixelSize.width, CGImageGetWidth(image.CGImage));
XCTAssertEqual(pixelSize.height, CGImageGetHeight(image.CGImage));
XCTAssertEqual(expectedScale, image.scale);
}
- (void)testPlaceholderSquareImage
{
CGSize size = {333, 333};
CGFloat expectedScale = 1.0/333;
CGSize pixelSize = {1, 1};
UIImage *image = RCTGetPlaceholderImage(size, nil);
RCTAssertEqualSizes(size, image.size);
XCTAssertEqual(pixelSize.width, CGImageGetWidth(image.CGImage));
XCTAssertEqual(pixelSize.height, CGImageGetHeight(image.CGImage));
XCTAssertEqual(expectedScale, image.scale);
}
- (void)testPlaceholderNonsquareImage
{
CGSize size = {640, 480};
CGFloat expectedScale = 1.0/160;
CGSize pixelSize = {4, 3};
UIImage *image = RCTGetPlaceholderImage(size, nil);
RCTAssertEqualSizes(size, image.size);
XCTAssertEqual(pixelSize.width, CGImageGetWidth(image.CGImage));
XCTAssertEqual(pixelSize.height, CGImageGetHeight(image.CGImage));
XCTAssertEqual(expectedScale, image.scale);
}
@end
@@ -19,8 +19,6 @@
#import "RCTJSCExecutor.h"
#import "RCTUtils.h"
#define RUN_PERF_TESTS 0
@interface RCTJSCExecutorTests : XCTestCase
@end
@@ -49,164 +47,4 @@
[_executor invalidate];
}
#if RUN_PERF_TESTS
static uint64_t _get_time_nanoseconds(void)
{
static struct mach_timebase_info tb_info = {0, 0};
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
int ret = mach_timebase_info(&tb_info);
assert(0 == ret);
});
return (mach_absolute_time() * tb_info.numer) / tb_info.denom;
}
- (void)testDeserializationPerf
{
// This test case checks the assumption that deserializing objects from JavaScript
// values one-by-one via ObjC JSC API is slower than using JSON string
// You might want to switch your tests schema to "Release" build configuration
JSContextGroupRef group = JSContextGroupCreate();
JSGlobalContextRef context = JSGlobalContextCreateInGroup(group, NULL);
id message = @[@[@1, @2, @3, @4], @[@{@"a": @1}, @{@"b": @2}], (id)kCFNull];
NSString *code = RCTJSONStringify(message, NULL);
JSStringRef script = JSStringCreateWithCFString((__bridge CFStringRef)code);
JSValueRef error = NULL;
JSValueRef value = JSEvaluateScript(context, script, NULL, NULL, 0, &error);
XCTAssertTrue(error == NULL);
id obj;
uint64_t start = _get_time_nanoseconds();
for (int i = 0; i < 10000; i++) {
JSStringRef jsonJSString = JSValueCreateJSONString(context, value, 0, nil);
NSString *jsonString = (__bridge NSString *)JSStringCopyCFString(kCFAllocatorDefault, jsonJSString);
JSStringRelease(jsonJSString);
obj = RCTJSONParse(jsonString, NULL);
}
NSLog(@"JSON Parse time: %.2fms", (_get_time_nanoseconds() - start) / 1000000.0);
JSStringRelease(script);
JSGlobalContextRelease(context);
JSContextGroupRelease(group);
}
- (void)testJavaScriptCallSpeed
{
/**
* Since we almost don't change the RCTJSCExecutor logic, and this test is
* very likely to become flaky (specially across different devices) leave it
* to be run manually
*
* Previous Values: If you change the executor code, you should update this values
*/
int const runs = 4e5;
int const frequency = 10;
double const threshold = 0.1;
static double const expectedTimes[] = {
0x1.6199943826cf1p+13,
0x1.a3bc0a81551c3p+13,
0x1.d49fbb8602fe3p+13,
0x1.d1f64085ecb7bp+13,
};
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
NSString *script = @" \
var modules = { \
module: { \
method: function () { \
return true; \
} \
} \
}; \
var Bridge = { \
callFunctionReturnFlushedQueue: function(module, method, args) { \
modules[module].apply(modules[module], args); \
} \
}; \
function require(module) { \
return Bridge; \
} \
";
[_executor executeApplicationScript:[script dataUsingEncoding:NSUTF8StringEncoding] sourceURL:[NSURL URLWithString:@"http://localhost:8081/"] onComplete:^(__unused NSError *error) {
NSMutableArray *params = [NSMutableArray new];
id data = @1;
for (int i = 0; i < 4; i++) {
double samples[runs / frequency];
int size = runs / frequency;
double total = 0;
for (int j = 0; j < runs; j++) {
@autoreleasepool {
double start = _get_time_nanoseconds();
[_executor callFunctionOnModule:@"module"
method:@"method"
arguments:params
callback:^(__unused id json, __unused NSError *unused) {
}];
double run = _get_time_nanoseconds() - start;
if ((j % frequency) == frequency - 1) { // Warmup
total += run;
samples[j/frequency] = run;
}
}
}
double mean = total / size;
double variance = 0;
for (int j = 0; j < size; j++) {
variance += pow(samples[j] - mean, 2);
}
variance /= size;
double standardDeviation = sqrt(variance);
double marginOfError = standardDeviation * 1.645;
double lower = mean - marginOfError;
double upper = mean + marginOfError;
int s = 0;
total = 0;
for (int j = 0; j < size; j++) {
double v = samples[j];
if (v >= lower && v <= upper) {
samples[s++] = v;
total += v;
}
}
mean = total / s;
lower = mean * (1.0 - threshold);
upper = mean * (1.0 + threshold);
double expected = expectedTimes[i];
NSLog(@"Previous: %lf, New: %f -> %a", expected, mean, mean);
if (upper < expected) {
NSLog(@"You made JS calls with %d argument(s) %.2lf%% faster :) - Remember to update the tests with the new value: %a",
i, (1 - (double)mean / expected) * 100, mean);
}
XCTAssertTrue(lower < expected, @"You made JS calls with %d argument(s) %.2lf%% slower :( - If that's *really* necessary, update the tests with the new value: %a",
i, ((double)mean / expected - 1) * 100, mean);
[params addObject:data];
}
dispatch_semaphore_signal(semaphore);
}];
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW)) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate dateWithTimeIntervalSinceNow:10]];
}
}
#endif
@end
@@ -221,10 +221,16 @@ RCT_EXPORT_MODULE()
- (void)testCustomSetBridgeModuleInitializedAtBridgeStartup
{
RUN_RUNLOOP_WHILE(!_customSetBridgeModuleNotificationSent);
XCTAssertFalse(_customSetBridgeModuleNotificationSent);
__block RCTTestCustomSetBridgeModule *module;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
module = [_bridge moduleForClass:[RCTTestCustomSetBridgeModule class]];
});
RUN_RUNLOOP_WHILE(!module);
XCTAssertTrue(_customSetBridgeModuleNotificationSent);
RCTTestCustomSetBridgeModule *module = [_bridge moduleForClass:[RCTTestCustomSetBridgeModule class]];
XCTAssertTrue(module.setBridgeOnMainThread);
XCTAssertFalse(module.setBridgeOnMainThread);
XCTAssertEqual(module.bridge, _bridge.batchedBridge);
XCTAssertNotNil(module.methodQueue);
}
-1
View File
@@ -46,7 +46,6 @@ var ViewBorderStyleExample = React.createClass({
<View>
<View style={{
borderWidth: 1,
borderRadius: 5,
borderStyle: this.state.showBorder ? 'dashed' : null,
padding: 5
}}>
@@ -109,6 +109,7 @@ var ViewPagerAndroidExample = React.createClass({
return {
page: 0,
animationsAreEnabled: true,
scrollEnabled: true,
progress: {
position: 0,
offset: 0,
@@ -167,6 +168,7 @@ var ViewPagerAndroidExample = React.createClass({
<ViewPagerAndroid
style={styles.viewPager}
initialPage={0}
scrollEnabled={this.state.scrollEnabled}
onPageScroll={this.onPageScroll}
onPageSelected={this.onPageSelected}
onPageScrollStateChanged={this.onPageScrollStateChanged}
@@ -174,6 +176,13 @@ var ViewPagerAndroidExample = React.createClass({
ref={viewPager => { this.viewPager = viewPager; }}>
{pages}
</ViewPagerAndroid>
<View style={styles.buttons}>
<Button
enabled={true}
text={this.state.scrollEnabled ? 'Scroll Enabled' : 'Scroll Disabled'}
onPress={() => this.setState({scrollEnabled: !this.state.scrollEnabled})}
/>
</View>
<View style={styles.buttons}>
{ animationsAreEnabled ?
<Button
+286
View File
@@ -0,0 +1,286 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @flow
*/
'use strict';
/* eslint-env browser */
const React = require('react');
const ReactNative = require('react-native');
const {
PixelRatio,
StyleSheet,
Text,
TextInput,
TouchableOpacity,
View,
} = ReactNative;
const DEFAULT_WS_URL = 'ws://localhost:5555/';
const WS_EVENTS = [
'close',
'error',
'message',
'open',
];
const WS_STATES = [
/* 0 */ 'CONNECTING',
/* 1 */ 'OPEN',
/* 2 */ 'CLOSING',
/* 3 */ 'CLOSED',
];
class Button extends React.Component {
render(): ReactElement {
const label = <Text style={styles.buttonLabel}>{this.props.label}</Text>;
if (this.props.disabled) {
return (
<View style={[styles.button, styles.disabledButton]}>
{label}
</View>
);
}
return (
<TouchableOpacity
onPress={this.props.onPress}
style={styles.button}>
{label}
</TouchableOpacity>
);
}
}
class Row extends React.Component {
render(): ReactElement {
return (
<View style={styles.row}>
<Text>{this.props.label}</Text>
<Text>{this.props.value}</Text>
</View>
);
}
}
function showValue(value) {
if (value === undefined || value === null) {
return '(no value)';
}
console.log('typeof Uint8Array', typeof Uint8Array);
if (typeof ArrayBuffer !== 'undefined' &&
typeof Uint8Array !== 'undefined' &&
value instanceof ArrayBuffer) {
return `ArrayBuffer {${Array.from(new Uint8Array(value))}}`;
}
return value;
}
type State = {
url: string;
socket: ?WebSocket;
socketState: ?number;
lastSocketEvent: ?string;
lastMessage: ?string | ?ArrayBuffer;
outgoingMessage: string;
};
class WebSocketExample extends React.Component<any, any, State> {
static title = 'WebSocket';
static description = 'WebSocket API';
state: State = {
url: DEFAULT_WS_URL,
socket: null,
socketState: null,
lastSocketEvent: null,
lastMessage: null,
outgoingMessage: '',
};
_connect = () => {
const socket = new WebSocket(this.state.url);
WS_EVENTS.forEach(ev => socket.addEventListener(ev, this._onSocketEvent));
this.setState({
socket,
socketState: socket.readyState,
});
};
_disconnect = () => {
if (!this.state.socket) {
return;
}
this.state.socket.close();
};
// Ideally this would be a MessageEvent, but Flow's definition
// doesn't inherit from Event, so it's 'any' for now.
// See https://github.com/facebook/flow/issues/1654.
_onSocketEvent = (event: any) => {
const state: any = {
socketState: event.target.readyState,
lastSocketEvent: event.type,
};
if (event.type === 'message') {
state.lastMessage = event.data;
}
this.setState(state);
};
_sendText = () => {
if (!this.state.socket) {
return;
}
this.state.socket.send(this.state.outgoingMessage);
this.setState({outgoingMessage: ''});
};
_sendBinary = () => {
if (!this.state.socket ||
typeof ArrayBuffer === 'undefined' ||
typeof Uint8Array === 'undefined') {
return;
}
const {outgoingMessage} = this.state;
const buffer = new Uint8Array(outgoingMessage.length);
for (let i = 0; i < outgoingMessage.length; i++) {
buffer[i] = outgoingMessage.charCodeAt(i);
}
this.state.socket.send(buffer);
this.setState({outgoingMessage: ''});
};
render(): ReactElement {
const socketState = WS_STATES[this.state.socketState || -1];
const canConnect =
!this.state.socket ||
this.state.socket.readyState >= WebSocket.CLOSING;
const canSend = !!this.state.socket;
return (
<View style={styles.container}>
<View style={styles.note}>
<Text>Pro tip:</Text>
<Text style={styles.monospace}>
node Examples/UIExplorer/websocket_test_server.js
</Text>
<Text>
{' in the '}
<Text style={styles.monospace}>react-native</Text>
{' directory starts a test server.'}
</Text>
</View>
<Row
label="Current WebSocket state"
value={showValue(socketState)}
/>
<Row
label="Last WebSocket event"
value={showValue(this.state.lastSocketEvent)}
/>
<Row
label="Last message received"
value={showValue(this.state.lastMessage)}
/>
<TextInput
style={styles.textInput}
autoCorrect={false}
placeholder="Server URL..."
onChangeText={(url) => this.setState({url})}
value={this.state.url}
/>
<Button
onPress={this._connect}
label="Connect"
disabled={!canConnect}
/>
<Button
onPress={this._disconnect}
label="Disconnect"
disabled={canConnect}
/>
<TextInput
style={styles.textInput}
autoCorrect={false}
placeholder="Type message here..."
onChangeText={(outgoingMessage) => this.setState({outgoingMessage})}
value={this.state.outgoingMessage}
/>
<View style={styles.buttonRow}>
<Button
onPress={this._sendText}
label="Send as text"
disabled={!canSend}
/>
<Button
onPress={this._sendBinary}
label="Send as binary"
disabled={!canSend}
/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
note: {
padding: 8,
margin: 4,
backgroundColor: 'white',
},
monospace: {
fontFamily: 'courier',
fontSize: 11,
},
row: {
height: 40,
padding: 4,
backgroundColor: 'white',
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
borderBottomWidth: 1 / PixelRatio.get(),
borderColor: 'grey',
},
button: {
margin: 8,
padding: 8,
borderRadius: 4,
backgroundColor: 'blue',
alignSelf: 'center',
},
disabledButton: {
opacity: 0.5,
},
buttonLabel: {
color: 'white',
},
buttonRow: {
flexDirection: 'row',
justifyContent: 'center',
},
textInput: {
height: 40,
backgroundColor: 'white',
margin: 8,
padding: 8,
},
});
module.exports = WebSocketExample;
+20
View File
@@ -22,6 +22,7 @@ var {
Text,
TouchableHighlight,
View,
WebView,
} = ReactNative;
var RCTNetworking = require('RCTNetworking');
@@ -45,6 +46,7 @@ class XHRExampleCookies extends React.Component {
var url = `https://${domain}/cookies/set?a=${a}&b=${b}`;
fetch(url).then((response) => {
this.setStatus(`Cookies a=${a}, b=${b} set`);
this.refreshWebview();
});
this.setState({
@@ -59,6 +61,7 @@ class XHRExampleCookies extends React.Component {
return response.json();
}).then((data) => {
this.setStatus(`Got cookies ${JSON.stringify(data.cookies)} from server`);
this.refreshWebview();
});
this.setStatus('Getting cookies...');
@@ -67,9 +70,14 @@ class XHRExampleCookies extends React.Component {
clearCookies() {
RCTNetworking.clearCookies((cleared) => {
this.setStatus('Cookies cleared, had cookies=' + cleared);
this.refreshWebview();
});
}
refreshWebview() {
this.refs.webview.reload();
}
setStatus(status: string) {
this.setState({status});
}
@@ -113,6 +121,18 @@ class XHRExampleCookies extends React.Component {
</View>
</TouchableHighlight>
<Text>{this.state.status}</Text>
<TouchableHighlight
style={styles.wrapper}
onPress={this.refreshWebview.bind(this)}>
<View style={styles.button}>
<Text>Refresh Webview</Text>
</View>
</TouchableHighlight>
<WebView
ref="webview"
source={{uri: 'http://httpbin.org/cookies'}}
style={{height: 100}}
/>
</View>
);
}
@@ -0,0 +1,43 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @flow
*/
'use strict';
/* eslint-env node */
const WebSocket = require('ws');
console.log(`\
Test server for WebSocketExample
This will send each incoming message right back to the other side.a
Restart with the '--binary' command line flag to have it respond with an
ArrayBuffer instead of a string.
`);
const respondWithBinary = process.argv.indexOf('--binary') !== -1;
const server = new WebSocket.Server({port: 5555});
server.on('connection', (ws) => {
ws.on('message', (message) => {
console.log('Received message:', message);
if (respondWithBinary) {
message = new Buffer(message);
}
ws.send(message);
});
console.log('Incoming connection!');
ws.send('Why hello there!');
});
@@ -10,7 +10,7 @@
*/
'use strict';
require('regenerator/runtime');
require('regenerator-runtime/runtime');
var React = require('react');
var ReactNative = require('react-native');
+1 -1
View File
@@ -23,7 +23,7 @@ var merge = require('merge');
// Diff Helpers
function arrayDiffer(a, b) {
if (a == null) {
if (a == null || b == null) {
return true;
}
if (a.length !== b.length) {
@@ -69,6 +69,7 @@ class Animated {
__getNativeConfig(): Object {
throw new Error('This JS animated node type cannot be used as native animated node');
}
toJSON(): any { return this.__getValue(); }
}
type AnimationConfig = {
@@ -82,7 +83,7 @@ type AnimationConfig = {
class Animation {
__active: bool;
__isInteraction: bool;
__nativeTag: number;
__nativeId: number;
__onEnd: ?EndCallback;
start(
fromValue: number,
@@ -91,7 +92,11 @@ class Animation {
previousAnimation: ?Animation,
animatedValue: AnimatedValue
): void {}
stop(): void {}
stop(): void {
if (this.__nativeId) {
NativeAnimatedAPI.stopAnimation(this.__nativeId);
}
}
_getNativeAnimationConfig(): any {
// Subclasses that have corresponding animation implementation done in native
// should override this method
@@ -105,9 +110,9 @@ class Animation {
}
__startNativeAnimation(animatedValue: AnimatedValue): void {
animatedValue.__makeNative();
this.__nativeTag = NativeAnimatedHelper.generateNewAnimationTag();
this.__nativeId = NativeAnimatedHelper.generateNewAnimationId();
NativeAnimatedAPI.startAnimatingNode(
this.__nativeTag,
this.__nativeId,
animatedValue.__getNativeTag(),
this._getNativeAnimationConfig(),
this.__debouncedOnEnd.bind(this)
@@ -311,6 +316,7 @@ class TimingAnimation extends Animation {
}
stop(): void {
super.stop();
this.__active = false;
clearTimeout(this._timeout);
window.cancelAnimationFrame(this._animationFrame);
@@ -381,6 +387,7 @@ class DecayAnimation extends Animation {
}
stop(): void {
super.stop();
this.__active = false;
window.cancelAnimationFrame(this._animationFrame);
this.__debouncedOnEnd({finished: false});
@@ -595,6 +602,7 @@ class SpringAnimation extends Animation {
}
stop(): void {
super.stop();
this.__active = false;
window.cancelAnimationFrame(this._animationFrame);
this.__debouncedOnEnd({finished: false});
@@ -645,7 +653,7 @@ class AnimatedValue extends AnimatedWithChildren {
this._animation.stop();
this._animation = null;
}
this._updateValue(value);
this._updateValue(value, !this.__isNative /* don't perform a flush for natively driven values */);
if (this.__isNative) {
NativeAnimatedAPI.setAnimatedNodeValue(this.__getNativeTag(), value);
}
@@ -705,7 +713,7 @@ class AnimatedValue extends AnimatedWithChildren {
* 0-10.
*/
interpolate(config: InterpolationConfigType): AnimatedInterpolation {
return new AnimatedInterpolation(this, Interpolation.create(config));
return new AnimatedInterpolation(this, config);
}
/**
@@ -723,7 +731,9 @@ class AnimatedValue extends AnimatedWithChildren {
animation.start(
this._value,
(value) => {
this._updateValue(value);
// Natively driven animations will never call into that callback, therefore we can always pass `flush = true`
// to allow the updated value to propagate to native with `setNativeProps`
this._updateValue(value, true /* flush */);
},
(result) => {
this._animation = null;
@@ -753,9 +763,11 @@ class AnimatedValue extends AnimatedWithChildren {
this._tracking = tracking;
}
_updateValue(value: number): void {
_updateValue(value: number, flush: bool): void {
this._value = value;
_flush(this);
if (flush) {
_flush(this);
}
for (var key in this._listeners) {
this._listeners[key]({value: this.__getValue()});
}
@@ -912,12 +924,14 @@ class AnimatedValueXY extends AnimatedWithChildren {
class AnimatedInterpolation extends AnimatedWithChildren {
_parent: Animated;
_config: InterpolationConfigType;
_interpolation: (input: number) => number | string;
constructor(parent: Animated, interpolation: (input: number) => number | string) {
constructor(parent: Animated, config: InterpolationConfigType) {
super();
this._parent = parent;
this._interpolation = interpolation;
this._config = config;
this._interpolation = Interpolation.create(config);
}
__getValue(): number | string {
@@ -930,7 +944,7 @@ class AnimatedInterpolation extends AnimatedWithChildren {
}
interpolate(config: InterpolationConfigType): AnimatedInterpolation {
return new AnimatedInterpolation(this, Interpolation.create(config));
return new AnimatedInterpolation(this, config);
}
__attach(): void {
@@ -939,6 +953,15 @@ class AnimatedInterpolation extends AnimatedWithChildren {
__detach(): void {
this._parent.__removeChild(this);
super.__detach();
}
__getNativeConfig(): any {
NativeAnimatedHelper.validateInterpolation(this._config);
return {
...this._config,
type: 'interpolation',
};
}
}
@@ -952,12 +975,18 @@ class AnimatedAddition extends AnimatedWithChildren {
this._b = typeof b === 'number' ? new AnimatedValue(b) : b;
}
__makeNative() {
this._a.__makeNative();
this._b.__makeNative();
super.__makeNative();
}
__getValue(): number {
return this._a.__getValue() + this._b.__getValue();
}
interpolate(config: InterpolationConfigType): AnimatedInterpolation {
return new AnimatedInterpolation(this, Interpolation.create(config));
return new AnimatedInterpolation(this, config);
}
__attach(): void {
@@ -968,6 +997,14 @@ class AnimatedAddition extends AnimatedWithChildren {
__detach(): void {
this._a.__removeChild(this);
this._b.__removeChild(this);
super.__detach();
}
__getNativeConfig(): any {
return {
type: 'addition',
input: [this._a.__getNativeTag(), this._b.__getNativeTag()],
};
}
}
@@ -981,12 +1018,18 @@ class AnimatedMultiplication extends AnimatedWithChildren {
this._b = typeof b === 'number' ? new AnimatedValue(b) : b;
}
__makeNative() {
super.__makeNative();
this._a.__makeNative();
this._b.__makeNative();
}
__getValue(): number {
return this._a.__getValue() * this._b.__getValue();
}
interpolate(config: InterpolationConfigType): AnimatedInterpolation {
return new AnimatedInterpolation(this, Interpolation.create(config));
return new AnimatedInterpolation(this, config);
}
__attach(): void {
@@ -997,6 +1040,14 @@ class AnimatedMultiplication extends AnimatedWithChildren {
__detach(): void {
this._a.__removeChild(this);
this._b.__removeChild(this);
super.__detach();
}
__getNativeConfig(): any {
return {
type: 'multiplication',
input: [this._a.__getNativeTag(), this._b.__getNativeTag()],
};
}
}
@@ -1015,7 +1066,7 @@ class AnimatedModulo extends AnimatedWithChildren {
}
interpolate(config: InterpolationConfigType): AnimatedInterpolation {
return new AnimatedInterpolation(this, Interpolation.create(config));
return new AnimatedInterpolation(this, config);
}
__attach(): void {
@@ -1394,7 +1445,7 @@ function createAnimatedComponent(Component: any): any {
for (var key in ViewStylePropTypes) {
if (!Component.propTypes[key] && props[key] !== undefined) {
console.error(
console.warn(
'You are setting the style `{ ' + key + ': ... }` as a prop. You ' +
'should nest it in a style object. ' +
'E.g. `{ style: { ' + key + ': ... } }`'
+1 -1
View File
@@ -233,7 +233,7 @@ function createInterpolationFromStringOutputRange(
// 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...'
return outputRange[0].replace(stringShapeRegex, () => {
const val = +interpolations[i++](input);
const rounded = shouldRound && i < 4 ? Math.round(val) : val;
const rounded = shouldRound && i < 4 ? Math.round(val) : Math.round(val * 1000) / 1000;
return String(rounded);
});
};
+23 -6
View File
@@ -16,7 +16,7 @@ var NativeAnimatedModule = require('NativeModules').NativeAnimatedModule;
var invariant = require('fbjs/lib/invariant');
var __nativeAnimatedNodeTagCount = 1; /* used for animated nodes */
var __nativeAnimationTagCount = 1; /* used for started animations */
var __nativeAnimationIdCount = 1; /* used for started animations */
type EndResult = {finished: bool};
type EndCallback = (result: EndResult) => void;
@@ -38,9 +38,13 @@ var API = {
assertNativeAnimatedModule();
NativeAnimatedModule.disconnectAnimatedNodes(parentTag, childTag);
},
startAnimatingNode: function(animationTag: number, nodeTag: number, config: Object, endCallback: EndCallback): void {
startAnimatingNode: function(animationId: number, nodeTag: number, config: Object, endCallback: EndCallback): void {
assertNativeAnimatedModule();
NativeAnimatedModule.startAnimatingNode(nodeTag, config, endCallback);
NativeAnimatedModule.startAnimatingNode(animationId, nodeTag, config, endCallback);
},
stopAnimation: function(animationId: number) {
assertNativeAnimatedModule();
NativeAnimatedModule.stopAnimation(animationId);
},
setAnimatedNodeValue: function(nodeTag: number, value: number): void {
assertNativeAnimatedModule();
@@ -97,12 +101,24 @@ function validateStyles(styles: Object): void {
}
}
function validateInterpolation(config: Object): void {
var SUPPORTED_INTERPOLATION_PARAMS = {
inputRange: true,
outputRange: true,
};
for (var key in config) {
if (!SUPPORTED_INTERPOLATION_PARAMS.hasOwnProperty(key)) {
throw new Error(`Interpolation property '${key}' is not supported by native animated module`);
}
}
}
function generateNewNodeTag(): number {
return __nativeAnimatedNodeTagCount++;
}
function generateNewAnimationTag(): number {
return __nativeAnimationTagCount++;
function generateNewAnimationId(): number {
return __nativeAnimationIdCount++;
}
function assertNativeAnimatedModule(): void {
@@ -113,7 +129,8 @@ module.exports = {
API,
validateProps,
validateStyles,
validateInterpolation,
generateNewNodeTag,
generateNewAnimationTag,
generateNewAnimationId,
assertNativeAnimatedModule,
};
@@ -9,7 +9,7 @@
'use strict';
jest
.autoMockOff()
.disableAutomock()
.setMock('Text', {})
.setMock('View', {})
.setMock('Image', {})
@@ -22,7 +22,7 @@ describe('Animated', () => {
it('works end to end', () => {
var anim = new Animated.Value(0);
var callback = jest.genMockFunction();
var callback = jest.fn();
var node = new Animated.__PropsOnlyForTests({
style: {
@@ -75,7 +75,7 @@ describe('Animated', () => {
it('does not detach on updates', () => {
var anim = new Animated.Value(0);
anim.__detach = jest.genMockFunction();
anim.__detach = jest.fn();
var c = new Animated.View();
c.props = {
@@ -101,11 +101,11 @@ describe('Animated', () => {
it('stops animation when detached', () => {
// jest environment doesn't have cancelAnimationFrame :(
if (!window.cancelAnimationFrame) {
window.cancelAnimationFrame = jest.genMockFunction();
window.cancelAnimationFrame = jest.fn();
}
var anim = new Animated.Value(0);
var callback = jest.genMockFunction();
var callback = jest.fn();
var c = new Animated.View();
c.props = {
@@ -125,14 +125,14 @@ describe('Animated', () => {
it('triggers callback when spring is at rest', () => {
var anim = new Animated.Value(0);
var callback = jest.genMockFunction();
var callback = jest.fn();
Animated.spring(anim, {toValue: 0, velocity: 0}).start(callback);
expect(callback).toBeCalled();
});
it('send toValue when a spring stops', () => {
var anim = new Animated.Value(0);
var listener = jest.genMockFunction();
var listener = jest.fn();
anim.addListener(listener);
Animated.spring(anim, {toValue: 15}).start();
jest.runAllTimers();
@@ -142,21 +142,24 @@ describe('Animated', () => {
expect(anim.__getValue()).toBe(15);
});
it('convert to JSON', () => {
expect(JSON.stringify(new Animated.Value(10))).toBe('10');
});
});
describe('Animated Sequence', () => {
it('works with an empty sequence', () => {
var cb = jest.genMockFunction();
var cb = jest.fn();
Animated.sequence([]).start(cb);
expect(cb).toBeCalledWith({finished: true});
});
it('sequences well', () => {
var anim1 = {start: jest.genMockFunction()};
var anim2 = {start: jest.genMockFunction()};
var cb = jest.genMockFunction();
var anim1 = {start: jest.fn()};
var anim2 = {start: jest.fn()};
var cb = jest.fn();
var seq = Animated.sequence([anim1, anim2]);
@@ -179,9 +182,9 @@ describe('Animated Sequence', () => {
});
it('supports interrupting sequence', () => {
var anim1 = {start: jest.genMockFunction()};
var anim2 = {start: jest.genMockFunction()};
var cb = jest.genMockFunction();
var anim1 = {start: jest.fn()};
var anim2 = {start: jest.fn()};
var cb = jest.fn();
Animated.sequence([anim1, anim2]).start(cb);
@@ -193,9 +196,9 @@ describe('Animated Sequence', () => {
});
it('supports stopping sequence', () => {
var anim1 = {start: jest.genMockFunction(), stop: jest.genMockFunction()};
var anim2 = {start: jest.genMockFunction(), stop: jest.genMockFunction()};
var cb = jest.genMockFunction();
var anim1 = {start: jest.fn(), stop: jest.fn()};
var anim2 = {start: jest.fn(), stop: jest.fn()};
var cb = jest.fn();
var seq = Animated.sequence([anim1, anim2]);
seq.start(cb);
@@ -215,14 +218,14 @@ describe('Animated Sequence', () => {
describe('Animated Parallel', () => {
it('works with an empty parallel', () => {
var cb = jest.genMockFunction();
var cb = jest.fn();
Animated.parallel([]).start(cb);
expect(cb).toBeCalledWith({finished: true});
});
it('works with an empty element in array', () => {
var anim1 = {start: jest.genMockFunction()};
var cb = jest.genMockFunction();
var anim1 = {start: jest.fn()};
var cb = jest.fn();
Animated.parallel([null, anim1]).start(cb);
expect(anim1.start).toBeCalled();
@@ -232,9 +235,9 @@ describe('Animated Parallel', () => {
});
it('parellelizes well', () => {
var anim1 = {start: jest.genMockFunction()};
var anim2 = {start: jest.genMockFunction()};
var cb = jest.genMockFunction();
var anim1 = {start: jest.fn()};
var anim2 = {start: jest.fn()};
var cb = jest.fn();
var par = Animated.parallel([anim1, anim2]);
@@ -255,9 +258,9 @@ describe('Animated Parallel', () => {
});
it('supports stopping parallel', () => {
var anim1 = {start: jest.genMockFunction(), stop: jest.genMockFunction()};
var anim2 = {start: jest.genMockFunction(), stop: jest.genMockFunction()};
var cb = jest.genMockFunction();
var anim1 = {start: jest.fn(), stop: jest.fn()};
var anim2 = {start: jest.fn(), stop: jest.fn()};
var cb = jest.fn();
var seq = Animated.parallel([anim1, anim2]);
seq.start(cb);
@@ -276,10 +279,10 @@ describe('Animated Parallel', () => {
it('does not call stop more than once when stopping', () => {
var anim1 = {start: jest.genMockFunction(), stop: jest.genMockFunction()};
var anim2 = {start: jest.genMockFunction(), stop: jest.genMockFunction()};
var anim3 = {start: jest.genMockFunction(), stop: jest.genMockFunction()};
var cb = jest.genMockFunction();
var anim1 = {start: jest.fn(), stop: jest.fn()};
var anim2 = {start: jest.fn(), stop: jest.fn()};
var anim3 = {start: jest.fn(), stop: jest.fn()};
var cb = jest.fn();
var seq = Animated.parallel([anim1, anim2, anim3]);
seq.start(cb);
@@ -306,8 +309,8 @@ describe('Animated Parallel', () => {
describe('Animated delays', () => {
it('should call anim after delay in sequence', () => {
var anim = {start: jest.genMockFunction(), stop: jest.genMockFunction()};
var cb = jest.genMockFunction();
var anim = {start: jest.fn(), stop: jest.fn()};
var cb = jest.fn();
Animated.sequence([
Animated.delay(1000),
anim,
@@ -319,7 +322,7 @@ describe('Animated delays', () => {
expect(cb).toBeCalledWith({finished: true});
});
it('should run stagger to end', () => {
var cb = jest.genMockFunction();
var cb = jest.fn();
Animated.stagger(1000, [
Animated.delay(1000),
Animated.delay(1000),
@@ -341,7 +344,7 @@ describe('Animated Events', () => {
});
it('should call listeners', () => {
var value = new Animated.Value(0);
var listener = jest.genMockFunction();
var listener = jest.fn();
var handler = Animated.event(
[{foo: value}],
{listener},
@@ -366,14 +369,14 @@ describe('Animated Interactions', () => {
});
afterEach(()=> {
jest.dontMock('InteractionManager');
jest.unmock('InteractionManager');
});
it('registers an interaction by default', () => {
InteractionManager.createInteractionHandle.mockReturnValue(777);
var value = new Animated.Value(0);
var callback = jest.genMockFunction();
var callback = jest.fn();
Animated.timing(value, {
toValue: 100,
duration: 100,
@@ -387,7 +390,7 @@ describe('Animated Interactions', () => {
it('does not register an interaction when specified', () => {
var value = new Animated.Value(0);
var callback = jest.genMockFunction();
var callback = jest.fn();
Animated.timing(value, {
toValue: 100,
duration: 100,
@@ -451,7 +454,7 @@ describe('Animated Vectors', () => {
it('should animate vectors', () => {
var vec = new Animated.ValueXY();
var callback = jest.genMockFunction();
var callback = jest.fn();
var node = new Animated.__PropsOnlyForTests({
style: {
@@ -536,7 +539,7 @@ describe('Animated Vectors', () => {
describe('Animated Listeners', () => {
it('should get updates', () => {
var value1 = new Animated.Value(0);
var listener = jest.genMockFunction();
var listener = jest.fn();
var id = value1.addListener(listener);
value1.setValue(42);
expect(listener.mock.calls.length).toBe(1);
@@ -554,7 +557,7 @@ describe('Animated Listeners', () => {
it('should removeAll', () => {
var value1 = new Animated.Value(0);
var listener = jest.genMockFunction();
var listener = jest.fn();
[1,2,3,4].forEach(() => value1.addListener(listener));
value1.setValue(42);
expect(listener.mock.calls.length).toBe(4);
@@ -9,7 +9,7 @@
'use strict';
jest
.autoMockOff()
.disableAutomock()
.setMock('Text', {})
.setMock('View', {})
.setMock('Image', {})
@@ -24,18 +24,19 @@ describe('Animated', () => {
beforeEach(() => {
var nativeAnimatedModule = require('NativeModules').NativeAnimatedModule;
nativeAnimatedModule.createAnimatedNode = jest.genMockFunction();
nativeAnimatedModule.connectAnimatedNodes = jest.genMockFunction();
nativeAnimatedModule.disconnectAnimatedNodes = jest.genMockFunction();
nativeAnimatedModule.startAnimatingNode = jest.genMockFunction();
nativeAnimatedModule.setAnimatedNodeValue = jest.genMockFunction();
nativeAnimatedModule.connectAnimatedNodeToView = jest.genMockFunction();
nativeAnimatedModule.disconnectAnimatedNodeFromView = jest.genMockFunction();
nativeAnimatedModule.dropAnimatedNode = jest.genMockFunction();
nativeAnimatedModule.createAnimatedNode = jest.fn();
nativeAnimatedModule.connectAnimatedNodes = jest.fn();
nativeAnimatedModule.disconnectAnimatedNodes = jest.fn();
nativeAnimatedModule.startAnimatingNode = jest.fn();
nativeAnimatedModule.stopAnimation = jest.fn();
nativeAnimatedModule.setAnimatedNodeValue = jest.fn();
nativeAnimatedModule.connectAnimatedNodeToView = jest.fn();
nativeAnimatedModule.disconnectAnimatedNodeFromView = jest.fn();
nativeAnimatedModule.dropAnimatedNode = jest.fn();
// jest environment doesn't have cancelAnimationFrame :(
if (!window.cancelAnimationFrame) {
window.cancelAnimationFrame = jest.genMockFunction();
window.cancelAnimationFrame = jest.fn();
}
});
@@ -59,6 +60,7 @@ describe('Animated', () => {
expect(nativeAnimatedModule.connectAnimatedNodes.mock.calls.length).toBe(2);
expect(nativeAnimatedModule.startAnimatingNode).toBeCalledWith(
jasmine.any(Number),
jasmine.any(Number),
{type: 'frames', frames: jasmine.any(Array), toValue: jasmine.any(Number)},
jasmine.any(Function)
@@ -90,12 +92,114 @@ describe('Animated', () => {
.toBeCalledWith(jasmine.any(Number), { type: 'props', props: { style: jasmine.any(Number) }});
});
it('sends a valid graph description for Animated.add nodes', () => {
var first = new Animated.Value(1);
var second = new Animated.Value(2);
var c = new Animated.View();
c.props = {
style: {
opacity: Animated.add(first, second),
},
};
c.componentWillMount();
Animated.timing(first, {toValue: 2, duration: 1000, useNativeDriver: true}).start();
Animated.timing(second, {toValue: 3, duration: 1000, useNativeDriver: true}).start();
var nativeAnimatedModule = require('NativeModules').NativeAnimatedModule;
expect(nativeAnimatedModule.createAnimatedNode)
.toBeCalledWith(jasmine.any(Number), { type: 'addition', input: jasmine.any(Array) });
var additionCalls = nativeAnimatedModule.createAnimatedNode.mock.calls.filter(
(call) => call[1].type === 'addition'
);
expect(additionCalls.length).toBe(1);
var additionCall = additionCalls[0];
var additionNodeTag = additionCall[0];
var additionConnectionCalls = nativeAnimatedModule.connectAnimatedNodes.mock.calls.filter(
(call) => call[1] === additionNodeTag
);
expect(additionConnectionCalls.length).toBe(2);
expect(nativeAnimatedModule.createAnimatedNode)
.toBeCalledWith(additionCall[1].input[0], { type: 'value', value: 1 });
expect(nativeAnimatedModule.createAnimatedNode)
.toBeCalledWith(additionCall[1].input[1], { type: 'value', value: 2 });
});
it('sends a valid graph description for Animated.multiply nodes', () => {
var first = new Animated.Value(2);
var second = new Animated.Value(1);
var c = new Animated.View();
c.props = {
style: {
opacity: Animated.multiply(first, second),
},
};
c.componentWillMount();
Animated.timing(first, {toValue: 5, duration: 1000, useNativeDriver: true}).start();
Animated.timing(second, {toValue: -1, duration: 1000, useNativeDriver: true}).start();
var nativeAnimatedModule = require('NativeModules').NativeAnimatedModule;
expect(nativeAnimatedModule.createAnimatedNode)
.toBeCalledWith(jasmine.any(Number), { type: 'multiplication', input: jasmine.any(Array) });
var multiplicationCalls = nativeAnimatedModule.createAnimatedNode.mock.calls.filter(
(call) => call[1].type === 'multiplication'
);
expect(multiplicationCalls.length).toBe(1);
var multiplicationCall = multiplicationCalls[0];
var multiplicationNodeTag = multiplicationCall[0];
var multiplicationConnectionCalls = nativeAnimatedModule.connectAnimatedNodes.mock.calls.filter(
(call) => call[1] === multiplicationNodeTag
);
expect(multiplicationConnectionCalls.length).toBe(2);
expect(nativeAnimatedModule.createAnimatedNode)
.toBeCalledWith(multiplicationCall[1].input[0], { type: 'value', value: 2 });
expect(nativeAnimatedModule.createAnimatedNode)
.toBeCalledWith(multiplicationCall[1].input[1], { type: 'value', value: 1 });
});
it('sends a valid graph description for interpolate() nodes', () => {
var node = new Animated.Value(10);
var c = new Animated.View();
c.props = {
style: {
opacity: node.interpolate({
inputRange: [10, 20],
outputRange: [0, 1],
}),
},
};
c.componentWillMount();
Animated.timing(node, {toValue: 20, duration: 1000, useNativeDriver: true}).start();
var nativeAnimatedModule = require('NativeModules').NativeAnimatedModule;
expect(nativeAnimatedModule.createAnimatedNode).toBeCalledWith(jasmine.any(Number), { type: 'value', value: 10 });
expect(nativeAnimatedModule.createAnimatedNode)
.toBeCalledWith(jasmine.any(Number), {
type: 'interpolation',
inputRange: [10, 20],
outputRange: [0, 1],
});
var interpolationNodeTag = nativeAnimatedModule.createAnimatedNode.mock.calls.find(
(call) => call[1].type === 'interpolation'
)[0];
var valueNodeTag = nativeAnimatedModule.createAnimatedNode.mock.calls.find(
(call) => call[1].type === 'value'
)[0];
expect(nativeAnimatedModule.connectAnimatedNodes).toBeCalledWith(valueNodeTag, interpolationNodeTag);
});
it('sends a valid timing animation description', () => {
var anim = new Animated.Value(0);
Animated.timing(anim, {toValue: 10, duration: 1000, useNativeDriver: true}).start();
var nativeAnimatedModule = require('NativeModules').NativeAnimatedModule;
expect(nativeAnimatedModule.startAnimatingNode).toBeCalledWith(
jasmine.any(Number),
jasmine.any(Number),
{type: 'frames', frames: jasmine.any(Array), toValue: jasmine.any(Number)},
jasmine.any(Function)
@@ -106,10 +210,27 @@ describe('Animated', () => {
var anim = new Animated.Value(0);
Animated.timing(anim, {toValue: 10, duration: 1000, useNativeDriver: true}).start();
anim.setValue(5);
var c = new Animated.View();
c.props = {
style: {
opacity: anim,
},
};
c.componentWillMount();
// We expect `setValue` not to propagate down to `setNativeProps`, otherwise it may try to access `setNativeProps`
// via component refs table that we override here.
c.refs = {
node: {
setNativeProps: jest.genMockFunction(),
},
};
anim.setValue(0.5);
var nativeAnimatedModule = require('NativeModules').NativeAnimatedModule;
expect(nativeAnimatedModule.setAnimatedNodeValue).toBeCalledWith(jasmine.any(Number), 5);
expect(nativeAnimatedModule.setAnimatedNodeValue).toBeCalledWith(jasmine.any(Number), 0.5);
expect(c.refs.node.setNativeProps.mock.calls.length).toBe(0);
});
it('doesn\'t call into native API if useNativeDriver is set to false', () => {
@@ -179,6 +300,25 @@ describe('Animated', () => {
expect(animation.start).toThrowError(/left/);
});
it('fails for unsupported interpolation parameters', () => {
var anim = new Animated.Value(0);
var c = new Animated.View();
c.props = {
style: {
opacity: anim.interpolate({
inputRange: [0, 100],
outputRange: [0, 1],
extrapolate: 'clamp',
}),
},
};
c.componentWillMount();
var animation = Animated.timing(anim, {toValue: 100, duration: 50, useNativeDriver: true});
expect(animation.start).toThrowError(/extrapolate/);
});
it('works for any `static` props and styles', () => {
// Passing "unsupported" props should work just fine as long as they are not animated
var anim = new Animated.Value(0);
@@ -201,4 +341,22 @@ describe('Animated', () => {
.toBeCalledWith(jasmine.any(Number), { type: 'props', props: { style: jasmine.any(Number) }});
});
it('send stopAnimation command to native', () => {
var value = new Animated.Value(0);
var animation = Animated.timing(value, {toValue: 10, duration: 50, useNativeDriver: true});
var nativeAnimatedModule = require('NativeModules').NativeAnimatedModule;
animation.start();
expect(nativeAnimatedModule.startAnimatingNode).toBeCalledWith(
jasmine.any(Number),
jasmine.any(Number),
{type: 'frames', frames: jasmine.any(Array), toValue: jasmine.any(Number)},
jasmine.any(Function)
);
var animationId = nativeAnimatedModule.startAnimatingNode.mock.calls[0][0];
animation.stop();
expect(nativeAnimatedModule.stopAnimation).toBeCalledWith(animationId);
});
});
@@ -8,7 +8,7 @@
*/
'use strict';
jest.dontMock('Easing');
jest.unmock('Easing');
var Easing = require('Easing');
describe('Easing', () => {
@@ -9,9 +9,9 @@
'use strict';
jest
.dontMock('Interpolation')
.dontMock('Easing')
.dontMock('normalizeColor');
.unmock('Interpolation')
.unmock('Easing')
.unmock('normalizeColor');
var Interpolation = require('Interpolation');
var Easing = require('Easing');
@@ -294,4 +294,14 @@ describe('Interpolation', () => {
outputRange: ['20deg', '30rad'],
})).toThrow();
});
it('should round the alpha channel of a color to the nearest thousandth', () => {
var interpolation = Interpolation.create({
inputRange: [0, 1],
outputRange: ['rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 1)'],
});
expect(interpolation(1e-12)).toBe('rgba(0, 0, 0, 0)');
expect(interpolation(2 / 3)).toBe('rgba(0, 0, 0, 0.667)');
});
});
@@ -1,6 +1,6 @@
/* eslint-disable */
jest.dontMock('bezier');
jest.unmock('bezier');
var bezier = require('bezier');
var identity = function (x) { return x; };
+7 -3
View File
@@ -12,10 +12,12 @@
'use strict';
var BatchedBridge = require('BatchedBridge');
var BugReporting = require('BugReporting');
var ReactNative = require('ReactNative');
var invariant = require('fbjs/lib/invariant');
var renderApplication = require('renderApplication');
const infoLog = require('infoLog');
if (__DEV__) {
// In order to use Cmd+P to record/dump perf data, we need to make sure
@@ -24,6 +26,7 @@ if (__DEV__) {
}
var runnables = {};
var runCount = 1;
type ComponentProvider = () => ReactClass<any>;
@@ -79,13 +82,14 @@ var AppRegistry = {
},
runApplication: function(appKey: string, appParameters: any): void {
console.log(
const msg =
'Running application "' + appKey + '" with appParams: ' +
JSON.stringify(appParameters) + '. ' +
'__DEV__ === ' + String(__DEV__) +
', development-level warning are ' + (__DEV__ ? 'ON' : 'OFF') +
', performance optimizations are ' + (__DEV__ ? 'OFF' : 'ON')
);
', performance optimizations are ' + (__DEV__ ? 'OFF' : 'ON');
infoLog(msg);
BugReporting.addSource('AppRegistry.runApplication' + runCount++, () => msg);
invariant(
runnables[appKey] && runnables[appKey].run,
'Application ' + appKey + ' has not been registered. This ' +
+2 -2
View File
@@ -13,8 +13,7 @@
const MessageQueue = require('MessageQueue');
const BatchedBridge = new MessageQueue(
__fbBatchedBridgeConfig.remoteModuleConfig,
__fbBatchedBridgeConfig.localModulesConfig,
() => global.__fbBatchedBridgeConfig
);
// TODO: Move these around to solve the cycle in a cleaner way.
@@ -24,6 +23,7 @@ const JSTimersExecution = require('JSTimersExecution');
BatchedBridge.registerCallableModule('Systrace', Systrace);
BatchedBridge.registerCallableModule('JSTimersExecution', JSTimersExecution);
BatchedBridge.registerCallableModule('HeapCapture', require('HeapCapture'));
if (__DEV__) {
BatchedBridge.registerCallableModule('HMRClient', require('HMRClient'));
@@ -51,65 +51,14 @@ Object.keys(RemoteModules).forEach((moduleName) => {
module = config && BatchedBridge.processModuleConfig(config, module.moduleID);
RemoteModules[moduleName] = module;
}
Object.defineProperty(NativeModules, moduleName, {
configurable: true,
enumerable: true,
value: module,
});
return module;
},
});
});
/**
* Copies the ViewManager constants and commands into UIManager. This is
* only needed for iOS, which puts the constants in the ViewManager
* namespace instead of UIManager, unlike Android.
*
* We'll eventually move this logic to UIManager.js, once all
* the call sites accessing NativeModules.UIManager directly have
* been removed #9344445
*/
const UIManager = NativeModules.UIManager;
UIManager && Object.keys(UIManager).forEach(viewName => {
const viewConfig = UIManager[viewName];
if (viewConfig.Manager) {
let constants;
/* $FlowFixMe - nice try. Flow doesn't like getters */
Object.defineProperty(viewConfig, 'Constants', {
configurable: true,
enumerable: true,
get: () => {
if (constants) {
return constants;
}
constants = {};
const viewManager = NativeModules[normalizePrefix(viewConfig.Manager)];
viewManager && Object.keys(viewManager).forEach(key => {
const value = viewManager[key];
if (typeof value !== 'function') {
constants[key] = value;
}
});
return constants;
},
});
let commands;
/* $FlowFixMe - nice try. Flow doesn't like getters */
Object.defineProperty(viewConfig, 'Commands', {
configurable: true,
enumerable: true,
get: () => {
if (commands) {
return commands;
}
commands = {};
const viewManager = NativeModules[normalizePrefix(viewConfig.Manager)];
viewManager && Object.keys(viewManager).forEach((key, index) => {
const value = viewManager[key];
if (typeof value === 'function') {
commands[key] = index;
}
});
return commands;
},
});
}
});
module.exports = NativeModules;
@@ -11,13 +11,15 @@
*/
'use strict';
var BatchedBridge = require('BatchedBridge');
var ReactNativeEventEmitter = require('ReactNativeEventEmitter');
const BatchedBridge = require('BatchedBridge');
BatchedBridge.registerCallableModule(
'RCTEventEmitter',
ReactNativeEventEmitter
);
const RCTEventEmitter = {
register(eventEmitter: any) {
BatchedBridge.registerCallableModule(
'RCTEventEmitter',
eventEmitter
);
}
};
// Completely locally implemented - no native hooks.
module.exports = ReactNativeEventEmitter;
module.exports = RCTEventEmitter;
@@ -10,21 +10,19 @@ var NativeModules = {
}),
},
Timing: {
createTimer: jest.genMockFunction(),
deleteTimer: jest.genMockFunction(),
createTimer: jest.fn(),
deleteTimer: jest.fn(),
},
GraphPhotoUpload: {
upload: jest.genMockFunction(),
upload: jest.fn(),
},
FacebookSDK: {
login: jest.genMockFunction(),
logout: jest.genMockFunction(),
queryGraphPath: jest.genMockFunction().mockImpl(
(path, method, params, callback) => callback()
),
login: jest.fn(),
logout: jest.fn(),
queryGraphPath: jest.fn((path, method, params, callback) => callback()),
},
DataManager: {
queryData: jest.genMockFunction(),
queryData: jest.fn(),
},
UIManager: {
customBubblingEventTypes: {},
@@ -38,10 +36,10 @@ var NativeModules = {
},
},
AsyncLocalStorage: {
getItem: jest.genMockFunction(),
setItem: jest.genMockFunction(),
removeItem: jest.genMockFunction(),
clear: jest.genMockFunction(),
getItem: jest.fn(),
setItem: jest.fn(),
removeItem: jest.fn(),
clear: jest.fn(),
},
SourceCode: {
scriptURL: null,
@@ -52,10 +50,10 @@ var NativeModules = {
},
ModalFullscreenViewManager: {},
AlertManager: {
alertWithArgs: jest.genMockFunction(),
alertWithArgs: jest.fn(),
},
Clipboard: {
setString: jest.genMockFunction(),
setString: jest.fn(),
},
};
+105
View File
@@ -0,0 +1,105 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule BugReporting
* @flow
*/
'use strict';
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
const Map = require('Map');
const infoLog = require('infoLog');
import type EmitterSubscription from 'EmitterSubscription';
type ExtraData = { [key: string]: string };
type SourceCallback = () => string;
type DebugData = { extras: ExtraData, files: ExtraData };
function defaultExtras() {
BugReporting.addFileSource('react_hierarchy.txt', () => require('dumpReactTree')());
}
/**
* A simple class for collecting bug report data. Components can add sources that will be queried when a bug report
* is created via `collectExtraData`. For example, a list component might add a source that provides the list of rows
* that are currently visible on screen. Components should also remember to call `remove()` on the object that is
* returned by `addSource` when they are unmounted.
*/
class BugReporting {
static _extraSources: Map<string, SourceCallback> = new Map();
static _fileSources: Map<string, SourceCallback> = new Map();
static _subscription: ?EmitterSubscription = null;
static _maybeInit() {
if (!BugReporting._subscription) {
BugReporting._subscription = RCTDeviceEventEmitter
.addListener('collectBugExtraData', BugReporting.collectExtraData, null);
defaultExtras();
}
}
/**
* Maps a string key to a simple callback that should return a string payload to be attached
* to a bug report. Source callbacks are called when `collectExtraData` is called.
*
* Returns an object to remove the source when the component unmounts.
*
* Conflicts trample with a warning.
*/
static addSource(key: string, callback: SourceCallback): {remove: () => void} {
return this._addSource(key, callback, BugReporting._extraSources);
}
/**
* Maps a string key to a simple callback that should return a string payload to be attached
* to a bug report. Source callbacks are called when `collectExtraData` is called.
*
* Returns an object to remove the source when the component unmounts.
*
* Conflicts trample with a warning.
*/
static addFileSource(key: string, callback: SourceCallback): {remove: () => void} {
return this._addSource(key, callback, BugReporting._fileSources);
}
static _addSource(key: string, callback: SourceCallback, source: Map<string, SourceCallback>): {remove: () => void} {
BugReporting._maybeInit();
if (source.has(key)) {
console.warn(`BugReporting.add* called multiple times for same key '${key}'`);
}
source.set(key, callback);
return {remove: () => { source.delete(key); }};
}
/**
* This can be called from a native bug reporting flow, or from JS code.
*
* If available, this will call `NativeModules.BugReporting.setExtraData(extraData)`
* after collecting `extraData`.
*/
static collectExtraData(): DebugData {
const extraData: ExtraData = {};
for (const [key, callback] of BugReporting._extraSources) {
extraData[key] = callback();
}
const fileData: ExtraData = {};
for (const [key, callback] of BugReporting._fileSources) {
fileData[key] = callback();
}
infoLog('BugReporting extraData:', extraData);
const BugReportingNativeModule = require('NativeModules').BugReporting;
BugReportingNativeModule &&
BugReportingNativeModule.setExtraData &&
BugReportingNativeModule.setExtraData(extraData, fileData);
return { extras: extraData, files: fileData };
}
}
module.exports = BugReporting;
+142
View File
@@ -0,0 +1,142 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule dumpReactTree
* @flow
*/
'use strict';
const ReactNativeMount = require('ReactNativeMount');
const getReactData = require('getReactData');
const INDENTATION_SIZE = 2;
const MAX_DEPTH = 2;
const MAX_STRING_LENGTH = 50;
/**
* Dump all React Native root views and their content. This function tries
* it best to get the content but ultimately relies on implementation details
* of React and will fail in future versions.
*/
function dumpReactTree() {
try {
return getReactTree();
} catch (e) {
return 'Failed to dump react tree: ' + e;
}
}
function getReactTree() {
let output = '';
const rootIds = Object.getOwnPropertyNames(ReactNativeMount._instancesByContainerID);
for (const rootId of rootIds) {
const instance = ReactNativeMount._instancesByContainerID[rootId];
output += `============ Root ID: ${rootId} ============\n`;
output += dumpNode(instance, 0);
output += `============ End root ID: ${rootId} ============\n`;
}
return output;
}
function dumpNode(node: Object, identation: number) {
const data = getReactData(node);
if (data.nodeType === 'Text') {
return indent(identation) + data.text + '\n';
} else if (data.nodeType === 'Empty') {
return '';
}
let output = indent(identation) + `<${data.name}`;
if (data.nodeType === 'Composite') {
for (const propName of Object.getOwnPropertyNames(data.props || {})) {
if (isNormalProp(propName)) {
try {
const value = convertValue(data.props[propName]);
if (value) {
output += ` ${propName}=${value}`;
}
} catch (e) {
const message = `[Failed to get property: ${e}]`;
output += ` ${propName}=${message}`;
}
}
}
}
let childOutput = '';
for (const child of data.children || []) {
childOutput += dumpNode(child, identation + 1);
}
if (childOutput) {
output += '>\n' + childOutput + indent(identation) + `</${data.name}>\n`;
} else {
output += ' />\n';
}
return output;
}
function isNormalProp(name: string): boolean {
switch (name) {
case 'children':
case 'key':
case 'ref':
return false;
default:
return true;
}
}
function convertObject(object: Object, depth: number) {
if (depth >= MAX_DEPTH) {
return '[...omitted]';
}
let output = '{';
let first = true;
for (const key of Object.getOwnPropertyNames(object)) {
if (!first) {
output += ', ';
}
output += `${key}: ${convertValue(object[key], depth + 1)}`;
first = false;
}
return output + '}';
}
function convertValue(value, depth = 0): ?string {
if (!value) {
return null;
}
switch (typeof value) {
case 'string':
return JSON.stringify(possiblyEllipsis(value).replace('\n', '\\n'));
case 'boolean':
case 'number':
return JSON.stringify(value);
case 'function':
return '[function]';
case 'object':
return convertObject(value, depth);
default:
return null;
}
}
function possiblyEllipsis(value: string) {
if (value.length > MAX_STRING_LENGTH) {
return value.slice(0, MAX_STRING_LENGTH) + '...';
} else {
return value;
}
}
function indent(size: number) {
return ' '.repeat(size * INDENTATION_SIZE);
}
module.exports = dumpReactTree;
+168
View File
@@ -0,0 +1,168 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getReactData
* @flow
*/
'use strict';
/**
* Convert a react internal instance to a sanitized data object.
*
* This is shamelessly stolen from react-devtools:
* https://github.com/facebook/react-devtools/blob/master/backend/getData.js
*/
function getData(element: Object): Object {
var children = null;
var props = null;
var state = null;
var context = null;
var updater = null;
var name = null;
var type = null;
var text = null;
var publicInstance = null;
var nodeType = 'Native';
// If the parent is a native node without rendered children, but with
// multiple string children, then the `element` that gets passed in here is
// a plain value -- a string or number.
if (typeof element !== 'object') {
nodeType = 'Text';
text = element + '';
} else if (element._currentElement === null || element._currentElement === false) {
nodeType = 'Empty';
} else if (element._renderedComponent) {
nodeType = 'NativeWrapper';
children = [element._renderedComponent];
props = element._instance.props;
state = element._instance.state;
context = element._instance.context;
if (context && Object.keys(context).length === 0) {
context = null;
}
} else if (element._renderedChildren) {
children = childrenList(element._renderedChildren);
} else if (element._currentElement && element._currentElement.props) {
// This is a native node without rendered children -- meaning the children
// prop is just a string or (in the case of the <option>) a list of
// strings & numbers.
children = element._currentElement.props.children;
}
if (!props && element._currentElement && element._currentElement.props) {
props = element._currentElement.props;
}
// != used deliberately here to catch undefined and null
if (element._currentElement != null) {
type = element._currentElement.type;
if (typeof type === 'string') {
name = type;
} else if (element.getName) {
nodeType = 'Composite';
name = element.getName();
// 0.14 top-level wrapper
// TODO(jared): The backend should just act as if these don't exist.
if (element._renderedComponent && element._currentElement.props === element._renderedComponent._currentElement) {
nodeType = 'Wrapper';
}
if (name === null) {
name = 'No display name';
}
} else if (element._stringText) {
nodeType = 'Text';
text = element._stringText;
} else {
name = type.displayName || type.name || 'Unknown';
}
}
if (element._instance) {
var inst = element._instance;
updater = {
setState: inst.setState && inst.setState.bind(inst),
forceUpdate: inst.forceUpdate && inst.forceUpdate.bind(inst),
setInProps: inst.forceUpdate && setInProps.bind(null, element),
setInState: inst.forceUpdate && setInState.bind(null, inst),
setInContext: inst.forceUpdate && setInContext.bind(null, inst),
};
publicInstance = inst;
// TODO: React ART currently falls in this bucket, but this doesn't
// actually make sense and we should clean this up after stabilizing our
// API for backends
if (inst._renderedChildren) {
children = childrenList(inst._renderedChildren);
}
}
return {
nodeType,
type,
name,
props,
state,
context,
children,
text,
updater,
publicInstance,
};
}
function setInProps(internalInst, path: Array<string | number>, value: any) {
var element = internalInst._currentElement;
internalInst._currentElement = {
...element,
props: copyWithSet(element.props, path, value),
};
internalInst._instance.forceUpdate();
}
function setInState(inst, path: Array<string | number>, value: any) {
setIn(inst.state, path, value);
inst.forceUpdate();
}
function setInContext(inst, path: Array<string | number>, value: any) {
setIn(inst.context, path, value);
inst.forceUpdate();
}
function setIn(obj: Object, path: Array<string | number>, value: any) {
var last = path.pop();
var parent = path.reduce((obj_, attr) => obj_ ? obj_[attr] : null, obj);
if (parent) {
parent[last] = value;
}
}
function childrenList(children) {
var res = [];
for (var name in children) {
res.push(children[name]);
}
return res;
}
function copyWithSetImpl(obj, path, idx, value) {
if (idx >= path.length) {
return value;
}
var key = path[idx];
var updated = Array.isArray(obj) ? obj.slice() : {...obj};
// $FlowFixMe number or string is fine here
updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
return updated;
}
function copyWithSet(obj: Object | Array<any>, path: Array<string | number>, value: any): Object | Array<any> {
return copyWithSetImpl(obj, path, 0, value);
}
module.exports = getData;
@@ -11,6 +11,7 @@
#import <AssetsLibrary/AssetsLibrary.h>
#import <libkern/OSAtomic.h>
#import <MobileCoreServices/MobileCoreServices.h>
#import "RCTBridge.h"
#import "RCTUtils.h"
@@ -53,10 +54,13 @@ RCT_EXPORT_MODULE()
ALAssetRepresentation *representation = [asset defaultRepresentation];
NSInteger length = (NSInteger)representation.size;
CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass((__bridge CFStringRef _Nonnull)(representation.UTI), kUTTagClassMIMEType);
NSURLResponse *response =
[[NSURLResponse alloc] initWithURL:request.URL
MIMEType:representation.UTI
MIMEType:(__bridge NSString *)(MIMEType)
expectedContentLength:length
textEncodingName:nil];
+9 -2
View File
@@ -108,8 +108,15 @@ didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info
BOOL isMovie = [mediaType isEqualToString:(NSString *)kUTTypeMovie];
NSString *key = isMovie ? UIImagePickerControllerMediaURL : UIImagePickerControllerReferenceURL;
NSURL *imageURL = info[key];
UIImage *image = info[UIImagePickerControllerOriginalImage];
NSNumber *width = 0;
NSNumber *height = 0;
if (image) {
height = @(image.size.height);
width = @(image.size.width);
}
if (imageURL) {
[self _dismissPicker:picker args:@[imageURL.absoluteString]];
[self _dismissPicker:picker args:@[imageURL.absoluteString, RCTNullIfNil(height), RCTNullIfNil(width)]];
return;
}
@@ -120,7 +127,7 @@ didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info
// WARNING: Using ImageStoreManager may cause a memory leak because the
// image isn't automatically removed from store once we're done using it.
[_bridge.imageStoreManager storeImage:originalImage withBlock:^(NSString *tempImageTag) {
[self _dismissPicker:picker args:tempImageTag ? @[tempImageTag] : nil];
[self _dismissPicker:picker args:tempImageTag ? @[tempImageTag, height, width] : nil];
}];
}
@@ -16,7 +16,6 @@
var NativeMethodsMixin = require('NativeMethodsMixin');
var PropTypes = require('ReactPropTypes');
var React = require('React');
var RCTDatePickerIOSConsts = require('UIManager').RCTDatePicker.Constants;
var StyleSheet = require('StyleSheet');
var View = require('View');
@@ -142,8 +141,8 @@ var DatePickerIOS = React.createClass({
var styles = StyleSheet.create({
datePickerIOS: {
height: RCTDatePickerIOSConsts.ComponentHeight,
width: RCTDatePickerIOSConsts.ComponentWidth,
height: 216,
width: 320,
},
});
@@ -127,7 +127,7 @@ var DrawerLayoutAndroid = React.createClass({
* - idle, meaning there is no interaction with the navigation view happening at the time
* - dragging, meaning there is currently an interaction with the navigation view
* - settling, meaning that there was an interaction with the navigation view, and the
* navigation view is now finishing it's closing or opening animation
* navigation view is now finishing its closing or opening animation
*/
onDrawerStateChanged: ReactPropTypes.func,
/**
@@ -6,14 +6,12 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule IOSDefaultEventPluginOrder
* @providesModule Keyboard
* @flow
*/
'use strict';
var IOSDefaultEventPluginOrder = [
'ResponderEventPlugin',
'IOSNativeBridgeEventPlugin'
];
const NativeEventEmitter = require('NativeEventEmitter');
const KeyboardObserver = require('NativeModules').KeyboardObserver;
module.exports = IOSDefaultEventPluginOrder;
module.exports = new NativeEventEmitter(KeyboardObserver);
+1
View File
@@ -351,6 +351,7 @@ const MapView = React.createClass({
}
var viewIndex = children.length;
children.push(React.cloneElement(view, {
// $FlowFixMe - An array of styles should be fine
style: [styles.annotationView, view.props.style || {}]
}));
}
@@ -308,6 +308,15 @@ var NavigatorIOS = React.createClass({
*/
translucent: PropTypes.bool,
/**
* A Boolean value that indicates whether the interactive pop gesture is enabled. Useful
* for enabling/disabling the back swipe navigation gesture. If this prop is not provided,
* the default behavior is for the back swipe gesture to be enabled when the navigation bar
* is shown and disabled when the navigation bar is hidden. Once you've provided
* the interactivePopGestureEnabled prop, you can never restore the default behavior.
*/
interactivePopGestureEnabled: PropTypes.bool,
},
navigator: (undefined: ?Object),
@@ -686,7 +695,8 @@ var NavigatorIOS = React.createClass({
style={styles.transitioner}
vertical={this.props.vertical}
requestedTopOfStack={this.state.requestedTopOfStack}
onNavigationComplete={this._handleNavigationComplete}>
onNavigationComplete={this._handleNavigationComplete}
interactivePopGestureEnabled={this.props.interactivePopGestureEnabled}>
{items}
</NavigatorTransitionerIOS>
</StaticContainer>
@@ -52,7 +52,11 @@ var PickerAndroid = React.createClass({
},
getInitialState: function() {
return this._stateFromProps(this.props);
var state = this._stateFromProps(this.props);
return {
...state,
initialSelectedIndex: state.selectedIndex,
};
},
componentWillReceiveProps: function(nextProps) {
@@ -87,7 +91,7 @@ var PickerAndroid = React.createClass({
mode: this.props.mode,
onSelect: this._onChange,
prompt: this.props.prompt,
selected: this.state.selectedIndex,
selected: this.state.initialSelectedIndex,
testID: this.props.testID,
style: [styles.pickerAndroid, this.props.style],
};
@@ -105,15 +109,24 @@ var PickerAndroid = React.createClass({
this.props.onValueChange(null, position);
}
}
this._lastNativePosition = event.nativeEvent.position;
this.forceUpdate();
},
componentDidMount: function() {
this._lastNativePosition = this.state.initialSelectedIndex;
},
componentDidUpdate: function() {
// The picker is a controlled component. This means we expect the
// on*Change handlers to be in charge of updating our
// `selectedValue` prop. That way they can also
// disallow/undo/mutate the selection of certain values. In other
// words, the embedder of this component should be the source of
// truth, not the native component.
if (this.refs[REF_PICKER] && this.state.selectedIndex !== event.nativeEvent.position) {
if (this.refs[REF_PICKER] && this.state.selectedIndex !== this._lastNativePosition) {
this.refs[REF_PICKER].setNativeProps({selected: this.state.selectedIndex});
this._lastNativePosition = this.state.selectedIndex;
}
},
});
@@ -15,7 +15,6 @@
var NativeMethodsMixin = require('NativeMethodsMixin');
var React = require('React');
var ReactChildren = require('ReactChildren');
var RCTPickerIOSConsts = require('NativeModules').UIManager.RCTPicker.Constants;
var StyleSheet = require('StyleSheet');
var StyleSheetPropType = require('StyleSheetPropType');
var TextStylePropTypes = require('TextStylePropTypes');
@@ -108,7 +107,7 @@ var styles = StyleSheet.create({
// The picker will conform to whatever width is given, but we do
// have to set the component's height explicitly on the
// surrounding view to ensure it gets rendered.
height: RCTPickerIOSConsts.ComponentHeight,
height: 216,
},
});
@@ -13,7 +13,6 @@
var Image = require('Image');
var NativeMethodsMixin = require('NativeMethodsMixin');
var NativeModules = require('NativeModules');
var PropTypes = require('ReactPropTypes');
var React = require('React');
var StyleSheet = require('StyleSheet');
@@ -72,7 +71,7 @@ var ProgressViewIOS = React.createClass({
var styles = StyleSheet.create({
progressView: {
height: NativeModules.ProgressViewManager.ComponentHeight
height: 2,
},
});
@@ -20,7 +20,7 @@ const View = require('View');
const requireNativeComponent = require('requireNativeComponent');
if (Platform.OS === 'android') {
var RefreshLayoutConsts = require('NativeModules').UIManager.AndroidSwipeRefreshLayout.Constants;
var RefreshLayoutConsts = require('UIManager').AndroidSwipeRefreshLayout.Constants;
} else {
var RefreshLayoutConsts = {SIZE: {}};
}
@@ -86,7 +86,7 @@ const RefreshControl = React.createClass({
/**
* Whether the view should be indicating an active refresh.
*/
refreshing: React.PropTypes.bool,
refreshing: React.PropTypes.bool.isRequired,
/**
* The color of the refresh indicator.
* @platform ios
@@ -121,10 +121,32 @@ const RefreshControl = React.createClass({
* Size of the refresh indicator, see RefreshControl.SIZE.
* @platform android
*/
size: React.PropTypes.oneOf(RefreshLayoutConsts.SIZE.DEFAULT, RefreshLayoutConsts.SIZE.LARGE),
size: React.PropTypes.oneOf([RefreshLayoutConsts.SIZE.DEFAULT, RefreshLayoutConsts.SIZE.LARGE]),
/**
* Progress view top offset
* @platform android
*/
progressViewOffset: React.PropTypes.number,
},
_nativeRef: {},
_nativeRef: (null: any),
_lastNativeRefreshing: false,
componentDidMount() {
this._lastNativeRefreshing = this.props.refreshing;
},
componentDidUpdate(prevProps: {refreshing: boolean}) {
// RefreshControl is a controlled component so if the native refreshing
// value doesn't match the current js refreshing prop update it to
// the js value.
if (this.props.refreshing !== prevProps.refreshing) {
this._lastNativeRefreshing = this.props.refreshing;
} else if (this.props.refreshing !== this._lastNativeRefreshing) {
this._nativeRef.setNativeProps({refreshing: this.props.refreshing});
this._lastNativeRefreshing = this.props.refreshing;
}
},
render() {
return (
@@ -137,11 +159,13 @@ const RefreshControl = React.createClass({
},
_onRefresh() {
this._lastNativeRefreshing = true;
this.props.onRefresh && this.props.onRefresh();
if (this._nativeRef) {
this._nativeRef.setNativeProps({refreshing: this.props.refreshing});
}
// The native component will start refreshing so force an update to
// make sure it stays in sync with the js component.
this.forceUpdate();
},
});
+5 -9
View File
@@ -13,8 +13,7 @@
var Dimensions = require('Dimensions');
var Platform = require('Platform');
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
var React = require('React');
var Keyboard = require('Keyboard');
var ReactNative = require('ReactNative');
var Subscribable = require('Subscribable');
var TextInputState = require('TextInputState');
@@ -23,9 +22,6 @@ var UIManager = require('UIManager');
var { ScrollViewManager } = require('NativeModules');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
import type ReactComponent from 'ReactComponent';
/**
* Mixin that can be integrated in order to handle scrolling that plays well
@@ -480,10 +476,10 @@ var ScrollResponderMixin = {
componentWillMount: function() {
this.keyboardWillOpenTo = null;
this.additionalScrollOffset = 0;
this.addListenerOn(RCTDeviceEventEmitter, 'keyboardWillShow', this.scrollResponderKeyboardWillShow);
this.addListenerOn(RCTDeviceEventEmitter, 'keyboardWillHide', this.scrollResponderKeyboardWillHide);
this.addListenerOn(RCTDeviceEventEmitter, 'keyboardDidShow', this.scrollResponderKeyboardDidShow);
this.addListenerOn(RCTDeviceEventEmitter, 'keyboardDidHide', this.scrollResponderKeyboardDidHide);
this.addListenerOn(Keyboard, 'keyboardWillShow', this.scrollResponderKeyboardWillShow);
this.addListenerOn(Keyboard, 'keyboardWillHide', this.scrollResponderKeyboardWillHide);
this.addListenerOn(Keyboard, 'keyboardDidShow', this.scrollResponderKeyboardDidShow);
this.addListenerOn(Keyboard, 'keyboardDidHide', this.scrollResponderKeyboardDidHide);
},
/**
@@ -5,7 +5,6 @@
*/
'use strict';
var NativeMethodsMixin = require('NativeMethodsMixin');
var React = require('React');
var ScrollResponder = require('ScrollResponder');
var ScrollView = require('ScrollView');
+87 -57
View File
@@ -11,30 +11,26 @@
*/
'use strict';
var ColorPropType = require('ColorPropType');
var EdgeInsetsPropType = require('EdgeInsetsPropType');
var Platform = require('Platform');
var PointPropType = require('PointPropType');
var RCTScrollView = require('NativeModules').UIManager.RCTScrollView;
var RCTScrollViewManager = require('NativeModules').ScrollViewManager;
var React = require('React');
var ReactNative = require('ReactNative');
var ScrollResponder = require('ScrollResponder');
var StyleSheet = require('StyleSheet');
var StyleSheetPropType = require('StyleSheetPropType');
var View = require('View');
var ViewStylePropTypes = require('ViewStylePropTypes');
const ColorPropType = require('ColorPropType');
const EdgeInsetsPropType = require('EdgeInsetsPropType');
const Platform = require('Platform');
const PointPropType = require('PointPropType');
const RCTScrollViewManager = require('NativeModules').ScrollViewManager;
const React = require('React');
const ReactNative = require('ReactNative');
const ScrollResponder = require('ScrollResponder');
const StyleSheet = require('StyleSheet');
const StyleSheetPropType = require('StyleSheetPropType');
const View = require('View');
const ViewStylePropTypes = require('ViewStylePropTypes');
var deprecatedPropType = require('deprecatedPropType');
var dismissKeyboard = require('dismissKeyboard');
var flattenStyle = require('flattenStyle');
var invariant = require('fbjs/lib/invariant');
var requireNativeComponent = require('requireNativeComponent');
var processDecelerationRate = require('processDecelerationRate');
var PropTypes = React.PropTypes;
var SCROLLVIEW = 'ScrollView';
var INNERVIEW = 'InnerScrollView';
const deprecatedPropType = require('deprecatedPropType');
const dismissKeyboard = require('dismissKeyboard');
const flattenStyle = require('flattenStyle');
const invariant = require('fbjs/lib/invariant');
const processDecelerationRate = require('processDecelerationRate');
const PropTypes = React.PropTypes;
const requireNativeComponent = require('requireNativeComponent');
/**
* Component that wraps platform ScrollView while providing
@@ -51,7 +47,7 @@ var INNERVIEW = 'InnerScrollView';
* Doesn't yet support other contained responders from blocking this scroll
* view from becoming the responder.
*/
var ScrollView = React.createClass({
const ScrollView = React.createClass({
propTypes: {
...View.propTypes,
/**
@@ -63,7 +59,7 @@ var ScrollView = React.createClass({
automaticallyAdjustContentInsets: PropTypes.bool,
/**
* The amount by which the scroll view content is inset from the edges
* of the scroll view. Defaults to `{0, 0, 0, 0}`.
* of the scroll view. Defaults to `{top: 0, left: 0, bottom: 0, right: 0}`.
* @platform ios
*/
contentInset: EdgeInsetsPropType,
@@ -119,7 +115,7 @@ var ScrollView = React.createClass({
* </ScrollView>
* );
* ...
* var styles = StyleSheet.create({
* const styles = StyleSheet.create({
* contentContainer: {
* paddingVertical: 20
* }
@@ -210,8 +206,11 @@ var ScrollView = React.createClass({
*/
onScrollAnimationEnd: PropTypes.func,
/**
* Called when scrollable content view of the ScrollView changes. It's
* implemented using onLayout handler attached to the content container
* Called when scrollable content view of the ScrollView changes.
*
* Handler function is passed the content width and content height as parameters: `(contentWidth, contentHeight)`
*
* It's implemented using onLayout handler attached to the content container
* which this ScrollView renders.
*/
onContentSizeChange: PropTypes.func,
@@ -219,7 +218,6 @@ var ScrollView = React.createClass({
* When true, the scroll view stops on multiples of the scroll view's size
* when scrolling. This can be used for horizontal pagination. The default
* value is false.
* @platform ios
*/
pagingEnabled: PropTypes.bool,
/**
@@ -329,6 +327,15 @@ var ScrollView = React.createClass({
* @platform android
*/
endFillColor: ColorPropType,
/**
* Tag used to log scroll performance on this scroll view. Will force
* momentum events to be turned on (see sendMomentumEvents). This doesn't do
* anything out of the box and you need to implement a custom native
* FpsListener for it to be useful.
* @platform android
*/
scrollPerfTag: PropTypes.string,
},
mixins: [ScrollResponder.Mixin],
@@ -338,7 +345,7 @@ var ScrollView = React.createClass({
},
setNativeProps: function(props: Object) {
this.refs[SCROLLVIEW].setNativeProps(props);
this._scrollViewRef && this._scrollViewRef.setNativeProps(props);
},
/**
@@ -356,16 +363,16 @@ var ScrollView = React.createClass({
* implement this method so that they can be composed while providing access
* to the underlying scroll responder's methods.
*/
getScrollResponder: function(): ReactComponent {
getScrollResponder: function(): ScrollView {
return this;
},
getScrollableNode: function(): any {
return ReactNative.findNodeHandle(this.refs[SCROLLVIEW]);
return ReactNative.findNodeHandle(this._scrollViewRef);
},
getInnerViewNode: function(): any {
return ReactNative.findNodeHandle(this.refs[INNERVIEW]);
return ReactNative.findNodeHandle(this._innerViewRef);
},
/**
@@ -389,7 +396,6 @@ var ScrollView = React.createClass({
} else {
({x, y, animated} = y || {});
}
// $FlowFixMe - Don't know how to pass Mixin correctly. Postpone for now
this.getScrollResponder().scrollResponderScrollTo({x: x || 0, y: y || 0, animated: animated !== false});
},
@@ -404,7 +410,7 @@ var ScrollView = React.createClass({
_handleScroll: function(e: Object) {
if (__DEV__) {
if (this.props.onScroll && !this.props.scrollEventThrottle && Platform.OS === 'ios') {
console.log(
console.log( // eslint-disable-line no-console-disallow
'You specified `onScroll` on a <ScrollView> but not ' +
'`scrollEventThrottle`. You will only receive one event. ' +
'Using `16` you get all the events but be aware that it may ' +
@@ -422,18 +428,29 @@ var ScrollView = React.createClass({
},
_handleContentOnLayout: function(e: Object) {
var {width, height} = e.nativeEvent.layout;
const {width, height} = e.nativeEvent.layout;
this.props.onContentSizeChange && this.props.onContentSizeChange(width, height);
},
_scrollViewRef: (null: ?ScrollView),
_setScrollViewRef: function(ref: ?ScrollView) {
this._scrollViewRef = ref;
},
_innerViewRef: (null: ?View),
_setInnerViewRef: function(ref: ?View) {
this._innerViewRef = ref;
},
render: function() {
var contentContainerStyle = [
const contentContainerStyle = [
this.props.horizontal && styles.contentContainerHorizontal,
this.props.contentContainerStyle,
];
let style, childLayoutProps;
if (__DEV__ && this.props.style) {
var style = flattenStyle(this.props.style);
var childLayoutProps = ['alignItems', 'justifyContent']
style = flattenStyle(this.props.style);
childLayoutProps = ['alignItems', 'justifyContent']
.filter((prop) => style && style[prop] !== undefined);
invariant(
childLayoutProps.length === 0,
@@ -442,34 +459,34 @@ var ScrollView = React.createClass({
);
}
var contentSizeChangeProps = {};
let contentSizeChangeProps = {};
if (this.props.onContentSizeChange) {
contentSizeChangeProps = {
onLayout: this._handleContentOnLayout,
};
}
var contentContainer =
const contentContainer =
<View
{...contentSizeChangeProps}
ref={INNERVIEW}
ref={this._setInnerViewRef}
style={contentContainerStyle}
removeClippedSubviews={this.props.removeClippedSubviews}
collapsable={false}>
{this.props.children}
</View>;
var alwaysBounceHorizontal =
const alwaysBounceHorizontal =
this.props.alwaysBounceHorizontal !== undefined ?
this.props.alwaysBounceHorizontal :
this.props.horizontal;
var alwaysBounceVertical =
const alwaysBounceVertical =
this.props.alwaysBounceVertical !== undefined ?
this.props.alwaysBounceVertical :
!this.props.horizontal;
var props = {
const props = {
...this.props,
alwaysBounceHorizontal,
alwaysBounceVertical,
@@ -493,7 +510,7 @@ var ScrollView = React.createClass({
sendMomentumEvents: (this.props.onMomentumScrollBegin || this.props.onMomentumScrollEnd) ? true : false,
};
var onRefreshStart = this.props.onRefreshStart;
const onRefreshStart = this.props.onRefreshStart;
if (onRefreshStart) {
// this is necessary because if we set it on props, even when empty,
// it'll trigger the default pull-to-refresh behavior on native.
@@ -501,12 +518,12 @@ var ScrollView = React.createClass({
function() { onRefreshStart && onRefreshStart(this.endRefreshing); }.bind(this);
}
var { decelerationRate } = this.props;
const { decelerationRate } = this.props;
if (decelerationRate) {
props.decelerationRate = processDecelerationRate(decelerationRate);
}
var ScrollViewClass;
let ScrollViewClass;
if (Platform.OS === 'ios') {
ScrollViewClass = RCTScrollView;
} else if (Platform.OS === 'android') {
@@ -521,12 +538,12 @@ var ScrollView = React.createClass({
'ScrollViewClass must not be undefined'
);
var refreshControl = this.props.refreshControl;
const refreshControl = this.props.refreshControl;
if (refreshControl) {
if (Platform.OS === 'ios') {
// On iOS the RefreshControl is a child of the ScrollView.
return (
<ScrollViewClass {...props} ref={SCROLLVIEW}>
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
{refreshControl}
{contentContainer}
</ScrollViewClass>
@@ -538,21 +555,21 @@ var ScrollView = React.createClass({
return React.cloneElement(
refreshControl,
{style: props.style},
<ScrollViewClass {...props} style={styles.base} ref={SCROLLVIEW}>
<ScrollViewClass {...props} style={styles.base} ref={this._setScrollViewRef}>
{contentContainer}
</ScrollViewClass>
);
}
}
return (
<ScrollViewClass {...props} ref={SCROLLVIEW}>
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
{contentContainer}
</ScrollViewClass>
);
}
});
var styles = StyleSheet.create({
const styles = StyleSheet.create({
base: {
flex: 1,
},
@@ -562,16 +579,29 @@ var styles = StyleSheet.create({
},
});
let nativeOnlyProps, AndroidScrollView, AndroidHorizontalScrollView, RCTScrollView;
if (Platform.OS === 'android') {
var nativeOnlyProps = { nativeOnly : { 'sendMomentumEvents' : true } };
var AndroidScrollView = requireNativeComponent('RCTScrollView', ScrollView, nativeOnlyProps);
var AndroidHorizontalScrollView = requireNativeComponent(
nativeOnlyProps = {
nativeOnly: {
sendMomentumEvents: true,
}
};
AndroidScrollView = requireNativeComponent('RCTScrollView', ScrollView, nativeOnlyProps);
AndroidHorizontalScrollView = requireNativeComponent(
'AndroidHorizontalScrollView',
ScrollView,
nativeOnlyProps
);
} else if (Platform.OS === 'ios') {
var RCTScrollView = requireNativeComponent('RCTScrollView', ScrollView);
nativeOnlyProps = {
nativeOnly: {
onMomentumScrollBegin: true,
onMomentumScrollEnd : true,
onScrollBeginDrag: true,
onScrollEndDrag: true,
}
};
RCTScrollView = requireNativeComponent('RCTScrollView', ScrollView, nativeOnlyProps);
}
module.exports = ScrollView;
@@ -12,7 +12,6 @@
'use strict';
var NativeMethodsMixin = require('NativeMethodsMixin');
var NativeModules = require('NativeModules');
var PropTypes = require('ReactPropTypes');
var React = require('React');
var StyleSheet = require('StyleSheet');
@@ -120,7 +119,7 @@ var SegmentedControlIOS = React.createClass({
var styles = StyleSheet.create({
segmentedControl: {
height: NativeModules.SegmentedControlManager.ComponentHeight
height: 28,
},
});
@@ -11,4 +11,6 @@
*/
'use strict';
module.exports = null;
const NativeEventEmitter = require('NativeEventEmitter');
module.exports = new NativeEventEmitter('StatusBarManager');
@@ -11,24 +11,26 @@
*/
'use strict';
const NativeEventEmitter = require('NativeEventEmitter');
const StatusBar = require('StatusBar');
const StatusBarManager = require('NativeModules').StatusBarManager;
import type {StatusBarStyle, StatusBarAnimation} from 'StatusBar';
/**
* Deprecated. Use `StatusBar` instead.
*/
const StatusBarIOS = {
class StatusBarIOS extends NativeEventEmitter {
setStyle(style: StatusBarStyle, animated?: boolean) {
console.warn('`StatusBarIOS.setStyle` is deprecated. Use `StatusBar.setBarStyle` instead.');
StatusBar.setBarStyle(style, animated);
},
}
setHidden(hidden: boolean, animation?: StatusBarAnimation) {
console.warn('`StatusBarIOS.setHidden` is deprecated. Use `StatusBar.setHidden` instead.');
StatusBar.setHidden(hidden, animation);
},
}
setNetworkActivityIndicatorVisible(visible: boolean) {
console.warn(
@@ -36,7 +38,7 @@ const StatusBarIOS = {
'Use `StatusBar.setNetworkActivityIndicatorVisible` instead.'
);
StatusBar.setNetworkActivityIndicatorVisible(visible);
},
};
}
}
module.exports = StatusBarIOS;
module.exports = new StatusBarIOS(StatusBarManager);
@@ -27,6 +27,10 @@ var TabBarIOS = React.createClass({
propTypes: {
...View.propTypes,
style: View.propTypes.style,
/**
* Color of text on unselected tabs
*/
unselectedTintColor: ColorPropType,
/**
* Color of the currently selected tab icon
*/
@@ -45,6 +49,7 @@ var TabBarIOS = React.createClass({
return (
<RCTTabBar
style={[styles.tabGroup, this.props.style]}
unselectedTintColor={this.props.unselectedTintColor}
tintColor={this.props.tintColor}
barTintColor={this.props.barTintColor}
translucent={this.props.translucent !== false}>
@@ -62,6 +62,11 @@ var TabBarItemIOS = React.createClass({
* component to set selected={true}.
*/
onPress: React.PropTypes.func,
/**
* If set to true it renders the image as original,
* it defaults to being displayed as a template
*/
renderAsOriginal: React.PropTypes.bool,
/**
* It specifies whether the children are visible or not. If you see a
* blank content, you probably forgot to add a selected one.
+45 -10
View File
@@ -120,6 +120,7 @@ var TextInput = React.createClass({
* Determines which keyboard to open, e.g.`numeric`.
*
* The following values work across platforms:
*
* - default
* - numeric
* - email-address
@@ -150,22 +151,54 @@ var TextInput = React.createClass({
'dark',
]),
/**
* Determines how the return key should look.
* @platform ios
* Determines how the return key should look. On Android you can also use
* `returnKeyLabel`.
*
* The following values work across platforms:
*
* - done
* - go
* - next
* - search
* - send
*
* The following values work on Android only:
*
* - none
* - previous
*
* The following values work on iOS only:
*
* - default
* - emergency-call
* - google
* - join
* - route
* - yahoo
*/
returnKeyType: PropTypes.oneOf([
'default',
// Cross-platform
'done',
'go',
'google',
'join',
'next',
'route',
'search',
'send',
'yahoo',
'done',
// Android-only
'none',
'previous',
// iOS-only
'default',
'emergency-call',
'google',
'join',
'route',
'yahoo',
]),
/**
* Sets the return key to the label. Use it instead of `returnKeyType`.
* @platform android
*/
returnKeyLabel: PropTypes.string,
/**
* Limits the maximum number of characters that can be entered. Use this
* instead of implementing the logic in JS to avoid flicker.
@@ -443,8 +476,8 @@ var TextInput = React.createClass({
!(props.value && childCount),
'Cannot specify both value and children.'
);
if (childCount > 1) {
children = <Text>{children}</Text>;
if (childCount >= 1) {
children = <Text style={props.style}>{children}</Text>;
}
if (props.inputView) {
children = [children, props.inputView];
@@ -531,6 +564,8 @@ var TextInput = React.createClass({
children={children}
editable={this.props.editable}
selectTextOnFocus={this.props.selectTextOnFocus}
returnKeyType={this.props.returnKeyType}
returnKeyLabel={this.props.returnKeyLabel}
/>;
return (
+2 -5
View File
@@ -360,10 +360,10 @@ var TouchableMixin = {
/**
* Place as callback for a DOM element's `onResponderGrant` event.
* @param {SyntheticEvent} e Synthetic event from event system.
* @param {string} dispatchID ID of node that e was dispatched to.
*
*/
touchableHandleResponderGrant: function(e, dispatchID) {
touchableHandleResponderGrant: function(e) {
var dispatchID = e.currentTarget;
// Since e is used in a callback invoked on another event loop
// (as in setTimeout etc), we need to call e.persist() on the
// event to make sure it doesn't get reused in the event object pool.
@@ -756,8 +756,5 @@ var Touchable = {
);
}
};
if (Touchable.TOUCH_TARGET_DEBUG) {
console.warn('Touchable.TOUCH_TARGET_DEBUG is enabled');
}
module.exports = Touchable;
@@ -55,7 +55,7 @@ var TouchableOpacity = React.createClass({
...TouchableWithoutFeedback.propTypes,
/**
* Determines what the opacity of the wrapped view should be when touch is
* active.
* active. Defaults to 0.2.
*/
activeOpacity: React.PropTypes.number,
},
@@ -123,6 +123,12 @@ var ViewPagerAndroid = React.createClass({
'none', // default
'on-drag',
]),
/**
* When false, the content does not scroll.
* The default value is true.
*/
scrollEnabled: ReactPropTypes.bool,
},
componentDidMount: function() {
@@ -201,7 +207,7 @@ var ViewPagerAndroid = React.createClass({
/**
* A helper function to scroll to a specific page in the ViewPager.
* The transition between pages will be *not* be animated.
* The transition between pages will *not* be animated.
*/
setPageWithoutAnimation: function(selectedPage: number) {
UIManager.dispatchViewManagerCommand(
@@ -264,6 +264,14 @@ var WebView = React.createClass({
);
},
stopLoading: function() {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.stopLoading,
null
);
},
/**
* We return an event with a bunch of fields including:
* url, title, loading, canGoBack, canGoForward
@@ -362,6 +362,14 @@ var WebView = React.createClass({
);
},
stopLoading: function() {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.stopLoading,
null
);
},
/**
* We return an event with a bunch of fields including:
* url, title, loading, canGoBack, canGoForward
@@ -56,10 +56,10 @@ var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
/**
* ListView - A core component designed for efficient display of vertically
* scrolling lists of changing data. The minimal API is to create a
* `ListView.DataSource`, populate it with a simple array of data blobs, and
* instantiate a `ListView` component with that data source and a `renderRow`
* callback which takes a blob from the data array and returns a renderable
* component.
* [`ListView.DataSource`](docs/listviewdatasource.html), populate it with a simple
* array of data blobs, and instantiate a `ListView` component with that data
* source and a `renderRow` callback which takes a blob from the data array and
* returns a renderable component.
*
* Minimal example:
*
@@ -117,7 +117,9 @@ var ListView = React.createClass({
*/
propTypes: {
...ScrollView.propTypes,
/**
* An instance of [ListView.DataSource](docs/listviewdatasource.html) to use
*/
dataSource: PropTypes.instanceOf(ListViewDataSource).isRequired,
/**
* (sectionID, rowID, adjacentRowHighlighted) => renderable
@@ -135,9 +137,10 @@ var ListView = React.createClass({
* a renderable component to be rendered as the row. By default the data
* is exactly what was put into the data source, but it's also possible to
* provide custom extractors. ListView can be notified when a row is
* being highlighted by calling highlightRow function. The separators above and
* below will be hidden when a row is highlighted. The highlighted state of
* a row can be reset by calling highlightRow(null).
* being highlighted by calling `highlightRow(sectionID, rowID)`. This
* sets a boolean value of adjacentRowHighlighted in renderSeparator, allowing you
* to control the separators above and below the highlighted row. The highlighted
* state of a row can be reset by calling highlightRow(null).
*/
renderRow: PropTypes.func.isRequired,
/**
@@ -593,12 +596,19 @@ var ListView = React.createClass({
var rowID = rowIDs[rowIdx];
var frame = this._childFrames[totalIndex];
totalIndex++;
if(this.props.renderSeparator &&
(rowIdx !== rowIDs.length - 1 || sectionIdx === allRowIDs.length - 1)){
totalIndex++;
}
if (!frame) {
break;
}
var rowVisible = visibleSection[rowID];
var min = isVertical ? frame.y : frame.x;
var max = min + (isVertical ? frame.height : frame.width);
if ((!min && !max) || (min === max)) {
break;
}
if (min > visibleMax || max < visibleMin) {
if (rowVisible) {
visibilityChanged = true;
@@ -35,9 +35,9 @@
const Animated = require('Animated');
const NavigationCardStackPanResponder = require('NavigationCardStackPanResponder');
const NavigationCardStackStyleInterpolator = require('NavigationCardStackStyleInterpolator');
const NavigationContainer = require('NavigationContainer');
const NavigationPagerPanResponder = require('NavigationPagerPanResponder');
const NavigationPagerStyleInterpolator = require('NavigationPagerStyleInterpolator');
const NavigationPointerEventsContainer = require('NavigationPointerEventsContainer');
const NavigationPropTypes = require('NavigationPropTypes');
const React = require('React');
const ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
@@ -50,20 +50,40 @@ import type {
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
type SceneViewProps = {
sceneRenderer: NavigationSceneRenderer,
sceneRendererProps: NavigationSceneRendererProps,
};
type Props = NavigationSceneRendererProps & {
style: any,
onComponentRef: (ref: any) => void,
panHandlers: ?NavigationPanPanHandlers,
pointerEvents: string,
renderScene: NavigationSceneRenderer,
style: any,
};
const {PropTypes} = React;
const propTypes = {
...NavigationPropTypes.SceneRenderer,
style: PropTypes.any,
panHandlers: NavigationPropTypes.panHandlers,
renderScene: PropTypes.func.isRequired,
};
class SceneView extends React.Component<any, SceneViewProps, any> {
static propTypes = {
sceneRenderer: PropTypes.func.isRequired,
sceneRendererProps:
PropTypes.shape(NavigationPropTypes.SceneRenderer).isRequired,
};
shouldComponentUpdate(nextProps: SceneViewProps, nextState: any): boolean {
return (
nextProps.sceneRendererProps.scene.navigationState !==
this.props.sceneRendererProps.scene.navigationState
);
}
render(): ?ReactElement {
return this.props.sceneRenderer(this.props.sceneRendererProps);
}
}
/**
* Component that renders the scene as card for the <NavigationCardStack />.
@@ -71,6 +91,15 @@ const propTypes = {
class NavigationCard extends React.Component<any, Props, any> {
props: Props;
static propTypes = {
...NavigationPropTypes.SceneRendererProps,
onComponentRef: PropTypes.func.isRequired,
panHandlers: NavigationPropTypes.panHandlers,
pointerEvents: PropTypes.string.isRequired,
renderScene: PropTypes.func.isRequired,
style: PropTypes.any,
};
shouldComponentUpdate(nextProps: Props, nextState: any): boolean {
return ReactComponentWithPureRenderMixin.shouldComponentUpdate.call(
this,
@@ -82,49 +111,39 @@ class NavigationCard extends React.Component<any, Props, any> {
render(): ReactElement {
const {
panHandlers,
pointerEvents,
renderScene,
style,
...props, /* NavigationSceneRendererProps */
} = this.props;
let viewStyle = null;
if (style === undefined) {
// fall back to default style.
viewStyle = NavigationCardStackStyleInterpolator.forHorizontal(props);
} else {
viewStyle = style;
}
const viewStyle = style === undefined ?
NavigationCardStackStyleInterpolator.forHorizontal(props) :
style;
const {
navigationState,
scene,
} = props;
const interactive = navigationState.index === scene.index && !scene.isStale;
const pointerEvents = interactive ? 'auto' : 'none';
let viewPanHandlers = null;
if (interactive) {
if (panHandlers === undefined) {
// fall back to default pan handlers.
viewPanHandlers = NavigationCardStackPanResponder.forHorizontal(props);
} else {
viewPanHandlers = panHandlers;
}
}
const viewPanHandlers = panHandlers === undefined ?
NavigationCardStackPanResponder.forHorizontal(props) :
panHandlers;
return (
<Animated.View
{...viewPanHandlers}
pointerEvents={pointerEvents}
ref={this.props.onComponentRef}
style={[styles.main, viewStyle]}>
{renderScene(props)}
<SceneView
sceneRenderer={renderScene}
sceneRendererProps={props}
/>
</Animated.View>
);
}
}
NavigationCard.propTypes = propTypes;
static CardStackPanResponder = NavigationCardStackPanResponder;
static CardStackStyleInterpolator = NavigationCardStackStyleInterpolator;
static PagerPanResponder = NavigationPagerPanResponder;
static PagerStyleInterpolator = NavigationPagerStyleInterpolator;
}
const styles = StyleSheet.create({
main: {
@@ -141,13 +160,6 @@ const styles = StyleSheet.create({
},
});
NavigationCard = NavigationPointerEventsContainer.create(NavigationCard);
const NavigationCardContainer = NavigationContainer.create(NavigationCard);
// Export these buil-in interaction modules.
NavigationCardContainer.CardStackPanResponder = NavigationCardStackPanResponder;
NavigationCardContainer.CardStackStyleInterpolator = NavigationCardStackStyleInterpolator;
NavigationCardContainer.PagerPanResponder = NavigationPagerPanResponder;
NavigationCardContainer.PagerStyleInterpolator = NavigationPagerStyleInterpolator;
module.exports = NavigationCardContainer;
module.exports = NavigationCard;
@@ -35,7 +35,6 @@
const NavigationAnimatedView = require('NavigationAnimatedView');
const NavigationCard = require('NavigationCard');
const NavigationCardStackStyleInterpolator = require('NavigationCardStackStyleInterpolator');
const NavigationContainer = require('NavigationContainer');
const NavigationCardStackPanResponder = require('NavigationCardStackPanResponder');
const NavigationPropTypes = require('NavigationPropTypes');
const React = require('React');
@@ -48,6 +47,7 @@ const {PropTypes} = React;
const {Directions} = NavigationCardStackPanResponder;
import type {
NavigationActionCaller,
NavigationParentState,
NavigationSceneRenderer,
NavigationSceneRendererProps,
@@ -60,10 +60,16 @@ import type {
type Props = {
direction: NavigationGestureDirection,
navigationState: NavigationParentState,
onNavigate: NavigationActionCaller,
renderOverlay: ?NavigationSceneRenderer,
renderScene: NavigationSceneRenderer,
};
type DefaultProps = {
direction: NavigationGestureDirection,
renderOverlay: ?NavigationSceneRenderer,
};
/**
* A controlled navigation view that renders a stack of cards.
*
@@ -78,17 +84,18 @@ type Props = {
* +-+ |
* +------------+
*/
class NavigationCardStack extends React.Component {
class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
_renderScene : NavigationSceneRenderer;
static propTypes = {
direction: PropTypes.oneOf([Directions.HORIZONTAL, Directions.VERTICAL]),
navigationState: NavigationPropTypes.navigationParentState.isRequired,
onNavigate: NavigationPropTypes.SceneRendererProps.onNavigate,
renderOverlay: PropTypes.func,
renderScene: PropTypes.func.isRequired,
};
static defaultProps = {
static defaultProps: DefaultProps = {
direction: Directions.HORIZONTAL,
renderOverlay: emptyFunction.thatReturnsNull,
};
@@ -101,7 +108,7 @@ class NavigationCardStack extends React.Component {
this._renderScene = this._renderScene.bind(this);
}
shouldComponentUpdate(nextProps: Object, nextState: Object): boolean {
shouldComponentUpdate(nextProps: Object, nextState: void): boolean {
return ReactComponentWithPureRenderMixin.shouldComponentUpdate.call(
this,
nextProps,
@@ -115,6 +122,8 @@ class NavigationCardStack extends React.Component {
navigationState={this.props.navigationState}
renderOverlay={this.props.renderOverlay}
renderScene={this._renderScene}
onNavigate={this.props.onNavigate}
// $FlowFixMe - style should be declared
style={[styles.animatedView, this.props.style]}
/>
);
@@ -149,4 +158,4 @@ const styles = StyleSheet.create({
},
});
module.exports = NavigationContainer.create(NavigationCardStack);
module.exports = NavigationCardStack;

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