Commit Graph

13492 Commits

Author SHA1 Message Date
Valentin Shergin f3893aab3b Fabric/Text: Connecting the dots
Summary: This change registers the Text module.

Reviewed By: mdvacca

Differential Revision: D7784509

fbshipit-source-id: 0de3e432b8f975927547ba990586f99655e8322d
2018-05-08 19:24:10 -07:00
Valentin Shergin 81bdd36204 Fabric/Text: RCTParagraphComponentView
Summary: RCTParagraphComponentView is a UIView which can render text using TextLayoutManager.

Reviewed By: mdvacca

Differential Revision: D7751853

fbshipit-source-id: e6ee9a0f989cdf6e878390d37dbcf8a11ef90bf4
2018-05-08 19:24:10 -07:00
Valentin Shergin 9646c5cb3c Fabric: RCTViewComponentView, storing just applied `layoutMetrics`
Summary:
This will be useful for this class and for subclasses soon.
For instance, when we draw something in `drawRect:`, we need to know exact content frame for rendering.

Reviewed By: mdvacca

Differential Revision: D7751855

fbshipit-source-id: 5d688368edd7b4f3c8c19d54ca701a9cc361270b
2018-05-08 19:24:10 -07:00
Riley Dulin 7e97ed00bc Fix prepack warning in RN bridge code
Reviewed By: yungsters

Differential Revision: D7903364

fbshipit-source-id: 4ef888f4e7f773f9fbc5183db2470b0f7b368d8a
2018-05-08 18:17:30 -07:00
Valentin Shergin b5a780608e Fabric/Text: text module, paragraph part
Summary: <Paragraph> component represents <View>-like component containing and displaying text.

Reviewed By: mdvacca

Differential Revision: D7751854

fbshipit-source-id: 1acdfebf6f96a5da068ce985e15288e958266855
2018-05-07 22:08:54 -07:00
Valentin Shergin dc7a87e737 Fabric/Text: text module, text part
Summary: <Text> component is used to describe text attributes in React.

Reviewed By: mdvacca

Differential Revision: D7751851

fbshipit-source-id: f90a4367cad64283ee64828b0d5e24470ee3d9f7
2018-05-07 22:08:53 -07:00
Valentin Shergin 02c3cd4c4e Fabric/Text: text module, rawtext part
Summary: <RawText> component represents a purely regular string object in React.

Reviewed By: mdvacca

Differential Revision: D7751850

fbshipit-source-id: 54afe43e0c1ac063862f109ea07f0e7de3593573
2018-05-07 22:08:53 -07:00
Valentin Shergin 05890a5942 Fabric/Text: textlayoutmanager
Summary:
TextLayoutManager measures and renders text using iOS specific APIs (CoreText & TextKit).
By desing, only this module should contain platfrom-specific text functionality.

Reviewed By: mdvacca

Differential Revision: D7751852

fbshipit-source-id: fd6e1907df617fe5a4479ea08f207946765b3a45
2018-05-07 19:05:53 -07:00
Valentin Shergin 62576bcb78 Fabric/Text: attributedstring module, the second part
Reviewed By: mdvacca

Differential Revision: D7748711

fbshipit-source-id: 57b37cb2eaa20b85c6f6719b38eac2a2c0479485
2018-05-07 18:09:06 -07:00
Valentin Shergin e2287976f3 Fabric/Text: attributedstring module, the first part
Summary:
`fabric/attributedstring` is a simple, cross-platfrom, react-specific implementation of attributed string (aka spanned string).
This diff is the first part of this which contains text primitives (types) and conversions.

Reviewed By: fkgozali

Differential Revision: D7748704

