Commit Graph

1575 Commits

Author SHA1 Message Date
Elliot Hesp d6513ca03f Add "Only supports one child" to TouchableWithoutFeedback
Summary: Closes https://github.com/facebook/react-native/pull/4985

Reviewed By: svcscm

Differential Revision: D2794384

Pulled By: bestander

fb-gh-sync-id: 7332a83df635619d1d6bfacbf6e9c71af90179d9
2016-01-06 11:52:30 -08:00
Quentin Valmori 3d0ff69e40 Map follow user location
Summary:
Fix #3105

It's the same PR as #3119 but as I force-pushed in my branch, I can't reopen the PR. I added an example.
![capture d ecran 2016-01-05 a 07 15 37](https://cloud.githubusercontent.com/assets/1107936/12108841/2727f504-b37c-11e5-8250-b53785930aba.png)
Closes https://github.com/facebook/react-native/pull/5126

Reviewed By: svcscm

Differential Revision: D2803052

Pulled By: nicklockwood

fb-gh-sync-id: 2e8978ff1b293d699462a8290b45fa74cc16b4dd
2016-01-06 11:00:34 -08:00
Ognen Ivanovski 61025a9b33 bugfix: NavigatoriOS doesn't update any scenes when 0th scene is replaced
Summary:
Calling navigator.replace(0, scene) has no effect.

This is because 0 is false in Javascript so when

    this.state.updatingAllIndicesAtOrBeyond == 0

(meaning update all indices starting with 0)

The whole expression evaluates to 0, i.e. false ->  therefore no update
happens.

Explicitly checking for not-equal to null (!= will convert undefined to null automatically) fixes the issue.
Closes https://github.com/facebook/react-native/pull/5155

Reviewed By: svcscm

Differential Revision: D2807397

Pulled By: nicklockwood

fb-gh-sync-id: 519a4ab35c86b0b608808b36593f5f8c2ecd1561
2016-01-06 10:33:36 -08:00
sunnylqm 7b63b225a5 remove a typo
Summary:
I can't guess the point. Just simply removed this typo.
Closes https://github.com/facebook/react-native/pull/4943

Reviewed By: svcscm

Differential Revision: D2786863

Pulled By: bestander

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

Reviewed By: svcscm

Differential Revision: D2803479

Pulled By: mkonicek

fb-gh-sync-id: 7da41eb0bdfb0f90b4f81d1006eaf00446820827
2016-01-06 10:25:34 -08:00
Noah Jorgenson 385fa00af8 Docs for manual linking in PushNotificationsIOS
Summary:
close #3831
Closes https://github.com/facebook/react-native/pull/5008

Reviewed By: svcscm

Differential Revision: D2794281

Pulled By: bestander

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

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

Reviewed By: svcscm

Differential Revision: D2807414

Pulled By: androidtrunkagent

fb-gh-sync-id: 091b6c6c91cebe175181f57b5c2785395b5db19b
2016-01-06 09:21:47 -08:00
Geoffrey Goh e730a9fdd0 Load assets from same folder as JSbundle (Android)
Summary:
https://github.com/facebook/react-native/issues/3679 was only partially fixed as the behaviour only works on iOS. This implements the same behaviour for Android. If the JSBundle was loaded from the assets folder, this will load images from the built-in resources. Else, load the image from the same folder as the JS bundle.

EDIT: For added clarity:

On iOS,
Bundle Location: 'file:///Path/To/Sample.app/main.bundle'
httpServerLocation: '/assets/module/a/'
Name: 'logo'
type: 'png'
**Resolved Asset location: '/Path/To/Sample.app/assets/module/a/logo.png'**

On Android,
Bundle Location: 'file:///sdcard/Path/To/main.bundle'
httpServerLocation: '/assets/module/a/',
name: 'logo'
type: 'png'
**Resolved Asset location: 'file:///sdcard/Path/To/drawable_mdpi/module_a_logo.png'**
Closes https://github.com/facebook/react-native/pull/4527

Reviewed By: svcscm

Differential Revision: D2788005

Pulled By: mkonicek

fb-gh-sync-id: 3f6462a7ee6370a92dd6727ac422c5de346c3ff1
2016-01-06 08:46:35 -08:00
Christopher Dro a3d9fadc78 Remove fixed size for Android. Fixes #3785
Summary:
Fixed #3785
Closes https://github.com/facebook/react-native/pull/4298

Reviewed By: svcscm

Differential Revision: D2807289

Pulled By: mkonicek

fb-gh-sync-id: 6f161e4f8b04597726183fdcf8bc22c682557958
2016-01-06 07:42:28 -08:00
Nick Lockwood 17df595e32 Implement Android's dispatchViewManagerCommand interface on iOS
Summary:
public
Android implement ViewManager methods via a dispatch method on UIManager, whereas iOS implements them by exposing the methods on the view manager modules directly.

This diff polyfills Android's implementation on top of the iOS implementation, allowing the same JS API to be used for both.

Reviewed By: javache

Differential Revision: D2803020

fb-gh-sync-id: 0da0544e593dc936467d16ce957a77f7ca41355b
2016-01-06 05:58:37 -08:00
Alex Kotliarskyi 28c0240361 Fix `background` warning in TouchableNativeFeedback
Summary:
The problem: no matter what value `background` prop has, it always triggers a warning

![screen shot 2016-01-05 at 1 20 35 pm](https://cloud.githubusercontent.com/assets/192222/12128053/c0a8754a-b3af-11e5-92c6-921e2e0c7cc4.png)

Looks like this happens because we use `createStrictShapeTypeChecker` prop types inside `PropTypes.oneOfType` instead of `PropTypes.shape`.
Closes https://github.com/facebook/react-native/pull/5132

Reviewed By: svcscm

Differential Revision: D2804478

Pulled By: mkonicek

fb-gh-sync-id: 32ce964047bddd9d92c214baaff5422dbcfd7e90
2016-01-06 05:58:31 -08:00
Milen Dzhumerov 7d70b86a7b RCTImageUtils Obj-C nullability annotations
Summary:
Add Objective-C nullability annotations to RCTImageUtils

public

Reviewed By: nicklockwood

Differential Revision: D2797310

fb-gh-sync-id: 08329f70d1a09bf47865c9e7e76d7b4340eb6e80
2016-01-06 03:55:30 -08:00
Pieter De Baets 8772a6a542 Wait for JSExecutor to tear down in RCTBridgeTests
Reviewed By: tadeuzagallo

Differential Revision: D2803092

fb-gh-sync-id: 71ccac2c13221bfbcb2f09a14d48ac2d2901d04e
2016-01-05 15:30:33 -08:00
odino 6edcebef9c Stop using platform-specific names for props
Summary:
Follows up on [this comment](https://github.com/facebook/react-native/pull/5065#issuecomment-168353782) by nicklockwood in #5065.

Rely on using the platform annotation and keep the API / naming less redundant.
Closes https://github.com/facebook/react-native/pull/5081

Reviewed By: svcscm

Differential Revision: D2803143

Pulled By: nicklockwood

fb-gh-sync-id: 9bdf028f5022ef46fcb63aa6c3fc931fdcc46f2b
2016-01-05 10:32:43 -08:00
Justin Spahr-Summers a5d82c2823 Add context executor API for sync hooks
Summary:
public

This exposes a proper API for adding synchronous callbacks to JS, as an optional feature of the executor.

This is based on nicklockwood's work in D2764492, but avoids refactoring bridge/executor interactions for the time being, since we agree on this API and can move the actual callsites around later.

Reviewed By: nicklockwood

Differential Revision: D2799506

fb-gh-sync-id: af209d9a0be927f3404205feb16e59745cc37aec
2016-01-05 08:00:38 -08:00
Michelle Todd 1dc5dca604 Rename methods in RCTPushNotificationManager so app store doesn't warn
Summary:
Including RCTPushNotificationManager is required for local notifications, which don't require a Push Notifications entitlement on your provisioning profile. However, if you don't have the entitlement, the app store warns you when you push an app build that contains `application:didRegisterForRemoteNotificationsWithDeviceToken:`, even if it isn't being called. This renames the methods so they have different names from the ones on UIApplication so the app store doesn't warn about them.
Closes https://github.com/facebook/react-native/pull/4897

Reviewed By: spicyj

Differential Revision: D2780533

Pulled By: nicklockwood

fb-gh-sync-id: 1a688f1ebd3cc9f86ba340ce453fdbfb46949839
2016-01-05 02:43:29 -08:00
Martín Bigio 54f2586735 Improve error message when devserver is not running
Summary:
public

If Hot Loading is enabled bu the packager server is not running, as the user updates files he'll see red boxes caused by the HMR runtime. The error those red boxes show is pretty weird for the end user. Lets improve the feedback we give!.

Reviewed By: vjeux

Differential Revision: D2795534

fb-gh-sync-id: dcc39e6682e0603bf10d0f5e623433262b745660
2016-01-04 09:56:30 -08:00
Janic Duplessis 44f7a00e95 Cross platform PullToRefreshView component
Summary:
Both iOS and Android currently support some sort of native pull to refresh control but the API was very different. I tried implementing a component based on PullToRefreshViewAndroid but that works on both platforms.

I liked the idea of wrapping the ListView or ScrollView with the PullToRefreshView component and allow styling the refresh view with platform specific props if needed. I also like the fact that 'refreshing' is a controlled prop so there is no need to keep a ref to the component or to the stopRefreshing function.

It is a pretty rough start so I'm looking for feedback and ideas to improve on the API before cleaning up everything.

On iOS we could probably deprecate the onRefreshStart property of the ScrollView and implement the native stuff in a PullToRefreshViewManager. We could then add props to customize the look of the UIRefreshControl (tintColor). We could also deprecate the Android only component and remove it later.
Closes https://github.com/facebook/react-native/pull/4915

Reviewed By: svcscm

Differential Revision: D2799246

Pulled By: nicklockwood

fb-gh-sync-id: 75872c12143ddbc05cc91900ab4612e477ca5765
2016-01-04 08:00:29 -08:00
Katrina Nova 86af597c2e Update NavigatorIOS.ios.js
Summary:
Allow props passed to the route object to overwrite props passed to the navigator.
Closes https://github.com/facebook/react-native/pull/5101

Reviewed By: svcscm

Differential Revision: D2799379

Pulled By: androidtrunkagent

fb-gh-sync-id: 147b6ba4b309657f03d7bda38f8958c4599c38c3
2016-01-04 07:42:31 -08:00
Satyajit Sahoo 68147cf39c Update references to `image!` to use require syntax
Summary: Closes https://github.com/facebook/react-native/pull/5089

Reviewed By: svcscm

Differential Revision: D2798548

Pulled By: androidtrunkagent

fb-gh-sync-id: 9e561fcfc103102d4c4bfbebc463eadb2fdd561a
2016-01-04 07:41:27 -08:00
Jason Brown b8aac8b77a Implement draggable annotations on MapView. Closes #2512
Summary: Closes https://github.com/facebook/react-native/pull/4441

Reviewed By: svcscm

Differential Revision: D2707897

Pulled By: nicklockwood

fb-gh-sync-id: 6f67f711c1ec1f821d03b9b1ea5cc39859d28fd1
2016-01-04 06:38:30 -08:00
Mike Armstrong e42c6d4446 Flows between RN Threads
Reviewed By: tadeuzagallo

Differential Revision: D2743733

fb-gh-sync-id: df4ae69a3501a37e08286857a8d4be3cd27c0ac3
2016-01-04 02:16:31 -08:00
Jay Salvat e62471b7c3 Fix pop method to properly refresh the navigatorBar
Summary:
When using nativator.pop() the navigatorBar doesn't refresh properly if we change navigationBarHidden.

When navigator.pop() is called, the navbar doesn't show up, even avec navigationBarHidden set back to true. See between Statusbar and Movie poster in the example below.

![bad](https://cloud.githubusercontent.com/assets/55496/8683849/77effa30-2a75-11e5-9f32-9be6fa87efac.gif)

    // Not actually updating the indices yet until we get the native
    // `onNavigationComplete`.
    updatingAllIndicesAtOrBeyond: null,

https://github.com/facebook/react-native/blob/master/Libraries/Components/Navigation/NavigatorIOS.ios.js#L510-L512

The View need to be refreshed in pop method anyway.

    updatingAllIndicesAtOrBeyond: this.state.requestedTopOfStack - n,

Now, navbar appears properly.

![good](https://cloud.githubusercontent.com/assets/55496/8683907/be9d2714-2a75-11e5-8fda-653e68869076.gif)
Closes https://github.com/facebook/react-native/pull/1989

Reviewed By: svcscm

Differential Revision: D2798515

Pulled By: androidtrunkagent

fb-gh-sync-id: 9d554c9d88b87628488a8cebb7e3bbe4dd9c017d
2016-01-02 22:52:30 -08:00
Kudo Chien 4972cabaa5 Add <Text> shadow support
Summary:
Add three new TextStylePropTypes for \<Text>
- textShadowOffset
- textShadowRadius
- textShadowColor
Closes https://github.com/facebook/react-native/pull/4975

Reviewed By: svcscm

Differential Revision: D2796278

Pulled By: nicklockwood

fb-gh-sync-id: f8c3fa210e664428b029b9fba8eca4a8eb81c08d
2016-01-01 09:33:31 -08:00
Nick Lockwood 718cd7953f Added getImageSize method
Summary:
public

This diff adds a `getSize()` method to `Image` to retrieve the width and height of an image prior to displaying it. This is useful when working with images from uncontrolled sources, and has been a much-requested feature.

In order to retrieve the image dimensions, the image may first need to be loaded or downloaded, after which it will be cached. This means that in principle you could use this method to preload images, however it is not optimized for that purpose, and may in future be implemented in a way that does not fully load/download the image data.

A fully supported way to preload images will be provided in a future diff.

The API (separate success and failure callbacks) is far from ideal, but until we agree on a unified standard, this was the most conventional way I could think of to implement it. If it returned a promise or something similar, it would be unique among all such APIS in the framework.

Please note that this has been a long time coming, in part due to much bikeshedding about what the API should look like, so while it's not unlikely that the API may change in future, I think having *some* way to do this is better than waiting until we can define the "perfect" way.

Reviewed By: vjeux

Differential Revision: D2797365

fb-gh-sync-id: 11eb1b8547773b1f8be0bc55ddf6dfedebf7fc0a
2015-12-31 18:51:30 -08:00
odino 6793128435 Allowing turning on / off DOM storage on android webviews
Summary:
Was developing on a WebView and couldnt get it to run. Turns out its JS code mostly depends on `localStorage` and I realized it wasnt turned on in RN. This PR adds a prop, similar to `javascriptEnabledAndroid` to be able to turn DOM storage on / off.

TBH I dont really know how it works on IOS, so I created an android specific thingy. I assume DOM storage is enabled by default on IOS.
Closes https://github.com/facebook/react-native/pull/5065

Reviewed By: svcscm

Differential Revision: D2797735

Pulled By: androidtrunkagent

fb-gh-sync-id: cd60cfa4d24d80fb82e4f54f387a4517a99e75ab
2015-12-31 18:04:29 -08:00
Nick Lockwood 55fe7ac9ae Fix flow errors
Reviewed By: gabelevi

Differential Revision: D2796260

fb-gh-sync-id: 8425e57a313326afb6f6ae5bb8b86a569f462b06
2015-12-31 07:48:29 -08:00
Ben Alpert 6a838a4201 Consume react, fbjs from npm
Summary:
We don't (yet) treat these the same as any other modules because we still have special resolution rules for them in the packager allowing the use of `providesModule`, but I believe this allows people to use npm react in their RN projects and not have duplicate copies of React. Fixes facebook/react-native#2985.

This relies on fbjs 0.6, which includes `.flow` files alongside the `.js` files to allow them to be typechecked without additional configuration. This also uses react 0.14.5, which shims a couple of files (as `.native.js`) to avoid DOM-specific bits. Once we fix these in React, we will use the same code on web and native. Hopefully we can also remove the packager support I'm adding here for `.native.js`.

This diff is not the desired end state for us – ideally the packager would know nothing of react or fbjs, and we'll get there eventually by not relying on `providesModule` in order to load react and fbjs modules. (fbjs change posted here but not merged yet: https://github.com/facebook/fbjs/pull/84.)

This should also allow relay to work seamlessly with RN, but I haven't verified this.

public

Reviewed By: sebmarkbage

Differential Revision: D2786197

fb-gh-sync-id: ff50f28445e949edc9501f4b599df7970813870d
2015-12-30 11:41:09 -08:00
olivier notteghem 5bc45f1881 improve navigation and tail fetch logging
Reviewed By: nspaun

Differential Revision: D2791366

fb-gh-sync-id: 5cacc34ef29630437e82b1fab18c928c8794d551
2015-12-30 05:08:25 -08:00
Mike Armstrong 8cabdbae1e Report jsc memory information to fbsystrace
Reviewed By: jspahrsummers

Differential Revision: D2789593

fb-gh-sync-id: e31d5f174b9cf896ce3be6431d81264d1d240fdb
2015-12-29 23:37:39 -08:00
Martín Bigio 5f850fbede Pipe `platform` and `bundleEntry` through WebSocket connection
Reviewed By: vjeux

Differential Revision: D2793572

fb-gh-sync-id: 6ce2467b8d528d1a91c1b4fc51741f2502674022
2015-12-29 18:25:28 -08:00
Brent Vatne fef01ed394 ScrollWithouth => ScrollWithout
Summary:
Oops!
Closes https://github.com/facebook/react-native/pull/5029

Reviewed By: svcscm

Differential Revision: D2793490

Pulled By: vjeux

fb-gh-sync-id: 0115d3ef38cad3e838241937263308827e56f25f
2015-12-29 12:42:26 -08:00
Martín Bigio 4ffb241647 Hot Loading E2E basic flow
Summary:
public

Implement all the necessary glue code for several diffs submitted before to get Hot Loading work end to end:

- Simplify `HMRClient`: we don't need to make it stateful allowing to enable and disable it because both when we enable and disable the interface we need to reload the bundle.
- On the native side we introduced a singleton to process the bundle URL. This new class might alter the url to include the `hot` attribute. I'm not 100% sure this is the best way to implement this but we cannot use `CTLSettings` for this as it's are not available on oss and I didn't want to contaminate `RCTBridge` with something specific to hot loading. Also, we could potentially use this processor for other things in the future. Please let me know if you don't like this approach or you have a better idea :).
- Use this processor to alter the default bundle URL and request a `hot` bundle when hot loading is enabled. Also make sure to enable the HMR interface when the client activates it on the dev menu.
- Add packager `hot` option.
- Include gaeron's `react-transform` on Facebook's JS transformer.

The current implementation couples a bit React Native to this feature because `react-transform-hmr` is required on `InitializeJavaScriptAppEngine`. Ideally, the packager should accept an additional list of requires and include them on the bundle among all their dependencies. Note this is not the same as the option `runBeforeMainModule` as that one only adds a require to the provided module but doesn't include all the dependencies that module amy have that the entry point doesn't. I'll address this in a follow up task to enable asap hot loading (9536142)

I had to remove 2 `.babelrc` files from `react-proxy` and `react-deep-force-update`. There's an internal task for fixing the underlaying issue to avoid doing this horrible hack (t9515889).

Reviewed By: vjeux

Differential Revision: D2790806

fb-gh-sync-id: d4b78a2acfa071d6b3accc2e6716ef5611ad4fda
2015-12-28 16:44:59 -08:00
Martín Bigio 90781d3067 Introduce Packager and App HMR WebSocket connection
Summary:
public

This diff adds infra to both the Packager and the running app to have a WebSocket based connection between them. This connection is toggled by a new dev menu item, namely `Enable/Disable Hot Loading`.

Reviewed By: vjeux

Differential Revision: D2787621

fb-gh-sync-id: d1dee769348e4830c28782e7b650d025f2b3a786
2015-12-28 16:44:32 -08:00
sunnylqm 8080583f52 update description about removeClippedSubviews
Summary: Closes https://github.com/facebook/react-native/pull/4998

Reviewed By: svcscm

Differential Revision: D2790689

Pulled By: androidtrunkagent

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

Reviewed By: svcscm

Differential Revision: D2790687

Pulled By: androidtrunkagent

fb-gh-sync-id: af055123b351e37081a37d6153333666a878113c
2015-12-28 06:39:32 -08:00
sunnylqm a47fcd44f9 Confusing description about task queue
Summary:
Just can't get the point. What does `the next task that might have been queued up earlier` mean? Earlier than what? `The first task`? Please correct me if I missed something.
Closes https://github.com/facebook/react-native/pull/4970

Reviewed By: svcscm

Differential Revision: D2789390

Pulled By: sahrens

fb-gh-sync-id: 3078fb6cbc7940d26d2dc393ba9448f132721ea2
2015-12-24 19:35:29 -08:00
Adam Miskiewicz c972cce405 Fix InteractionManager-test.js
Summary:
Rather than specifying what not to mock, turn off autoMock for this test suite, and only mock BatchedBridge.

Fixes #4965
Closes https://github.com/facebook/react-native/pull/4967

Reviewed By: svcscm

Differential Revision: D2789079

Pulled By: androidtrunkagent

fb-gh-sync-id: 0d7024f92b630a3c0643ea2e1fde8d673fcdf6e1
2015-12-24 09:25:19 -08:00
Spencer Ahrens 893a54d0cd Add yieldy, chained async task support to InteractionManager
Summary:
Default behavior should be unchanged.

If we queue up a bunch of expensive tasks during an interaction, the default
`InteractionManager` behavior would execute them all in one synchronous loop at
the end the JS event loop via one `setImmediate` call, blocking the JS thread
the entire time.

The `setDeadline` addition in this diff enables an option to only execute tasks
until the `eventLoopRunningTime` is hit (added to MessageQueue/BatchedBridge),
allowing the queue execution to be paused if an interaction starts in between
tasks, making the app more responsive.

Additionally, if a task ends up generating a bunch of additional tasks
asynchronously, the previous implementation would execute these new tasks after
already scheduled tasks. This is often fine, but I want it to fully resolve
async tasks and all their dependencies before making progress in the rest of the
queue, so I added support for `type PromiseTask = {gen: () => Promise}` to do
just this. It works by building a stack of queues each time a `PromiseTask` is
started, and pops them off the stack once they are resolved and the queues are
processed.

I also pulled all of the actual queue logic out of `InteractionManager` and into
a new `TaskQueue` class to isolate concerns a bit.

public

Reviewed By: josephsavona

Differential Revision: D2754311

fb-gh-sync-id: bfd6d0c54e6410cb261aa1d2c5024dd91a3959e6
2015-12-23 16:12:30 -08:00
Pieter De Baets 0cfe76399c Improve red boxes coming from RCTWebSocketExecutor
Reviewed By: tadeuzagallo

Differential Revision: D2775452

fb-gh-sync-id: b709e0e725ab76468700466b804237eed9158bfd
2015-12-23 13:32:28 -08:00
Pieter De Baets ae2f556c71 Fix scroll-to-top in MarketPlace
Reviewed By: weicool

Differential Revision: D2779979

fb-gh-sync-id: 72982a8f3142fa2cfd60fe4f68bbe1a42fc793c2
2015-12-23 12:40:33 -08:00
StefanT a162f72655 Added ColorPropType
Summary:
Problem: https://github.com/facebook/react-native/issues/4708

Solution: Added a ColorPropType that validates the color used by the dev

Notes:
1) I'm working a Win8.1 machine and couldn't build the react-native using the github repo. As soon as I figure that out, I'll probably figure how to run the tests and how to add some for this feature.
2) It's my first pull request. Be gentle :)
Closes https://github.com/facebook/react-native/pull/4866

Reviewed By: bestander, svcscm

Differential Revision: D2783672

Pulled By: nicklockwood

fb-gh-sync-id: ca22aa3c0999188075681b5d20fff0631496e238
2015-12-23 10:08:38 -08:00
Andreas Stütz 7164c755cb Add props for content insets
Summary:
This PR adds a contentInsetStart and a contentInsetEnd property to ToolbarAndroid, allowing offsetting Toolbar contents to different keylines
Closes https://github.com/facebook/react-native/pull/4699

Reviewed By: svcscm

Differential Revision: D2759294

Pulled By: mkonicek

fb-gh-sync-id: f22aa255f07929ad7a99ac7568981d35e848065b
2015-12-23 10:08:33 -08:00
Mike Fowler 134dd57cd6 Update ToolbarAndroid.android.js
Summary:
Updates the documentation for `ToolbarAndroid.android.js` with proper asset system syntax.
Closes https://github.com/facebook/react-native/pull/4908

Reviewed By: svcscm

Differential Revision: D2783113

Pulled By: mkonicek

fb-gh-sync-id: 321d79cb80025d7a065ccf012678ecebccb35bae
2015-12-23 10:08:28 -08:00
Nick Lockwood 83c2e0303b Added JS wrappers for ImageStore and ImageEditor
Summary:
public
Added JS wrappers for ImageStore(Manager) and ImageEditor(Manager) so they can be required in the normal way instead of accessed directly via NativeModules.

Reviewed By: dmmiller

Differential Revision: D2773822

fb-gh-sync-id: 6eeafd3f80a87b1b91a04a2aebad6e2fd31b0e98
2015-12-23 10:08:07 -08:00
Christoph Pojer b7e939b38d Update all tests to use Jasmine 2
Reviewed By: vjeux

Differential Revision: D2782581

fb-gh-sync-id: 1d938a2bbdd8670c917c1793234dfdcb29fd4511
2015-12-23 10:08:01 -08:00
Johan Lindskogen afbff9bf88 Add support for binary type data (ArrayBuffer)
Summary:
Entirely based on https://github.com/facebook/react-native/pull/1829
I just updated the diff to be compatible with the current master branch.
Closes https://github.com/facebook/react-native/pull/4483

Reviewed By: svcscm

Differential Revision: D2783425

Pulled By: nicklockwood

fb-gh-sync-id: 1cc67c0741cff3b071530877d688f6b8c1061e3f
2015-12-23 10:07:37 -08:00
Brent Vatne 6df737d1e7 Expose in public interface
Summary:
Allows you to do:
```
var { RecyclerViewBackedScrollView } = require('react-native')
```

Rather than:
```
var RecyclerViewBackedScrollView = require('react-native/Libraries/Components/ScrollView/RecyclerViewBackedScrollView')
```

Also...

- Export `ScrollView` by default rather than `UnimplementedView` for `RecyclerViewBackedScrollView` on iOS -- this makes it easier on the user, so you don't have to always do a conditional for: `if IOS then use ScrollView else use RecyclerViewBackedScrollView`. I can't think of a case where this would lead to undesirable behaviour.
- Add `RecyclerViewBackedScrollView` to `MainReactPackage`
- Fix an issue with `MapView` that threw a red-screen when trying to access constants on Android because there is no `MapView` in open source and MapView.js doesn't have a platform extension.
Closes https://github.com/facebook/react-native/pull/4514

Reviewed By: svcscm

Differential Revision: D2753466

Pulled By: mkonicek

fb-gh-sync-id: 0b6e2133975c911d5117e7531cb9093faf314c52
2015-12-23 10:07:34 -08:00
Calvin Freitas 7b62dc22ad Add example of getting window dimensions to Dimensions docs.
Summary:
This pull request adds an example to the Dimensions documentations.  Specifically, it gives an example of how to get the height and width from the window.

I'm submitting this documentation because discovering this information cost me some time and my hope is to save other folks time by having this info right in the docs generated from the comments in this file.

Let me know if you need anything else.
Closes https://github.com/facebook/react-native/pull/4211

Reviewed By: svcscm

Differential Revision: D2719953

Pulled By: androidtrunkagent

fb-gh-sync-id: 86d18e3847066211a013a50ce2f2a3e2032f5052
2015-12-23 10:07:12 -08:00
Christopher Chedeau d9c582ed64 Revert dimensions.js change
To unbreak the sync
2015-12-23 10:06:50 -08:00
Martin Konicek ae9d2ce35c Add example of getting window dimensions to Dimensions docs
By @calvinf

Closes https://github.com/facebook/react-native/pull/4211
2015-12-22 17:34:17 +01:00
Christopher Dro 4cb775286c Add option for both min/max track image.
Summary:
This is a followup to PR #3850 but now separates min/max track images into different properties.
Closes #4476

Add examples for `minimumTrackTintColor`, `maximumTrackTintColor`, `minimumTrackImage`, `maximumTrackImage` to UIExplorer.
Closes https://github.com/facebook/react-native/pull/4586

Reviewed By: svcscm

Differential Revision: D2779193

Pulled By: nicklockwood

fb-gh-sync-id: 0510a0f496816baacdd0d4be0f3cd3a63a5a9865
2015-12-21 10:30:39 -08:00
Martin Kralik d359c01f53 updated css-layout and fixed callsites
Reviewed By: mmahoney, nicklockwood

Differential Revision: D2759669

fb-gh-sync-id: 0b099f9c7d68bbcb62a38d2a3e355dfb6c61eb4e
2015-12-21 10:18:41 -08:00
olivier notteghem 040909904c fix listview inefficiency for tail-fetching scenarios (part1)
Reviewed By: sahrens

Differential Revision: D2775226

fb-gh-sync-id: 13cc895d8cde4ab1baf527ab468d6c7b47158aef
2015-12-21 08:41:31 -08:00
Qiao Liang da850be6f0 add doc for native event in doc 2015-12-20 16:20:56 +08:00
olivier notteghem 174d37c1d9 fix listview inefficiency for tail-fetching scenarios (part2)
Reviewed By: sahrens

Differential Revision: D2775293

fb-gh-sync-id: a18a2fd6f64b5c979267a21ecdac8c3d97d9e007
2015-12-19 17:13:28 -08:00
Nick Lockwood 97fe0eae6b Fix map annotation view layout bug
Summary:
public
When using the custom view option for MapView annotations, the view would sometimes be top-left-aligned on the coordinate instead of centered on it. This fixes that.

Reviewed By: fredliu

Differential Revision: D2776380

fb-gh-sync-id: 793bfd1c3f5b1c923caf031e01b1f6c90e544472
2015-12-19 09:16:26 -08:00
Gabe Levi ca17ed3b50 Deploy v0.20.1
Reviewed By: mroch

Differential Revision: D2775901

fb-gh-sync-id: ef4fa402a930e4b5c82513dc5cc05553fa539116
2015-12-18 17:04:29 -08:00
glevi@fb.com dc6ca95c3a Fixed Flow errors
Reviewed By: nicklockwood

Differential Revision: D2773940

fb-gh-sync-id: 3d632c57c411ddaf428c1d96d145da62dd115a14
2015-12-18 11:17:29 -08:00
Martin Konicek 920f71da57 Alert docs
Reviewed By: bestander

Differential Revision: D2773540

fb-gh-sync-id: 8baf08aa6a50955c5c9c806e8b93230086b504af
2015-12-18 06:10:31 -08:00
Nick Lockwood 9901bf20e1 Fixed image source for MapView annotations
Summary:
public
resolveAssetSource was not being called on MapView image any more, resulting in an error when using `require(./imagename.png)` syntax.

Reviewed By: fredliu

Differential Revision: D2772560

fb-gh-sync-id: 0a50a9c3ba727406343a0f47c84941e95df9cadd
2015-12-18 00:50:30 -08:00
Nick Lockwood ba3a5f0eec Removed overly-strict typing in MapViewExample
Summary:
public

While it's nice to see such a masterclass in strict typing with Flow, having it an example serves no useful purpose, and makes the example unnecessarily fragile with respect to API changes.

Reviewed By: gabelevi

Differential Revision: D2769981

fb-gh-sync-id: db5550d5674bf32ef8d331861751a4e6aa1f6536
2015-12-17 16:34:09 -08:00
Martin Konicek 8cd7730080 Open source Android WebView
Summary:
Keep `WebView.android.js` and `WebView.ios.js`, there are
some small differences. Use the same example on both platforms.

public

Reviewed By: bestander

Differential Revision: D2769446

fb-gh-sync-id: be3d0afcbfd6ddcbaa49f70555063b3081ba03cb
2015-12-17 12:47:39 -08:00
Adam Miskiewicz 8b03b9654d Merge pull request #4846 from qbig/minor-doc-animation
[Doc][Minor] updated deprecated sample code in animation doc
2015-12-17 15:07:10 -05:00
Martin Konicek 3a3af8a385 Open souce the Android Dialog module
Summary:
public

The `DialogModule` requires `android.support.v4.app.FragmentManager` which means
every app that wants to use Dialogs would need to have its Activity extend the legacy
`android.support.v4.app.FragmentActivity`.

This diff makes the `DialogModule` work with both the Support `FragmentManager`
(for AdsManager & potentially other fb apps) and the `android.app.FragmentManager`
(for new apps with no legacy dependencies).

Also wrap the native module in the same `Alert` API that we have on iOS and provide
a cross-platform example. In my opinion the iOS Alert API is quite nice and easy to use.

We still keep `AlertIOS` around because of its `prompt` function which is iOS-specific
and also for backwards compatibility.

Reviewed By: foghina

Differential Revision: D2647000

fb-gh-sync-id: e2280451890bff58bd9c933ab53cd99055403858
2015-12-17 11:11:13 -08:00
Andrew Crowell fe86771a22 Maintain cursor position when TextInput value is changed programmatically
Summary:
This is useful for applying input masks in the onChange handler that you then need to propagate down to the native component. In our case, we add commas as the user enters a price. Without this change, the cursor will end up in the wrong place when the text is transformed in our onChange handler.
Closes https://github.com/facebook/react-native/pull/4716

Reviewed By: svcscm

Differential Revision: D2766236

Pulled By: nicklockwood

fb-gh-sync-id: c4057d77d62507ec9e09eb0242888bf2858d822f
2015-12-17 10:23:26 -08:00
Qiao Liang 521983480a updated deprecated sample code in animation doc 2015-12-18 00:11:00 +08:00
Nick Lockwood f9dfb90a35 Added ability to use a custom view for MapView annotations
Summary:
public
This diff adds the ability to specify a custom React component (aka view) to be displayed as a MapView pin.

This makes it possible to use remote images (using an <Image/> component), or text (using a <Text/> component), or anything else.

One consequence of this is that MapView can no longer support arbitrary subviews. To place views in front the map, add them to a separate container view.

Reviewed By: tadeuzagallo

Differential Revision: D2764790

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

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

Reviewed By: svcscm

Differential Revision: D2766720

Pulled By: androidtrunkagent

fb-gh-sync-id: 2b60f2d238a8f8e5b27dbfb307887934be477c81
2015-12-16 15:08:44 -08:00
Marc Shilling f48dbbecd6 Fix getCurrentPosition
Summary:
Instantiates the _pendingRequests array before trying to add to it. As it currently stands, we try to add the pending request before the array is created. getCurrentPosition always fails on the first try.
Closes https://github.com/facebook/react-native/pull/4764

Reviewed By: svcscm

Differential Revision: D2764751

Pulled By: androidtrunkagent

fb-gh-sync-id: 411a03ff16d40725d8cc0909607632045eb5a27b
2015-12-16 08:37:33 -08:00
Elliot Hesp 6ddcef8a23 Update to PullToRefreshViewAndroid docs
Summary:
As mentioned in https://github.com/facebook/react-native/issues/4793 it is not initially clear that the PullToRefreshViewAndroid component needs the `{flex: 1}` style in order for it's child component to function correctly (without examining the example). This will hopefully clear that up.
Closes https://github.com/facebook/react-native/pull/4814

Reviewed By: svcscm

Differential Revision: D2764534

Pulled By: androidtrunkagent

fb-gh-sync-id: ae1c529342e85f8348b4f683e42bf25df5dbea09
2015-12-16 05:17:30 -08:00
Milen Dzhumerov 1304e78136 Inline require ExceptionsManager dependencies
Summary:
Inline require `ExceptionsManager` dependencies which are eagerly loaded on app startup (via `setUpConsole()` which is called from `InitializeJavaScriptAppEngine.js`) even though it's necessary until an exception needs to be reported.

This can save about 30-40ms on an iOS device.

public

Reviewed By: nicklockwood, tadeuzagallo, jspahrsummers

Differential Revision: D2755161

fb-gh-sync-id: d4cbfebf04d861b3a70558346a395d3d3ee87cc6
2015-12-16 04:02:30 -08:00
Tadeu Zagallo 809627379b Rename RCTContextExecutor to RCTJSCExecutor
Summary:
public

Rename the executor to so it actually says something about the implementation.

Reviewed By: jspahrsummers, nicklockwood

Differential Revision: D2759688

fb-gh-sync-id: 5b1ac447e75109fbbc2ee71c804710d9926785aa
2015-12-16 02:51:28 -08:00
Tadeu Zagallo f5673026f4 Remove expensive args from profile markers
Summary:
public

We were adding all the arguments passed to all the JS functions and callbacks
called over the bridge to marker names, and this args can be huge, meaning a lot
of time spent stringifying arguments and therefore less accurate profile results

Reviewed By: nicklockwood

Differential Revision: D2761809

fb-gh-sync-id: 2d0b5b90cc9e59fe491c108b0360b84ab5fee5b7
2015-12-16 02:13:28 -08:00
Dave Miller fcf0431d25 Add support for more Scroll Events to Android
Summary:
public
This adds support for
onScrollBeginDrag/End
onMomentumScrolBegin/End

Reviewed By: astreet

Differential Revision: D2739035

fb-gh-sync-id: 2a49d1df54e5f5cd82008bdb0ffde0881ba39aff
2015-12-16 00:48:28 -08:00
Qiao Liang edc318fcb9 added doc for image resizeMode
Summary:
based on 62e8ddc205/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.java  and http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
Closes https://github.com/facebook/react-native/pull/4799

Reviewed By: svcscm

Differential Revision: D2762795

Pulled By: androidtrunkagent

fb-gh-sync-id: 2906c9f334f0afd4d58d4864a2b8472a5a871fc0
2015-12-15 17:34:29 -08:00
Hedger Wang 53d18c83c8 Fix app crash caused by TextInput.
Reviewed By: zjj010104

Differential Revision: D2761644

fb-gh-sync-id: 89241de2f8c84d569ec452871f740a0d655cc95e
2015-12-15 17:32:27 -08:00
Hedger Wang 67c6afd14b immediatelyResetRouteStack does not update Navigator's title
Summary:
re-render the whole navigation bar while calling immediatelyResetRouteStack
from navigator.

Reviewed By: zjj010104

Differential Revision: D2751922

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

Differential Revision: D2755832

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

(i'm using the inspector)

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

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

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

**After the fix:**

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

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

Reviewed By: svcscm

Differential Revision: D2760205

Pulled By: androidtrunkagent

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

Reviewed By: svcscm

Differential Revision: D2759918

Pulled By: androidtrunkagent

fb-gh-sync-id: d692b5c7f561822353e522f9d4dfde7e60b491cf
2015-12-15 09:09:32 -08:00
Nick Lockwood 9f48c004ba Added setChildren() function
Summary:
public
Most of the time - especially during app startup - when we call UIManager.manageChildren(), we are actually just adding the first set of children to a newly created view.

This case is already optimized for in the JS code, by memoizing index arrays at various sizes, but this is not especially efficient since it is still sending an array of indices with each call that could be easily inferred on the native side instead.

I've added a hybrid native/JS optimization that improves the performance for this case. It's not a huge win in terms of time saved, but benchmarks show improvements in the ~1% range for several of the app startup metrics.

Reviewed By: tadeuzagallo

Differential Revision: D2757388

fb-gh-sync-id: 74f0cdbba93af2c04d69b192a8c2cc5cf429fa09
2015-12-15 06:56:31 -08:00
Satyajit Sahoo eb188c8d98 Add deep linking support to IntentAndroid
Summary:
Add a method to handle URLs registered to the app,

```js
IntentAndroid.getInitialURL(url => {
    if (url) {
        // do stuff
    }
});
```

Refer - http://developer.android.com/training/app-indexing/deep-linking.html#adding-filters

The API cannot be same as the iOS API (i.e. as a constant), as the activity is not availble at the time of module initialization. Moreover, multiple activties can share the same bridge instance, and the activity itself is not a constant. Hence the initialURL can change.
Closes https://github.com/facebook/react-native/pull/4320

Reviewed By: svcscm

Differential Revision: D2759667

Pulled By: foghina

fb-gh-sync-id: b725231ae1401fa5565d444eee5a30d303e263ae
2015-12-15 06:27:27 -08:00
Huang Yu f946d14fcc clean four MapView lint warnings
Summary:
clean four MapView lint warnings.
Closes https://github.com/facebook/react-native/pull/4778

Reviewed By: svcscm

Differential Revision: D2759161

Pulled By: androidtrunkagent

fb-gh-sync-id: c5b028d0400c5084436d636d3bf9a0072fa09571
2015-12-14 22:47:29 -08:00
Christopher Chedeau a539f137b3 Merge pull request #4776 from sunnylqm/patch-14
geolocation is now opensourced on android
2015-12-14 19:43:34 -08:00
zjlovezj 484fe9155b add backfaceVisibility to ImageStylePropTypes
Summary:
to eliminate to yellow box.
ViewStylePropTypes also has this prop.
0a3694ce48/Libraries/Components/View/ViewStylePropTypes.js
Closes https://github.com/facebook/react-native/pull/4765

Reviewed By: svcscm

Differential Revision: D2754433

Pulled By: androidtrunkagent

fb-gh-sync-id: 4bb53213aea6f7d629b31e0e4d4a46ae980ff219
2015-12-14 18:57:31 -08:00
sunnylqm 934f4de16e geolocation is now opensourced on android 2015-12-15 10:10:20 +08:00
Jack Hsu acf977a481 Exposes `setNativeProps` method for PullToRefreshViewAndroid
Summary:
Keep `PullToRefreshViewAndroid` consistent with other components that allow optimization through `setNativeProps`.

Also updates the example to make sure it is working.
Closes https://github.com/facebook/react-native/pull/4771

Reviewed By: svcscm

Differential Revision: D2756033

Pulled By: androidtrunkagent

fb-gh-sync-id: a1f483a3809f01bca06a6a09498f9a89fd65f572
2015-12-14 12:58:31 -08:00
Brent Vatne c8108bdbe1 Fixed controlled component on iOS and remove unnecessary code
Summary:
Closes #4290

`mostRecentEventCount` was always being set after `text` on iOS, so let's be really explicit about the order here as we were doing on Android: always call `setNativeProps` providing the `mostRecentEventCount` before we call `onChange` or `onChangeText`.

I also ripped out storing `mostRecentEventCount` in the state, which isn't necessary since we're always doing it through `setNativeProps`.
Closes https://github.com/facebook/react-native/pull/4588

Reviewed By: svcscm

Differential Revision: D2754565

Pulled By: nicklockwood

fb-gh-sync-id: a1401f39b4e19248095517c2a3503cd2af59fa47
2015-12-14 06:46:31 -08:00
Huang Yu 4373aa6822 fix animated lint warnings
Summary:
fix lint warnings under 'Libraries/Animated' directory
Closes https://github.com/facebook/react-native/pull/4448

Reviewed By: svcscm

Differential Revision: D2753880

Pulled By: androidtrunkagent

fb-gh-sync-id: c6619c636ff67a74e6f063f70526327d756271db
2015-12-13 11:45:28 -08:00
Huang Yu e0c724a4c3 fix lint warnings from DrawerLayoutAndroid
Summary:
fix 3 lint warnings from DrawerLayoutAndroid.android.js
Closes https://github.com/facebook/react-native/pull/4451

Reviewed By: svcscm

Differential Revision: D2715067

Pulled By: mkonicek

fb-gh-sync-id: 9cd0158087c8533950cdab85fdbfb137fcca20e4
2015-12-11 23:05:27 -08:00
Jan Kassens 836ba8fb38 BridgeProfiler: add sync Relay methods
Reviewed By: sahrens

Differential Revision: D2721549

fb-gh-sync-id: af6a83f8505a83e323af3992d9552654ea644324
2015-12-11 11:50:30 -08:00
Tadeu Zagallo 3549ff049c Rename BridgeProfiling to Systrace for consistency
Summary:
public

Rename the `BridgeProfiling` JS module to `Systrace`, since it's actually just
an API to Systrace markers.

This should make it clearer as we add more perf tooling.

Reviewed By: jspahrsummers

Differential Revision: D2734001

fb-gh-sync-id: 642848fa7340c545067f2a7cf5cef8af1c8a69a2
2015-12-11 03:53:19 -08:00
Sebastian Markbage ae912a83d7 Codemod Internal Unit Tests and Remove Require Fallback
Summary:
MessageQueue no longer falls back to require. To do this we need to register all the modules in our internal unit tests. I did this codemod manually.

This is a bit unfortunate boilerplate but there are very few of these modules outside of unit tests. This boilerplate is only a hassle for these test files.

public

Reviewed By: spicyj

Differential Revision: D2736397

fb-gh-sync-id: 59fa4c4e75c538f3577bc9693b93e1b7c4d4d233
2015-12-10 23:24:29 -08:00
glevi@fb.com 53825f5206 Fix errors in fbobjc
Reviewed By: nicklockwood

Differential Revision: D2745907

fb-gh-sync-id: f4687313ad817bb1d5a56bb766d8efa4a2926da7
2015-12-10 13:56:44 -08:00
Leland Richardson 3eb32cbb0e Animated.multiply and Animated.add to combine animated values
Summary:
This PR was created in response to feedback from an older PR: https://github.com/facebook/react-native/pull/2045

The `.interpolate()` API of Animated values is quite effective to accomplish transformations based on a single animated value, but currently there is a class of animations that is impossible: animations being driven by more than one value.

Usage would be like the following:

```js
getInitialState: function() {
  return {
    panY: new Animated.Value(0),
    offset: new Animated.Value(0),
  };
}
```

```js
var scale = Animated.add(panY, offset).interpolate({
  inputRange: [...],
  outputRange: [...],
});
```

I have a real use case for this, and I cannot think of any way to accomplish what I need without an API like this.

The animation I am trying to accomplish is I have a PanResponder being used to detect both x and y panning. The y-axis panning drives a 3d sroll-like animation (which we can call `panY`), and the x-axis panning is driving a "swipe-to-remove" animation (
Closes https://github.com/facebook/react-native/pull/4395

Reviewed By: svcscm

Differential Revision: D2731305

Pulled By: vjeux

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

Reviewed By: svcscm

Differential Revision: D2745080

Pulled By: vjeux

fb-gh-sync-id: 531907f03ae46d5200003cdb335c10b40c7d3bed
2015-12-10 12:46:31 -08:00
Nick Lockwood 88ac40666c Replaced RegExp method parser with recursive descent
Summary:
public

This diff replaces the RegEx module method parser with a handwritten recursive descent parser that's faster and easier to maintain.

The new parser is ~8 times faster when tested on the UIManager.managerChildren() method, and uses ~1/10 as much RAM.

The new parser also supports lightweight generics, and is more tolerant of white space.

(This means that you now can – and should – use types like `NSArray<NSString *> *` for your exported properties and method arguments, instead of `NSStringArray`).

Reviewed By: jspahrsummers

Differential Revision: D2736636

fb-gh-sync-id: f6a11431935fa8acc8ac36f3471032ec9a1c8490
2015-12-10 10:12:29 -08:00
Nick Lockwood ce7c0b735f Fixed image tinting
Summary:
public

A previous refactor introduced a bug where setting the tintColor of an <Image> to null no longer cleared the tint. This fixes it again.

Reviewed By: javache

Differential Revision: D2744279

fb-gh-sync-id: 1b5e0d546bf456d7b93e2ceee73c568c185c305c
2015-12-10 09:09:30 -08:00
Nick Lockwood da153d3928 Fixed bug where module with moduleID of zero wouldn't be loaded
Reviewed By: jspahrsummers

Differential Revision: D2744167

fb-gh-sync-id: b442af60618703ab19290d042b3614984cd9a3ae
2015-12-10 07:12:29 -08:00
Nick Lockwood ec5ca67044 Fixed JS crash on Android when requiring a native module that doesn't exist
Summary:
public

NativeModule getters call the nativeRequireModuleConfig function to lazily load a module if it's not already available, but this crashes on Android since the nativeRequireModuleConfig hook hasn't been implemented yet. This diff checks that the hook exists before calling it.

Reviewed By: gsaraf

Differential Revision: D2744080

fb-gh-sync-id: cae9c8c45a4d3c80ceb8c10f3d4d59a8d9d3c7f8
2015-12-10 06:00:31 -08:00
Mike Armstrong 7f710f9050 Add fbsystrace markers using the legacyprofiler
Reviewed By: astreet

Differential Revision: D2728033

fb-gh-sync-id: 264d40930b8fec0262cbea36529bd8b11efcc58e
2015-12-10 04:39:31 -08:00
Nick Lockwood d138403c2e Added deferred module loading feature
Reviewed By: javache

Differential Revision: D2717687

fb-gh-sync-id: 4c03c721c794a2e7ac67a0b20474129fde7f0a0d
2015-12-10 04:31:30 -08:00
Spencer Ahrens 96c9ce811a Fix Text + TouchableWithoutFeedback
Summary:
Arrow functions don't have `arguments`...whoops :(

public

Reviewed By: vjeux, ericvicenti

Differential Revision: D2741448

fb-gh-sync-id: 15e9fb0446909e4cbbbb5e30024dde58d872e725
2015-12-09 17:18:26 -08:00
Felipe Martim 96553cf553 Add rotateX and rotateY transforms to Android Views .
Summary:
Setting rotateX and rotateY for Android Views.
Closes https://github.com/facebook/react-native/pull/4413

Reviewed By: svcscm

Differential Revision: D2741328

Pulled By: mkonicek

fb-gh-sync-id: 931027c006bc571ef374a7b82cc7074b8a34bc8d
2015-12-09 16:09:30 -08:00
Martin Konicek 139f9945df Don't use arrow functions with Flow types to fix website generation
Summary:
Our custom jsdocs parser doesn't support the syntax yet.

public

Reviewed By: bestander

Differential Revision: D2739861

fb-gh-sync-id: eefc3c54b98e06597ca7d93396aa4fe3a92d4a58
2015-12-09 14:56:40 -08:00
tantan 90c7ad112f add Clipboard component for ios and android
Summary:
add Clipboard component for ios and android
 ```javascript
    import Clipboard from 'react-native'

    Clipboard.get((content)=>{
          console.log('here is content in clipboard:%s',content)
    });
    var content = 'here is a string';
    Clipboard.set(content);
```
Closes https://github.com/facebook/react-native/pull/4384

Reviewed By: svcscm

Differential Revision: D2738881

Pulled By: mkonicek

fb-gh-sync-id: a06df32d1eb2824cc9ca3de9d45e4e67fd2edbc9
2015-12-09 10:04:21 -08:00
Christopher Dro 86bb656e6f Add tintColor for buttons.
Summary:
Closes #3374
Closes https://github.com/facebook/react-native/pull/4590

Reviewed By: javache

Differential Revision: D2729616

Pulled By: mkonicek

fb-gh-sync-id: 4a3b6de10a09cad73dbd9d5d552adc3f6ba054e0
2015-12-09 05:19:25 -08:00
Harry Moreno 54ec6e7cab Docs warn navigator ios
Summary:
ping https://github.com/facebook/react-native/issues/795#issuecomment-139895307
Closes https://github.com/facebook/react-native/pull/3087

Reviewed By: svcscm

Differential Revision: D2738947

Pulled By: mkonicek

fb-gh-sync-id: e29dfd933a8da42551576bdb1fb5c270039722ee
2015-12-09 04:34:30 -08:00
Martin Kralik 14478f6701 better error message for `propTypes` check
Summary:
When you did a typo in declaring a prop type (like using `boolean` insteal of `bool`) you'd got a bit misleading error message:
{F27113768}
The truth is that the prop type is defined, but not correctly. So I've changed the message in this case to be more accurate:
{F27113627}

public

Reviewed By: sahrens

Differential Revision: D2729340

fb-gh-sync-id: dd12c10a4f3a1c9825293f86481a082908127a76
2015-12-09 04:06:31 -08:00
Sebastian Markbage 8d397b4cbc Decouple Module System from Native Calls
Summary:
The JavaScript ecosystem doesn't have the notion of a built-in native module loader. Even Node is decoupled from its module loader. The module loader system is just JS that runs on top of the global `process` object which has all the built-in goodies.

Additionally there is no such thing as a global require. That is something unique to our providesModule system. In other module systems such as node, every require is contextual. Even registered npm names are localized by version.

The only global namespace that is accessible to the host environment is the global object. Normally module systems attaches itself onto the hooks provided by the host environment on the global object.

Currently, we have two forms of dispatch that reaches directly into the module system. executeJSCall which reaches directly into require. Everything now calls through the BatchedBridge module (except one RCTLog edge case that I will fix). I propose that the executors calls directly onto `BatchedBridge` through an instance on the global so that everything is guaranteed to go through it. It becomes the main communication hub.

I also propose that we drop the dynamic requires inside of MessageQueue/BatchBridge and instead have the modules register themselves with the bridge.

executeJSCall was originally modeled after the XHP equivalent. The XHP equivalent was designed that way because the act of doing the call was the thing that defined a dependency on the module from the page. However, that is not how React Native works.

The JS side is driving the dependencies by virtue of requiring new modules and frameworks and the existence of dependencies is driven by the JS side, so this design doesn't make as much sense.

The main driver for this is to be able to introduce a new module system like Prepack's module system. However, it also unlocks the possibility to do dead module elimination even in our current module system. It is currently not possible because we don't know which module might be called from native.

Since the module system now becomes decoupled we could publish all our providesModule modules as npm/CommonJS modules using a rewrite script. That's what React Core does.

That way people could use any CommonJS bundler such as Webpack, Closure Compiler, Rollup or some new innovation to create a JS bundle.

This diff expands the executeJSCalls to the BatchedBridge's three individual pieces to make them first class instead of being dynamic. This removes one layer of abstraction. Hopefully we can also remove more of the things that register themselves with the BatchedBridge (various EventEmitters) and instead have everything go through the public protocol. ReactMethod/RCT_EXPORT_METHOD.

public

Reviewed By: vjeux

Differential Revision: D2717535

fb-gh-sync-id: 70114f05483124f5ac5c4570422bb91a60a727f6
2015-12-08 16:03:37 -08:00
Gabe Levi 99bba8ca4e Use .flow files to tell Flow about react-native module
Reviewed By: jeffmo

Differential Revision: D2735788

fb-gh-sync-id: 7a15caa5effb89b902bba7e0031822f534813c52
2015-12-08 14:51:31 -08:00
Konstantin Raev 56793e3f8d Fixed Flow error
Reviewed By: gabelevi

Differential Revision: D2734738

fb-gh-sync-id: 5ba3d4285185cd220a5bf6a26cb3818311822e52
2015-12-08 12:08:27 -08:00
Edvin Erikson c489660f26 Inspecting stateless components.
Summary:
Fixes #4602

Fixes a bug where the app crashes when you try to inspect a stateless
component.
Fixed by replacing all occurrences of the getPublicInstance method in
Libraries/Inspector/Inspector.js with the _instance property instead.
Defaults to an empty object if _instance is falsy.
Closes https://github.com/facebook/react-native/pull/4642

Reviewed By: svcscm

Differential Revision: D2734491

Pulled By: androidtrunkagent

fb-gh-sync-id: 4ea753b7e0ef3fd05af2d80abadc365c5c787f98
2015-12-08 10:13:25 -08:00
Konstantin Raev c9d796fc6a NetInfo: Cleaned up code and examples
Reviewed By: andreicoman11

Differential Revision: D2723578

fb-gh-sync-id: b7bb9ce69f24ff5dcf38409de92d57f53da003fa
2015-12-08 09:35:22 -08:00
Emilio Rodriguez e2c35dddba Added support for styling the PickerIOS
Summary:
 - PickerIOS accepts now a new prop: style
 - this prop modifies the native style of the RCTPicker allowing to modify the font size of the items (fontSize), color of the items (color, only 6 char HEX values for now) and alignment of the items (textAlign)
Closes https://github.com/facebook/react-native/pull/4490

Reviewed By: svcscm

Differential Revision: D2723190

Pulled By: nicklockwood

fb-gh-sync-id: ab9188192f1d0d087787dfed8c128073bfaa3235
2015-12-08 07:48:26 -08:00
Nick Lockwood b672294858 Added RCTImageSource
Summary:
public

The +[RCTConvert UIImage:] function, while convenient, is inherently limited by being synchronous, which means that it cannot be used to load remote images, and may not be efficient for local images either. It's also unable to access the bridge, which means that it cannot take advantage of the modular image-loading pipeline.

This diff introduces a new RCTImageSource class which can be used to pass image source objects over the bridge and defer loading until later.

I've also added automatic application of the `resolveAssetSource()` function based on prop type, and fixed up the image logic in NavigatorIOS and TabBarIOS.

Reviewed By: javache

Differential Revision: D2631541

fb-gh-sync-id: 6604635e8bb5394425102487f1ee7cd729321877
2015-12-08 03:32:30 -08:00
Spencer Ahrens 4ce03582a0 Improve Text perf
Summary:
public

Most apps create tons of text components but they are actually quite heavy because of the the Touchable mixin which requires binding tons of functions for every instance created.

This diff makes the binding lazy, so that the main handlers are only bound if there is a valid touch action configured (e.g. onPress), and the Touchable mixin functions are only bound the first time the node is actually touched and becomes the responder.

ScanLab testing shows 5-10% win on render time and memory for various products.

Reviewed By: sebmarkbage

Differential Revision: D2716823

fb-gh-sync-id: 30adb2ed2231c5635c9336369616cf31c776b930
2015-12-07 23:12:28 -08:00
Nick Lockwood f9b744d501 Use lazy getters to reduce `require('react-native')` overhead
Summary:
public

In the open source React Native implementation, the recommended approach for importing modules is by importing a the `ReactNative` object, which includes all available modules.

This is rather inefficient because it ends up initializing all the JS modules, even if you don't use them.

This diff switches the properties of the `ReactNative ` object to lazy getter functions, which defers the `require` until the module is actually requested.

This doesn't prevent unused modules from being included in the JS bundle, but it will prevent them from being initialized unless/until they are used.

Reviewed By: vjeux

Differential Revision: D2722993

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

Reviewed By: svcscm

Differential Revision: D2723280

Pulled By: mkonicek

fb-gh-sync-id: 57074ab893c3e2eae3cefc3002853bfdfed91734
2015-12-07 11:29:24 -08:00
sathis abea6c30b4 Make style property available in Image.android.js like Image.ios.js
Summary:
Thanks ahanriat for pointing out  :)
Closes https://github.com/facebook/react-native/pull/4618

Reviewed By: svcscm

Differential Revision: D2729582

Pulled By: androidtrunkagent

fb-gh-sync-id: df7b9af24cc035c7a9618a7850d628961fcd776b
2015-12-07 10:47:28 -08:00
Martin Konicek 611e0619ca Rename PullToRefreshLayoutAndroid -> PullToRefreshViewAndroid
Summary:
The naming "Layout" is an Android-specific thing and not useful in JS. Let's stay consistent with naming like "ScrollView", "MapView" etc.

public

Reviewed By: bestander

Differential Revision: D2723163

fb-gh-sync-id: 6b86e5a649254c41e9d6b0ef6f1fe2ff4b9f3e9a
2015-12-07 08:33:25 -08:00
Olivier Notteghem a38ce5c570 match RN attachment images Feed experience with Native with spinner/fade in
Reviewed By: astreet

Differential Revision: D2722917

fb-gh-sync-id: a09b9a1a4b9a19b94471d8e93ec5bde53af7da06
2015-12-06 15:48:34 -08:00
Atticus White ca9f0adee2 Improve Modal docs describing iOS only support
Summary:
Adds a note that the `Modal` component is only available in iOS.

I hit a bit of a pickle this weekend after realizing a handful of components I built will have to be rewritten. Unfortunately there's no notes in the documentation that the support is limited. Hopefully this can contribute towards avoiding those situations
Closes https://github.com/facebook/react-native/pull/4592

Reviewed By: svcscm

Differential Revision: D2727634

Pulled By: androidtrunkagent

fb-gh-sync-id: 2d0efcca8e17d16cf63d592e235261cea63e59ea
2015-12-05 18:48:28 -08:00
Mihai Giurgeanu 31125b2ed7 Android - Fixing #4392
Summary:
This is just an workaround for making UIExplorer work in Android.
Closes https://github.com/facebook/react-native/pull/4405

Reviewed By: svcscm

Differential Revision: D2727452

Pulled By: tadeuzagallo

fb-gh-sync-id: af48fb8c462ab04874cfdb96c0fd4409bf6d92c3
2015-12-05 14:59:29 -08:00
glevi@fb.com 383d991c40 Fix flow errors in fbobjc
Reviewed By: jeffmo

Differential Revision: D2724169

fb-gh-sync-id: d2736ce2550fe8bf45c18bce7d89a9cb5c98cb87
2015-12-04 11:56:29 -08:00
SangYeob Bono Yu f4c286f7ac Add support for Universal Links
Summary:
Adds support for [Universal Links](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html).
Closes https://github.com/facebook/react-native/pull/4109

Reviewed By: svcscm

Differential Revision: D2658105

Pulled By: nicklockwood

fb-gh-sync-id: 7d94564f64cda7d31c79cf8f4c450ed2387057be
2015-12-04 09:05:31 -08:00
Nick Lockwood dde55c30ea This Fixes scroll to top and resigning first responder
Reviewed By: tadeuzagallo

Differential Revision: D2713488

fb-gh-sync-id: 99b2646f7bf8a3ee889bbb856c298beed6817321
2015-12-04 07:56:29 -08:00
Matt Revell c1849e7f4b Fix an issue with unsafe picker access to setNativeProps.
Summary:
Fixing an issue where PickerIOS and DatePicker are being accessed unsafely, As a side effect we are also using ref callbacks as oppose to strings.

Fixed after spotting an issue in our app where the picker is closed and the callback attempts to update native props for an item that no longer exists.
Closes https://github.com/facebook/react-native/pull/3920

Reviewed By: svcscm

Differential Revision: D2663634

Pulled By: nicklockwood

fb-gh-sync-id: 813b32a038f59864401d5d3985c7ea32f5e13301
2015-12-04 07:41:30 -08:00
Dan Witte 70f0dfc0e6 revert D2707930
Reviewed By: fkgozali

Differential Revision: D2720828

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

Reviewed By: svcscm

Differential Revision: D2718764

Pulled By: androidtrunkagent

fb-gh-sync-id: eeefd16617fcb5e5ca21f6fd0cf29d63cb3b1f1c
2015-12-03 11:56:29 -08:00
Nick Lockwood 9a47ca1cc9 Added addChildren() function as a more-optimal replacement for manageChildren for common use cases.
Reviewed By: jspahrsummers

Differential Revision: D2707930

fb-gh-sync-id: c44219bf9af943cad5b57f370656c1bcac732cd9
2015-12-03 11:34:27 -08:00
Christopher Dro dd9c1e16ee Add string as possible propType for 'systemIcon'
Summary:
Fixes #2361
Closes https://github.com/facebook/react-native/pull/4523

Reviewed By: svcscm

Differential Revision: D2718568

Pulled By: androidtrunkagent

fb-gh-sync-id: a15c94acaac899dfdaeb397c8c764053d1430854
2015-12-03 11:10:40 -08:00
Milen Dzhumerov a64ee7d8c5 Batch AsyncStorage.multiGet calls
Reviewed By: javache

Differential Revision: D2636553

fb-gh-sync-id: d6351b67c615d8c01c11c10e32321a9764c54c67
2015-12-03 09:10:29 -08:00
Nick Lockwood 3313f769f5 Use console.error() for the Touchable.js bug so we can capture it in production logs
Reviewed By: javache

Differential Revision: D2717874

fb-gh-sync-id: 7c2cac61fe4fbd2c6de6cf1d9059df9ac119f543
2015-12-03 09:02:25 -08:00
Konstantin Raev 10c8a1c417 fixed mardown formatting in NetInfo code to allow proper JS Docs
Summary:
Current docs look bad https://facebook.github.io/react-native/docs/netinfo.html#content
Closes https://github.com/facebook/react-native/pull/4531

Reviewed By: svcscm

Differential Revision: D2717974

Pulled By: androidtrunkagent

fb-gh-sync-id: cd2cadfb782f8ce6a418ca7af5fcefb54504059b
2015-12-03 07:53:28 -08:00
Sameer Rahmani c8eed6a361 RTL support added for ToolbarAndroid via "rtl" property
Summary: Closes https://github.com/facebook/react-native/pull/4378

Reviewed By: svcscm

Differential Revision: D2715052

Pulled By: mkonicek

fb-gh-sync-id: e24f5db230cd7329911797794e5ef150f6195c4a
2015-12-03 05:18:26 -08:00
Wenjing Wang 0058b0806b propTypes could be undefined
Summary:
public
This causes a warning since propType not exist

Reviewed By: vjeux

Differential Revision: D2713358

fb-gh-sync-id: 58406d1dc969e6f1d40bee958c28cc87036b30c2
2015-12-02 12:33:30 -08:00
Konstantin Raev 0779dd1e87 Open source the Android NetInfo module
Reviewed By: mkonicek

Differential Revision: D2703432

fb-gh-sync-id: 4a85844f1734ec433df543c89f0fdd56fe5db13c
2015-12-02 11:52:22 -08:00
Nick Lockwood 6d29f710e1 Fixed TextInput on iOS 8 and earlier
Summary:
public

The scrolling fix I added to RCTTextView doesn't work on iOS 8 because the underlying UITextField doesn't resize correctly, which breaks text input functionality. This diff fixes it.

Reviewed By: tadeuzagallo

Differential Revision: D2712618

fb-gh-sync-id: 1d0282df3a16f1cb6ddf9d005d640738bb1b5659
2015-12-02 10:37:26 -08:00
Nick Lockwood 7ab17e5ef3 Fix for long press state transition error in Touchable.js
Summary:
public

This diff fixes an occasional JS exception thrown by Touchable.js when it attempts to transitions to the RESPONDER_ACTIVE_LONG_PRESS_IN state from the RESPONDER_INACTIVE_PRESS_IN state.

Although I wasn't able to reproduce the error while testing, I was able to identify the likely cause: the LONG_PRESS_DETECTED state transition is triggered by a timer that is started on touch-down. This timer should be cancelled if the gesture is interrupted, however I identified a code path where the state can be changed to RESPONDER_INACTIVE_PRESS_IN without the longPressDelayTimeout being cancelled.

To fix this, I've added some logic to cancel the timer in that case. I've also added a test for the error scenario that will display a redbox in __DEV__ mode, but will fail gracefully in production mode.

Reviewed By: jingc

Differential Revision: D2709750

fb-gh-sync-id: aeea1a31de5e92eb394c2ea177f556b131d50790
2015-12-02 09:54:29 -08:00
Nick Lockwood 37042573b8 Added blurOnSubmit support to multine TextInput (aka RCTTextView)
Summary:
public

Setting `blurOnSubmit=true` on a multiline `<TextInput>` now causes it to behave like a single-line input with respect to the return key:

With the default value of `false`, pressing return will enter a newline character into the field. If you set the value to `true`, pressing return will now blur the field and trigger the onSubmitEditing event. The newline character will *not* be added to the text.

(See associated github task for dicussion: https://github.com/facebook/react-native/pull/2149)

Reviewed By: javache

Differential Revision: D2710448

fb-gh-sync-id: c9706ae11f8b399932d3400ceb4c7558e455570d
2015-12-02 08:16:27 -08:00
Nick Lockwood 807e0d9310 Fixed Xcode warnings
Summary:
public

Fixed some Xcode warnings, and added some missing UIResponder methods to make the behavior of RCTTextView more self-consistent.

Reviewed By: javache

Differential Revision: D2712250

fb-gh-sync-id: d30038500194d7a5262d9e77d516c65d836a4420
2015-12-02 08:03:26 -08:00
Nick Lockwood 04187536d1 Fixed threading bug in RCTNetworking
Summary:
public

When uploading images, RCTHTTPFormDataHelper was sometimes accessed on the wrong thread.

Reviewed By: helouree

Differential Revision: D2709186

fb-gh-sync-id: d0a14926927d1d41f602f78a9f6892dfbdfc6ff9
2015-12-02 02:24:27 -08:00
Wenjing Wang 0571250521 8/n Fix warnings at startup
Summary:
public
- Add missing required `key` prop for array of child components

Reviewed By: zjj010104

Differential Revision: D2711271

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

Differential Revision: D2706663

fb-gh-sync-id: 017c91bab849bf18767cacd2ebe32d1a1b10c715
2015-12-01 20:11:26 -08:00
Nathan Spaun cf892a96d6 Fix NetInfo for Android
Reviewed By: oli

Differential Revision: D2708102

fb-gh-sync-id: f6a12c49c89c46d31114fefaf3e2b1ba72dabdee
2015-12-01 15:14:30 -08:00
Mike Armstrong b6f5c7fa04 Fix systrace profile handling for relay async calls
Reviewed By: astreet

Differential Revision: D2700239

fb-gh-sync-id: eaa29d63ee4f7688dd70b0cdc12564a9d479f9ef
2015-12-01 08:42:24 -08:00
Huang Yu 0a3694ce48 fix several lint warnings
Summary: fix some ling warnings from several files
Closes https://github.com/facebook/react-native/pull/4450

Reviewed By: svcscm

Differential Revision: D2707606

Pulled By: mkonicek

fb-gh-sync-id: 410ccacf061ac7b0f6e44d1a5e4621a9d1d606fc
2015-12-01 07:26:29 -08:00
Aleksei Androsov d08727d99f RCTImagePickerManager crash on image from CameraRoll
Summary: Image from CameraRoll haven't UIImagePickerControllerReferenceURL. So we need to save it to PhotoAlbums first.

To save image I've used the same method from RCTCameraRollManager.
Closes https://github.com/facebook/react-native/pull/4412

Reviewed By: svcscm

Differential Revision: D2707249

Pulled By: nicklockwood

fb-gh-sync-id: eee683bd4179700bed46ebf45e569197f3ad2077
2015-12-01 02:13:28 -08:00
Christopher Dro f025049b6c Add secure and login-password types to AlertIOS.
Summary: Request from issue #3893

* Added support for `secure-text` and `login-password` types to AlertIOS.
* Fixed and extended the cancel button highlighting functionality, which was broken at some point
* Added localization for default `OK` and `Cancel` labels when using UIAlertController

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

Reviewed By: javache

Differential Revision: D2702052

Pulled By: nicklockwood

fb-gh-sync-id: cce312d7fec949f5fd2a7c656e65c657c4832c8f
2015-11-30 19:51:41 -08:00
Huang Yu 7242efde0a fix navigator lint warnings
Summary: fix some lint warnings under `Libraries/CustomComponents/Navigator/` directory
Closes https://github.com/facebook/react-native/pull/4447

Reviewed By: svcscm

Differential Revision: D2706390

Pulled By: ericvicenti

fb-gh-sync-id: 5bfed687265e07a162ffc528a41fa5b0d384f635
2015-11-30 19:31:30 -08:00
Huang Yu 8f2023d961 fix Libraries/Components/Touchable lint warnings
Summary: fix 4 lint warnings under Libraries/Components/Touchable directory
Closes https://github.com/facebook/react-native/pull/4449

Reviewed By: svcscm

Differential Revision: D2705537

Pulled By: spicyj

fb-gh-sync-id: 0c573d846a2263819c2a0bffe0a178eee1fe3fca
2015-11-30 17:16:26 -08:00
Huang Yu da0744892c fix Library/ReactNative lint warnings
Summary: fix 2 lint warnings under `Libraries/ReactNative` directory
Closes https://github.com/facebook/react-native/pull/4446

Reviewed By: svcscm

Differential Revision: D2705429

Pulled By: nicklockwood

fb-gh-sync-id: a7318ef9d1d194f077b0879fd041c42da5b2dec3
2015-11-30 16:25:46 -08:00
Huang Yu 9f92e91608 fix camera roll lint warnings
Summary: fix lint warnings under `Libraries/CameraRoll` directory
Closes https://github.com/facebook/react-native/pull/4445

Reviewed By: svcscm

Differential Revision: D2705430

Pulled By: nicklockwood

fb-gh-sync-id: b5a179750a6696836cf458bc8e646e6b8a23fd98
2015-11-30 16:25:41 -08:00
Huang Yu 0c8bafe84a fix library/utility lint warnings
Summary: I have disected lint warnings fixes to several PRs. This one fixes lint warnings under Libraries/Utility path.
Closes https://github.com/facebook/react-native/pull/4444

Reviewed By: svcscm

Differential Revision: D2705303

Pulled By: spicyj

fb-gh-sync-id: c745ac62cbff30d6bb9478a1d2465fe56b305f0c
2015-11-30 16:15:30 -08:00
Nick Lockwood 94f126ddbf Fixed TextInput.blur()
Reviewed By: helouree

Differential Revision: D2704065

fb-gh-sync-id: a4f5aa9c9b4fcb7980eb85289d16982840a980bd
2015-11-30 14:32:06 -08:00
Aleksei Androsov 015c6b3be2 ImagePicker always called with cancelCallback
Summary: We should pick 2 callbacks from pickerCallbacks and pickerCancelCallbacks arrays and call them depens on args.
Closes https://github.com/facebook/react-native/pull/4411

Reviewed By: svcscm

Differential Revision: D2703209

Pulled By: javache

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

Reviewed By: svcscm

Differential Revision: D2674315

Pulled By: nicklockwood

fb-gh-sync-id: 26120f7bcbb675e8217b8bd963dcc6ed314d4ba3
2015-11-30 08:32:23 -08:00
Andreas Amsenius 0f0b57880f ActionSheetIOS sharing exclude activity types
Summary: Closes https://github.com/facebook/react-native/pull/4427

Reviewed By: svcscm

Differential Revision: D2702825

Pulled By: nicklockwood

fb-gh-sync-id: f12e83332f2083cee2c04625b5113774c8a907e0
2015-11-30 06:20:30 -08:00
Nick Lockwood c63de5e2a5 Fixed MapView crash on iOS 8 and earlier
Summary: public

[MKPinAnnotationView redPinColor] is only supported on iOS 9 and later. This caused React Native to crash on iOS 8 and earlier.

This fixes the crash by providing a forked implementation for different OS versions.

Reviewed By: tadeuzagallo, javache

Differential Revision: D2702737

fb-gh-sync-id: cd8984f1f3d42989001f3c571e325f1b4ba09ac8
2015-11-30 05:10:26 -08:00
Nick Lockwood 01a0facf33 Fixed onFocus/onBlur events for multiline TextInput
Summary: public

onFocus and onBlur were not firing for multiline TextInputs.

Reviewed By: tadeuzagallo

Differential Revision: D2699846

fb-gh-sync-id: 7e64309bc631a42a99f989f615fef927dc50217c
2015-11-27 07:47:28 -08:00
Nick Lockwood 60db876f66 Wrapped UIManager native module for better abstraction
Summary: public

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

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

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

Reviewed By: tadeuzagallo

Differential Revision: D2700348

fb-gh-sync-id: dd9030eface100b1baf756da11bae355dc0f266f
2015-11-27 07:00:32 -08:00
Mike Armstrong af753a8a4d Add NativeProfiling module that uses RN nativeProfiler or console.profile
Reviewed By: jspahrsummers

Differential Revision: D2696072

fb-gh-sync-id: 6a2b9793424cf9a82b9472e6d468cbd81dd6780a
2015-11-27 04:44:25 -08:00
Mike Armstrong e1533fdff6 Move BridgeProfile call to give better systrace info
Reviewed By: tadeuzagallo, sahrens

Differential Revision: D2697510

fb-gh-sync-id: 00ec4d5835331b78c554c904dd29661dad9f6f97
2015-11-27 01:19:25 -08:00
Tim Park 8911b72d9e Add Polyline support to MapView
Summary: Per issue #1925, add support for Polyline to MapView.

Briefly, if you have a MapView declared as:

    <MapView
      annotations={this.state.annotations}
      overlays={this.state.overlays}
      style={styles.map}
      region={this.state.region}
      ref="mapView"
    />

then setting

    this.state.overlays = [{
      coordinates: [
        { latitude: 35.5, longitude: -5.5 },
        { latitude: 35.6, longitude: -5.6 },
        ...
      ],
      strokeColor: 'rgba(255, 0, 0, 0.5)',
      lineWidth: 3,
    }];

will draw a red line between the points in locations with a width of 3 and equally blended with the background.
Closes https://github.com/facebook/react-native/pull/4153

Reviewed By: svcscm

Differential Revision: D2697347

Pulled By: nicklockwood

fb-gh-sync-id: a436e4ed8d4e43f2872b39b4694fad7c02de8fe5
2015-11-26 08:54:16 -08:00
Andy Street a636ddd9f0 Backout D2677289 [react_native] View recycling in JS
Summary: public

We're seeing related crashes. The diff has no tests, the perf tests weren't conclusive, and the person who'd be supporting it no longer is available to work on it. We can try this again later in a less rushed manner with proper perf testing.

Reviewed By: davidaurelio

Differential Revision: D2696615

fb-gh-sync-id: 3b6814ac12af19516146d5c42d2add8321b10db5
2015-11-26 08:41:27 -08:00
Pieter De Baets bb11e05c33 Default empty view to RCTView with position: absolute
Reviewed By: spicyj, davidaurelio

Differential Revision: D2693494

fb-gh-sync-id: fc00b995d7d4fdaaedf4c3e5382354f0a1f4ac23
2015-11-26 08:12:28 -08:00
Nick Lockwood 4b6b71664e Fix buck error
Reviewed By: idevelop

Differential Revision: D2699529

fb-gh-sync-id: d71a5abf04b767a58dd6f054a88a8bf0c561aa8d
2015-11-26 05:42:25 -08:00
Nick Lockwood 5b5b55027b Added support for custom color and image for map annotations
Summary: public

This diff extends RCTMap annotations with an `image` and `tintColor` property, which can be used to render completely custom pin graphics.

The tintColor applies to both regular pins and custom pin images, allowing you to provide varied pin colors without needing multiple graphic assets.

Reviewed By: fredliu

Differential Revision: D2685581

fb-gh-sync-id: c7cf0af5c90fd8d1e9b3fec4b89206440b47ba8f
2015-11-26 03:07:28 -08:00
Brent Vatne ae09a10c95 Add onLoadX support on Android
Summary: ~~This is a WIP, just finished the first bit and wanted to get some feedback to see if this approach seems appropriate, as I haven't done a lot of Android development.~~

Looks ready for review now.
Closes https://github.com/facebook/react-native/pull/3791

Reviewed By: svcscm

Differential Revision: D2672262

Pulled By: mkonicek

fb-gh-sync-id: 1e8f1cc6658fb719a68f7da455f30a7c9b1db730
2015-11-25 18:30:31 -08:00
Kyle Corbitt b65f1f2234 Use elevation to implement shadows on Android
Summary: This PR includes a working interface to Android's `elevation` property implemented as an RN style. Elevation is the only (easy) [platform-supported way to create shadows](http://developer.android.com/training/material/shadows-clipping.html). For it to work note that you must be running on Android 5.0+, and add `elevation` to a view with a `backgroundColor` set. These are platform limitations.

This PR is not intended to be merged in its current state, but rather to inform the discussion from #2768. At a minimum, before merging we would need to add the elevation style to the docs and rebase this to master (**EDIT** I have now rebased on master because from v0.14.2 too many commits were being pulled in -- haven't tested it since the rebase though). Additionally, it might be good to add tests, although I couldn't find any for the Android code. I'm happy to get that done if this feature gets signed off by the React Native team.

Finally, as I argued in #2768 I think that `elevation` is a useful abstraction ov
Closes https://github.com/facebook/react-native/pull/4180

Reviewed By: svcscm

Differential Revision: D2684746

Pulled By: mkonicek

fb-gh-sync-id: 825f3ccd20c4b0eea9d11b5f0e3a6b018b7e4378
2015-11-25 18:28:29 -08:00
Chester Wood e966cd1041 Set navigator.product to ReactNative
Summary: Fix for [Issue 1331](https://github.com/facebook/react-native/issues/1331). Sets navigator.product to ReactNative and navigator.productSub to the version string in package.json.

Note that the code requires package.json, which works fine in the RN packager, but webpack users will probably a need to configure a json loader in their config file.

Tested using UIExplorer and console.log printout of the product variables in xcode and Chrome debugger.
Closes https://github.com/facebook/react-native/pull/4083

Reviewed By: svcscm

Differential Revision: D2696881

Pulled By: vjeux

fb-gh-sync-id: 511446432dcd0ec658100715129c77153e743423
2015-11-25 12:45:28 -08:00
Milen Dzhumerov a663d4d8d5 Use for-loop instead of forEach() in a hot path
Summary: public

Replaces the usage of forEach() with a for loop on a hot code path

Reviewed By: tadeuzagallo

Differential Revision: D2690727

fb-gh-sync-id: b7cbcda5cf80a0e31753f49c01e145abb789f3e5
2015-11-25 07:24:31 -08:00
Milen Dzhumerov 638fd11c5c Revert 3770f061c832 for further investigation
Reviewed By: idevelop

Differential Revision: D2695659

fb-gh-sync-id: b1ba529c648681faef5d4f07273722764722fbe1
2015-11-25 05:24:28 -08:00
Nick Lockwood 060664fd3d Refactored module access to allow for lazy loading
Summary: public

The `bridge.modules` dictionary provides access to all native modules, but this API requires that every module is initialized in advance so that any module can be accessed.

This diff introduces a better API that will allow modules to be initialized lazily as they are needed, and deprecates `bridge.modules` (modules that use it will still work, but should be rewritten to use `bridge.moduleClasses` or `-[bridge moduleForName/Class:` instead.

The rules are now as follows:

* Any module that overrides `init` or `setBridge:` will be initialized on the main thread when the bridge is created
* Any module that implements `constantsToExport:` will be initialized later when the config is exported (the module itself will be initialized on a background queue, but  `constantsToExport:` will still be called on the main thread.
* All other modules will be initialized lazily when a method is first called on them.

These rules may seem slightly arcane, but they have the advantage of not violating any assumptions that may have been made by existing code - any module written under the original assumption that it would be initialized synchronously on the main thread when the bridge is created should still function exactly the same, but modules that avoid overriding `init` or `setBridge:` will now be loaded lazily.

I've rewritten most of the standard modules to take advantage of this new lazy loading, with the following results:

Out of the 65 modules included in UIExplorer:

* 16 are initialized on the main thread when the bridge is created
* A further 8 are initialized when the config is exported to JS
* The remaining 41 will be initialized lazily on-demand

Reviewed By: jspahrsummers

Differential Revision: D2677695

fb-gh-sync-id: 507ae7e9fd6b563e89292c7371767c978e928f33
2015-11-25 04:49:45 -08:00
Pieter De Baets bba71f146d Defer rendering events popover until required
Reviewed By: davidaurelio

Differential Revision: D2690835

fb-gh-sync-id: 1d17c20b308e364c49f868d8861c6ad93957bffe
2015-11-25 04:15:27 -08:00
Pieter De Baets 38db6fa465 Remove scrollview support from UIManager, remove mainScrollView(delegate)
Reviewed By: nicklockwood

Differential Revision: D2692749

fb-gh-sync-id: 48975d2f09f3b2902dfa2e56ff9d34257b2395bc
2015-11-25 04:12:34 -08:00
Milen Dzhumerov fc5a8678d3 Implement efficient DiskCache.clear()
Summary: public

Ability to efficiently remove all keys with a particular prefix

Reviewed By: tadeuzagallo

Differential Revision: D2658741

fb-gh-sync-id: 3770f061c83288efe645162ae84a9fd9194d2fd6
2015-11-25 03:23:36 -08:00
Manuel Nakamurakare 9fc3991615 added method to set thumb image
Summary: this change will allow the slider to have different thumb images .

Sets an image for the thumb. It only supports static images
Closes https://github.com/facebook/react-native/pull/3849

Reviewed By: svcscm

Differential Revision: D2665699

Pulled By: nicklockwood

fb-gh-sync-id: 3a767e43170074e2419067d5c8eae61668ebb5e9
2015-11-24 16:10:04 -08:00
Nick Lockwood b5be05d82b Fix flaky scrolling for TextInput when using rich text
Summary: public

This diff fixes the jumpy scrolling for multiline `<TextInput>` when using nested `<Text>` components to implement rich text highlighting.

The fix is to disable scrolling on the underlying UITextView, and nest it inside another UIScrollView that we control.

Reviewed By: ericvicenti, tadeuzagallo

Differential Revision: D2674670

fb-gh-sync-id: bacee3ae485523cc26ca8102b714e081df230629
2015-11-24 15:38:27 -08:00
Krzysztof Magiera 469a65217c Add note in View.js render method that wrapper component is not used.
Summary: Got bitten lately by View.js returning different component based on `__DEV__`

Adding a warning in the render method that should make it cleaner in the future that this method is not actually being used in prod mode.
Closes https://github.com/facebook/react-native/pull/4322

Reviewed By: svcscm

Differential Revision: D2691880

Pulled By: vjeux

fb-gh-sync-id: 119672740969a857ab6288b7914d52e8d40a1d95
2015-11-24 13:08:25 -08:00
Tim Yung 2c14ab582a RN: Add "Dismiss All" to YellowBox
Summary: Adds a "Dismiss All" button to YellowBox for people who see litter on the ground and continue walking. (Just kidding).

public

Reviewed By: vjeux

Differential Revision: D2691764

fb-gh-sync-id: 9746b42bc1e5dc51f2320880f47f8cb17b952570
2015-11-24 11:37:31 -08:00
Alexey Lang b4beba5217 Fix logging JSAppRequireTime
Reviewed By: andreicoman11

Differential Revision: D2690760

fb-gh-sync-id: 41e88c48deec05539e7681862d794ed650b81bfa
2015-11-24 10:20:28 -08:00
Konstantin Raev 37f81341a0 Open source SwipeRefreshLayoutAndroid
Reviewed By: mkonicek

Differential Revision: D2679605

fb-gh-sync-id: 7f3e7384b37f29002ddd8cb7a4567fa96c76f047
2015-11-24 10:15:14 -08:00
Roman Telicak 3622e44426 Update removeClippedSubviews prop default value 2015-11-24 16:04:35 +01:00
Sebastian Markbage 64675dc078 Move RelayProfiler Decoupled Initialization to use Double Dispatch
Reviewed By: josephsavona

Differential Revision: D2689433

fb-gh-sync-id: 966b3d855a5a0a755fd55fb583e31ba648de2a7a
2015-11-23 19:24:27 -08:00
Sebastian Markbage f624d01cac Make Style Interpolator Function Generation Lazy
Summary: This code generation executes eagerly and these functions are fairly large and takes time to compile.

However, I'm mostly doing this change because it significantly increases the Prepack binary file size.

In theory, there might be a slight impact on the first use of these interpolators but I couldn't really tell.

An alternative would be to create a factory that is called by the components at an appropriate time, or to just refactor the whole thing to use Animated.

I didn't want to dig too deeply for a single component though.

public

Reviewed By: vjeux

Differential Revision: D2687296

fb-gh-sync-id: 6fc8cdf54dfb6f0b50c11db973d67d114bbc7400
2015-11-23 14:20:29 -08:00
Spencer Ahrens 598d37f6d5 Quick fix to require cycle in UnimplementedView
Reviewed By: vjeux

Differential Revision: D2686884

fb-gh-sync-id: 99afd8b389d5849d708654a4967dbd403ac24a9b
2015-11-23 14:14:32 -08:00
Kevin Gozali db617e56a3 send fatal error for js exception in eventEmitter
Summary: public

Any uncaught exception inside an event emitter handler was reported as softError, which didn't crash the app, but left the app running in an unknown state. Since there's no way for the app to catch these softerror (to provide a fallback error view, etc), let's change it to report fatal error for uncaught exception for the time being.

Reviewed By: javache

Differential Revision: D2685322

fb-gh-sync-id: 52956d3db20809cc90448bd080795754b899435e
2015-11-23 13:52:27 -08:00
Martin Konicek b9580511a6 Codemod IntentAndroid.{openURI -> openURL}
Reviewed By: olegbl

Differential Revision: D2680128

fb-gh-sync-id: d9786b6c20d4d6f62cc79fb21ab6861afe30bb54
2015-11-23 11:04:29 -08:00
Hedger Wang e0d53e1c48 Fix move gesture handling.
Summary: public

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

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

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

Reviewed By: fkgozali

Differential Revision: D2683802

fb-gh-sync-id: 50ae877787167511df48378304bd2ad665c73300
2015-11-23 09:20:28 -08:00
Milen Dzhumerov e4dca7a1fa Add JSON methods to systrace
Summary: public Add JSON methods to systraces

Reviewed By: jspahrsummers

Differential Revision: D2679719

fb-gh-sync-id: d8bbdc9577264b1de01d7bb52656f4f1a86a5982
2015-11-23 07:03:39 -08:00
Milen Dzhumerov 02b67d9d40 BridgeProfiling measure methods
Summary: public Add measure() family of methods which allow to easily swizzle methods for profiling

Reviewed By: tadeuzagallo

Differential Revision: D2679904

fb-gh-sync-id: 3724440e1bdaca9e854f4d4124a897a204966dc7
2015-11-23 07:03:32 -08:00
David Aurelio 6b3a6e5958 Unbreak open source release due to import of internal module
Reviewed By: majak

Differential Revision: D2685592

fb-gh-sync-id: eb5e9baf15d08ff1ec2c29e0ca1fe94df079d79e
2015-11-23 06:37:29 -08:00
Nick Lockwood f827a513a1 Fixed double-callback for cached images
Summary: public

A missing return statement in RCTImageLoader meant that cached images would be loaded twice - once from cache and again from the source.

This was mostly innocuous, causing only a slight perf regression due to the image cache being effectively disabled, however in some cases (such as RCTImageEditingManager.cropImage) it caused the success callback to fire twice, resulting in a crash.

Reviewed By: fkgozali

Differential Revision: D2684956

fb-gh-sync-id: 7580a6fbfe00a30807951803e04bfcdbee3bb80a
2015-11-23 04:20:28 -08:00
Alexander Blom 274c5c78c4 Support cookies on Android
Summary: This adds a persistent cookie store that shares cookies with WebView.

Add a `ForwardingCookieHandler` to OkHttp that uses the underlying Android webkit `CookieManager`.
Use a `LazyCookieHandler` to defer initialization of `CookieManager` as this will in turn trigger initialization of the Chromium stack in KitKat+ which takes some time. This was we will incur this cost on a background network thread instead of during startup.
Also add a `clearCookies()` method to the network module.

Add a cookies example to the XHR example. This example should also work for iOS (except for the clear cookies part). They are for now just scoped to Android.

Closes #2792.

public

Reviewed By: andreicoman11

Differential Revision: D2615550

fb-gh-sync-id: ff726a35f0fc3c7124d2f755448fe24c9d1caf21
2015-11-23 03:21:31 -08:00
Tim Yung 8ab51828ff RN: Revamp YellowBox for Warnings
Reviewed By: vjeux

Differential Revision: D2667624

fb-gh-sync-id: f3c6ed63f3138edd13e7fe283cf877d598018813
2015-11-20 13:09:16 -08:00
James Ide b641d3de37 Merge pull request #4262 from rreusser/note-on-geolocation-docs
[Docs] Note that Android geolocation not yet open sourced
2015-11-20 12:57:34 -08:00
Ricky Reusser 945a1c72db Note in docs that Android geolocation not yet open sourced 2015-11-20 15:43:07 -05:00