Commit Graph

2410 Commits

Author SHA1 Message Date
Alexey Lang 6224ef5301 Measure time to create ReactInstanceManager
Reviewed By: fkgozali

Differential Revision: D6591797

fbshipit-source-id: 7345b7c772eb4ae35ad570082090fbdf704102d3
2018-01-29 11:07:39 -08:00
Satyajit Sahoo be56a3efee Implement Blob support for XMLHttpRequest
Summary:
This PR is a followup to https://github.com/facebook/react-native/pull/11417 and should be merged after that one is merged.

  1. Add support for creating blobs from strings, not just other blobs
  1. Add the `File` constructor which is a superset of `Blob`
  1. Add the `FileReader` API which can be used to read blobs as strings or data url (base64)
  1. Add support for uploading and downloading blobs via `XMLHttpRequest` and `fetch`
  1. Add ability to download local files on Android so you can do `fetch(uri).then(res => res.blob())` to get a blob for a local file (iOS already supported this)

  1. Clone the repo https://github.com/expo/react-native-blob-test
  1. Change the `package.json` and update `react-native` dependency to point to this branch, then run `npm install`
  1. Run the `server.js` file with `node server.js`
  1. Open the `index.common.js` file and replace `localhost` with your computer's IP address
  1. Start the packager with `yarn start` and run the app on your device

If everything went well, all tests should pass, and you should see a screen like this:

![screen shot 2017-06-08 at 7 53 08 pm](https://user-images.githubusercontent.com/1174278/26936407-435bbce2-4c8c-11e7-9ae3-eb104e46961e.png)!

Pull to rerun all tests or tap on specific test to re-run it

  [GENERAL] [FEATURE] [Blob] - Implement blob support for XMLHttpRequest
Closes https://github.com/facebook/react-native/pull/11573

Reviewed By: shergin

Differential Revision: D6082054

Pulled By: hramos

fbshipit-source-id: cc9c174fdefdfaf6e5d9fd7b300120a01a50e8c1
2018-01-26 09:17:11 -08:00
4ndroidev 7b1915e74d Fix NPE in Android Switch during measure
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Fixes #16000

see [Issue #16000](https://github.com/facebook/react-native/issues/16000)
fix a null pointer exception while using higher version 'com.android.support:appcompat-v7'

N/A

[ANDROID][BUGFIX][Switch] - Fix NPE in Android Switch during measure
Closes https://github.com/facebook/react-native/pull/16064

Differential Revision: D6816122

Pulled By: hramos

fbshipit-source-id: ba9a6febad4884b8ab142d8c7142085367006904
2018-01-25 18:00:09 -08:00
Michael Lee 869866cc5c Continue wrapping functions as we prepare for skylark
Differential Revision: D6808010

fbshipit-source-id: f24e71558baed2c2da319e20e0faf66858eb27d5
2018-01-25 09:30:00 -08:00
Sergei Dryganets 0c18ec5b9c Popups calling error callback instead of crashing if view with passed tagId not found
Summary:
The showPopup method has an error callback. For some reason, it is asserting in case the wrong tagId is passed instead of calling the error callback on Android.

Pass not existing tagId to showPopup method and make sure it is receiving an error in js instead of crashing in native on Android.

[ANDROID] [MINOR] showPopup method calls error callback instead of crashing on errors.
Closes https://github.com/facebook/react-native/pull/17550

Differential Revision: D6776014

Pulled By: hramos

fbshipit-source-id: 1d97b762818d1591018fd43556eb41c3fb491eb9
2018-01-23 14:07:25 -08:00
Jonathan Kim 4f6c157250 Fix open source build load error
Reviewed By: hramos

Differential Revision: D6785610

fbshipit-source-id: d50aab72aa51f8aa063f23fc1e328caf9c02de0c
2018-01-23 09:51:40 -08:00
Pritesh Nandgaonkar be8e7c6e65 Made logging logic dynamic to log string length
Reviewed By: emilsjolander

Differential Revision: D6784491

fbshipit-source-id: 26e4520a84be355ff992b808297ce7a95b3d09e3
2018-01-23 06:46:08 -08:00
Sergei Dryganets 46cc4907e3 ClassCastException fix: getText() returns CharSequence not Spanned.
Summary:
ClassCastException fix: getText() returns CharSequence not Spanned.
From the other hand, EditTexts getText method returns Editable which extends Spanned.
This commit fixes two similar bugs one in flat TextView and another in standard TextView.
Also, it removes redundant checks in the ReactEditText.

Application without this change sporadically crashes with the following stack trace:
```
java.lang.ClassCastException: java.lang.String cannot be cast to android.text.Spanned
	at com.facebook.react.views.text.ReactTextView.reactTagForTouch(ReactTextView.java:195)
	at com.facebook.react.uimanager.TouchTargetHelper.getTouchTargetForView(TouchTargetHelper.java:269)
	at com.facebook.react.uimanager.TouchTargetHelper.findTargetTagAndCoordinatesForTouch$58866680(TouchTargetHelper.java:101)
	at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java:77)
	at com.facebook.react.ReactRootView.dispatchJSTouchEvent(ReactRootView.java:151)
	at com.facebook.react.ReactRootView.onInterceptTouchEvent(ReactRootView.java:127)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2110)

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

Differential Revision: D6775986

Pulled By: hramos

fbshipit-source-id: 6de929937cbbb3e7bd98a708a40700f883cbaef0
2018-01-22 15:15:23 -08:00
Pascal Hartig ff2658c3de Mark model fields final
Reviewed By: emilsjolander

Differential Revision: D6759564

fbshipit-source-id: 810dc8a9730fb330760d2aedecafcea81cf25cb1
2018-01-22 03:05:17 -08:00
Build Service f49f7932d5 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/instagram-directapp.config.json on master
fbshipit-source-id: ec880908d30772bf2047963013d184e01405de03
2018-01-22 02:16:31 -08:00
Build Service faa9519021 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/fb4a.config.json on master
fbshipit-source-id: c7382ae9de4fb1697190bbc9fe385bd552973fdd
2018-01-22 02:16:31 -08:00
Build Service 8bd00a2361 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/expresswifi.config.json on master
fbshipit-source-id: 42904e404f11a205af8af486e9535a8dc52da81e
2018-01-22 02:16:31 -08:00
Build Service bb6fceac27 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/creatorapp.config.json on master
fbshipit-source-id: 9ae5884ac23492feed039da32433cd8c08e2cc0e
2018-01-22 02:16:31 -08:00
Build Service c7846c4bfb @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/adsmanager.config.json on master
fbshipit-source-id: a0ba2333de9b635234aa56ccd080252fa400d534
2018-01-22 02:16:31 -08:00
Jonathan Kim 4f2cc42a2d Make xplat react native files buildable
Reviewed By: mzlee

Differential Revision: D6605611

fbshipit-source-id: baa33947319a27b95020924d177a9398a276dabe
2018-01-21 22:05:05 -08:00
David Vacca 4d3519cc6a Adding JS hierarchy information when a StackOverflowException is thrown in Dev mode
Reviewed By: achen1

Differential Revision: D6716309

fbshipit-source-id: 23458cd126d13fec3aa9c09420f7cdd230ec8dd0
2018-01-19 13:02:41 -08:00
David Vacca 1aac962378 Capture StackOverflowExceptions triggered when drawing a ReactViewGroup or ReactRootView
Reviewed By: achen1

Differential Revision: D6653395

fbshipit-source-id: 849b1a2ed6ab9bc057414d451e97a673178c30dd
2018-01-18 18:48:59 -08:00
David Vacca 877f1cde2e Fix and re-enable "view flattening" optimizations for Marketplace
Reviewed By: achen1

Differential Revision: D6751078

fbshipit-source-id: 32bfb9ac64f183fabbba85755be372016722afc6
2018-01-18 17:55:08 -08:00
Ram N f5efc460ad Add support for finding multiple views with NativeIds using a single listener
Reviewed By: mdvacca

Differential Revision: D6735460

fbshipit-source-id: e038a68637a00fda7058fc82e253ae68cdf67c6e
2018-01-18 11:33:34 -08:00
David Vacca 71ec85f24c Cleanup ReactHorizontalScrollView
Reviewed By: achen1

Differential Revision: D6693605

fbshipit-source-id: e58425b2a5b0bf75ffb41ef3ab6fa7ad46222531
2018-01-18 10:46:47 -08:00
Tim Yung df2f33537a RN: Revert D6701597
Reviewed By: mdvacca

Differential Revision: D6735812

fbshipit-source-id: 8144b72883150f9d7e2614ee0f238c1b8e44c6ab
2018-01-17 15:11:14 -08:00
Kathy Gray 7891805d22 move native accesses of map into two accesses instead of per-element
Differential Revision: D6650192

fbshipit-source-id: 0eb0719fd3b7813add33a3d4fe3fb70e6f375fd7
2018-01-17 10:51:49 -08:00
Kathy Gray 5649aed6d3 Move native accesses of array into one access instead of per-element
Differential Revision: D6578349

fbshipit-source-id: 84ebd66ed791a845e9cc0fbc7e12a377534aa903
2018-01-17 10:51:49 -08:00
Felix Oghina fc6dd78935 Remove SoLoaderShim, use SoLoader
Summary:
SoLoader is more stable on older versions of Android. Switching to it should fix recurring issues that we get such as `UnsatisfiedLinkError` and so on.

CI + run showcase app.
Closes https://github.com/facebook/fresco/pull/1989

Reviewed By: erikandre

Differential Revision: D6556420

Pulled By: foghina

fbshipit-source-id: ffc3faef6452294b4d781258c64ef57e08d107b5
2018-01-16 09:16:01 -08:00
David Vacca 1f5bb374cd Revert D6704701: Refactor ReactViewGroup to reuse ReactViewBackgroundManager
Differential Revision: D6704701

fbshipit-source-id: 01feb61a9c2c263f88cca4fea5978957c5e4767f
2018-01-16 08:15:47 -08:00
Semen Zhydenko d2c569795c Typos in comments and log messages
Summary:
No code changes, no testing required.

alligned -> aligned
allignment -> alignment
completly -> completely
conseptually -> conceptually
decendents -> descendants
indefinetly -> indefinitely
dimention -> dimension
doesnt -> doesn't
safegaurd -> safeguard
intialization -> initialization
hierachy -> hierarchy
happend -> happened
gaurd -> guard
programatically -> programmatically
initalized -> initialized
immidiately -> immediately
occured -> occurred
unkown -> unknown
neccessary -> necessary
neccesarily -> necessarily
occuring -> occurring
comoponent -> component
propogate -> propagate
recieved -> received
referece -> reference
perfomance -> performance
recieving -> receiving
subsquently -> subsequently
scoll -> scroll
suprisingly -> surprisingly
targetting -> targeting
tranform -> transform
symetrical -> symmetrical
wtih -> with
Closes https://github.com/facebook/react-native/pull/17578

Differential Revision: D6718791

Pulled By: shergin

fbshipit-source-id: 4ab79c1131ec5971d35a0c7199eba7ec0a0918ad
2018-01-12 22:18:45 -08:00
David Vacca e8aa60430c Refactor ReactViewGroup to reuse ReactViewBackgroundManager
Reviewed By: achen1

Differential Revision: D6704701

fbshipit-source-id: 14bb155f2eb0951307674e257e729a1c72b08d8b
2018-01-12 17:08:00 -08:00
Brandon Williams 164f6b6afd Unset phone and visible-password keyboardType flags on Android
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Attempted fix for issue #17248

Added unit tests that cover the affected function and manually repeated the reproduction steps found in the issue.

Note: I had to apply the attached patch file to actually *run* the tests because they were not enabled. I didn't include this in the PR because it seemed like a secondary problem with possible ramifications (see comment near patched line) beyond this issue. For example, other, unrelated tests break when that line is uncommented.
[textInputTestEnable.patch.txt](https://github.com/facebook/react-native/files/1565807/textInputTestEnable.patch.txt)

If I should apply the patch to this PR or re-enable the tests in some other fashion, please let me know and I can do so.

(none)

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[ANDROID] [BUGFIX] [TextInput] - Fix an issue when swapping to and from the `'visible-password'` or `'phone-pad'` keyboard types.
Closes https://github.com/facebook/react-native/pull/17249

Differential Revision: D6713008

Pulled By: hramos

fbshipit-source-id: 85eeb5398748d48e59d33eb86d851fd02d587a31
2018-01-12 11:32:52 -08:00
Sergei Dryganets 9024f56bda Fix crash due to mishandling of UTF-8 in progressive download.
Summary:
Fixes:
```
Fatal Exception: java.lang.RuntimeException: Failed to create String from JSON
       at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
       at android.os.Looper.loop(Looper.java:234)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:193)
       at java.lang.Thread.run(Thread.java:818)
```
JavaScriptCore is very strict about invalid UTF symbols.
So if you pass an invalid UTF-8 string to it the string will be decoded as an empty string.

The current implementation of progressive downloading for Android blindly cuts the response in 8KB chunks.
That could cause a problem in case the last symbol in the chunk is multi-byte.

To prevent it I added a class which determines if this is the case and cut the string in the appropriate place.
A remainder is prepended to the next chunk of data.

This should fix the root cause of this issue:
https://github.com/facebook/react-native/issues/10756
Closes https://github.com/facebook/react-native/pull/15295

Differential Revision: D6712570

Pulled By: hramos

fbshipit-source-id: f07fcf0f011c2133c8e860ceb0588a29d36d07fb
2018-01-12 11:10:04 -08:00
Sergei Dryganets c8e98bbaf5 CI for Android fixed
Summary:
Fix for android github CI.

Github CI doesn't work without this change.

CI passes.

[INTERNAL] Android CI fix.
Closes https://github.com/facebook/react-native/pull/17551

Differential Revision: D6707477

Pulled By: hramos

fbshipit-source-id: f98515234da3b90ee3233523bcd7cc67ed82c1b4
2018-01-12 08:01:00 -08:00
Igor Ganapolsky 7abffc3f8c punctuation and grammar
Summary:
Use a comma for clear punctuation, and use 'wants' verb.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Use clear grammar for README file

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/react-native-website, and link to your PR here.)

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Closes https://github.com/facebook/react-native/pull/17545

Differential Revision: D6711711

Pulled By: hramos

fbshipit-source-id: 315f66e5b36c4a3ffdc5407876cc0fc2ed596a56
2018-01-12 08:01:00 -08:00
Attila Jakabfi 2a22d998f8 Spacing
Differential Revision: D6683074

fbshipit-source-id: a76bc5028962d738bb931a997752f6ba194bd8ed
2018-01-12 05:13:21 -08:00
Sergei Dryganets d5e3f081c6 Fix #6228: Crash in Android dialog module.
Summary:
Android dialog module has a race condition as a result of which it crashes.
See this issue:
https://github.com/facebook/react-native/issues/6228.

The mIsInForeground flag is set on UI thread but was used from the ReactMethod thread.
Now all public methods of FragmentManagerHelper called from UI thread only.
Asserts are added in appropriate places to prevent future regressions.

Make sure that dialogs work after this change.
It will be nearly impossible to reproduce the issue manually but automatic regression tests should be able to catch this. At least our tests were crashing on some dialog scenarios from time to time.

[ANDROID] [MINOR] [BUGFIX] - Race condition fix in Android Dialogs module.
Closes https://github.com/facebook/react-native/pull/17392

Reviewed By: achen1

Differential Revision: D6708787

Pulled By: mdvacca

fbshipit-source-id: 99beb3ea3046286cc973f7677e98ff36f162b09b
2018-01-11 18:57:31 -08:00
Andrew Chen (Eng) f363dfe766 Fix redbox style
Differential Revision: D6689447

fbshipit-source-id: de6b1295e53c46bdf99f0f4a26130f516763ee66
2018-01-11 15:42:17 -08:00
Andrew Chen (Eng) e3c27f585a Add Context to Redbox report api
Differential Revision: D6700021

fbshipit-source-id: b8ba8242a68c02e608900c93a7645d61158cc0cb
2018-01-11 15:17:46 -08:00
Emil Sjölander 1c3f6acfe5 Expose more android device infos
Reviewed By: fkgozali

Differential Revision: D6692907

fbshipit-source-id: ecbcf763aae2035c9526e891d0cc14a987b6d4c1
2018-01-11 04:16:39 -08:00
Tim Yung 7e9242bd1a RN: Fix `borderRadius` for Image Background (Android)
Differential Revision: D6701597

fbshipit-source-id: 462b578c3b988c5fa7e3d25e4a6425d170ab4b62
2018-01-11 00:41:52 -08:00
David Vacca c249e52096 Fix BadTokenException when redbox was dismissed and re-displayed
Reviewed By: achen1

Differential Revision: D6690662

fbshipit-source-id: d3e3fa4108d832da0a6d9e290263121ba86afbf4
2018-01-10 16:46:35 -08:00
Steven Cable 22735f6903 Fix DeviceInfoModule LifecycleEventListener
Summary:
Fixes one of the two parts of [issue posted here](https://github.com/facebook/react-native/issues/17209).  Motivation is that we wanted our app to be able to handle user changing font size while the app is running.  Yes, we know that changing font size doesn't inherently trigger a re-render, but at the minimum it should cause `PixelRatio.getFontScale()` to return an updated value.

1. Render an interface and invoke `PixelRatio.getFontScale()`
2. Change the font scale in Settings > Accessibility > Font Size
3. Return to the React Native app (without reloading Javascript) and invoke `PixelRatio.getFontScale()` again.
4. Verify that the result of `PixelRatio.getFontScale()` has changed to reflect the new font size.

For a video of the problem, see the linked issue under the Motivation heading.  In this fixed version, the number actually does update as expected.

None.  This should require no documentation change, as it is behavior that the docs seem to indicate should be happening already.
In fact, [the documentation at the bottom of this page](https://facebook.github.io/react-native/docs/native-modules-android.html) appears to already indicate that this should be done for anything implementing LifecycleEventListener.

[ANDROID] [BUGFIX] [DeviceInfo] - Fix the DeviceInfoModule to properly respond to LifecycleEvents
Closes https://github.com/facebook/react-native/pull/17227

Differential Revision: D6692358

Pulled By: hramos

fbshipit-source-id: 3db212fe8103c7aa29a29ead6c772abb7ae4cd85
2018-01-10 05:32:09 -08:00
James Ide 7f58189605 Change inlined `okhttp3.Headers` references to a Java import
Summary:
In BundleDownloader.java, there were references to `okhttp3.Headers` instead of importing the class at the top of the file. This PR is a simple change to use an import instead.

Compile the Android app

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/react-native-website, and link to your PR here.)

[ANDROID][MINOR][BundleDownloader] - Use Java import instead of fully qualified class name
Closes https://github.com/facebook/react-native/pull/17507

Differential Revision: D6691593

Pulled By: hramos

fbshipit-source-id: 81b366db608b7be8a903d2f25b36ca5642d9eec3
2018-01-09 23:54:57 -08:00
Andrew Chen (Eng) b0319f3293 Fix ReactScrollView lints
Differential Revision: D6689492

fbshipit-source-id: c55f98f3ed25757ec192a023d2dd60c73aae8df2
2018-01-09 18:52:38 -08:00
David Vacca b2848a54b0 Adding support to float values for Android snapToInterval
Reviewed By: fkgozali

Differential Revision: D6684529

fbshipit-source-id: 51efa0a2d38acf4134bb824c462973e5c6bdf17a
2018-01-09 12:32:53 -08:00
David Vacca e5c2a66897 Fix Modal not disappearing when navigating from inside a Modal to another activity
Reviewed By: achen1

Differential Revision: D6668368

fbshipit-source-id: 809e9c978032e731478bcc8e290eb030e4ee6eca
2018-01-08 10:00:49 -08:00
David Vacca 0356cbd13b Fix BadTokenException when displaying warning messages
Reviewed By: achen1

Differential Revision: D6651871

fbshipit-source-id: fc7fc118999f0e752636a3142764bd3496e5dc81
2018-01-05 16:08:17 -08:00
Wesley Walser c49d249fd7 Send scroll velocity data to Javascript on momentum scroll events.
Reviewed By: sahrens

Differential Revision: D6643379

fbshipit-source-id: 70550274975ed7c2b43a3d668422102d0c115ba7
2018-01-05 10:46:03 -08:00
David Vacca e57a43b97a Revert D6531148: Fix BadTokenException and IllegalArgmentException thrown when showing or dismissing Modal
Differential Revision: D6531148

fbshipit-source-id: a90cc38f98d6b86151539abd2a07bfcf1c253a5f
2018-01-04 17:31:17 -08:00
Josh Hargreaves c9ff0bc212 Implement onKeyPress Android
Summary:
This implements onKeyPress for Android on TextInputs and addresses https://github.com/facebook/react-native/issues/1882.
**N.B. that this PR has not yet addressed hardware keyboard inputs**, but doing will be fairly trivial. The main challenge was doing this for soft keyboard inputs.

I've tried to match the style as much as I could. Will happily make any suggested edits be they architectural or stylistic design (edit: and of course implementation), but hopefully this is a good first pass :).
I think important to test this on the most popular keyboard types; maybe different languages too.
I have not yet added tests to test implementation, but will be happy to do that also.

- Build & run RNTester project for Android and open TextInput.
- Enter keys into 'event handling' TextInput.
- Verify that keys you enter appear in onKeyPress below the text input
- Test with autocorrect off, on same input and validate that results are the same.

Below is a gif of PR in action.
![onkeypressandroid](https://user-images.githubusercontent.com/1807207/27512892-3f95c098-5949-11e7-9364-3ce9437f7bb9.gif)
Closes https://github.com/facebook/react-native/pull/14720

Differential Revision: D6661592

Pulled By: hramos

fbshipit-source-id: 5d53772dc2d127b002ea5fb84fa992934eb65a42
2018-01-04 12:51:38 -08:00
Jimmy Zhuang ddd65f1ba9 Support snapToInterval for horizontal scrollview on Android
Summary:
`snapToInterval` is available on iOS but on android yet. This PR is to add support for `snapToInterval` on android.

Example:

![android_snap](https://cloud.githubusercontent.com/assets/1699429/19086983/39d3ee1c-8a25-11e6-9c84-20f25a751f32.gif)

TO: lelandrichardson spikebrehm
Closes https://github.com/facebook/react-native/pull/10242

Differential Revision: D4168527

fbshipit-source-id: de3dd9ac5d9e0fddfce5e5bc0aa6a4f33f1e30b3
2018-01-03 10:33:07 -08:00
Héctor Ramos f9e742aadf Fix buck failure
Summary:
Buck is failing due to missing args: https://circleci.com/gh/facebook/react-native/29268
Closes https://github.com/facebook/react-native/pull/17346

Differential Revision: D6642181

Pulled By: hramos

fbshipit-source-id: 399d3c5f197ae0de9748a592def945c14ac1d348
2017-12-28 08:31:28 -08:00
Alex Dvornikov 80f9e1f7de remove "prepareReact" call from the Android bridge
Reviewed By: alexeylang

Differential Revision: D6596304

fbshipit-source-id: 0285611cfdd66ce5bdfa503c9fe8f1963a0c583f
2017-12-26 14:47:30 -08:00
Taras Tsugrii a6a66c5b39 Remove last usages of cxx_library.
Reviewed By: mzlee

Differential Revision: D6632262

fbshipit-source-id: 1ec3ba232e573b9cbc892f23827f9a7c5df34106
2017-12-23 19:41:31 -08:00
Taras Tsugrii 077c3ab349 Define internal FB macro for OSS builds.
Reviewed By: hramos

Differential Revision: D6626785

fbshipit-source-id: bb7c89499bc7c72e24dabd82899c3d9c49874101
2017-12-22 08:47:50 -08:00
Héctor Ramos c547f783c4 Update Docker images to latest Android SDK, Buck
Summary:
Test Plan

Rebuilt Docker images locally, confirmed successful image build.

Can later be reproed with

```
npm run test-android-setup
npm run test-android-build
npm run test-android-run-unit-tests
```

Note that unit tests are failing in master, but in this PR we can repro the same failure.
Closes https://github.com/facebook/react-native/pull/17313

Differential Revision: D6624899

Pulled By: hramos

fbshipit-source-id: 42b8cd708ec2a02399bb6ef30fd73faba2646f79
2017-12-21 17:31:32 -08:00
Krzysztof Magiera 7ff6657985 Add top offset for react loading view on Kitkat
Summary:
This PR fixes the problem with dev loading view on KitKat and older Android devices after #16596

Install RNTester app on Android API 19 or lower device. See green loading view show up under status bar. Do the same with full screen theme set and see it show up correctly at the top of the screen.
Verify the green loading bar displays correctly on devices with API > 19 too.

This fixes an issue introduced in #16596

[ANDROID][MINOR][DevSupport] - Fix green dev loading bar on Android Kitkat and below
Closes https://github.com/facebook/react-native/pull/17305

Differential Revision: D6621077

Pulled By: achen1

fbshipit-source-id: 3b4216af535d7db5c96d137f20004fe2651b1dc9
2017-12-21 12:36:15 -08:00
Taras Tsugrii ba31d29dc9 Replace native cxx_library with fb-specific macros.
Reviewed By: adamjernst

Differential Revision: D6618153

fbshipit-source-id: 188e2ca3cc78efad6e71f0a22547e26abf2f62e1
2017-12-21 08:58:50 -08:00
Ram N 4996b9aeb4 On Android, seperate logic to initialize JS from starting the app
Reviewed By: achen1

Differential Revision: D6606265

fbshipit-source-id: d432661b5f8aa2b7600b1140e1617aab852f343e
2017-12-19 20:31:15 -08:00
Pritesh Nandgaonkar f1055bcac8 Make YGNode as c++ struct with properties exposed through accessors
Reviewed By: emilsjolander

Differential Revision: D6592257

fbshipit-source-id: 641e8b9462ad00731a094511f9f5608b23a6bb21
2017-12-19 11:32:49 -08:00
Ben Nham bef7967f9a move page registration logic in to jsinspector
Reviewed By: pakoito

Differential Revision: D6531199

fbshipit-source-id: ed1ae9e2f0c19e7656cd022e438693798320e55a
2017-12-15 09:20:13 -08:00
Max Sherman b952365ba6 std::string to const char*
Reviewed By: danzimm

Differential Revision: D6570194

fbshipit-source-id: 84dae925b9269393b6925e0977598e3872acb14e
2017-12-14 13:36:51 -08:00
Shin-Kai Chen 29f3f55298 Do not overwrite the same text in ReactEditText
Differential Revision: D6516674

fbshipit-source-id: 246b8efeff7963912bf6b1c8a004c3103be03246
2017-12-11 21:45:37 -08:00
Ramanpreet Nara cb49877a25 Backed out changeset 4fe617216293
Reviewed By: fred2028

Differential Revision: D6539205

fbshipit-source-id: c97d4f3dbd457f59968991b043d7106e551effad
2017-12-11 18:02:02 -08:00
David Vacca c465599a27 Fix BadTokenException and IllegalArgmentException thrown when showing or dismissing Modal
Reviewed By: achen1

Differential Revision: D6531148

fbshipit-source-id: 1d3f6e041ac68ad13120c56ea5223557fca34f0d
2017-12-11 09:46:30 -08:00
Krzysztof Magiera d19afc73f5 Use currentActivity to display redbox, loading view and dev menu
Summary:
This change aims at replacing SYSTEM_ALERT_WINDOW/OVERLAY API being used for rendering dev support related views on Android (redbox, dev menu, green loading view) with API that does not require any special permission. The permission is still used for displaying perf monitor, although it is no longer requested at app startup but only when perf monitor gets enabled.

This change should not affect the way react native apps work in production environment as in release mode all dev support functionality is disabled.

There are two main reasons why requiring SYSTEM_ALERT/OVERLAY permission for displaying basic dev related windows is problematic:
 1) On Android >=6 devices it is required that overlay permission is granted in device settings for apps being side loaded (not installed via play store which is usually the case for apps being developed). Although this setting is not available on some Android devices including Google's stock Android TV version. On such devices App cannot be granted rights to draw in system alert window which cases the app to crash (instead of showing a redbox or dev menu dialog)
 2) Some Android device vendors have issues with implementation of `Settings.canDrawOverlays` that always return false (I've seen it on Xiaomi Redmi 4A with Android 6.1). This issue because of the following code in [ReactActivityDelegate.java#L90](1e8f3b1102/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java (L90)), results in the overlay permission settings screen popping up every time the app is launched even though the permission has been perviously granted which is extremely annoying. Since this change only require overlay permission for displaying perf monitor we no longer ask for it on startup but only when user switches perf monitor ON.

Test need to be performed on pre Android 6 and post Android 6 devices.

1. Run app with devserver off -> should result in redbox
2. Start packager with --reset-cache flag for the loading bar to be visible for some longer period of time. Then restart the app and see the loading bar show up
3. While the app is running, open dev menu, navigate to "dev settings", test "reload"
4. Modify JS app such that the app crashes, see it display redbox properly. Check if "reload" button works well from the redbox
5. Verify that "Show Perf Monitor" option works as expected. On Android >=6 re-install the app to see it ask for overlay permission at the moment when perf monitor option gets selected.

 - SYSTEM_ALERT_WINDOW permission will no longer be required on Android to display Redbox

 This change can break things for framework users who provide custom implementation of DevSupportManager interface on Android:

- **Who does this affect**: Owners of apps that use custom implementation of DevSupportManager interface on Android.

- **How to migrate**: Update `create` method of your `DevSupportManager`'s factory to take `ReactInstanceManagerDevHelper` type as a second argument instead of `ReactInstanceDevCommandsHandler`. The interface `ReactInstanceDevCommandsHandler` has been renamed to `ReactInstanceManagerDevHelper` but kept all the methods the same (new method got added). If you were calling one of three methods from `ReactInstanceDevCommandsHandler` interface (`onReloadWithJSDebugger`, `onJSBundleLoadedFromServer` and `toggleElementInspector`) you can call exact same methods directly on `ReactInstanceManagerDevHelper` instance that is being provided in exchange for `ReactInstanceManagerDevHelper `.

- **Why make this breaking change**:
This PR adds a new method to `ReactInstanceManagerDevHelper` called `getCurrentActivity`. In which case the prev name can no longer be justified. The activity is required for some of the DevSupportManager methods in order to start new dialogs and popups so that overlay permission isn't necessary.

- **Severity (number of people affected x effort)**:
Relatively small (perhaps Fb internally is using DevSupportManager abstraction to provide an alternative implementation but since it isn't documented I doubt anyone else uses it). Effort it very low as it boils down to updating uses of interface `ReactInstanceDevCommandsHandler` with `ReactInstanceManagerDevHelper` (all the methods in `ReactInstanceDevCommandsHandler` stays the same)
Closes https://github.com/facebook/react-native/pull/16596

Differential Revision: D6256999

Pulled By: achen1

fbshipit-source-id: 551d449e831da3de466726ead172608527fcfbb4
2017-12-07 18:39:46 -08:00
Paco Estevez Garcia 3d5dc872a4 Add callback for Connection/Disconnection to Metro
Reviewed By: bnham

Differential Revision: D6447126

fbshipit-source-id: d4c8a4dfb65c2a378f7fe696c8617ff5f3c6cb68
2017-12-07 09:52:08 -08:00
Jonathan Keljo 71006f74cd Fixes for migrating to Buck's source-only ABI feature
Reviewed By: dreiss

Differential Revision: D6475725

fbshipit-source-id: ac6725bbaaf2dbd78512a67497fbfcc044f59f60
2017-12-05 10:34:12 -08:00
Paco Estevez Garcia 7c7108a1e8 Add inspector attach to RN Dev Menu (Android)
Reviewed By: Hypuk

Differential Revision: D6405828

fbshipit-source-id: 9274c3e8748e6ce259357836dde7d53c4fce9fbf
2017-12-05 07:03:48 -08:00
Petter Hesselberg 5b83dbe25a Update stale JavaDoc reference
Summary:
I don't like JavaDoc errors

N/A; Change does not touch executable code
Closes https://github.com/facebook/react-native/pull/17023

Differential Revision: D6472273

Pulled By: shergin

fbshipit-source-id: 3131e17ca9925c42def02047082378fb3169c82b
2017-12-03 21:01:15 -08:00
Cory Reed d2f0abdf4e Fix Android comment and docblock typos
Summary:
👋 Hello! Thanks for react-native, it’s a great project.

I was digging into the Android implementation in _ReactAndroid_ and noticed a couple typos in the documentation. I went through and tried to fix all the typos I could find using [aspell](http://aspell.net).

Not applicable: these changes are only to comments, and CI should be skipped.

[ANDROID][ENHANCEMENT][*] - Correct comment and docblock typos
Closes https://github.com/facebook/react-native/pull/17049

Differential Revision: D6472182

Pulled By: shergin

fbshipit-source-id: 7e62cab118609596b483d1cf16c3abf651d6753b
2017-12-03 20:16:36 -08:00
Jonathan Keljo 801cbdb047 Autofixes for migrating to Buck's source-only ABI feature
Reviewed By: asp2insp

Differential Revision: D6441284

fbshipit-source-id: cfc96c5eb93a7260705fabc361763405c9fb38c6
2017-12-01 21:03:07 -08:00
Andres Suarez d674d48a7b Run buildifier over all BUCK files
Reviewed By: mzlee, dinhviethoa

Differential Revision: D6439498

fbshipit-source-id: ec847595afdd79434e48652d237d2533bbd2cad2
2017-11-29 20:30:43 -08:00
Ramanpreet Nara ca7fe72c31 Fix border-rendering in APIs < 18 cont.
Reviewed By: achen1

Differential Revision: D6418192

fbshipit-source-id: 2186a6103d6542f5ced332d5cb083b1f58bfd43d
2017-11-27 17:51:15 -08:00
Valentin Shergin 0bef872f3f TextInput: Fixed autoscroll to cursor on Android
Summary:
This feature was disabled for multiline textinputs in D3528202 ... seems without a good reason.
The broken autoscroll-to-cursor feature is terribly harmful and counter-intuitive in ALL cases.
I also add a contentSize tracking in the example app to make sure that it is unaffected by this change.

https://pxl.cl/9RHP

https://github.com/facebook/react-native/issues/12799
https://github.com/facebook/react-native/issues/15778

Special thanks to konradkierus!

Reviewed By: sahrens

Differential Revision: D6405985

fbshipit-source-id: 337a390a9db7b3528200ef66c4a079b87608294e
2017-11-27 16:46:43 -08:00
Alexey Lang 028b64bcd3 Fix logging unpacking time when it happens concurrently with eager unpacking
Reviewed By: dcaspi

Differential Revision: D6413546

fbshipit-source-id: 9ae167ea2f816b070da29cf81f653af568aed01a
2017-11-27 12:32:32 -08:00
Ben Nham 70c359000a move inspector out of jschelpers
Differential Revision: D6385924

fbshipit-source-id: 1913d903077494cc0d86d5a8c8839620f1ecab0c
2017-11-27 07:23:37 -08:00
Lukas Wöhrl 1050e0b476 Add justify-content: space-evenly
Summary:
Adds new ```space-evenly``` for ```justify-content```.

Also adds a typofix in one of the other justify-content tests.

Fixes #657
Closes https://github.com/facebook/yoga/pull/658

Differential Revision: D6407996

Pulled By: emilsjolander

fbshipit-source-id: cc837409e1345624b4bd72c31e25fe68dcb0f6a3
2017-11-27 04:01:02 -08:00
Dmitry Zakharov dd888d3346 Fix boolean conversion in sync RN method calls.
Reviewed By: fromcelticpark

Differential Revision: D6408182

fbshipit-source-id: 251ab0cfe3197e59de0cb86816d5f0b908433b43
2017-11-24 12:31:41 -08:00
David Detlefs 05e862d48d Add Systrace-based telemetry to Hermes GC.
Reviewed By: amnn

Differential Revision: D6393879

fbshipit-source-id: d35a4647d000356dc99bce3187acc50d3a69ddeb
2017-11-23 15:15:54 -08:00
Rafael Oleza 968c88d141 Enable end to end deltas by default on Android
Reviewed By: mjesun

Differential Revision: D6406466

fbshipit-source-id: ab776d9ea89ed2ab83b8ede78be4e5d5f3074e34
2017-11-23 13:04:48 -08:00
James Reggio dc01eff72d Fix crash with non-zero blurRadius less than 1
Summary:
There's a crash-inducing bug with `Image.blurRadius` on Android.

`blurRadius` is specified in JavaScript as a `float`, but it's cast to `int` before being passed to the `IterativeBoxBlurPostProcessor`. However, in `IterativeBoxBlurPostProcessor`, there is an argument precondition requiring the integer `blurRadius` to be non-zero.

Because the `== 0` condition is evaluated on the `float`, it's possible for a `blurRadius` in the range of `(0, 1)` (non-inclusive) to pass the conditional, and then be truncated to `0` and passed as an argument to `IterativeBoxBlurPostProcessor`, which will fail its precondition and crash the app.

This change works in our app, which was previously crashing.

[ANDROID] [BUGFIX] [Image] Fixed crash when specifying an Image.blurRadius between (0, 1)
Closes https://github.com/facebook/react-native/pull/16845

Differential Revision: D6387416

Pulled By: shergin

fbshipit-source-id: d5191aa97e949ffd41e6d68c96b3c7bcbc82a52e
2017-11-21 12:30:49 -08:00
Ramanpreet Nara 5aa1fb3ff3 Fix border-rendering in APIs < 18
Summary:
`Canvas.clipPath` isn't supported with hardware acceleration in APIs below 18. The rounded border rendering logic for Android relies on this method. Therefore, rounded borders do not render correctly on such devices.

**Screenshot of Nexus 5 running API 17 (Before these changes):**
https://pxl.cl/9rsf

**The fix**: If the API version is less than 18 and we're rendering rounded borders, I disable hardware acceleration. Otherwise, I enable it. I'm going to check to see if this has perf regressions by running a CT-Scan.

With this change, rounded borders render correctly on Android devices running versions of Android between Honeycomb to JellyBean MR2.

**Screenshot of Nexus 5 running API 17 (After these changes):**
https://pxl.cl/9rrk

Reviewed By: xiphirx

Differential Revision: D6153087

fbshipit-source-id: 16e35be096051ac817c8b8bcdd132ecff3b4b167
2017-11-21 11:17:03 -08:00
Gabriel Peal 1e18d907bf Prevent a crash when no cursor drawable is set
Summary:
React Native 0.43 added additional functionality to setSelectionColor that also tints the cursor drawable of the View. However, some views may not have a cursor drawable set in which case, the code will crash when attempting to load a drawable with resource id 0.

We encountered this in our RN 0.45 upgrade in the Airbnb app.

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

Differential Revision: D6386076

Pulled By: shergin

fbshipit-source-id: faa5a1edb3be8d08988f46205c0f22d17b63b5bc
2017-11-21 10:36:10 -08:00
Rafael Oleza f587f8d51d Enable end to end deltas by default on Android
Reviewed By: mjesun

Differential Revision: D6374111

fbshipit-source-id: f372242ddbb8a278041d1ebb2aace227a571c2e0
2017-11-20 13:16:11 -08:00
Dmitry Zakharov f1015664e9 Fix crash when destroying catalyst
Reviewed By: fromcelticpark

Differential Revision: D6373275

fbshipit-source-id: c36b53f023800097b301d530250b05e5b2a4dfca
2017-11-20 07:38:53 -08:00
Alexander Komissarov ad89ea7b50 check if listener is still in the set before calling onHostResume
Reviewed By: achen1

Differential Revision: D6341419

fbshipit-source-id: e49188803bbf3641bad6a9cc8c497d453798bbce
2017-11-17 11:20:45 -08:00
Rafael Oleza 231c7a0304 Add end to end Delta support to Android devices
Reviewed By: davidaurelio

Differential Revision: D6338677

fbshipit-source-id: 8fa8f618bf8d6cb2291ce4405093cad23bd47fc3
2017-11-17 07:47:38 -08:00
allengleyzer 3e4cf0e8d2 Added progress updates for all XMLHttpRequest upload types
Summary:
Previously, only form-data request bodies emitted upload progress updates. Now,
other request body types will also emit updates.

Addresses issues:
https://github.com/facebook/react-native/issues/15724
https://github.com/facebook/react-native/issues/11853

This is a bug fix for functionality that's missing on Android. These events are already working correctly on iOS.

Run the following code on Android, and ensure that events are being sent:
```
const fileUri = 'file:///my_file.dat';
const url = 'http://my_post_url.com/';
const xhr = new XMLHttpRequest();

xhr.upload.onprogress = (event) => {
    console.log('progress: ' + event.loaded + ' / ' + event.total);
}

xhr.onreadystatechange = () => {if (xhr.readyState === 4) console.log('done');}

console.log('start');

xhr.open('POST', url);

xhr.send({ uri: fileUri }); // sending a file (wasn't sending progress)
xhr.send("some big string"); // sending a string (wasn't sending progress)

const formData = new FormData(); formData.set('test', 'data');
xhr.send(formData); // sending form data (was already working)
```

[ANDROID] [BUGFIX] [XMLHttpRequest] - Added progress updates for all XMLHttpRequest upload types

Previously, only form-data request bodies emitted upload progress updates. Now,
other request body types will also emit updates.

Addresses issues:
https://github.com/facebook/react-native/issues/15724
https://github.com/facebook/react-native/issues/11853
Closes https://github.com/facebook/react-native/pull/16541

Differential Revision: D6325252

Pulled By: hramos

fbshipit-source-id: 4fe617216293e6f451e2a1af4fa872e8f56d4f93
2017-11-14 11:01:17 -08:00
Dmitry Zakharov cfa2bbf2f6 Remove minNumShakes from ReactInstaneManager
Reviewed By: kathryngray

Differential Revision: D6313521

fbshipit-source-id: ffef1f96fbec88cdcc7597fa81505aee59e10bb8
2017-11-14 09:38:03 -08:00
Dmitry Zakharov 4f886a29a1 Remove android_react_native_perf.use_separate_ui_bg_thread experiment.
Reviewed By: AaaChiuuu

Differential Revision: D6313250

fbshipit-source-id: 583a729a157a2053827631a43e38917753e78477
2017-11-14 06:58:46 -08:00
Dmitry Zakharov 053776338e Cleanup ReactInstanceManager
Reviewed By: kathryngray

Differential Revision: D6296922

fbshipit-source-id: 2fbf11f09a3c25ff3e7c222edc2e01b81e687943
2017-11-14 05:46:08 -08:00
Dmitry Zakharov 4894ac430d Remove splitting to BridgeCorePackage and ReactNativePackage.
Reviewed By: kathryngray

Differential Revision: D6286129

fbshipit-source-id: 8d75e610291402ccbffb137ce46e64d11826b950
2017-11-14 04:56:43 -08:00
Alex Dvornikov a47431ed74 Adopt split segments registration approach on Android
Differential Revision: D6284863

fbshipit-source-id: 0df6b90eb0cbeab4c8a2b11f1e4dcbd5d5dfab72
2017-11-09 12:23:51 -08:00
Alex Dvornikov cff0d8e0e5 Register split segment paths with RAMBundleRegistry
Differential Revision: D6284466

fbshipit-source-id: c80cf929af38f92f06cca5b366c58785ae992d83
2017-11-09 12:23:46 -08:00
Dmitry Zakharov 260e6d2355 Remove shared bridge experiment
Reviewed By: kathryngray

Differential Revision: D6284437

fbshipit-source-id: 14e0516f22dde04c0bbc4eb8fac603590d32d66a
2017-11-09 09:55:05 -08:00
Ramanpreet Nara 7170543e80 Make direction-aware borders work with APIs >= 17
Reviewed By: achen1

Differential Revision: D6189497

fbshipit-source-id: 848ca35540c5a4eb1581e0b7c39f8fa880540317
2017-11-08 10:31:21 -08:00
Alex Dvornikov 6ecae73fe5 Remove RAMBundleRegistry subclasses
Differential Revision: D6262247

fbshipit-source-id: 708f919e34f1706d9aca19a34ad8ea506e9f8d8b
2017-11-08 04:12:20 -08:00
Brent Erickson e6f542d620 When subscribing for network connectivity broadcasts, also query the value so we always have the most up-to-date value.
Summary:
We've seen cases (based on logs) where NetInfo is reporting no connectivity, but network requests still work. This will keep status up to date after app foreground <-> backgrounds, since we don't listen to broadcasts when backgrounded.

This is rather difficult to test given we haven't nailed an internal repro (evidence is solely based on device/app logs).  Testing has been done to ensure that there are no behavioural changes on devices that were previously working (no regressions).
Closes https://github.com/facebook/react-native/pull/15558

Differential Revision: D6264708

Pulled By: hramos

fbshipit-source-id: 1648cadb59949103d0a595614b38024ec9236719
2017-11-07 14:56:23 -08:00
Dmitry Zakharov 1b71e03932 Make RN Events registered disregarding ViewManager use pattern.
Reviewed By: fromcelticpark

Differential Revision: D6260009

fbshipit-source-id: f3d00162f8473976264ebef040d01163950f2170
2017-11-07 11:32:34 -08:00
Omri Gindi a6465d1c17 Backed out changeset 322626be193e
Reviewed By: wutalman

Differential Revision: D6258856

fbshipit-source-id: 392dc91f87148c70817f13858a7fcd368f028b2d
2017-11-07 04:53:40 -08:00
Alex Dvornikov f1258181ee Rename "js-bundles" to "js-segments"
Differential Revision: D6244399

fbshipit-source-id: d1606d126e3b598b19fa8a0955438c8dec76f5d0
2017-11-06 18:25:52 -08:00
Marc Horowitz 515eb0e801 Fix a race condition in the animation module
Summary:
update() is called from the choreographer, so it can be
invoked asynchronously relative to RN.  If it's called while the node
tree is incomplete, this can be called with no parent.  Don't treat an
unparented node as an invariant failure, just skip over it.

Reviewed By: AaaChiuuu

Differential Revision: D6249038

fbshipit-source-id: d22807dff1659bf29a81893ab97d0fe7c19de512
2017-11-06 13:49:46 -08:00
Dmitry Zakharov fdf04953c0 Make RN Events registered disregarding ViewManager use pattern.
Reviewed By: bvaughn

Differential Revision: D6223864

fbshipit-source-id: 322626be193e5fa840d3e5477e86adaa90f2726d
2017-11-06 06:40:19 -08:00
Bartol Karuza 3f1b021506 Inverted descent/ascent Android prioritisation to match iOS lineHeight behaviour
Summary:
We noticed that on Android the lineHeight behaviour is different from iOS for built in fonts and custom fonts. The problem becomes visible when the lineHeight approaches the fontSize, showing a cut-off on the bottom of the TextView. This issue has been raised before in #10712. There is a mention of a PR with a fix in that issue, which has not been merged yet. This implementation is a less intrusive fix leaving the current lineHeight approach in place and fixing the discrepancy only.

This proposed change prioritises ascent over descent for reduction, making the lineHeight functionality behave identical to iOS.

There is no existing test covering the lineHeight property and its behaviour in the CustomLineHeightSpan. This PR contains new unit tests that covers the various scenario's for the lineHeight calculations.

The original behaviour, before the change can against these unit tests. The case that fails is `shouldReduceAscentThird`, which can be made to succeed on the old code by changing the asserts to:
```
    assertThat(fm.top).isEqualTo(-5);
    assertThat(fm.ascent).isEqualTo(-5);
    assertThat(fm.descent).isEqualTo(-4);
    assertThat(fm.bottom).isEqualTo(-4);
```
The unit test succeeds for the current implementation, which has the values for ascent and descent inverted.

Below screenshots show before, after and iOS:

BEFORE
![screen shot 2017-10-18 at 15 35 41](https://user-images.githubusercontent.com/1605731/31721688-58d7086a-b41a-11e7-8186-9a201e2acb01.png)

AFTER
![screen shot 2017-10-18 at 15 37 02](https://user-images.githubusercontent.com/1605731/31721665-473cf86c-b41a-11e7-94d5-7a70eaf99889.png)

iOS
![screen shot 2017-10-18 at 15 35 22](https://user-images.githubusercontent.com/1605731/31721712-707e30a6-b41a-11e7-9baa-f886a66837e6.png)

[ANDROID] [BUGFIX] [Text] - Fix the lineHeight behaviour on Android to match iOS
Closes https://github.com/facebook/react-native/pull/16448

Differential Revision: D6221854

Pulled By: andreicoman11

fbshipit-source-id: 7292f0f05f212d79678ac9d73e8a46bf93f1a7c6
2017-11-06 05:00:41 -08:00
Dan Caspi 19de7fcb22 Moving some RAM logic to Instance.
Reviewed By: michalgr

Differential Revision: D6208977

fbshipit-source-id: 28339d07c58f1acc816be02f2707ef75529fa069
2017-11-03 05:32:02 -07:00
Alex Dvornikov b5651d945c Add "setJsBundlesDirectory" method to CatalystInstanceImpl
Differential Revision: D6042493

fbshipit-source-id: 950c6d6bdc2e0b62b14c9bcfc86233159a002c67
2017-11-01 06:54:44 -07:00
Pritesh Nandgaonkar 0230672275 Reverting the dirty child optimization
Reviewed By: emilsjolander

Differential Revision: D6203290

fbshipit-source-id: 8e42abb70e55f0fac90faaa21ecdbe0fbb76ce6b
2017-10-31 23:15:43 -07:00
Pritesh Nandgaonkar 587225ab45 Used hasDirtyChildren tag for the optimization
Reviewed By: emilsjolander

Differential Revision: D6134754

fbshipit-source-id: bbcfee14058140b946401de756a3f130de0f51cd
2017-10-31 08:21:54 -07:00
Dmitry Zakharov 387a3557ae Remove FlatUI references from fb4a.
Reviewed By: AaaChiuuu

Differential Revision: D6189136

fbshipit-source-id: c92a4d46098ff36ddbf267d150c6fa559a60a1e8
2017-10-31 06:46:06 -07:00
Dmitry Zakharov a5550a56ea Introduce getConstants generation for Native Modules codegen.
Reviewed By: fkgozali

Differential Revision: D6125394

fbshipit-source-id: 13b48c75056868f45394f277d75fb05d167f1c9f
2017-10-30 08:16:48 -07:00
Alexey Lang 9742bcb4ba Remove quicklog
Reviewed By: AaaChiuuu

Differential Revision: D6172832

fbshipit-source-id: d239ce8bef0918d3e90662258b6eabe3502f4897
2017-10-30 08:12:34 -07:00
David Vacca c278020633 Fixing RTL HorizontalScrolling in Android
Reviewed By: astreet

Differential Revision: D6170631

fbshipit-source-id: 254e6ed9a4d6e42b6d1215de1ff63aedb2c07a0a
2017-10-27 12:34:10 -07:00
Jonathan Keljo dd016f334c Automated fixups for Instagram
Reviewed By: dreiss

Differential Revision: D6168048

fbshipit-source-id: 0e51319d93fd697db01ea3933f48cd06a6ffac12
2017-10-27 00:52:40 -07:00
Andrew Chen (Eng) 9b6f160c04 Revert D5638458: Fixing RTL HorizontalScrolling in Android
Differential Revision: D5638458

fbshipit-source-id: f4474a12821cd2c20f57ce3bac5996c327ceaa33
2017-10-26 15:33:10 -07:00
David Vacca 36c951d24f Fixing RTL HorizontalScrolling in Android
Reviewed By: astreet

Differential Revision: D5638458

fbshipit-source-id: 08a5070a362eb43e12140cc204172d0950a1b720
2017-10-26 11:25:22 -07:00
Charles Dick 1c104310fb RN catalyst instance destroy markers
Reviewed By: alexeylang

Differential Revision: D6109891

fbshipit-source-id: 2cd1491381220a80f71f9ab205a2c6a309ed35ae
2017-10-26 10:28:41 -07:00
Dmitry Zakharov f0fb720eaa Introduce mobile config flag to load classes for View Managers
Reviewed By: kathryngray

Differential Revision: D6148468

fbshipit-source-id: d0f919f63922dae4b0720f22fa70ab4a7f67b48a
2017-10-26 08:51:11 -07:00
Ramanpreet Nara efa4d3c222 Rename I18nManager Left/Right swap methods
Reviewed By: fkgozali

Differential Revision: D6140072

fbshipit-source-id: 282dc614c036de8f217a729f21a1bbe92b8afd7d
2017-10-24 20:45:59 -07:00
Andrew Chen (Eng) 90a42396b9 React native shadow tree sonar plugin
Reviewed By: emilsjolander

Differential Revision: D6050845

fbshipit-source-id: 8c041b26ed4eb701830f1aced73d996c71cb3326
2017-10-24 18:34:40 -07:00
Rafael Magalhães ce967c6fbe Requesting permission results into ArrayIndexOutOfBoundsException
Summary:
Reported in Issue #15928

Fixing bug when permission showing dialog and user go to home and re-open minimized app.

1. Ask for permission
2. Minimize app (Press HomeButton)
3. Open app again via shortcut

 [ANDROID] [BUGFIX] [PermissionsModule.java] - Fixed bug when asked for permission Cause: java.lang.ArrayIndexOutOfBoundsException · length=0; index=0
Closes https://github.com/facebook/react-native/pull/16507

Differential Revision: D6133708

Pulled By: shergin

fbshipit-source-id: 9c05d1d5d16fedf718ad5113df69a4df3af62013
2017-10-23 23:30:08 -07:00
Jonathan Keljo 18364e95b7 Export deps to be source-ABI friendly
Reviewed By: dreiss

Differential Revision: D6124559

fbshipit-source-id: f831196724f8e171b86c58af5d2ed7944ecf6b6b
2017-10-23 12:22:53 -07:00
Alexey Lang 95073f8589 Use ReactMarker for all perf logging in the bridge
Reviewed By: AaaChiuuu

Differential Revision: D6030270

fbshipit-source-id: c9fa04d4f2816e4e0a4a14caf41795d0f547a7a0
2017-10-22 04:04:42 -07:00
Tao Huang 7e0b7ef8d0 Fix wrong error code when location service is turned off on Android device
Reviewed By: achen1

Differential Revision: D6106890

fbshipit-source-id: ab6ccdc2625745e4bbcdb0d7fe284de504d09641
2017-10-19 19:52:57 -07:00
Ramanpreet Nara 99d294bf3d Consider negative border radii and widths invalid
Reviewed By: achen1

Differential Revision: D5998369

fbshipit-source-id: d54302777f4eeb13f4521800130c17ac07f1b354
2017-10-19 18:08:25 -07:00
Ramanpreet Nara 00c9c1ad74 Implement direction-aware border clipping
Reviewed By: achen1

Differential Revision: D6015812

fbshipit-source-id: 406ddb12884a1c490cee784c6ef42322bd497b24
2017-10-18 19:33:33 -07:00
Ramanpreet Nara 875f273dba Implement border(Start|End)Color for rounded borders
Reviewed By: achen1

Differential Revision: D6014637

fbshipit-source-id: 33c10ec1f84075e0bb1c1f529aa7231497028380
2017-10-18 19:33:33 -07:00
Ramanpreet Nara 38c2c26d90 Implement rounded border(Start|End)Width
Reviewed By: achen1

Differential Revision: D6013412

fbshipit-source-id: e7aa7a3cd9e3ed72b25664efee59e42792098fbd
2017-10-18 19:33:33 -07:00
Ramanpreet Nara 1a7abcf526 Android: Implement border(Top|Bottom)(Start|End)Radius for RN
Reviewed By: achen1

Differential Revision: D5924734

fbshipit-source-id: 24759326064c11d2cd8948c7a710376ca9f41c63
2017-10-18 19:33:32 -07:00
Ramanpreet Nara 0f467a25ed Android: Implement border(Start|End)Color for RN non-rounded borders
Reviewed By: achen1

Differential Revision: D5921865

fbshipit-source-id: ed964291cba0c701de677c24c54f885cda78e7cc
2017-10-18 19:33:32 -07:00
Ramanpreet Nara 7ed7593b2b Android: Implement border(Start|End)Width for non-rounded borders
Reviewed By: achen1

Differential Revision: D5917755

fbshipit-source-id: 3ec0ab1a1e191f5f6fd956691995e95937a513cc
2017-10-18 19:33:32 -07:00
Ramanpreet Nara 04a8c62313 Android: Implement margin(Start|End) styles for RN
Reviewed By: achen1

Differential Revision: D5907651

fbshipit-source-id: 4df7583483e6f10b5433b9fa9d9345e00ccedd20
2017-10-18 19:33:32 -07:00
Ramanpreet Nara 1ed08d3c01 Android: Implement padding(Start|End) styles for RN
Reviewed By: AaaChiuuu

Differential Revision: D5907207

fbshipit-source-id: c9bb322f94d701463be35fb1ca92aab80f47d8ab
2017-10-18 19:33:31 -07:00
Ramanpreet Nara dc92e69867 Android: Forward RN start/end styles to Yoga
Reviewed By: AaaChiuuu

Differential Revision: D5906097

fbshipit-source-id: 79bd43ea54572eb612e781628551bccf5a4f948d
2017-10-18 19:33:31 -07:00
Ramanpreet Nara 98547d4bcf Implement gating support for direction-aware API changes
Reviewed By: achen1

Differential Revision: D6045083

fbshipit-source-id: 857a43029ad88d2324ec77145a1e30d92b5e8fae
2017-10-18 19:33:31 -07:00
Ramanpreet Nara f7888310d4 Implement border(Left|Right|Top|Bottom)Color for rounded borders
Reviewed By: achen1

Differential Revision: D6009609

fbshipit-source-id: 6a247a14aa48ac2edc637bf064216407a3a9a81f
2017-10-18 19:33:30 -07:00
Ramanpreet Nara 4994d6a389 Implement partial rounded borders
Reviewed By: achen1

Differential Revision: D5982241

fbshipit-source-id: 2f694daca7e1b16b5ff65f07c7d15dd558a4b7e8
2017-10-18 19:33:30 -07:00
Ramanpreet Nara de313f6fdd Fix border clipping
Reviewed By: achen1

Differential Revision: D5992045

fbshipit-source-id: fccd864dbc24592c3cd4df7300aca5096537e1d8
2017-10-18 19:33:30 -07:00
Alexey Lang 52a67db629 Fix Systrace section for Lazy View Managers
Differential Revision: D6088310

fbshipit-source-id: cf14c9cc91068cfabf4e7c1bbae5df7f25e0ced3
2017-10-18 12:18:12 -07:00
Andrew Chen (Eng) 91372e8f9a Add callback for UIImplementation layout updates
Differential Revision: D6063839

fbshipit-source-id: ae08fd2fc6c6365813b8077efe14990a0355a5c7
2017-10-17 07:47:12 -07:00
Andrew Chen (Eng) dc16150bae Expose ReactInstanceManager from ReactRootView
Reviewed By: AaaChiuuu

Differential Revision: D6051991

fbshipit-source-id: f175fc273895d7e9fedec73428d61395ae00649f
2017-10-17 04:31:03 -07:00
Max Sherman f3b117abd0 Un-revert logMarker for hermes diff
Reviewed By: mhorowitz

Differential Revision: D6051880

fbshipit-source-id: 0ce4bbed9ba8579033ee5397ff6c0975b6886fb1
2017-10-13 14:01:43 -07:00
Max Sherman e60a2d0a53 Revert D5939688: [hermes][rn] Share logPerfMarker with hermes
Differential Revision: D5939688

fbshipit-source-id: 37daeeaa01144472c26383106c88dd49bb99a37b
2017-10-12 19:21:42 -07:00
Max Sherman fe62da34a6 Share logPerfMarker with hermes
Reviewed By: mhorowitz

Differential Revision: D5939688

fbshipit-source-id: ab6a86eb66a3d9501b9b5a55b562b277b5ab0620
2017-10-12 15:33:04 -07:00
Janic Duplessis 2b4ff6ea19 Native Animated - Restore default values when removing props on Android
Summary:
Rebased version of #12842 that was reverted because of failing fb internal tests.
Closes https://github.com/facebook/react-native/pull/15919

Differential Revision: D5823956

Pulled By: hramos

fbshipit-source-id: 4ece19a403f5ebbe4829c4c26696ea0575ab1d0e
2017-10-12 13:11:00 -07:00
Valentin Shergin f2c6877b91 Fixed crash on attempt to update local data of deallocated shadow node
Summary:
Trivial.
That's okay that sometimes shadowNodes and views hierarchies have lack of synchonization.

Reviewed By: sahrens

Differential Revision: D6040022

fbshipit-source-id: 6b49a82317b620b66a87441719fddcafb1f27934
2017-10-12 09:46:29 -07:00
Michael Lee 7997a2b749 Fix platform flags to also check for linux
Reviewed By: danzimm

Differential Revision: D6036995

fbshipit-source-id: 98d7f19eb80b72090b26252864a6bd41a3295462
2017-10-12 09:16:40 -07:00
Peter Ruibal 752b68857c Add `visible-password` for TextInput.keyboardType on Android
Summary:
`visible-password` represents a very basic keyboard, typically only
letters and numbers.  Backed by InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD,
it is useful for things like password and code entry fields. It can also be more
effective than autoCorrect={false} for disabling autocompletion on some keyboards
(like Gboard).

Note `secureTextEntry` also affects `TYPE_TEXT_VARIATION_*` flags internally, so there
may be some undefined behavior when combining `secureTextEntry` with
`keyboardType="visible-password"`

Also, while here, improve the documentation on TextInput to explicitly enumerate
which keyboardType applies to Android vs. iOS (since this is the first android-specific)

Reviewed By: shergin

Differential Revision: D6005353

fbshipit-source-id: 13af90c96353f714c0e106dd0fde90184a476533
2017-10-10 18:18:34 -07:00
Dmitry Zakharov ca834f96af Fix scrolling events for RN.
Reviewed By: bvaughn

Differential Revision: D6020664

fbshipit-source-id: c9fb9069e9dcde298901ba2c03bacc8b646844d0
2017-10-10 11:08:40 -07:00
Nivetha Singara Vadivelu 9424cd7e8f Handling exceptions in video player
Reviewed By: furdei

Differential Revision: D5958119

fbshipit-source-id: 79b431a8422d60134890d44e99c358a07a5adc5b
2017-10-09 22:45:48 -07:00
Janis Peisenieks 7a7bdeec3e Omit all line terminators for ImageStore.getBase64ForTag
Summary:
FIX #11142

This fixes #11142 and supersedes #11155 as I was unsure how to add/change commits in that PR.

Wrote up a bunch of unit tests for the ImageStore module. The added tests showed that there was indeed a problem with the flags used for the Base64OutputStream, and they also show that that has been fixed now.
Closes https://github.com/facebook/react-native/pull/13856

Differential Revision: D6017764

Pulled By: shergin

fbshipit-source-id: adf667dc722ddfe31449afd8cd20a0a192eacff6
2017-10-09 22:16:20 -07:00
Janic Duplessis 0cd69e8a02 Run eslint --fix
Summary:
CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable.

**Test plan**
Quick manual test, cosmetic changes only.
Closes https://github.com/facebook/react-native/pull/16229

Differential Revision: D6009748

Pulled By: TheSavior

fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
2017-10-09 17:46:44 -07:00
Yann Pringault 1c24440644 Add TimePicker modes
Summary:
In the spirit of #10932, I added the `mode` option to the `TimePicker` Android API.
There is only one mode available for **Android < 5**, the `spinner` one.
If we are on **Android >= 5** we can choose between `spinner` or `clock`. If we specify `default` it will use the default of the current Android version.

On **Android < 5**, whatever we choose it will be this:
![screen shot 2017-02-14 at 17 05 44](https://cloud.githubusercontent.com/assets/5436545/22937805/024ec67e-f2da-11e6-8b32-a680d9bc2247.png)

On **Android >= 5**, with the `spinner` mode:
![screen shot 2017-02-14 at 16 51 17](https://cloud.githubusercontent.com/assets/5436545/22937803/024e0bbc-f2da-11e6-9f4b-26102ff2eeac.png)

And with the `clock` mode, the default:
![screen shot 2017-02-14 at 16 51 02](https://cloud.githubusercontent.com/assets/5436545/22937804/024e64e0-f2da-11e6-9911-4135049f4726.png)
Closes https://github.com/facebook/react-native/pull/12384

Differential Revision: D6006689

Pulled By: hramos

fbshipit-source-id: fcd37c867c4061b9982b1687f2c10211e54df7cf
2017-10-08 12:38:45 -07:00