fbshipit-source-id: d76e31807e5ac7ab1a16fd6ee6445c59de5b89a2
2018-05-07 18:09:06 -07:00
Kevin Gozali 6611fefef7 iOS: Exposes the RCTFont size overrides so unit tests can use the same values
Summary:
`RCTFontTests` test in RNTester is broken if the target deployment is <= OS 8.2. This is because RCTFont.mm overrides the OS-defined values, but the override is only visible to RCTFont.mm internals. As the result, when the Unit test tries to create UIFont of the "same" weight, it got a different font - most likely due to internal floating rounding errors.

To mitigate, code that wants to test out internals of RCTFont should import RCTFontConstantsOverride.h

Reviewed By: mmmulani

Differential Revision: D7900954

fbshipit-source-id: e5814ef059a8afdfb5205ca1af46c41b3cfd4318
2018-05-07 17:31:12 -07:00
Tim Yung 820673e707 RN: Simplify `verifyPropTypes`
Reviewed By: sahrens

Differential Revision: D7893675

fbshipit-source-id: 74d1eff57201a2af4a12c39c4335e28ff9f14090
2018-05-07 16:48:24 -07:00
Tim Yung b549e364e0 RN: Simpify `requireNativeComponent`
Reviewed By: sahrens

Differential Revision: D7893592

fbshipit-source-id: bfe7772ff2fa785fc7c5ad1f7dc0dbe97b6ffb11
2018-05-07 16:48:24 -07:00
Tim Yung 28d37781c6 RN: Optimize View Attribute Initialization
Reviewed By: sahrens

Differential Revision: D7893593

fbshipit-source-id: a425e841c9c86b063803878c7b07704c8a90a83a
2018-05-07 16:48:24 -07:00
Tim Yung 1c90a2b47b RN: Fix `requireNativeComponent` Check
Reviewed By: sahrens, TheSavior

Differential Revision: D7893594

fbshipit-source-id: 83f6995842e9480382c0b2abf6b6e72c6c107a49
2018-05-07 16:48:24 -07:00
Andrew Chen (Eng) 1be2541ce2 Add assertion to ensure copied shadow nodes are of the same type as the original
Reviewed By: mdvacca

Differential Revision: D7664638

fbshipit-source-id: e1b7acbafd8a8fd9d6301d8afbb3e5959dc15b7a
2018-05-07 14:55:33 -07:00
Héctor Ramos 3145b1e62a Update IssueCommands.txt
Summary:
Use new labels.
Closes https://github.com/facebook/react-native/pull/19165

Differential Revision: D7899306

Pulled By: hramos

fbshipit-source-id: 9a36426bcdd4af110b5c29e186b66e7eadcf69cd
2018-05-07 14:30:32 -07:00
Chirag Jain 15f8d7013c CI: fix watchman install errors and update ios simulators to version 11.2
Summary:
Fixes watchman install errors.

Check that iphone 5s is booted properly on circle. Check brew install watchman succeeds.

[CI] - Fix ios version on circleci and fixes brew install watchman error
Closes https://github.com/facebook/react-native/pull/19166

Differential Revision: D7899295

Pulled By: hramos

fbshipit-source-id: 2260a2675879cf97fb0b2f11139d9bb84ce7444e
2018-05-07 14:30:32 -07:00
David Vacca 4d99daaa91 Fix RNTester WebBrowser example
Reviewed By: yungsters

Differential Revision: D7890708

fbshipit-source-id: e96c2283f92ae151152f89bebd95141852ff40b1
2018-05-07 12:26:05 -07:00
Andrew Chen (Eng) 30d06b4286 Better error messages for ReadableNativeMap ClassCastExceptions
Reviewed By: mdvacca

Differential Revision: D7800266

fbshipit-source-id: 3fa224d3adc54a7bc59a6a37b9ad6928ac33ceb6
2018-05-07 12:26:05 -07:00
Andrew Clark 0125813f21 React sync for revisions 0887c7d...25dda90
Reviewed By: sebmarkbage

Differential Revision: D7886956

fbshipit-source-id: 5a94df618ce26dee0876b627fbbaaf0a14a403fe
2018-05-07 11:15:12 -07:00
Tim Yung 1ab7d49c2d RN: Cleanup `__propTypesSecretDontUseThesePlease`
Reviewed By: bvaughn

