Commit Graph

948 Commits

Author SHA1 Message Date
Chris Hopman 1a690d5674 Delete old bridge
Reviewed By: astreet

Differential Revision: D3510660

fbshipit-source-id: 031b9dcf19dd4e6677a6c9417917930bcbbe3219
2016-08-02 17:58:26 -07:00
Daniel Braun c15e2bb619 Fixed reverse logic in ReactToolbarManager setRtl.
Summary:
The logic in `setRtl` is wrong. You would expect that `{rtl: true}` would set the layout direction to RTL, instead it currently does the opposite.
This commit fixes the issue.
Closes https://github.com/facebook/react-native/pull/9132

Differential Revision: D3657134

fbshipit-source-id: f946698b548988541de7da5565d2ab122746ecf0
2016-08-02 12:28:33 -07:00
Lukas Piatkowski 2231b21ed0 #15.1 Extend packager server to receive signals from Sampling Profiler
Reviewed By: bestander

Differential Revision: D3606098

fbshipit-source-id: ec55030dd1b3a27f0595650da1ce01fe1ac9116c
2016-08-02 11:14:06 -07:00
Lukas Piatkowski ec0ccf599a #15 Add a button in devtools to start/stop the Sampling Profiler
Differential Revision: D3555704

fbshipit-source-id: 4add16c923fcfd306892efec4630c24ae438d6dd
2016-08-02 11:14:06 -07:00
Charles Dick aba87550cc upload JSC heap capture to bundle server
Reviewed By: bestander

Differential Revision: D3642116

fbshipit-source-id: 9626078bb0f087f55d8270c8e0b082c74bd2df9d
2016-08-02 08:13:57 -07:00
Andy Street 36ca1a078a Fix ScrollView bounce back bug in open source
Summary: We now reach in and use the Scroller directly, reimplementing fling() and onOverScrolled(). I verified that in Android 4.1.2 ScrollView#mScroller exists as a private on ScrollView, but there's still potential that this could break things if OEMs have modified ScrollView so we just log a warning if we can't get access to that field.

Reviewed By: foghina

Differential Revision: D3650008

fbshipit-source-id: e52909bf9d6008f6d1ecd458aee25fe82ffaac19
2016-08-01 11:58:36 -07:00
Siqi Liu 75e404bdde Add Report Button for Android Redbox, enabled in Ads Manager, Groups and FB4A
Reviewed By: foghina

Differential Revision: D3542780

fbshipit-source-id: a0dfb8b8af7a5ae0ca696e84ec4b8795a293c26f
2016-08-01 08:13:33 -07:00
Think Wu 37df151562 fix cleanReactNdkLib task failure caused by module not found
Summary:
The `clean` task always fail due to the failure of the `cleanReactNdkLib` task, error messages:

```
:ReactAndroid:cleanReactNdkLib
Android NDK: /my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk: Cannot find module with tag 'react' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
make: Leaving directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
/my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk:31: *** Android NDK: Aborting.    .  Stop.
:ReactAndroid:cleanReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:cleanReactNdkLib'.
> Process 'command '/usr/local/opt/android-ndk/ndk-build'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info
Closes https://github.com/facebook/react-native/pull/7935

Differential Revision: D3646120

Pulled By: bestander

fbshipit-source-id: c869ff4a2d3407643fdeec431f454071747eb429
2016-07-29 17:58:26 -07:00
Don Yu 7d27f4941c Expose rootViewTag for ReactRootView
Reviewed By: AaaChiuuu

Differential Revision: D3630452

fbshipit-source-id: 9e7e750051b8bd5c60971a82740916e2e5faf6f6
2016-07-29 11:15:18 -07:00
Mengjue Wang 70dc98dea4 Provide RTL support for RCTShadowView according to new csslayout
Summary:
The make current RCTShadowView support RTL layout.
1 Change all left/right to start/end for margin, padding, boarder and position
2 Calculate position in the same way as margin, padding and boarder

Reviewed By: fkgozali

Differential Revision: D3619292

fbshipit-source-id: eaaa6faeee93c964d59bb6f498d89effc09ed567
2016-07-29 10:43:23 -07:00
Andy Street 65fdd70d45 Use non-breaking space for Reload button
Summary: Stops the text in 'Reload (R, R)' from wrapping after the comma.

Reviewed By: foghina

Differential Revision: D3641409

fbshipit-source-id: ecbc8ea2935f613559f26e8ace1e9b609ea2ad18
2016-07-29 07:13:43 -07:00
Marc Shilling 7606564611 Make getCurrentActivity public on ReactContext
Summary:
Addresses #8661
Closes https://github.com/facebook/react-native/pull/9071

Differential Revision: D3641285

Pulled By: foghina

fbshipit-source-id: dede86743efddc33b6ead053e805770fc213685c
2016-07-29 04:28:27 -07:00
Seth Kirby e87a02c520 Delay dropping root views until the drop views step of StateBuilder.
Summary: Make UIOperation public so that custom implementations can expose instances of it.

Reviewed By: ahmedre

Differential Revision: D3618197

fbshipit-source-id: 89f764818cc2e8e94cf9678814e56e7074eb9067
2016-07-28 17:13:36 -07:00
Mengjue Wang 873c6ff5b9 Fix CSSLayout to Support RTL
Summary:
The current CSSLayout can't support RTL because wrong calculation for absolute position.
This change is mainly to fix the issue: https://github.com/facebook/css-layout/issues/197
Three main problems I fixed:
1. Calculate the position in the same way as margin, boarder, and padding. So that to fix the absolute problem.
2. Fix one wrong calculation for leading value when we only know the trailing value. It was hard code for the LTR situation. Now I changed it to depends on the main Axis.
3. Expose getter and setter function for RN to read layout direction and start/end position value.

Reviewed By: fkgozali

Differential Revision: D3616949

fbshipit-source-id: ae7a47cc0a5d02b42b95f87232be51ab144056d9
2016-07-28 14:58:35 -07:00
Daniel Braun 1bb1385c7d Webview: Fix broken fullscreen modals due to zero body height.
Summary:
Supersedes PR #8536
Fixes #5211

JavaScript plugins such as Fotorama are broken when attempting use its fullscreen feature.

If there's an absolute HTML element with 100% height under <body>, its height is 0 when rendered in the Android WebView.

This commit fixes it.
Closes https://github.com/facebook/react-native/pull/8830

Reviewed By: bestander

Differential Revision: D3632821

Pulled By: jamesgpearce

fbshipit-source-id: c185bcd30d1d214a357d0d8552d61d0ddfa5e6c6
2016-07-27 16:58:57 -07:00
Andrew Y. Chen aa32fd64a5 Add Airplane mode as a potential reason for debug server exceptions
Reviewed By: jingc

Differential Revision: D3632310

fbshipit-source-id: e6ccbfaaccf6853c615956842ea657eaba76cbe2
2016-07-27 16:28:27 -07:00
Mengjue Wang 5b4fb89e4c Fix UNSET problem for text alignment change
Summary: Use UNSET(-1) as default will lead wrong calculation for text alignment. Change it to Gravity.NO_GRAVITY to fix this problem.

Reviewed By: fkgozali

Differential Revision: D3624417

fbshipit-source-id: c116560e64600be60b2fe719f575701b00f20a97
2016-07-27 10:28:37 -07:00
Mengjue Wang 8c0a045c0d Connect the OS setting with isRTL
Summary: Provide two function in I18nUtil to get the device and app current using language. And Set isRTL with both allowRTL and current app using language.

Reviewed By: fkgozali

Differential Revision: D3603412

fbshipit-source-id: 6bb280d56af9a12901148df9fab368366073680f
2016-07-26 14:43:49 -07:00
Mengjue Wang 54a4450309 Change the textalign setter to support RTL
Summary: Change the textalign setter to support RTL. In order to support text alignment according to layout style, move the textalign setter bridge function from ReactTextViewManager.java to ReactTextShadowNode.java and calculate it correctly on RCTTextUpdate.

Reviewed By: dmmiller

Differential Revision: D3597494

fbshipit-source-id: e5ca17b99b4233cc49a447a34175473e339ff53d
2016-07-26 12:13:33 -07:00
Ben Alpert a2fb703bbb Convert from React.createClass to ES6 classes
Reviewed By: cpojer

Differential Revision: D3619143

fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
2016-07-26 01:13:31 -07:00
Sokovikov 857d2b8eae change lineBreakMode to ellipsizeMode
Summary:
lineBreakMode only in rc so I think we can replace property without any deprecation warnings. satya164
Closes https://github.com/facebook/react-native/pull/9008

Differential Revision: D3614901

fbshipit-source-id: 724227c0a89192825a24850b930b80884571a51f
2016-07-25 13:13:35 -07:00
Chris Hopman d67258eb91 Move some really old tests to the cxx bridge
Reviewed By: mhorowitz

Differential Revision: D3507905

fbshipit-source-id: cbe55495a991bf6eef961319ba8b219e660dce05
2016-07-25 12:29:25 -07:00
SangYeob Bono Yu d06bea4962 Add dep for android local unit tests
Summary:
`./scripts/run-android-local-unit-tests.sh` raise error
```
05: error: cannot access com.facebook.react.bridge.CatalystInstance
    verify(mCatalystInstanceImpl).loadScriptFromOptimizedBundle(
                                 ^
  class file for com.facebook.react.bridge.CatalystInstance not found
```
and this PR fix it.
Closes https://github.com/facebook/react-native/pull/8957

Differential Revision: D3613491

Pulled By: bestander

fbshipit-source-id: 53b52fca13482e6474d7ffec9c19c0e7d6e4d100
2016-07-25 09:13:38 -07:00
SangYeob Bono Yu 3b35732800 Add Share module
Summary:
revision of https://github.com/facebook/react-native/pull/5476

It has only one method `shareTextContent` and next will be`shareBinaryContent`.

In Android, Promise can't receive a result, because `startActivityForResult` is not working with `Intent.ACTION_SEND`. Maybe we can use `createChooser(Intent target, CharSequence title, IntentSender sender)` which requires API level 22.
Closes https://github.com/facebook/react-native/pull/5904

Differential Revision: D3612889

fbshipit-source-id: 0e7aaf34b076a99089cc76bd649e6da067d9a760
2016-07-25 03:43:29 -07:00
ASCE1885 c21d3a1029 fix NullPointerException Caused by manageChildren
Summary: Closes https://github.com/facebook/react-native/pull/8991

Differential Revision: D3612777

Pulled By: dmmiller

fbshipit-source-id: d8da5ef8354cdaf55d8a3efbc2bfbc2aef74a044
2016-07-25 02:28:32 -07:00
Ahmed El-Helw 5f41769485 Fix ViewPager behavior with Nodes
Summary: Add a batch addition operation for ViewPager.

Differential Revision: D3597840

fbshipit-source-id: 1c9c42e03da2492444298220e75f547b6567b4e5
2016-07-22 15:43:27 -07:00
ASCE1885 37e5f3b6ca fix mTimerIdsToTimers remove error
Summary:
In Timing.java, the key provided to the remove function of mTimerIdsToTimers is not correct, that may introduce bugs.
Closes https://github.com/facebook/react-native/pull/8966

Differential Revision: D3605291

Pulled By: astreet

fbshipit-source-id: 97563b6846e8f3f40d20b48b3852dd557c9932f3
2016-07-22 09:28:40 -07:00
Andy Street a07026d075 Put setChildren debug log in DEBUG clause
Summary:
Missed wrapping this previously :x
Closes https://github.com/facebook/react-native/pull/8930

Reviewed By: foghina

Differential Revision: D3593226

Pulled By: astreet

fbshipit-source-id: aea05a6fe7a806d0e31bb486d3de90fe18f2c15f
2016-07-22 06:13:32 -07:00
Dave Miller da063e3d55 Set Event timestamp internally
Summary: This is pure cleanup so that we can make sure that all events are living in the same time space (currently nano seconds).

Reviewed By: foghina

Differential Revision: D3593884

fbshipit-source-id: 71b084362008f1c93c21880630acf11f5c058355
2016-07-21 07:43:28 -07:00
Mengjue Wang 700e82f663 Provide I18n Module in OSS 3/3
Summary: expose context for I18nManagerModule and I18nUtil

Reviewed By: dmmiller

Differential Revision: D3575706

fbshipit-source-id: d432d3762df13f9a1b33a32eff306f88e49fe852
2016-07-20 15:29:27 -07:00
Mengjue Wang 566e0553ca Provide I18n Module in OSS 2/3
Summary: Add module dependence into RN

Reviewed By: dmmiller

Differential Revision: D3575689

fbshipit-source-id: bc8cd221ffa4fcdbdab97051c0f8dedd387d6ee1
2016-07-20 11:28:33 -07:00
Mengjue Wang 0ab1486f7e Provide I18n Module in OSS 1/3
Summary: Create I18nUtil and I18nManagerModule for OSS.

Reviewed By: dmmiller

Differential Revision: D3575674

fbshipit-source-id: aad96be167f3e7b0692a9cc2c7f8a558e7aa722a
2016-07-20 11:28:33 -07:00
Don Yu 12ec213c0d Add support for layout gravity to ToastAndroid
Summary: Add support for top, bottom, and center layout gravity to ToastAndroid

Reviewed By: AaaChiuuu

Differential Revision: D3590224

fbshipit-source-id: 84dbbcfbe4133f291d62723c5c261acd7b32b46e
2016-07-20 08:13:37 -07:00
Adam Comella c4ffc7d71c Android: Fix handling of line height with inline images
Summary:
This PR was split from a commit originally in #8619. /cc dmmiller

When an inline image was larger than the specified line height,
the image would be clipped. This changes the behavior so
that the line height is changed to make room for the inline
image. This is consistent with the behavior of RN for iOS.

Here's how the change works.

ReactTextView now receives its line height from the layout thread
rather than directly from JavaScript.

The reason is that the layout thread may pick a different line height.
In the case that the tallest inline image is larger than the line
height supplied by JavaScript, we want to use that image's height as
the line height rather than the supplied line height.

Also fixed a bug where the image, which is supposed to be baseline
aligned, would be positioned at the wrong y location. To fix this,
we use `y` (the baseline) in the `draw` method rather than trying
to calculate the baseline from `bottom`. For more information
see https://code.google.com/p/andro
Closes https://github.com/facebook/react-native/pull/8907

Differential Revision: D3592781

Pulled By: dmmiller

fbshipit-source-id: cba6cd86eb4e3abef6a0d7a81f802bdb0958492e
2016-07-20 07:13:37 -07:00
Andrew Jack c47f7457c0 Update OkHttp to 3.4.0 and Okio to 1.9.0
Summary:
- 3.3.1 wasn't compatible with Robolectric 3.0, however 3.4.0 [fixes](https://github.com/square/okhttp/issues/2533#issuecomment-230198063) this issue.
- Few other fixes to OkHttp mentioned in the [CHANGELOG.md](https://github.com/square/okhttp/blob/master/CHANGELOG.md)

> Fixes: #7743
>
- Android apps can recover from a `REFUSED_STREAM` in HTTP/2.
- A few other fixes mentioned in the [CHANGELOG.md](https://github.com/square/okhttp/blob/master/CHANGELOG.md)

- CircleCi
- Test with `/Examples` 
Closes https://github.com/facebook/react-native/pull/8672

Reviewed By: alsutton

Differential Revision: D3541293

Pulled By: bestander

fbshipit-source-id: 76429861b4f4df15cb9c18ab0f177daee3e1459d
2016-07-20 06:43:33 -07:00
Jon Vassbø b7bf24bc7f Support geolocation in android webview
Summary:
Makes sure request for geolocation use in the webview is handled.
This solves issue #7609

Currently use of geolocation in webview fails silently, as the permission request is never received by the native app.

**Test plan (required)**

1. Create new project with webview
2. Add javascript for geolocation:
```javascript
navigator.geolocation.getCurrentPosition(function (position) {
  console.log('success', position)
}, function (error) {
  console.log('could not determine position', error)
})
```
3. Run code and assert geolocation permission is requested, resulting in success (or error) callback being called
Closes https://github.com/facebook/react-native/pull/8305

Differential Revision: D3592887

fbshipit-source-id: 84fe2383fba8873431c5e89d154c0a4fd58ffb70
2016-07-20 05:43:25 -07:00
Adam Comella e1b3bbdb04 Android: Refactor HierarchyOptimizer in preparation of inline view support
Summary:
This PR was split from commits originally in #8619. /cc dmmiller

These refactorings to the HierarchyOptimizer are in preparation for implementing support for inline views in #8619.

**Refactoring 1: Collapse add*LayoutOnlyNodeToLayoutOnlyNode**

addLayoutOnlyNodeToLayoutOnlyNode and addNonLayoutOnlyNodeToLayoutOnlyNode
had nearly identical implementations. They both walk thru the ancestors
looking for a nonlayout-only node and adjusting the passed in index at each
step. This introduces a new function, walkUpUntilNonLayoutOnly, which
takes care of that responsibility. This simplifies addNodeToNode
because it can now consider the type of the parent and the type of
the child independently.

**Refactoring 2: Extract addGrandchildren**

Pull out addLayoutOnlyNode's logic into a helper called
addGrandchildren. We will need to call this method in
another place later.

**Test plan (required)**

This change was tested with UIExplorer and a small test app and it's being used in my team's app.
Closes https://github.com/facebook/react-native/pull/8908

Differential Revision: D3592783

Pulled By: dmmiller

fbshipit-source-id: a513e8d381e71112ce6348bbee7d4a7c62c33619
2016-07-20 04:28:36 -07:00
Konstantin Raev 702c14bdf2 Enabled Vertical ScrollView instrumentation test in SandCastle
Reviewed By: emilsjolander

Differential Revision: D3588423

fbshipit-source-id: ad2486b3da5fe7972e4ea9409a729d2ba2483782
2016-07-20 02:58:39 -07:00
Tobias Ritzau d343eaabff Added the native animation demo to the android UIExplorer
Reviewed By: javache

Differential Revision: D3569816

fbshipit-source-id: ab03f3f3ad10b3921d428628c87e4091c07ceafe
2016-07-19 02:43:24 -07:00
Yibin Chen 4ccd14f31a Integrating AutoUpdater's custom JS Bundle loading into Fb4a
Reviewed By: AaaChiuuu

Differential Revision: D3558831

fbshipit-source-id: b3909de774922fae903f3e8718fbfcd9b1ece2f8
2016-07-18 16:28:28 -07:00
Olivier Notteghem e27c1495bd network congestion improvements (part 1)
Reviewed By: dmmiller

Differential Revision: D3553287

fbshipit-source-id: ea33bb7d929cbc0229bfe8537c3a4fc58fe9691e
2016-07-18 12:13:29 -07:00
Janic Duplessis 80872ffccd Remove exported constants from RCTTimers to allow lazy initialization
Summary:
As per javache comments in #8734.

Also removes now useless feature detection check.

**Test plan**
Tested that rIC still works in UIExplorer example.
Closes https://github.com/facebook/react-native/pull/8795

Differential Revision: D3572566

Pulled By: javache

fbshipit-source-id: 261d13d8b03898313f8b4184d634c70f81a61b62
2016-07-15 13:58:40 -07:00
Michał Gregorczyk 3c0f428f05 Fix optimized bundle stuff.
Reviewed By: davidaurelio, tadeuzagallo

Differential Revision: D3563710

fbshipit-source-id: 2b0a982d388ee5f44b806f8e561ef49a3fd8c8ca
2016-07-14 15:28:46 -07:00
Felix Oghina b0c023c85c fix removing views from ViewPagerAndroid
Summary:
Two things in this diff:

1. Implemented `getItemPosition` in our adapter; the default implementation always returns POSITION_UNCHANGED, which is incorrect, and causes `destroyItem` to never (sometimes?) be called.
2. Fix `destroyItem`: this never worked. `destroyItem` is always called by the ViewPager after a `notifyDataSetChanged()`, so after `removeViewAt`, which removes the view from `mViews`, causing `destroyItem` to throw `IndexOutOfBoundsException` when it tries to get the view. Since our item objects are just views, use that instead of checking `mViews`.

Reviewed By: ahmedre

Differential Revision: D3555427

fbshipit-source-id: 900c2696162d07f507e850517d483b943ce39a35
2016-07-14 13:28:25 -07:00
David Aurelio df01215006 Reverted commit D3545345
Reviewed By: tadeuzagallo

Differential Revision: D3545345

fbshipit-source-id: d655918be7dcadaf8143800497e85f3de44bd48a
2016-07-14 10:58:27 -07:00
Alexander Blom 55fb4f4a75 Don't close WebSocket if it fails during connect
Summary: This is causing log spew in all Android RN apps because we try to close a non-existing web socket.

Reviewed By: foghina

Differential Revision: D3548998

fbshipit-source-id: 27392915bdf456c88f44c3b394c5c9d2ea1bab54
2016-07-14 07:43:32 -07:00
Janic Duplessis 18394fb179 Initial implementation of requestIdleCallback on Android
Summary:
This is a follow up of the work by brentvatne in #5052. This addresses the feedback by astreet.

- Uses ReactChoreographer with a new callback type
- Callback dispatch logic moved to JS
- Only calls into JS when needed, when there are pending callbacks, it even removes the Choreographer listener when no JS context listen for idle events.

** Test plan **
Tested by running a background task that burns all remaining idle time (see new UIExplorer example) and made sure that UI and JS fps stayed near 60 on a real device (Nexus 6) with dev mode disabled. Also tried adding a JS driven animation and it stayed smooth.

Tested that native only calls into JS when there are pending idle callbacks.

Also tested that timers are executed before idle callback.
```
requestIdleCallback(() => console.log(1));
setTimeout(() => console.log(2), 100);
burnCPU(1000);
// 2
// 1
```

I did *not* test with webworkers but it should work as I'm using executor tokens.
Closes https://github.com/facebook/react-native/pull/8569

Differential Revision: D3558869

Pulled By: astreet

fbshipit-source-id: 61fa82eb26001d2b8c2ea69c35bf3eb5ce5454ba
2016-07-13 18:58:20 -07:00
Chris Hopman c89c25f27d Make new bridge default in OSS
Reviewed By: bestander

Differential Revision: D3553208

fbshipit-source-id: 35d466e87032618978230b118772e366ba1deea9
2016-07-13 16:13:19 -07:00
Emil Sjolander 8dd8c41553 Point csslayout deps over to xplat
Reviewed By: bestander

Differential Revision: D3555221

fbshipit-source-id: cad4c74f4780c6d636fd244f7a4dcd1806241b25
2016-07-13 14:28:45 -07:00
Emil Sjolander 86e304f6a3 Move csslayout into xplat
Reviewed By: lucasr

Differential Revision: D3509483

fbshipit-source-id: dfd0b00002b7da6432667b4a795edb5a15cf9a88
2016-07-13 10:28:27 -07:00