Commit Graph

7083 Commits

Author SHA1 Message Date
Pieter De Baets 7b7ecdf337 Cleanup warnings
Reviewed By: majak

Differential Revision: D3542606

fbshipit-source-id: 41246a012a32fafc4ddbb307c7b9919e3c203393
2016-07-12 05:59:12 -07:00
Adam Ernst 3be8c957b0 Minor cleanup to make loader unaware of bridge
Summary: The loader should be a utility that stands alone. The bridge uses the loader, not the other way around.

Reviewed By: bnham

Differential Revision: D3546157

fbshipit-source-id: 91016afb629df1f8c83c8fca6f42649be0b046b0
2016-07-12 05:28:37 -07:00
Adam Ernst c7a590655c Expose a method to synchronously load bundle if possible
Summary:
This diff exposes a new experimental method `[RCTJavaScriptLoader +attemptSynchronousLoadOfBundleAtURL:sourceLength:error:]`. It may be used if you know that a specific call site must load its JavaScript synchronously, or else fail entirely.

This new API will succeed for file URLs that point to a RAM bundle. It will fail for non-RAM-bundle files and for HTTP URLs.

This also cleans up the error domain and codes for this class. This should be the only externally visible change from this diff if you don't use the new API: the codes and domains you receive from the API may change slightly. They were pretty sloppy and undocumented before, so I think this change is for the better.

Reviewed By: bnham

Differential Revision: D3545956

fbshipit-source-id: 30e65f4e8330d2d68f3f50ade077fdc1db4a435e
2016-07-12 05:28:36 -07:00
Adam Ernst 80c71e5cae Refine RCTJSCExecutor's APIs for using a thread/context that already exists
Summary:
The `initWithJSContextProvider:` API created a `RCTJSCExecutor` with a thread/context that already exists, but it did not solve the problem of loading an actual application script; the `executeApplicationScript:` API is also asynchronous.

Create a new merged API that allows you to pass in a pre-created thread/context pair and immediately receive an `RCTJSCExector` that has already executed a specified application script.

This also removes the `underlyingJSContext` API entirely, in favor of passing it back in a byref variable in the new API. This minimizes the surface area for API abuse.

Reviewed By: bnham

Differential Revision: D3545349

fbshipit-source-id: 1c564f44d2a5379b5e6f75640079a28fd7169f67
2016-07-12 05:28:36 -07:00
Mengjue Wang 38a6eec0db Provide RTL support for new Navigator -- Make RTL works in NUX
Summary: Provide RTL support in NavigationPager

Reviewed By: fkgozali

Differential Revision: D3536850

fbshipit-source-id: 29890a125dc5e001b4c10208cd53bfeca0d9b5c3
2016-07-11 20:58:32 -07:00
Mengjue Wang 471ee87445 Wrap native module I18nManager with a new RCTI18nManager.js and fix current use of native module I18nManager
Summary: create new RCTI18nManager.js to warp-up native module I18nManager and fix current use of it.

Reviewed By: ericvicenti

Differential Revision: D3547427

fbshipit-source-id: 53a695c94ca6bba2f566d0725c553e58d60bf451
2016-07-11 20:58:32 -07:00
Elliot Lynde d905af4736 Delete AnimatedNative-test
Reviewed By: cpojer

Differential Revision: D3546643

fbshipit-source-id: d0484e55e8e2943584d9084f2663dbdbfe3fce0e
2016-07-11 19:43:21 -07:00
Spencer Ahrens 4d6c1e55d7 Bring back trackingName
Reviewed By: yungsters

Differential Revision: D3501805

fbshipit-source-id: be7e1a76c022d050542af797dda49b3cf14340bb
2016-07-11 17:58:21 -07:00
Spencer Ahrens 9b184cc0f4 Fix bug in cancelling last task in TaskQueue
Summary:
We don't want to remove the last queue from the stack, it should just have no tasks in it.

Fixes issue reported here: https://www.facebook.com/groups/reactnativeoss/permalink/1569170356712926/

Reviewed By: yungsters

Differential Revision: D3539287

fbshipit-source-id: ea95673491fee0ea82f0f1b79b8f60e00cd3d035
2016-07-11 16:13:49 -07:00
Adam Ernst 0a98b612aa Change how native require hook is registered
Summary:
Instead of two separate dispatches to the JavaScript thread, only do one. Avoid the strongSelf dance entirely.