Differential Revision: D7892903

fbshipit-source-id: aab0537fe508ac740d0a2798a04f54411c8c038d
2018-05-07 09:56:15 -07:00
David Vacca 23f8f7aecb Breaking Change: Restrict WebView to only manage navigation of whitelisted URLs: http(s) by default
Reviewed By: achen1

Differential Revision: D7834050

fbshipit-source-id: 80f7fd3cd20979590b75804819e154afc14a3c64
2018-05-04 23:18:14 -07:00
David Vacca 1e68ca7dc8 Cleanup android warnings related to static interface declarations
Reviewed By: fkgozali

Differential Revision: D7853681

fbshipit-source-id: d342e9dc9a1efa921d1421d545798e0b706745b4
2018-05-04 18:00:02 -07:00
David Vacca b7562818e6 Add molly dependency in Fabric/jsc/jni project
Reviewed By: fkgozali

Differential Revision: D7816676

fbshipit-source-id: 8f227482eb1129f51d758bc13e619af30d6c2b1f
2018-05-04 18:00:02 -07:00
Mehdi Mulani 634e7e11e3 iOS only: Breaking Change: Restrict WebView to only http(s) URLs
Summary:
To prevent people from linking file:// or other URLs inside RN WebViews, default <WebView> to not allowing those types of URLs.
This adds the originWhitelist to specify other schemes or domains to be allowed.

If the url is not allowed, it will be opened in Safari/by the OS instead.

Reviewed By: yungsters

Differential Revision: D7833203

fbshipit-source-id: 6881acd3b434d17910240e4edd585c0a10b5df8c
2018-05-04 13:48:34 -07:00
Tim Yung cd48a6130b RN: Disable testImageCachePolicyTest
Reviewed By: fkgozali

Differential Revision: D7878430

fbshipit-source-id: 60f0ca3f2b59987d618982c91a7e91a2f4b6a18b
2018-05-04 10:58:46 -07:00
Logan Daniels f5fcebabeb PerformanceLogger: log extras to console in DEV mode
Differential Revision: D7862011

fbshipit-source-id: 591caf37d6c91ccb07f13005c0f6c57dcaaa22c5
2018-05-03 16:43:34 -07:00
Jonathan Kim 255b97ddd1 Load and use fb_xplat_cxx_test
Reviewed By: mzlee

Differential Revision: D7854278

fbshipit-source-id: 2a4c4fc27fc665a192fc04a8c8fae19f7f221566
2018-05-03 16:04:29 -07:00
Maël Nison b63015d34e Bumps Jest to 23.0.0-charlie.1 [fbsource]
Differential Revision: D7859604

fbshipit-source-id: 6a2d74679f5eae3cb0102f461272b7cbd5716cba
2018-05-03 14:06:13 -07:00
Andrew Chen (Eng) 5a6147c4f8 Fix DevLoadingViewController
Reviewed By: mdvacca

Differential Revision: D7860219

fbshipit-source-id: 3770a2064808bf4ae4c61f15c6d68c3b93fe9f38
2018-05-03 13:03:53 -07:00
David Aurelio 786c1ecc2a Markers: add info about type of delta client
Summary: Adds information which type of delta client is used (if at all) to the `BundleInfo` object.

Reviewed By: fromcelticpark

Differential Revision: D7845139

fbshipit-source-id: e4bf6cda62c71a78aaff97aa69daec263e6d3cdf
2018-05-03 08:47:47 -07:00
David Aurelio dd036c2328 Hook up native delta client
Summary:
Adds support for native clients to `ReactAndroid`:
- `.devsupport.BundleDeltaClient` is now abstract with two implementations: the existing Java client, and a native client
- `BundleDeltaClient#processDelta(...)` can now return a native delta client object
- if that client object is non-null, the bridge is started up with that client rather than a script written to disk