This refactor does mean that the cost of registering the nativeRequire hook on the context is not measured by the `RCTPLRAMBundleLoad` tag. However it should be almost zero-cost to construct and set a single block, so I'm OK with that change.

Reviewed By: bnham

Differential Revision: D3542940

fbshipit-source-id: d6bd26e478d0d33b56f8116d7efe6aac80c91711
2016-07-11 15:58:20 -07:00
Pieter De Baets ba4c34c0db Remove deprecated nativeScrollDelegate property
Summary: We deprecated it a while back and nobody is using it internally.

Reviewed By: majak

Differential Revision: D3542602

fbshipit-source-id: dfe11a47b21d2f8a7c946c902f0ea427615ffc31
2016-07-11 13:34:02 -07:00
Pieter De Baets ff3ab32a72 Cleanup RCTImageLoader weakSelf/strongSelf
Reviewed By: mmmulani

Differential Revision: D3542393

fbshipit-source-id: b241586b0da254f688d0e8bdbf7d4ce72dc0d21f
2016-07-11 13:34:00 -07:00
Pieter De Baets 3816ced49b nil out pendingCalls when we're done with them
Reviewed By: mmmulani

Differential Revision: D3543825

fbshipit-source-id: cf2fcdb4e1536c00675fafa85d0f880313a80655
2016-07-11 13:33:58 -07:00
Pieter De Baets 81f59dfdc2 Remove code for testing without JS bundle
Reviewed By: mmmulani

Differential Revision: D3542347

fbshipit-source-id: d0dcfb65645faf515e6e48e6ff733646e1bcf907
2016-07-11 13:33:55 -07:00
Pieter De Baets 2ae23d9f36 Flush pending calls off the main-thread
Reviewed By: majak

Differential Revision: D3535193

fbshipit-source-id: 8c4736629eab3c723641f0c3fb449c168cd492a1
2016-07-11 13:33:52 -07:00
Adam Ernst af7104b49e Extract part of executeApplicationScript into a C function
Reviewed By: javache

Differential Revision: D3542897

fbshipit-source-id: aa74c0c7c4477158fc9c8aff69432aed592f472f
2016-07-11 13:33:50 -07:00
Adam Ernst 5e89baa7a0 Remove needless weakSelf from executeApplicationScript
Reviewed By: javache

Differential Revision: D3542798

fbshipit-source-id: bf3fe15c78b55691176aecf209210a6f35f98862
2016-07-11 13:33:48 -07:00
Adam Ernst 8fb6111fa5 Make loadRAMBundle a C function, not a method
Summary: This makes the state it uses more explicit. It also makes a bug with performance measurement obvious: if we early return to error, we never mark stop for `RCTPLRAMStartupCodeSize`.

Reviewed By: javache

Differential Revision: D3542751

fbshipit-source-id: e6c1e3f3a76098ca37b8078f6e9abc805ad2d9da
2016-07-11 13:33:46 -07:00
Héctor Ramos b33424e5ed Fix links from networking to navigation in The Basics.
Summary:
Fixes #8611.

Once this lands, we may want to cherry-pick it into 0.29 to fix the broken links.
Closes https://github.com/facebook/react-native/pull/8698

Differential Revision: D3544388

Pulled By: JoelMarcey

fbshipit-source-id: d5132b112e3079d1fd9ab6d84ff1a4328bee871f
2016-07-11 12:13:45 -07:00
Tim Yung 1db781316b RN: Clean JSTimersExecution JS
Reviewed By: sahrens

Differential Revision: D3539098

fbshipit-source-id: f17a35c5d6a45627bd6961b6b06266fe254d3976
2016-07-11 11:28:21 -07:00
Tim Yung ed4db631fa RN: Change Time Drift Error into Warning
Summary: Changes the time drift error into a warning that will only get logged once per debugging session.

Reviewed By: jingc

Differential Revision: D3539067

fbshipit-source-id: 357db15750d867a91c39b5fc5fd6ed4ae2852bc7
2016-07-11 10:28:27 -07:00
Andy Street 6d3c7b8a4c Fix 'Unexpected EOF' in old bridge
Summary: This is caused by receiving \u2028/2029 in callbacks/function calls. The correct solution is to not evaluate these strings as scripts but instead parse them as json and pass them through the JSC API.

Reviewed By: lexs

Differential Revision: D3543098

fbshipit-source-id: 4d8acce1d510bb17361d32103d4738fc0208b0a8
2016-07-11 09:58:27 -07:00
Pieter De Baets 7b718b03eb Allow RCTDisplayLink to pause more often
Summary:
By default we run the the JS display link, even if there are no modules listening. Given that most listeners will be lazily constructed, let's make it paused by default.

Since RCTTiming almost never unpauses due to some long-lived timers, implement a sleep timer that pauses the displaylink but uses an NSTimer to wake up in time.

Reviewed By: mhorowitz

Differential Revision: D3235044

fbshipit-source-id: 4a340fea552ada1bd8bc0d83b596a7df6f992387
2016-07-11 08:28:24 -07:00
Mehdi Mulani 4840233bcd Bring back FBPortForwarding into fbobjc (Revert D3056293)
Reviewed By: frantic

Differential Revision: D3542397

fbshipit-source-id: 7f25f9753ec8d7a88f736014bba231fc5fb8b245
2016-07-11 07:28:22 -07:00
Tadeu Zagallo 5d06918d07 Add new FileSourceProvider
Summary: Add a new interface to JSC that allows loading a file lazily from disk, i.e. using mmap, instead of loading the whole file upfront and copying into the VM.

Reviewed By: michalgr

Differential Revision: D3534042

fbshipit-source-id: 98b193cc7b7e33248073e2556ea94ce3391507c7
2016-07-11 06:58:26 -07:00
Alex Kotliarskyi e5650560c0 Class for JS stack frames instead of dictionaries
Summary:
Currently React Native codebase treats JS stack traces as array of dictionaries.

This diff switches the Red Box to use new `RCTJSStackFrame` for internal data representation, while keeping the exposed API unchanged. The next step would be to replace the rest of manual parsing and usage of dictionaries.

The new class has ability to parse the stack from raw strings or dictionaries.

Depends on D3429031

Reviewed By: javache

Differential Revision: D3473199

fbshipit-source-id: 90d2a4f5e8e054b75c99905f35c2ee54927bb311
2016-07-11 06:13:32 -07:00
Chirag 13a19a8897 Don't block scroll when using non-touchable visible row for SwipeableRow
Summary:
**motivation**
Currently when using a non-touchable visible row for a SwipeableRow, the scroll on list view is blocked.

**Test Plan**
```
<SwipeableListView
   dataSource={dataSource}
   renderRow={() => <View style={styles.row}/>}
   renderQuickActions={() => <View style={styles.hiddenrow}/>}
/>
```

* Tested that when using non-touchable for renderRow allows scrolling on list view.
* Tested that when using touchable for renderRow allows scrolling on list view.

cc fred2028
Closes https://github.com/facebook/react-native/pull/8537

Differential Revision: D3542407

Pulled By: fred2028

fbshipit-source-id: b7ad7ff7c7dd1b717544746a85bb265414aa18f4
2016-07-11 04:58:32 -07:00
sam a2c6a7bc64 export SwipeableListView component.
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