Reviewed By: fromcelticpark

Differential Revision: D7845135

fbshipit-source-id: 379a9c6f9319c62eec3c370cda9ffa0969266a29
2018-05-03 08:47:47 -07:00
David Aurelio 8f85abdb14 `JSBundleLoader`: allow to load with delta client
Summary: Adds glue between `CatalystInstance` and `JSBundleLoader`: Adds the possibility to create a `JSBundleLoader` instance that calls into `CatalystInstanceImpl#loadScriptFromDeltaBundle(...)`.

Reviewed By: fromcelticpark

Differential Revision: D7845134

fbshipit-source-id: 9585b44a6e7c63245c9f634543642be55c928896
2018-05-03 08:47:47 -07:00
David Aurelio 3e730528ee Allow to not use native delta client
Summary:
Adds the possibility to disable native delta clients in `DevInternalSettings`

Depending on the bridge in use, there might not be support for native delta clients, but since the settings are shared app-wide, it can not be enabled individually.

Reviewed By: johnislarry

Differential Revision: D7845137

fbshipit-source-id: ab368e6fed0f4bec49032c4a20466e156d20fdae
2018-05-03 08:47:47 -07:00
David Aurelio 36f254aa75 `CatalystInstanceImpl`: Method for loading from delta client
Summary:
Adds `loadScriptFromDeltaBundle` / `jniLoadScriptFromDeltaBundle` methods to `CatalystInstanceImpl`.

These methods allow to run JS coming from a native delta client as RAM bundles, to leverage the RAM bundle mechanism for development / reload scenarios.

Reviewed By: fromcelticpark

Differential Revision: D7845140

fbshipit-source-id: b79b340f36c28939a31eb63a3c463d0792a208f7
2018-05-03 08:47:47 -07:00
David Aurelio 82b8a9221a Add hybrid class to hold native delta client
Summary:
Adds hybrid JNI wrapper class that can hold a native delta client.

This class allows Java code in the `devsupport` package to hold onto a native delta client across reloads.
It also takes care of passing `okhttp` response objects to native code, where we build a `std::string` to hold JSON messages coming from Metro, and parse them with `folly::parseJson`.

In a follow-up, we will switch to a streaming-friendly binary format that will make allocating memory for the whole message unnecessary.

Reviewed By: fromcelticpark

Differential Revision: D7845138

fbshipit-source-id: 7a29b30645331addf843097dd0d05c03b3143991
2018-05-03 08:47:47 -07:00
David Aurelio 4d931d529e Add native delta client for Metro
Summary:
Adds C++ delta client that keeps modules in memory, and can be used as a RAM bundle.

For now, this client expects a `folly::dynamic` object as payload for patches, i.e. the JSON response retrieved from Metro needs to be parsed with `folly::parseJson` by the caller.

In the future, we will replace JSON with a streaming friendly binary format.

Reviewed By: fromcelticpark

Differential Revision: D7845136

fbshipit-source-id: f003f98a2607c8354c427a7e60e01e19e20295b1
2018-05-03 08:47:47 -07:00
David Aurelio e8662a2123 Add react dev menu setting for cpp deltas
Summary:
Adds a menu item to enable handling of JS module deltas in native code.
The check box is dependent on JS Deltas being activated in the first place.

Reviewed By: cpojer

Differential Revision: D7380167

fbshipit-source-id: 3001d12140542b4e52b1ce96be3c5f56e52a15f8
2018-05-03 08:47:46 -07:00
Jonathan Kim be379efc9b Minimize included defs by adding a level of indirection
Reviewed By: zertosh

Differential Revision: D7851714

fbshipit-source-id: aa14e003a612173c6f316cb76a26f7e78e7f15d4
2018-05-02 22:24:42 -07:00
Jacky Wijaya 56d48bd9ec Fix Android, DevServerHelper from calling okhttp3 response.body.string() twice
Summary:
Fixing from call response.body.string() twice in DevServerHelper.java.
https://github.com/square/okhttp/issues/1240#issuecomment-68142603