1. [`SwipeableListView`](https://github.com/facebook/react-native/blob/master/Libraries/Experimental/SwipeableRow/SwipeableListView.js) is already usable, I think it would be great to export it so users can test it.
Closes https://github.com/facebook/react-native/pull/8482

Differential Revision: D3542403

Pulled By: fred2028

fbshipit-source-id: 7b4e0aa8c50110e434c9d64b72b15d1206fa0470
2016-07-11 04:58:32 -07:00
Nathan Azaria c8b5880102 Renamed updateObject:forKey to updateValue:forKey
Reviewed By: javache

Differential Revision: D3534820

fbshipit-source-id: 32afa39aedd43319fb5933ee0b169a41f4c8cd19
2016-07-11 03:43:23 -07:00
Nathan Azaria defc34a28b Removed calls to RCTBundleURLProvider setDefaults
Reviewed By: javache

Differential Revision: D3534799

fbshipit-source-id: 0c784cd9a993c6379e49087906ebf670ddd4f8cd
2016-07-11 02:58:32 -07:00
Nivetha Singara Vadivelu 0b773c41ac Navigator - making changes so that a simple flick can be detected
Summary:
Decreased the distance threshold so that the user doesn't need to swipe a large distance to
set the pan responder.

Also, set a threshold for the velocity so that a simple flick can be detected.

Reviewed By: hedgerwang

Differential Revision: D3540354

fbshipit-source-id: 251a4f14dc014bc32b3a83fa8de419f86ca40b84
2016-07-10 20:43:26 -07:00
Pieter De Baets 4aedcc7670 Fix double completion callback in RCTJavascriptLoader
Reviewed By: foghina, mmmulani

Differential Revision: D3541511

fbshipit-source-id: 9a0a4be635ca910cb1a5c875a0f4a2b82c51cf71
2016-07-10 12:28:24 -07:00
Ritesh Kadmawala c0316c695d Fixed the issue due to which js assets are not bundled in the apk when separate build for different CPU architectures is enabled
Summary:
This PR tries to fix a minor bug in `react.gradle` due to which task that bundles JS into the assets folder of the APK is not run when separate build per CPU architecture is enabled and we are using different product flavors.
Closes https://github.com/facebook/react-native/pull/8675

Differential Revision: D3541348

fbshipit-source-id: 4c84f21a06a45046f84bdd8ae5c5d834ec080476
2016-07-10 05:43:20 -07:00
Nicolas Charpentier 65ff8192dd Remove instructions about IP address on iOS
Summary:
The documentation was not updated after this change : Implemented automatic IP detection for iOS (8c29a52)

Fixes #8651.
Closes https://github.com/facebook/react-native/pull/8660

Differential Revision: D3539749

fbshipit-source-id: fe3b37c446a8c37941adbb08c4301284950a176a
2016-07-08 19:33:22 -07:00
Simon Dohmen d73446c549 Fixed position of ripple-effect
Summary:
I recognised that the ripple effect was always located at the bottom of my buttons. So i started to search for other ppl having the same problem. I also found this bug on the f8 app.

The gifs show the behaviour before and after my changes:

[The ripple effect is always on the bottom of the element, because pageY is used instead of the relative pos]
![before](https://cloud.githubusercontent.com/assets/956410/16042805/df49d97e-323c-11e6-8ce2-b0658ec85b27.gif)

![after](https://cloud.githubusercontent.com/assets/956410/16042804/df483a60-323c-11e6-862f-e8c97b835339.gif)

Before, the absolute position of the touch was used to update the position during movement but it should be the relative position. Just some small calculation changes were needed to achieve the correct behaviour :)
Closes https://github.com/facebook/react-native/pull/8111

Differential Revision: D3539652

fbshipit-source-id: dd8c8f3c7402d0d435f1c2ca67c1a59b474efda3
2016-07-08 19:33:20 -07:00
Emil Sjolander 70b989eb67 Revert land of css-layout PR #199
Reviewed By: bestander

Differential Revision: D3536627

fbshipit-source-id: e89b2a5fd38d1228bd8526c46bb26c594947837a
2016-07-08 16:48:13 -07:00
Michał Gregorczyk dd06b74157 Make SoLoader an external dependency
Reviewed By: bestander

Differential Revision: D3535233

fbshipit-source-id: 9fddb654123a7606d46069a98e2f68dec7f520fa
2016-07-08 16:48:13 -07:00
David Aurelio 2426b3b5ec Prevent tests with invalid UTF-8 from failing when jest reads them from the cache
Summary: The utf-8 test was failing when run from Jest’s cache, because it contained unicode escape sequences for stray high and low surrogates. Somewhere in the process of transpiling, caching on disk, and reading from the cache, those stray surrogates are changed to U+FFFD (REPLACEMENT CHARACTER / �). This diffs changes the method of creating these strings from literals to `String.fromCharCode`, which survives the process as intended.

Reviewed By: bestander

Differential Revision: D3534711

fbshipit-source-id: 365bace77a1f914e6e2fbb3430b3e0ea6cec5e83
2016-07-08 12:35:53 -07:00
Adam Ernst 39cb110c5b Add the ability to pre-create the JavaScript thread with RCTJSCExecutor
Summary: This can be used to create a JavaScript thread and `JSContext` in advance, then supply them to the `RCTJSCExecutor` at creation time later.

Reviewed By: javache

Differential Revision: D3534553

fbshipit-source-id: 99ccf711928cd12e84c9fbe142c6d19a7af55d07
2016-07-08 12:35:50 -07:00
Adam Ernst 294173a427 Organize ivars in RCTJSCExecutor
Reviewed By: javache

Differential Revision: D3534380

fbshipit-source-id: 364213f24256602471a5b3cd1afe6c7be4aab743
2016-07-08 12:35:48 -07:00
Adam Ernst 7ee2f48451 Remove left-over ctx property from RCTJavaScriptContext
Summary: This was left over from a previous change.

Reviewed By: javache

Differential Revision: D3534376

fbshipit-source-id: 6932364d1c32d8fbdf56c642893f9ea5e6dc1fee
2016-07-08 12:35:45 -07:00
Mengjue Wang 7e5fc17983 Provide RTL support for SwipeableRow
Summary:
Flipped the gesture for SwipeableRow
 Provide RTL support for SwipeableRow. When developer set RTL layout in their app, all the animation and  gesture will change to RTL status.

Reviewed By: fkgozali

Differential Revision: D3532919

fbshipit-source-id: 76fc94cdaa8457350e9bbe3366aa714c9eb45245
2016-07-08 12:18:00 -07:00
Mengjue Wang cadc753e4c Change NavigatorSceneConfig for RTL
Summary:
For RTL experiment, we need to swap all the Left and Right gesture and animation.
 Provide RTL support for Navigator in RN.

Reviewed By: hedgerwang

Differential Revision: D3519811

fbshipit-source-id: b53d9bf901ec056614658b627823d2225bdc82b1
2016-07-08 10:58:55 -07:00
Emil Sjolander ca66383941 Correctly size cross axis when measuring flex basis
Summary:
https://github.com/facebook/css-layout/pull/199

- Nodes were measured with the assumption of being text nodes (height depends on width) when determining flex basis. This is not always true. Even when we are just interested in the main axis (flex basis) we need to correctly constrain the cross axis.
- Some tests were wrong. Measuring texts.big and expecting it to have textSizes.smallHeight which doesn't make a lot of sense.

Reviewed By: vjeux

Differential Revision: D3510163

fbshipit-source-id: ee53b548dd078005fdd153d279e4c7fef3dd02d0
2016-07-08 09:28:35 -07:00
Adam Ernst 1ebd9c5dea Create JSContext inside setUp
Summary:
In practice, it *MUST* be the call to `self.context` within `setUp` that triggers the creation of the context:

- It can't come before that point because `_jscWrapper` has not been set up yet
- It can't come after that point since `self.context` would create the context there.

Just move the creation to be inline, enforced by assert. This makes it easier to reason about where the context is created, and easier to change how it is created later.

Reviewed By: javache

Differential Revision: D3529843

fbshipit-source-id: 8ed5a9861ebefd4b9e0f7155db8587dcf0442b7a
2016-07-08 09:13:59 -07:00
Adam Ernst 29f9be6d9c Remove needless weak self in RCTJSCExecutor
Summary: There's no reason for this; setUp is once-and-done. Probably just trying to ignore the incorrect clang warning.

Reviewed By: javache

Differential Revision: D3528494

fbshipit-source-id: e4f986df8d097e4720dfd4a51e7fb6c9c9b5108f
2016-07-08 09:13:59 -07:00
Emil Sjolander 89a53b687c Use AT_MOST measurespec when onyl max dimension is defined
Summary:
https://github.com/facebook/css-layout/pull/200
Make use of max dimension styles to allow root to be measured with AT_MOST measure mode

Reviewed By: IanChilds

Differential Revision: D3513505

fbshipit-source-id: 169f49717e896eb6270b52fb7115ce005aa0e3a8
2016-07-08 03:58:28 -07:00
Konstantin Raev 3ddf3db551 Fixed objc test runner and bezier test
Summary:
- kill -9 SERVER_PID does not work for packager currently because it is started as daemon.
- And lego tests just hang until they are killed e.g. intern/sandcastle/1952254070/187417721/
- fixed bezier test because it annoyed me with random breaks because of precision

Reviewed By: davidaurelio

Differential Revision: D3528588

fbshipit-source-id: 87e5b4330fa69bc9a8a7f48e2250f3c2239f2b35
2016-07-08 03:28:58 -07:00
Gant c3f4d79475 changes link file on Android to MainApplication.java for 0.29 update
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - #8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes https://github.com/facebook/react-native/pull/8612

Differential Revision: D3533960

fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
2016-07-08 01:45:58 -07:00
Jake Murzy 46a685169e Use active scene passed in `props` by `NavigationTransitioner`
Summary:
With facebook/react-native@c57bac4, `NavigationTransitioner` passes the currently active `scene` in transition `props`. This simplifies the handling of transition changes when rendering overlay.

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

Differential Revision: D3533447

Pulled By: ericvicenti

fbshipit-source-id: df568dc5cf5d57d8948b9f0400a8d693cf5564e1
2016-07-07 21:13:31 -07:00