I'm getting error like this
```
05-01 21:16:47.080 22836-23064/com.my.company.bundle E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
                                                                               Process: com.my.company.bundle, PID: 22836
                                                                               java.lang.IllegalStateException: closed
                                                                                   at okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:398)
                                                                                   at okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:392)
                                                                                   at okhttp3.internal.c.a(Util.java:449)
                                                                                   at okhttp3.v.string(ResponseBody.java:174)
                                                                                   at com.facebook.react.devsupport.f$8.onResponse(DevServerHelper.java:487)
                                                                                   at com.newrelic.agent.android.instrumentation.okhttp3.CallbackExtension.onResponse(CallbackExtension.java:41)
                                                                                   at okhttp3.s$a.c(RealCall.java:153)
                                                                                   at okhttp3.internal.b.run(NamedRunnable.java:32)
                                                                                   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
                                                                                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
                                                                                   at java.lang.Thread.run(Thread.java:764)
```

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

- In my case, My device is using a Proxy, and tried to connect the packager. When it failed from connecting packager through websocket, It crash by this line of code.
<!--
  Required: 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!
-->

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [BUGFIX] [DevServerHelper] - fixing from calling body.string() twice.

<!--
  **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 ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {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/19088

Differential Revision: D7853822

Pulled By: mdvacca

fbshipit-source-id: c11a73ce2fa6d40b0a7bd8bc0fca7b07c6bc27ed
2018-05-02 19:24:08 -07:00
David Vacca 23d61b35fb Breaking change - Disable WebView geolocation by default
Reviewed By: yungsters

Differential Revision: D7846198

fbshipit-source-id: 8d6daff4b794d3569b5ddba2d8d62af8c7ff5b03
2018-05-02 15:59:06 -07:00
Eric Rozell ba88292130 Support platform-specific prop type overrides
Summary:
Moves `PlatformViewPropTypes` to the end of `ViewPropTypes` so platforms can override prop type values. An example of this is in `react-native-windows`, we want to support additional values for the `importantForAccessibility` prop type that are specific to Windows (more details in [this PR](https://github.com/Microsoft/react-native-windows/pull/1807)).

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.

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

<!--
  Required: 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!
-->

Run jest tests, test RNTester on iOS and Android. Did not test tvOS, but this should not impact tvOS as the only props included from `PlatformViewPropTypes` are unique (i.e., are not overridden in this file).

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

https://github.com/Microsoft/react-native-windows/pull/1807

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[CATEGORY] [TYPE] [LOCATION] - Message

<!--
  **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 ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {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
-->

[GENERAL][Enhancement][View] - Make `ViewPropTypes` more friendly to platform extensions.
Closes https://github.com/facebook/react-native/pull/19090

Differential Revision: D7846438

Pulled By: shergin

fbshipit-source-id: e51ee3256d1c21001b371bd07da21319f3ecd810
2018-05-02 11:21:51 -07:00
Peter van der Zee aa6f394c42 Enable `?.` plugins in RN
Summary: Enable the optional chaining operator plugins for React Native.

Reviewed By: rafeca

Differential Revision: D7828244

fbshipit-source-id: 659a8a82ff6d656a5cb2f33377d85b668b93a9ea
2018-05-02 07:41:50 -07:00
Rubén Norte 9927d20927 Set hasteImplModulePath in React Native Jest preset
Reviewed By: cpojer

Differential Revision: D7843566

fbshipit-source-id: 98be0d7286351475248f53b7c028e6c85d411a10
2018-05-02 03:52:39 -07:00
Spencer Ahrens fffae99640 deepDiffer: add maxDepth arg
Reviewed By: blairvanderhoof

Differential Revision: D7839729

fbshipit-source-id: fe9a06d2aaed9dfbfb3e52779ba4b1b98007b9ce
2018-05-01 22:01:52 -07:00
Spencer Ahrens 5b2a2bee7a PureComponentDebug
Summary:
Drop in replacement for `React.PureComponent` or can replace `React.PureComponent` for all components.

Logs out what exactly triggered a re-render of a `PureComponent` to make it easier to track down why a component is re-rendering. With some other changes we'll also get component stacks in the YellowBox to make it even easier.

I thought about logging the values, but it's too easy to render something gross or cyclical like react components, so I figured people could break in the debugger to get more detail as needed.

Special flow type should cause errors if people try to commit any usage of this - it should only be used for local debugging.

Reviewed By: yungsters

Differential Revision: D7826325

fbshipit-source-id: fdf7910336452ac1c7acd328c04d441dfb186b59
2018-05-01 19:47:52 -07:00
Jerry Horton 37c820f16e Fix for issue #19086 RCTHasFontHandlerSet(); This function definition…
Summary:
… is not a protoype #19086

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.

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fixes #19086

Related to react-native-navigation issue #3019

<!--
  Required: 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!
-->

Created a fresh react native >= 0.55.2 project and only install React Native Navigation. The error "This function declaration is not a prototype" message occurs.

Downgrading to React Native 0.54.4 builds fine.

![screen shot 2018-05-01 at 3 17 51 pm](https://user-images.githubusercontent.com/5680239/39491718-ddfdd6a0-4d52-11e8-937f-7ed9702a2e30.png)

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

No documentation change

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->
[iOS] [BUGFIX] [react-native-navigation] - For compatibility with react-native-navigation >= 2.0.2237 https://github.com/facebook/react-native/issues/19086
<!--
  **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 ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {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/19089

Differential Revision: D7841198

Pulled By: shergin

fbshipit-source-id: 31638274055c3f143342d2d6dde6d4af7a2ac304
2018-05-01 19:32:07 -07:00
David Vacca 99a6c0af40 Fix NPE in ReactSliderManager.initMeasureFunction
Reviewed By: fkgozali

Differential Revision: D7825102

fbshipit-source-id: af7502a5e6ffa83965a66a0a099d729152d7627f
2018-05-01 19:32:07 -07:00
Eric Samelson bf83600996 Remove race condition in initial layout of ReactRootView
Summary:
There is a race condition stemming from `ReactRootView.onCreate` that occasionally causes the initial root layout calculation to never occur. In this method currently, `updateRootLayoutSpecs(...)` is called before `enableLayoutCalculation()`, meaning that it's possible for the native modules thread to reach `UIImplementation.updateViewHierarchy` before layout calculation has been enabled (i.e. before the rootViewTag is added to `UIImplementation.mMeasuredRootNodes` on the UI thread).

When this occurs, `UIImplementation.applyUpdatesRecursive` is never called. This causes the app to hang on the splash screen indefinitely, the JS never gets past the first call to `render`, and no layout events are ever sent to the JS.

This PR reverses the order of those two method calls to ensure that the rootViewTag is always added to `mMeasuredRootNodes` before `UIImplementation.updateViewHierarchy` expects it. We inspected all of the code paths of both `enableLayoutCalculation()` and `updateRootLayoutSpecs()` to ensure that in this new order, the rootViewTag will *always* be added to `mMeasuredRootNodes` before the call to `updateViewHierarchy` is dispatched, and that no other side effects would be introduced.

Tested with an app that reliably had this issue (hanging splash screen) on 1 out of every ~10 launches. Logged values to ensure that empty `mMeasuredRootNodes` was the difference between failed and successful launches. After this change, I launched the same app 50+ times without any issues.

[ANDROID][BUGFIX][ReactRootView] - remove race condition in initial layout of ReactRootView
Closes https://github.com/facebook/react-native/pull/19038

Differential Revision: D7834270

Pulled By: hramos

fbshipit-source-id: 6040da900f807dcacbc86ae2c36b4ca004f80178
2018-05-01 14:04:40 -07:00