Compare commits

...
147 Commits
Author SHA1 Message Date
Mike Grabowski a442e0b635 [0.59.8] Bump version numbers 2019-05-08 19:05:06 +02:00
Mike Grabowski 8382ca19a6 Revert "Fix accessibility event properties for TextInput (#24641)"
This reverts commit 0a3bbcd1b2.
2019-05-08 17:42:38 +02:00
Spencer AhrensandMike Grabowski 74d740c97b Set scroll view throttle by default
Summary:
Setting the scroll throttle for every animated scrollview is a pain, and if you forget it's super janky and can be confusing and frustrating.

Enables setting default props in createAnimatedComponent and uses it for scrollview.

Reviewed By: TheSavior

Differential Revision: D14790093

fbshipit-source-id: dd8f6f6540813245e87d696351f09ebb2e6ed5f2
2019-05-08 17:12:01 +02:00
Mike Grabowski b7d84747b8 Revert "React sync"
This reverts commit 5f00f4c6ea.
2019-05-08 16:55:33 +02:00
Mike Grabowski c7c952743a Revert "Downgrade Prettier"
This reverts commit b1c5937826.
2019-05-08 16:55:26 +02:00
Mike Grabowski edff084129 Revert "Update lock"
This reverts commit 130a2241a1.
2019-05-08 16:55:21 +02:00
Mike Grabowski 7242dc6bbe [0.59.7] Bump version numbers 2019-05-08 14:55:03 +02:00
Nicolas BreidingerandMike Grabowski bcd1e23dd8 Fix HasteImpl Regex (#24628)
Summary:
The jest HasteImpl's `pluginNameReducers` regex was not properly escaping a backslash, resulting in unintended behavior.

The intent of the code is to strip the `.${name}` from the end of a filepath, where `name` is a platform name. The correct regex for that would be `^(.*)\.(myPlat)$`, but because the regex is being constructed from a string, the `\.` is being interpreted as an escaped period, resulting in the regex  `^(.*).(myPlat)$`. To correct this, the backslash needs to be escaped so it makes it into the regex.

[General] [Fixed] - Fix HasteImpl platform name regex
Pull Request resolved: https://github.com/facebook/react-native/pull/24628

Differential Revision: D15224468

Pulled By: hramos

fbshipit-source-id: 6eb507aa5410bdd7c247e6d301052d41995a2f11
2019-05-07 11:57:34 +02:00
James IdeandMike Grabowski f68dc80a7c Fix sparse array handling in EventEmitter#listeners() (#24546)
Summary:
Fixes a regression in https://github.com/facebook/react-native/commit/1f8b46a2fc191e2899735fbdcdbb535a91b63724. The internal subscription vendor uses a sparse array to track listeners, which makes listener removal fast. When querying listeners, the sparse entries need to be removed. `Array#filter` is a built-in way to do this -> linked to the JS spec, which explains this.

[General] [Fixed] - Fixed sparse array handling in `EventEmitter#listeners()`
Pull Request resolved: https://github.com/facebook/react-native/pull/24546

Differential Revision: D15044790

Pulled By: cpojer

fbshipit-source-id: 0f1301618739357b4a0f5378b9584efe74f0f09a
2019-05-06 20:26:50 +02:00
Spencer AhrensandMike Grabowski 08141ef155 make sure onLayout calls _updateViewableItems immediately
Summary:
Makes sure `onViewableItemsChanged` fires ASAP when `waitForInterations` is false.

This also works around another deeper bug where updates scheduled with `InteractionManager` aren't firing at all in some cases, and thus instead of just firing late, `onViewableItemsChanged` isn't firing until scroll which is not what we want with `waitForInterations: false`. That bug will require more digging.

Differential Revision: D14984333

fbshipit-source-id: 718b39670307c6bc16268759bdb513682745265d
2019-05-06 20:25:48 +02:00
Rick HanlonandMike Grabowski c286769d28 Fix metro websocket reconnect logic
Summary:
This diff fixes the reconnect logic with the metro websockets which is causing the app to not re-connect when metro crashes. To demonstrate the issue, consider the following video:

{F156029086}

On the left we have metro, on the right is the xcode console with some logging to show the reconnecting phase. When we kill the metro server you can see the app tries to reconnect once and that's it - when metro is started back up, you can see the notification that there are no apps running and can also see that cmd+opt+r doesn't work anymore

I updated the logic to optimistically start the connection and if it's still unavailable to retry again after the timeout

[iOS][Fixed] - Metro websocket reconnect logic

Reviewed By: shergin

Differential Revision: D14961433

fbshipit-source-id: 0569aa169dc9f538a7e4a8d04e99de39f2e9b3f9
2019-05-06 20:25:36 +02:00
Valentin SherginandMike Grabowski f71357aa81 Fixed incorrect opacity behaviour for <Text> component on iOS (#24435)
Summary:
This PR fixes #24229.
Seems currently `opacity` props for Text is being applied twice (one for text color and one for the whole view). This PR disables applying the prop to the text.

[CATEGORY] [TYPE] - Fixed double applying opacity prop for Text
Pull Request resolved: https://github.com/facebook/react-native/pull/24435

Differential Revision: D14932795

Pulled By: cpojer

fbshipit-source-id: f9280fc75f788424cb5f1e42d2e79efdb354d645
2019-05-06 20:24:55 +02:00
WoodpavandMike Grabowski 17a81be40d Fix: text shadow displays on iOS when textShadowOffset is {0,0} (#24398)
Summary:
There is a problem rendering text shadows on iOS. If the offset of the text shadow is `{width:0,height:0}`, the shadow does not display. This prevents you from representing a light directly above the text. This occurs because a text shadow only renders if the offset is a non-zero CGRect `{width:0,height:0}`.

My change checks `textShadowRadius` instead. If `textShadowRadius` is not nan then the user is rendering a text shadow. There are no situations to render a shadow without `textShadowRadius` making it a good variable to check.

This PR fixes this stale issue: https://github.com/facebook/react-native/issues/17277

[iOS] [Fixed] - Text shadow now displays when the textShadowOffset is {width:0,height:0}
Pull Request resolved: https://github.com/facebook/react-native/pull/24398

Differential Revision: D14890768

Pulled By: cpojer

fbshipit-source-id: a43b96a4a04a5603eede466abacd95c010d053e5
2019-05-06 20:23:21 +02:00
osdnkandMike Grabowski 4a82dca3b1 Add listener for non-value animated node (#22883)
Summary:
Changelog:
----------
[Changed][General] Move callback-related logic to `AnimatedNode` class in order to make it possible to add the listener for other animated nodes than `AnimatedValue`.

I observed that native code appears to be fully prepared for listening not only to animated value but animated nodes generally. Therefore I managed to modify js code for exposing `addListener` method from `AnimatedNode` class instead of `AnimatedValue`. It called for some minor changes, which are not breaking.

If you're fine with these changes, I could add proper docs if needed.
Pull Request resolved: https://github.com/facebook/react-native/pull/22883

Differential Revision: D14041747

Pulled By: cpojer

fbshipit-source-id: 94c68024ceaa259d9bb145bf4b3107af0b15db88
2019-05-06 20:22:58 +02:00
Christoph NakazawaandMike Grabowski db641040a0 Do not overwrite Object.freeze
Summary: Now that React Native ships with a newer version of JSC, we do not need this code to wrap `Object.freeze` any longer.

Reviewed By: mmmulani

Differential Revision: D14779239

fbshipit-source-id: 1a6e1a9c7f4312572bd08ba604fa8c9d6b1927e1
2019-05-06 20:22:16 +02:00
Achille UrbainandMike Grabowski 7140a7f7d1 Make KeyboardAvoidingView with behavior="height" resize on keyboard close (#18889)
Summary:
<!--
  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 #13754
Pull Request resolved: https://github.com/facebook/react-native/pull/18889

Differential Revision: D14486115

Pulled By: PeteTheHeat

fbshipit-source-id: 7b8b4fa9d2c99fc5d6145fed4681afdc4bb14fb8
2019-05-06 20:20:51 +02:00
Alec LarsonandMike Grabowski 0c420644d9 Fix prop overrides of TouchableWithoutFeedback (#23966)
Summary:
Child props were being overridden by `<Touchable>` props even when the `<Touchable>` props were undefined.

[General] [Fixed] - Prevent prop override by TouchableWithoutFeedback when undefined
Pull Request resolved: https://github.com/facebook/react-native/pull/23966

Differential Revision: D14502918

Pulled By: cpojer

fbshipit-source-id: 614ee43bbb6f062a98bd9318693807320979a016
2019-05-06 20:20:20 +02:00
Georgios AndreadisandMike Grabowski 4884ab6799 Resolve relative size rendering error in inspector (#23804)
Summary:
Currently, when relative sizes are given in margin or padding stylings (be it a percentage or an auto measure), the inspector crashes, due to frame rendering not properly handling those kinds of measurements. This PR adds a resolution step for them:

* Percentages are evaluated relative to the window size.
* I decided to simply not render `auto` margins/paddings, due to the complexities involved (e.g. when the margin is between multiple elements with relative sizes).

Since the inspector does not crash anymore on relative sizes on paddings or margins, I believe that this addresses #17496.

Fixes #17496

[General] [Fixed] - Fix inspector rendering of relative margins and paddings
Pull Request resolved: https://github.com/facebook/react-native/pull/23804

Differential Revision: D14437273

Pulled By: cpojer

fbshipit-source-id: c9f0f71a2e1b2399a2b2148cef2124787703ead3
2019-05-06 20:19:39 +02:00
Vojtech NovakandMike Grabowski 54f91d3ca9 make sure to check array bounds in VirtualizedSectionList (#23710)
Summary:
SectionList accesses items outside of the array bounds.

This was discovered when using mobx, which warns you: `[mobx.array] Attempt to read an array index (${index}) that is out of bounds`. This is because `section.data[itemIndex + 1]` goes beyond array length.

This PR adds an array length check and simplifies the code a bit to avoid repetitive `this.props.`
Pull Request resolved: https://github.com/facebook/react-native/pull/23710

Differential Revision: D14298557

Pulled By: cpojer

fbshipit-source-id: fee3422ad5b053d91a097c5842f46e78a149c3d5
2019-05-06 20:19:29 +02:00
Masayuki IwaiandMike Grabowski e0d1b3ab84 Update _scrollAnimatedValue offset of ScrollViews. (#19481)
Summary:
`_scrollAnimatedValue` offset of ScrollView is set once in `UNSAFE_componentWillMount` but it is never updated.
It causes unexpected render result.

![rn-scrollview-fix1](https://user-images.githubusercontent.com/143255/40640292-61843eca-6350-11e8-9412-f5383ea65ea0.gif)

So I suggest to update `_scrollAnimatedValue` offset when ScrollView contentInset is updated.
Pull Request resolved: https://github.com/facebook/react-native/pull/19481

Differential Revision: D14223304

Pulled By: cpojer

fbshipit-source-id: 4191cfcf6414adf3a0abd156517d5f9778565671
2019-05-06 20:19:16 +02:00
alanfosterandMike Grabowski 57dc37ec5b Update network inspector to have smarter scroll stickiness (#21952)
Summary:
When making use of the network inspector on a react-native app, it can be quite annoying that as new requests come in the network inspector instantly sticks to the bottom.

This PR makes this logic smarter by allowing the user to be scrolled away from the bottom by two rows to override this automatic scrolling to the bottom logic.
Pull Request resolved: https://github.com/facebook/react-native/pull/21952

Differential Revision: D14162762

Pulled By: cpojer

fbshipit-source-id: ad49858509dd74a817ebabab54fdacc99773bf22
2019-05-06 20:19:00 +02:00
Spencer AhrensandMike Grabowski c40a938ead Fix infinite setState in VirtualizedList
Reviewed By: larrylin28

Differential Revision: D14990686

fbshipit-source-id: 632fa0e4e11feff9dcfb4ac62ba8bc7a6c0393a5
2019-05-06 20:18:36 +02:00
Emiel MolsandMike Grabowski 84e2636004 ReactAndroid: JS errors during bundle load were reported as UnknownCppException (#24648)
Summary:
This fixes a regression on Android introduced by f3e5cce where JS errors thrown during bundle load were lost (shown only as UnknownCppException). It is especially tough to debug (custom) bundling errors without seeing the javascript error.

Root cause hypothesis: since switching to clang, `JSError`s thrown in ReactCommon's `JSCRuntime::checkException` were never matched as `std::exception` in ReactAndroid's `convertCppExceptionToJavaException` due to these missing flags.

I'm a bit shy on low-level details concerning how C++ rtti works exactly around catching exceptions thrown in other libraries. All I can say that with this change, a `bundle.android.js` that only contains `throw new Error("wtf");` now nicely outputs a message and stack trace in the logcat. Before (and since DanielZlotin's switch to clang) it just outputted:

```
2019-04-29 12:17:59.365 1162-1306/com.rntest E/unknown:ReactNative: Exception in native call
    com.facebook.jni.UnknownCppException: Unknown
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:214)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
        at java.lang.Thread.run(Thread.java:764)
```

[Android] [Fixed] - JS errors during bundle load were reported as UnknownCppException.
Pull Request resolved: https://github.com/facebook/react-native/pull/24648

Differential Revision: D15123525

Pulled By: mdvacca

fbshipit-source-id: 74b5ce9ebae38d172446b6e31739d795c601947b
2019-04-30 22:32:23 +02:00
zhongwuzwandMike Grabowski c37e9c8905 Add convert compatible of NSString for bridge message data (#24630)
Summary:
Fixes https://twitter.com/estevao_lucas/status/1117572702083190785?s=215 in #24626 . Now we try to convert any id to `NSString`, not throw error.

cc. cpojer .

[iOS] [Fixed] - Add convert compatible of NSString for bridge message data
Pull Request resolved: https://github.com/facebook/react-native/pull/24630

Differential Revision: D15120205

Pulled By: cpojer

fbshipit-source-id: 4849a8e941410b292f971608a9cdb38c11502445
2019-04-30 22:32:00 +02:00
Estevão LucasandMike Grabowski 0a3bbcd1b2 Fix accessibility event properties for TextInput (#24641)
Summary:
When a `TextInput` receives any accessibility event prop (`onAccessibilityTap`, `onMagicTap`, `onAccessibilityEscape`, `onAccessibilityEscape`), causes a crash.

<p align=center><img src=https://user-images.githubusercontent.com/20709038/56871548-84f00980-69ed-11e9-8906-0206899e5435.jpg width=300></p>

[iOS] [Fixed] - Fix accessibility event properties for `TextInput`
Pull Request resolved: https://github.com/facebook/react-native/pull/24641

Differential Revision: D15120211

Pulled By: cpojer

fbshipit-source-id: 7996ab9f9b78588fab4986c3de6114817ec37296
2019-04-30 22:31:06 +02:00
Spencer AhrensandMike Grabowski 39776a82f0 don't throttle below 16ms
Summary: For some reason the scroll events are sometimes generated with highly irregular spacing, some coming less than a millisecond apart. For interactions that must track scrolling exactly, this can cause them to glitch. With a scroll throttle of less than 17 ms, the intention is clear that the UI should be updated in sync with the scroll view so we shouldn't drop any events.

Reviewed By: PeteTheHeat

Differential Revision: D15068841

fbshipit-source-id: 730e7cb29cc3ddae66f37cf7392e02e0cc9d7844
2019-04-30 22:29:11 +02:00
Thorben PrimkeandMike Grabowski 379874dc49 Adds Logic To Catch MissingWebViewPackageException (#24533)
Summary:
We are seeing crash reports that the webview is missing. In this case
it should fail gracefully so that a missing webview does not block
from using an app built with React Native.

The contains could also be changed to check for "webview" in general
to catch all webview related exception. It's currently checking on
for the specific string that I'm seeing in our app's crashreporting tool.

<img width="1507" alt="Screen Shot 2019-04-19 at 11 26 19 AM" src="https://user-images.githubusercontent.com/741767/56438307-5e1c2f80-6297-11e9-970b-a5095d18e9d7.png">

<img width="935" alt="Screen Shot 2019-04-19 at 11 32 58 AM" src="https://user-images.githubusercontent.com/741767/56438213-fa920200-6296-11e9-8008-5eb344eca8a8.png">

[Android] [Fixed] - The ReactCookieJarContainer/ForwardingCookieHandler now handles the missing WebView  gracefully.
Pull Request resolved: https://github.com/facebook/react-native/pull/24533

Differential Revision: D15062824

Pulled By: cpojer

fbshipit-source-id: 80805a47494f0d924b7ee029ce8ca0504eaeee57
2019-04-30 22:27:25 +02:00
Christoph NakazawaandMike Grabowski f3801d90fa Revert "improve RTL (#24069)" (#24580)
Summary:
This reverts commit b3c74967ca.

Fixes #24267

[Android] [Fixed] - Invalid text alignment for RTL fonts.
Pull Request resolved: https://github.com/facebook/react-native/pull/24580

Differential Revision: D15061667

Pulled By: cpojer

fbshipit-source-id: 6d02c9e938f1f8630ba691f57bdf79fd57db3bb2
2019-04-30 22:26:35 +02:00
James TreanorandMike Grabowski 2b7d7999e1 Fix nullability warnings in RCTExceptionsManager (#24467)
Summary:
There are a number of nullability warnings in `RCTExceptionsManager` when building React Native for iOS with Xcode 10.2. This resolves them without changing the existing behavior.

See the warnings here:

![image](https://user-images.githubusercontent.com/1773641/56201323-89551380-6038-11e9-9998-b6a8d3d28f36.png)

[iOS] [Fixed] - Fix nullability warnings in RCTExceptionsManager
Pull Request resolved: https://github.com/facebook/react-native/pull/24467

Differential Revision: D14973485

Pulled By: cpojer

fbshipit-source-id: 2fac9f067ac9418397c3913760a2403f9a2cc147
2019-04-30 22:25:24 +02:00
Mike Grabowski df4e67fe75 [0.59.6] Bump version numbers 2019-04-18 14:53:24 +02:00
Mike Grabowski 130a2241a1 Update lock 2019-04-18 14:39:00 +02:00
Mike Grabowski b1c5937826 Downgrade Prettier 2019-04-18 14:38:26 +02:00
Eli WhiteandMike Grabowski 5f00f4c6ea React sync
Summary:
This sync includes the following changes:
- **[1b2159acc](https://github.com/facebook/react/commit/1b2159acc )**: [React Native] measure calls will now call FabricUIManager (#15324) //<Eli White>//
- **[c7a959982](https://github.com/facebook/react/commit/c7a959982 )**: [React Native] Add tests to paper renderer for measure, measureLayout (#15323) //<Eli White>//
- **[aece8119c](https://github.com/facebook/react/commit/aece8119c )**: Refactor EventComponent logic + add onOwnershipChange callback (#15354) //<Dominic Gannaway>//
- **[183d1f42e](https://github.com/facebook/react/commit/183d1f42e )**: Fix: Measure expiration times relative to module initialization (#15357) //<Andrew Clark>//
- **[b4bc33a58](https://github.com/facebook/react/commit/b4bc33a58 )**: Fix areHookInputsEqual method  warning params order (#15345) //<砖家>//
- **[29fb5862f](https://github.com/facebook/react/commit/29fb5862f )**: Move EventComponent state creation to complete phase + tests (#15352) //<Dominic Gannaway>//
- **[745baf2e0](https://github.com/facebook/react/commit/745baf2e0 )**: Provide new jsx transform target for reactjs/rfcs#107 (#15141) //<Ricky Vetter>//
- **[81a61b1d1](https://github.com/facebook/react/commit/81a61b1d1 )**: React events: add delay props to Press module (#15340) //<Nicolas Gallagher>//
- **[4064ea9fa](https://github.com/facebook/react/commit/4064ea9fa )**: Experimental event API: Support EventComponent onUnmount responder callback (#15335) //<Dominic Gannaway>//
- **[4fbbae8af](https://github.com/facebook/react/commit/4fbbae8af )**: Add full TouchHitTarget hit slop (experimental event API) to ReactDOM (#15308) //<Dominic Gannaway>//
- **[958b6173f](https://github.com/facebook/react/commit/958b6173f )**: Add delay props to Hover event module (#15325) //<Nicolas Gallagher>//
- **[c3cc936da](https://github.com/facebook/react/commit/c3cc936da )**: Add Hover,Focus,Press docs to REAMDE (#15328) //<Nicolas Gallagher>//
- **[49595e921](https://github.com/facebook/react/commit/49595e921 )**: [New Scheduler] Fix: Suspending an expired update (#15326) //<Andrew Clark>//
- **[b93a8a9bb](https://github.com/facebook/react/commit/b93a8a9bb )**: Experimental event API: refactor responder modules for lifecycle inclusion (#15322) //<Dominic Gannaway>//
- **[937d262f5](https://github.com/facebook/react/commit/937d262f5 )**: React events: keyboard press, types, tests (#15314) //<Nicolas Gallagher>//
- **[7a2dc4853](https://github.com/facebook/react/commit/7a2dc4853 )**: Allow DevTools to toggle Suspense fallbacks (#15232) //<Dan Abramov>//
- **[43b1f74c8](https://github.com/facebook/react/commit/43b1f74c8 )**: Alternate fix for #14198 //<Andrew Clark>//
- **[41aa345d2](https://github.com/facebook/react/commit/41aa345d2 )**: Fix a crash in Suspense with findDOMNode //<Dan Abramov>//
- **[6d0effad7](https://github.com/facebook/react/commit/6d0effad7 )**: Expose extra internals in FB build of react-dom/unstable-new-scheduler (#15311) //<Andrew Clark>//
- **[3a44ccefe](https://github.com/facebook/react/commit/3a44ccefe )**: Fix feature flags react-dom/unstable-new-scheduler (#15309) //<Andrew Clark>//
- **[92a1d8fea](https://github.com/facebook/react/commit/92a1d8fea )**: mark react-events as private so we publish script skips it for now (#15307) //<Sunil Pai>//
- **[e5c59359c](https://github.com/facebook/react/commit/e5c59359c )**: Prevent bundling of Node polyfills when importing TestUtils/TestRenderer (#15305) //<Dan Abramov>//
- **[73187239a](https://github.com/facebook/react/commit/73187239a )**: writing unit tests in experimental event Drag API (#15297) //<Behzad Abbasi>//
- **[89064fe68](https://github.com/facebook/react/commit/89064fe68 )**: Adds displayName to EventComponent and EventTarget (#15268) //<Dominic Gannaway>//
- **[fc6a9f1a1](https://github.com/facebook/react/commit/fc6a9f1a1 )**: Add test for async event dispatching (#15300) //<Nicolas Gallagher>//
- **[38fa84088](https://github.com/facebook/react/commit/38fa84088 )**: Experiemental event API - wrap async dispatched events (#15299) //<Dominic Gannaway>//
- **[4d5cb64aa](https://github.com/facebook/react/commit/4d5cb64aa )**: Rewrite ReactFiberScheduler for better integration with Scheduler package (#15151) //<Andrew Clark>//
- **[aed0e1c30](https://github.com/facebook/react/commit/aed0e1c30 )**: await act(async () => ...) (#14853) //<Sunil Pai>//
- **[4c75881ee](https://github.com/facebook/react/commit/4c75881ee )**: Remove maxDuration from tests (#15272) //<Sebastian Markbåge>//
- **[9307932fe](https://github.com/facebook/react/commit/9307932fe )**: Refactor event object creation for the experimental event API (#15295) //<Dominic Gannaway>//
- **[6a1e6b2f7](https://github.com/facebook/react/commit/6a1e6b2f7 )**: Experimental event API: loosen EventTarget constraints and warnings (#15292) //<Dominic Gannaway>//
- **[f243deab8](https://github.com/facebook/react/commit/f243deab8 )**: Add tests for Press responder event module (#15290) //<Nicolas Gallagher>//
- **[296c4393d](https://github.com/facebook/react/commit/296c4393d )**: Add Press event prop types and fix a check in Safari (#15288) //<Nicolas Gallagher>//
- **[4482fdded](https://github.com/facebook/react/commit/4482fdded )**: Fix host context issues around EventComponents and EventTargets (#15284) //<Dominic Gannaway>//
- **[5ef0d1d29](https://github.com/facebook/react/commit/5ef0d1d29 )**: Rename hover props in experimental event API and write unit tests (#15283) //<Behzad Abbasi>//
- **[9444a5472](https://github.com/facebook/react/commit/9444a5472 )**: Warn on nested EventTragets in experimental event API (#15287) //<Dominic Gannaway>//
- **[7f1f5ddc3](https://github.com/facebook/react/commit/7f1f5ddc3 )**: Rename press props in experimental event API (#15263) //<Nicolas Gallagher>//
- **[2e02469fa](https://github.com/facebook/react/commit/2e02469fa )**: ReactNative's ref.measureLayout now takes a ref (#15126) //<Eli White>//
- **[1b94fd215](https://github.com/facebook/react/commit/1b94fd215 )**: Make setNativeProps a no-op with Fabric renderer (#15094) //<Eli White>//
- **[08055a625](https://github.com/facebook/react/commit/08055a625 )**: Fix Press module in experimental event API (#15262) //<Nicolas Gallagher>//
- **[f4625f518](https://github.com/facebook/react/commit/f4625f518 )**: Fix on(Long)PressChange events in experimental press event API (#15256) //<Nicolas Gallagher>//
- **[a41b21770](https://github.com/facebook/react/commit/a41b21770 )**: Add additional event API responder surfaces (#15248) //<Dominic Gannaway>//
- **[700f17be6](https://github.com/facebook/react/commit/700f17be6 )**: Fix longpress in experimental Press event module (#15246) //<Nicolas Gallagher>//
- **[5d336df70](https://github.com/facebook/react/commit/5d336df70 )**: Allow for null targetFiber for root event handling (#15247) //<Dominic Gannaway>//
- **[c6f3524df](https://github.com/facebook/react/commit/c6f3524df )**: Adds React event component and React event target support to SSR renderer (#15242) //<Dominic Gannaway>//
- **[c7a2dce50](https://github.com/facebook/react/commit/c7a2dce50 )**: Disable JS urls at build level for www (#15230) //<Sebastian Markbåge>//
- **[fb6b50871](https://github.com/facebook/react/commit/fb6b50871 )**: Update versions for 16.8.6 //<Dan Abramov>//
- **[1cfd25668](https://github.com/facebook/react/commit/1cfd25668 )**: Fix circular module imports causing file size increase (#15231) //<Dominic Gannaway>//
- **[669cafb36](https://github.com/facebook/react/commit/669cafb36 )**: Adds experimental event component responder surfaces (#15228) //<Dominic Gannaway>//
- **[d8cb10f11](https://github.com/facebook/react/commit/d8cb10f11 )**: Enabled warnAboutDeprecatedLifecycles flag by default (#15186) //<Brian Vaughn>//
- **[80f8b0d51](https://github.com/facebook/react/commit/80f8b0d51 )**: Add part of the event responder system for experimental event API (#15179) //<Dominic Gannaway>//
- **[5c2b2c085](https://github.com/facebook/react/commit/5c2b2c085 )**: Warn about async infinite useEffect loop (#15180) //<Dan Abramov>//
- **[8e9a013c0](https://github.com/facebook/react/commit/8e9a013c0 )**: Release 16.8.5 //<Dan Abramov>//
- **[f33e5790b](https://github.com/facebook/react/commit/f33e5790b )**: eslint-plugin-react-hooks@1.6.0 //<Dan Abramov>//
- **[b1cccd1ed](https://github.com/facebook/react/commit/b1cccd1ed )**: Warn about setState directly in dep-less useEffect (#15184) //<Dan Abramov>//
- **[78f2775ed](https://github.com/facebook/react/commit/78f2775ed )**: Flip event passive logic on passiveBrowserEventsSupported (#15190) //<Dominic Gannaway>//
- **[f161ee2eb](https://github.com/facebook/react/commit/f161ee2eb )**: React.warn() and React.error() (#15170) //<Brian Vaughn>//
- **[78968bb3d](https://github.com/facebook/react/commit/78968bb3d )**: Validate useEffect without deps too (#15183) //<Dan Abramov>//
- **[4b8e1641b](https://github.com/facebook/react/commit/4b8e1641b )**: Fork performWork instead of using boolean flag (#15169) //<Sebastian Markbåge>//
- **[56035dac6](https://github.com/facebook/react/commit/56035dac6 )**: unstable_Profiler -> Profiler (#15172) //<Brian Vaughn>//
- **[31518135c](https://github.com/facebook/react/commit/31518135c )**: Strengthen nested update counter test coverage (#15166) //<Dan Abramov>//
- **[66f280c87](https://github.com/facebook/react/commit/66f280c87 )**: Add internal logic for listening to event responders (#15168) //<Dominic Gannaway>//
- **[b1a56abd6](https://github.com/facebook/react/commit/b1a56abd6 )**: Fork ReactFiberScheduler with feature flag //<Andrew Clark>//
- **[45f571736](https://github.com/facebook/react/commit/45f571736 )**: ReactFiberScheduler -> ReactFiberScheduler.old //<Andrew Clark>//
- **[c05b4b81f](https://github.com/facebook/react/commit/c05b4b81f )**: Link to useLayoutEffect gist in a warning (#15158) //<Dan Abramov>//
- **[061d6ce3c](https://github.com/facebook/react/commit/061d6ce3c )**: fix(react-dom): access iframe contentWindow instead of contentDocument (#15099) //<Renan Valentin>//
- **[b83e01cad](https://github.com/facebook/react/commit/b83e01cad )**: Adds more scaffolding for experimental event API (#15112) //<Dominic Gannaway>//
- **[daeda44d8](https://github.com/facebook/react/commit/daeda44d8 )**: Follow up to 15150 (#15152) //<Dominic Gannaway>//
- **[acd65db5b](https://github.com/facebook/react/commit/acd65db5b )**: Deprecate module pattern (factory) components (#15145) //<Sebastian Markbåge>//
- **[55cc921c5](https://github.com/facebook/react/commit/55cc921c5 )**: Adds react-events package for internal testing (#15150) //<Dominic Gannaway>//
- **[7ad738630](https://github.com/facebook/react/commit/7ad738630 )**: Improve warning for invalid class contextType (#15142) //<Dan Abramov>//
- **[1e3364e76](https://github.com/facebook/react/commit/1e3364e76 )**: Test that we don't suspend when disabling yielding (#15143) //<Sebastian Markbåge>//
- **[42c3c967d](https://github.com/facebook/react/commit/42c3c967d )**: Compile invariant directly to throw expressions (#15071) //<Andrew Clark>//
- **[df7b87d25](https://github.com/facebook/react/commit/df7b87d25 )**: Warn for Context.Consumer with contextType (#14831) //<Brandon Dail>//
- **[2b93d686e](https://github.com/facebook/react/commit/2b93d686e )**: Add more info to invalid hook call error message (#15139) //<Jared Palmer>//
- **[d926936f0](https://github.com/facebook/react/commit/d926936f0 )**: Eager bailout optimization should always compare to latest reducer (#15124) //<Andrew Clark>//
- **[4162f6026](https://github.com/facebook/react/commit/4162f6026 )**: Add feature flag to disable yielding (#15119) //<Sebastian Markbåge>//
- **[8d60bd4dc](https://github.com/facebook/react/commit/8d60bd4dc )**: [Shallow] Implement setState for Hooks and remount on type change (#15120) //<Dan Abramov>//
- **[035e4cffb](https://github.com/facebook/react/commit/035e4cffb )**: Change passive checker to use defineProperty (#15121) //<Dominic Gannaway>//
- **[b283d75c1](https://github.com/facebook/react/commit/b283d75c1 )**: Support React.memo in ReactShallowRenderer (#14816) //<Brandon Dail>//
- **[f0621fe23](https://github.com/facebook/react/commit/f0621fe23 )**: Use same example code for async effect warning (#15118) //<Dan Abramov>//
- **[52c870c8d](https://github.com/facebook/react/commit/52c870c8d )**: Fix shallow renderer not allowing hooks in forwardRef render functions (#15100) //<Sebastian Silbermann>//
- **[f1ff4348c](https://github.com/facebook/react/commit/f1ff4348c )**: Don't suggest a function as its own dep (#15115) //<Dan Abramov>//
- **[371bbf36b](https://github.com/facebook/react/commit/371bbf36b )**: Add infrastructure for passive/non-passive event support for future API exploration (#15036) //<Dominic Gannaway>//
- **[ab5fe174c](https://github.com/facebook/react/commit/ab5fe174c )**: Don't set the first option as selected in select tag with `size` attribute  (#14242) //<Mateusz>//
- **[935f60083](https://github.com/facebook/react/commit/935f60083 )**: eslint-plugin-react-hooks@1.5.1 //<Dan Abramov>//
- **[0c03a4743](https://github.com/facebook/react/commit/0c03a4743 )**: Adds experimental event API scaffolding (#15108) //<Dominic Gannaway>//
- **[1204c7897](https://github.com/facebook/react/commit/1204c7897 )**: [eslint] Wording tweaks (#15078) //<Sophie Alpert>//
- **[9d77a317b](https://github.com/facebook/react/commit/9d77a317b )**: Improve async useEffect warning (#15104) //<Dan Abramov>//
- **[103378b1e](https://github.com/facebook/react/commit/103378b1e )**: Warn for javascript: URLs in DOM sinks (#15047) //<Sebastian Markbåge>//
- **[5d0c3c6c7](https://github.com/facebook/react/commit/5d0c3c6c7 )**: [Partial Hydration] Render client-only content at normal priority (#15061) //<Sebastian Markbåge>//
- **[6a4a261ee](https://github.com/facebook/react/commit/6a4a261ee )**: Test suspended children are hidden before layout in persistent mode (#15030) //<Andrew Clark>//
- **[bc8bd24c1](https://github.com/facebook/react/commit/bc8bd24c1 )**: Run persistent mode tests in CI (#15029) //<Andrew Clark>//
- **[3f4852fa5](https://github.com/facebook/react/commit/3f4852fa5 )**: Run Placeholder tests in persistent mode, too (#15013) //<Andrew Clark>//
- **[d0289c7e3](https://github.com/facebook/react/commit/d0289c7e3 )**: eslint-plugin-react-hooks@1.5.0 //<Dan Abramov>//
- **[03ad9c73e](https://github.com/facebook/react/commit/03ad9c73e )**: [ESLint] Tweak setState updater message and add useEffect(async) warning (#15055) //<Dan Abramov>//
- **[eb6247a9a](https://github.com/facebook/react/commit/eb6247a9a )**: More concise messages (#15053) //<Dan Abramov>//
- **[197703ecc](https://github.com/facebook/react/commit/197703ecc )**: [ESLint] Add more hints to lint messages (#15046) //<Dan Abramov>//
- **[6d2666bab](https://github.com/facebook/react/commit/6d2666bab )**: Fix ESLint rule crash (#15044) //<Dan Abramov>//
- **[9b7e1d138](https://github.com/facebook/react/commit/9b7e1d138 )**: [ESLint] Suggest moving inside a Hook or useCallback when bare function is a dependency (#15026) //<Dan Abramov>//
- **[1e3b6192b](https://github.com/facebook/react/commit/1e3b6192b )**: Import Scheduler directly, not via host config (#14984) //<Andrew Clark>//
- **[5d49dafac](https://github.com/facebook/react/commit/5d49dafac )**: Enforce deps array in useMemo and useCallback (#15025) //<Dan Abramov>//
- **[a9aa24ed8](https://github.com/facebook/react/commit/a9aa24ed8 )**: 16.8.4 and changelog //<Brian Vaughn>//
- **[fa5d4ee43](https://github.com/facebook/react/commit/fa5d4ee43 )**: [ESLint] Treat functions that don't capture anything as static (#14996) //<Dan Abramov>//
- **[fd557d453](https://github.com/facebook/react/commit/fd557d453 )**: Warn on mount when deps are not an array (#15018) //<Dan Abramov>//
- **[ce45ca9ba](https://github.com/facebook/react/commit/ce45ca9ba )**: Prettier //<Andrew Clark>//
- **[757a70b25](https://github.com/facebook/react/commit/757a70b25 )**: ReactNoop.yield -> Scheduler.yieldValue (#15008) //<Andrew Clark>//
- **[9d756d903](https://github.com/facebook/react/commit/9d756d903 )**: Revert #14756 changes to ReactFiberScheduler (#14992) //<Andrew Clark>//
- **[f16442a10](https://github.com/facebook/react/commit/f16442a10 )**: eslint-plugin-react-hooks@1.4.0 //<Dan Abramov>//
- **[e1e45fb36](https://github.com/facebook/react/commit/e1e45fb36 )**: [ESLint] Suggest to destructure props when they are only used as members (#14993) //<Dan Abramov>//
- **[59ef28437](https://github.com/facebook/react/commit/59ef28437 )**: Warn about dependencies outside of render scope (#14990) //<Dan Abramov>//
- **[df7b4768c](https://github.com/facebook/react/commit/df7b4768c )**: [ESLint] Deduplicate suggested dependencies (#14982) //<Dan Abramov>//
- **[02404d793](https://github.com/facebook/react/commit/02404d793 )**: Avoid dynamic dispatch for scheduler calls (#14968) //<Dan Abramov>//
- **[bb2939ccc](https://github.com/facebook/react/commit/bb2939ccc )**: Support editable useState hooks in DevTools (#14906) //<Brian Vaughn>//
- **[69060e1da](https://github.com/facebook/react/commit/69060e1da )**: Swap expect(ReactNoop) for expect(Scheduler) (#14971) //<Andrew Clark>//
- **[ccb2a8a44](https://github.com/facebook/react/commit/ccb2a8a44 )**: Replace test renderer's fake Scheduler implementation with mock build (#14970) //<Andrew Clark>//
- **[53e787b45](https://github.com/facebook/react/commit/53e787b45 )**: Replace noop's fake Scheduler implementation with mock Scheduler build (#14969) //<Andrew Clark>//
- **[3ada82b74](https://github.com/facebook/react/commit/3ada82b74 )**: Allow extraneous effect dependencies (#14967) //<Dan Abramov>//
- **[00748c53e](https://github.com/facebook/react/commit/00748c53e )**: Add new mock build of Scheduler with flush, yield API (#14964) //<Andrew Clark>//
- **[4186952a6](https://github.com/facebook/react/commit/4186952a6 )**: Fixed incompatibility between react-debug-tools and useContext() (#14940) //<Brian Vaughn>//
- **[0b8efb229](https://github.com/facebook/react/commit/0b8efb229 )**: Allow omitting constant primitive deps (#14959) //<Dan Abramov>//
- **[875d05d55](https://github.com/facebook/react/commit/875d05d55 )**: Include full error messages in React Native build (#15363) //<Andrew Clark>//
- **[c64b33003](https://github.com/facebook/react/commit/c64b33003 )**: Move EventTypes to ReactTypes (#15364) //<Dominic Gannaway>//
- **[4c78ac0b9](https://github.com/facebook/react/commit/4c78ac0b9 )**: Track Event Time as the Start Time for Suspense (#15358) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React sync for revisions 8e25ed2...c64b330

Reviewed By: hramos

Differential Revision: D14862650

fbshipit-source-id: 350447246d26c69e7f462c5eb4e3ec02e99d05bb
2019-04-18 14:04:53 +02:00
Mike Grabowski 822bdd4a0b [0.59.5] Bump version numbers 2019-04-17 23:51:44 +02:00
Mike Grabowski f5a31801a0 Enforced thread safety on UIImplementation methods that mutate the shadowNodeRegistry 2019-04-17 21:32:29 +02:00
AntoineDoubovetzkyandMike Grabowski 54af5b151e Remove wrapper around ListEmptyComponent (#24339)
Summary:
This pull request fixes #24257.

The wrapper around ListEmptyComponent doesn't allow to use flex on the ListEmptyComponent.
The wrapper was removed in this [commit](https://github.com/facebook/react-native/commit/db061ea8c7b78d7e9df4a450c9e7a24d9b2382b4), and then put back in this [commit](https://github.com/facebook/react-native/commit/e94d3444dcface90bd20234d13143462690ff23c) but I think the relevant part was removing the condition on `itemCount !== 0` to apply the inversionStyle on the ScrollView and everything is still working without the wrapper.

[GENERAL] [FIXED] - Remove wrapper around ListEmptyComponent
Pull Request resolved: https://github.com/facebook/react-native/pull/24339

Differential Revision: D14822221

Pulled By: cpojer

fbshipit-source-id: 623e1ab3f228e9b75b92cdcd568683232a403c1a
2019-04-17 21:26:51 +02:00
Mike DiarmidandMike Grabowski d7bd6cce38 JSStackTrace -> Ensure lineNumber exists before consuming (#24399)
Summary:
Fixes https://github.com/facebook/react-native/issues/24382

[ANDROID] [INTERNAL] - Fixed a `NoSuchKeyException` when parsing JS stack frames without line numbers.
Pull Request resolved: https://github.com/facebook/react-native/pull/24399

Differential Revision: D14890746

Pulled By: cpojer

fbshipit-source-id: cea3653076484ad624084c370439f8a39c303083
2019-04-17 21:23:35 +02:00
Ryan DonnellyandMike Grabowski 72b4cc091d Calculate Correct Window Dimensions for iOS (#19932)
Summary:
Fixes: #16152

[iOS] [Fixed] - Pass back correct dimensions for application window in Dimensions module
Pull Request resolved: https://github.com/facebook/react-native/pull/19932

Reviewed By: cpojer

Differential Revision: D14312906

Pulled By: PeteTheHeat

fbshipit-source-id: aacb729c89862267465eefc3534c48d9d4b5d746
2019-04-17 21:22:56 +02:00
Vishwesh JainkuniyaandMike Grabowski b8aac029f1 Fix: mostRecentEventCount is not updated. (#17990)
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!

-->

Update it's value as it changes on the JS thread, so that updated value is used (https://github.com/facebook/react-native/blob/f7f5dc66493ad25a85927a9503728b0491c8aab9/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L243) whenever setSelection(int start, int end) is called (https://github.com/facebook/react-native/blob/f7f5dc66493ad25a85927a9503728b0491c8aab9/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L315).
Pull Request resolved: https://github.com/facebook/react-native/pull/17990

Differential Revision: D14255969

Pulled By: mdvacca

fbshipit-source-id: 555d6752eabca5c31c1762955a56f99cc1828546
2019-04-17 21:21:46 +02:00
Seph SolimanandMike Grabowski effb028ad5 Fix #23755 ("RCTImagePickerManager requires main queue setup" warning) (#24314)
Summary:
Fix #23755 - Which is to remove the warning:
```
Module RCTImagePickerManager requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
```

General Fixed - Warning "RCTImagePickerManager requires main queue setup
Pull Request resolved: https://github.com/facebook/react-native/pull/24314

Differential Revision: D14788772

Pulled By: cpojer

fbshipit-source-id: e2017136008367d36468debb258afa698b5402bc
2019-04-17 21:20:15 +02:00
Mike Grabowski d60a2fbb01 [0.59.4] Bump version numbers 2019-04-08 23:51:19 +02:00
PIYUSH GUPTAandMike Grabowski dc29f29f18 Revert "Remove react-clone-referenced-element dependency (#23933)"
ListView is still part of 0.59. We cant cherry-pick this one. Solved conflict manually.

This reverts commit 27872cf97c.
2019-04-08 23:27:05 +02:00
Craig_MartinandMike Grabowski e3ac3293d9 Add scrollToOverflowEnabled prop to ScrollView (#24296)
Summary:
ScrollView's scrollTo behavior on iOS was recently changed to limit the offset to the content size plus any content inset (see #23427). This departure from the old behavior created UI issues for anyone that is using the over-scroll ability for the purpose of positioning elements at specific coordinates on the screen. Examples include using this behavior to position TextInputs above the virtual keyboard programmatically when focused or moving drop down elements positioned near the bottom of the content toward the top of the screen when selected to show a larger absolutely positioned item list. Default behavior does not change and this is an "opt-in" type of prop to re-enable the old behavior.

[iOS] [Added] - Added scrollToOverflowEnabled prop to ScrollView
Pull Request resolved: https://github.com/facebook/react-native/pull/24296

Differential Revision: D14762619

Pulled By: cpojer

fbshipit-source-id: d2a552b5cb321d52e8ea4116327bf9ec647a3aae
2019-04-08 23:22:33 +02:00
Michał PierzchałaandMike Grabowski 17292c9db2 Make Jest transform @react-native-community packages by default (#24294)
Summary:
Currently, `react-native` Jest preset will not automatically transpile extracted Lean Core modules (all under `react-native-community` org), so maintainers will likely need to update their docs on how to do that (it's a common pain in RN testing story).

We can make it easier for users and maintainers by adding RNC modules to the `transformIgnorePatterns` whitelist we have in Jest preset. Some of them are not necessary to transpile, but I'd say it's a small sacrifice to make (having first test run possibly slower) for having less friction around migrating to extracted modules.

[General] [Added] - make Jest transform react-native-community/ packages by default
Pull Request resolved: https://github.com/facebook/react-native/pull/24294

Differential Revision: D14748962

Pulled By: cpojer

fbshipit-source-id: 36300ee021f03b8c13275a6e0cf28d988ee5beba
2019-04-08 23:21:52 +02:00
Michał PierzchałaandMike Grabowski dc25f209d7 chore: update Jest preset to align with Jest 24 (#24062)
Summary:
Jest 24 includes [`testMatch` and `moduleFileExtensions`](https://github.com/facebook/jest/blob/c5fd7aae93764c13c259ae9a73846c10e84ae2a3/packages/jest-config/src/Defaults.ts#L70) that align with the ones that are currently there on master, because it added default handling for TypeScript as well. I think it's time for us to move to Jest 24. Is there a way we can tell users to upgrade Jest to certain version?

Fixes https://github.com/facebook/react-native/issues/24060

[General] [Changed] - update Jest preset to align with Jest 24
Pull Request resolved: https://github.com/facebook/react-native/pull/24062

Differential Revision: D14538988

Pulled By: cpojer

fbshipit-source-id: d8d152b8e8517b34144970f1cc1ed0b49f8b4e54
2019-04-08 23:21:49 +02:00
James IdeandMike Grabowski 27872cf97c Remove react-clone-referenced-element dependency (#23933)
Summary:
This package was a dependency for ListView, which is no longer part of RN. Removed the dependency from package.json and yarn.lock.

Also removed its pattern from the Jest preset -- ListView is not in this repo and also react-clone-referenced-element was written at a time when Node did not support the same modern JS features as RN. The latest Node 8+ supports the features that react-clone-referenced-element uses so we don't need to transform it.

[General] [Removed] - Removed unused react-clone-referenced-element dependency
Pull Request resolved: https://github.com/facebook/react-native/pull/23933

Differential Revision: D14477240

Pulled By: cpojer

fbshipit-source-id: 4f6975133b54cc75088262cedd11da20225cada8
2019-04-08 23:21:38 +02:00
Sunny LuoandMike Grabowski d6bca9723e Prevent crash when setting underlineColorAndroid (#24183)
Summary:
Try to prevent the crash described in https://github.com/facebook/react-native/issues/17530

There seems to be a bug in `Drawable.mutate()` in some devices/android os versions even after you check the constant state. This error is hard to reproduce and to fix, so just try to catch the exception to prevent crash.

[Android][Fixed] Prevent random crash when setting underlineColorAndroid
Pull Request resolved: https://github.com/facebook/react-native/pull/24183

Differential Revision: D14710484

Pulled By: cpojer

fbshipit-source-id: 3af20a5cb0ecd40839beaf85118c0f5aa6905414
2019-04-08 23:18:33 +02:00
zhongwuzwandMike Grabowski 0167cf2813 Fix triangle views on iOS (#23402)
Summary:
Fixes #22824 #21945 , the bug comes from #21208 , it was to fix #11897. Now Let's constrain edge adjust only when view has corners.

[iOS] [Fixed] - Fix triangle views on iOS
Pull Request resolved: https://github.com/facebook/react-native/pull/23402

Differential Revision: D14059192

Pulled By: hramos

fbshipit-source-id: be613bf056d3cc484f281f7ea3d08f251971700a
2019-04-08 23:17:41 +02:00
PIYUSH GUPTAandMike Grabowski 05723ed08a fixed touchable longpress (#24238)
Summary:
This diff fixes a bug in TouchableNativeFeedback where a long press is not registered.

cause of the bug is _touchableHandleResponderMove_ being invoked **regardless** of a moving gesture ( even when movedDistance is 0) in some devices ( including OnePlus5t ), which was eventually clearing out  the long-press timeout.

fix is to prevent _touchableHandleResponderMove_ from Implementing if the state of touchable is RESPONDER_INACTIVE_PRESS_IN.

[General] [Fixed] - Touchable onLongPress fix.
Pull Request resolved: https://github.com/facebook/react-native/pull/24238

Reviewed By: cpojer

Differential Revision: D14712986

Pulled By: rickhanlonii

fbshipit-source-id: e85a66a7e8b61e0a33146b2472e2e055726a0e93
2019-04-08 23:16:42 +02:00
Ilja DaderkoandMike Grabowski 836a8e0e4d Fix universal links not working in iOS 12 / Xcode 10 (#22764)
Summary:
fix #22716

Changelog:
----------
[iOS][Fixed] - Fix universal links in iOS 12 / Xcode 10
Pull Request resolved: https://github.com/facebook/react-native/pull/22764

Differential Revision: D14576559

Pulled By: cpojer

fbshipit-source-id: 4ef727e1d9aa7646359b63468285fec1f8f1651b
2019-04-08 23:15:49 +02:00
Lorenzo Sciandra 3b91a7ec23 [0.59.3] Bump version numbers 2019-04-01 12:43:47 +01:00
Alfred ZienandLorenzo Sciandra df7ea67313 Use constructor attribute instead of +load objc method (#24155)
Summary:
Xcode 10.2 forbids creating categories for swift class that uses `+load` method. In react-native categories like this are used to register swift classes as modules (macro `RCT_EXTERN_MODULE`) This PR changes it to use `__attribute__((constructor))` instead of objc `+load` method.

I introduced new macro for this purpose, `RCT_EXPORT_MODULE_NO_LOAD`, it expands in something like:
```
void RCTRegisterModule(Class);

+ (NSString *)moduleName {
  return @"jsNameFoo";
}

__attribute__((constructor)) static void initialize_ObjcClassFoo{
  RCTRegisterModule([ObjcClassFoo class]);
}
```

Functions marked with `__attribute__((constructor))` are run before main and after all `+load` methods, so it seems like correct thing to do.

Fixes https://github.com/facebook/react-native/issues/24139
Doc about loading order https://developer.apple.com/documentation/objectivec/nsobject/1418815-load?language=objc

[iOS] [Fixed] - Fix runtime crash in xcode 10.2 when using RCT_EXTERN_MODULE for swift classes.
Pull Request resolved: https://github.com/facebook/react-native/pull/24155

Reviewed By: javache

Differential Revision: D14668235

Pulled By: shergin

fbshipit-source-id: 0c19e69ce2a68327387809773848d4ecd36d7461
2019-04-01 12:07:09 +01:00
michalchudziakandLorenzo Sciandra e94d3444dc Fix behaviour of Header, Footer and Empty List components in VirtualizedList when it's inverted (#24167)
Summary:
Fixes https://github.com/facebook/react-native/issues/23453
Fixes https://github.com/facebook/react-native/issues/21196

Basically, changes made in https://github.com/facebook/react-native/pull/21496 currently breaks behavior of `<VirtualizedList />`  and any components that are based on it (`<SectionList />, <FlatList />`). This PR solves both issues listed above.

Visual confirmation of the resolved issue:

**Vertical, not inverted, not empty**
![image](https://user-images.githubusercontent.com/7837457/55076839-b005d700-5096-11e9-91de-090934cb0129.png)

**Vertical, not inverted, empty**
![image](https://user-images.githubusercontent.com/7837457/55076971-fb1fea00-5096-11e9-8d73-5a2d86275da8.png)

**Vertical, inverted, not empty**
![image](https://user-images.githubusercontent.com/7837457/55077042-23a7e400-5097-11e9-911f-9dad4d48a578.png)

**Vertical, inverted, empty**
![image](https://user-images.githubusercontent.com/7837457/55079957-87351000-509d-11e9-8f1c-b7134f1f43f9.png)

**Horizontal, not inverted, not empty**
![image](https://user-images.githubusercontent.com/7837457/55077118-44703980-5097-11e9-94e9-e33d4af436ee.png)

**Horizontal, not inverted, empty**
![image](https://user-images.githubusercontent.com/7837457/55077150-52be5580-5097-11e9-9d43-7cb4e983167e.png)

**Horizontal, inverted, not empty**
![image](https://user-images.githubusercontent.com/7837457/55077183-623d9e80-5097-11e9-9e8a-1b2468c7b3a9.png)

**Horizontal, inverted, empty**
![image](https://user-images.githubusercontent.com/7837457/55080033-af247380-509d-11e9-90ae-1ff656d46dd1.png)

[General] [Fixed] - Fixed VirtualizedList, SectionList and FlatList behavior on rendering list headers with inverted prop and zero items
Pull Request resolved: https://github.com/facebook/react-native/pull/24167

Differential Revision: D14642345

Pulled By: cpojer

fbshipit-source-id: b530bbbd57f60e53a976ac5db272ea4b2d2b3e99
2019-03-29 15:20:20 +00:00
David VaccaandLorenzo Sciandra 13cb5a91ed Fix IllegalStateException when tapping next on Android Keyboard
Summary: This diff fixes an IllegalStateException that is thrown when the user click is on a edit text and tap 'Next' on the keyboard to focus on the next view, but the next view is hidden.

Reviewed By: lunaleaps, mmmulani

Differential Revision: D14598410

fbshipit-source-id: 2999cc468ed24bedff163eedcfaec50f6ee005d6
2019-03-29 15:19:30 +00:00
Mr. AnonymousandLorenzo Sciandra 775553b7da Update projectRoot in launchPackager.bat (#24115)
Summary:
`launchPackager.bat` starts metro server but does not pass projectRoot to it. So metro server starts in the wrong directory, It is because `startServerInNewWindow` pass `react-native` directory instead of `projectRoot` in the third argument of `spawn()` in `runAndroid.js`

Its working for people
See https://github.com/facebook/react-native/issues/23908#issuecomment-475889443

[Android] [Fixed] - projectRoot in launchPackager.bat
Pull Request resolved: https://github.com/facebook/react-native/pull/24115

Differential Revision: D14597101

Pulled By: cpojer

fbshipit-source-id: fb4155b72e35062cfb41fe1b3ecca0e2b4e849ce
2019-03-29 15:19:06 +00:00
Ali Akbar AziziandLorenzo Sciandra 581dc3ed21 Fix bat file (#23967)
Summary:
Add reactNativePath to cli.js

Add reactNativePath to cli.js

[GENERAL] [FIXED] - Internal - Update packagers to the latest CLI
Pull Request resolved: https://github.com/facebook/react-native/pull/23967

Differential Revision: D14502855

Pulled By: hramos

fbshipit-source-id: b9804e4fb364c004215227d938fe7101641f5b3c
2019-03-29 15:19:00 +00:00
zhongwuzwandLorenzo Sciandra 1a35bc5562 Fix TextInput maxLength when insert characters at begin (#23472)
Summary:
Fixes #21639 , seems we tried to fix this before, please see related `PR` like [D10392176](https://github.com/facebook/react-native/commit/36507e4a3c2fa58dcfdc9bd389b37536c66006d0), #18627, but they don't solve it totally.

[iOS] [Fixed] - Fix TextInput maxLength when insert characters at begin
Pull Request resolved: https://github.com/facebook/react-native/pull/23472

Reviewed By: mmmulani

Differential Revision: D14366406

Pulled By: ejanzer

fbshipit-source-id: fc983810703997b48824f84f2f9198984afba9cd
2019-03-29 15:16:14 +00:00
Lukas KuruczandLorenzo Sciandra bdf809e817 Fix PerfMonitor appearance when reloading JS (#24073)
Summary:
Fix for this issue I rasied: https://github.com/facebook/react-native/issues/24024
When I toggle `Show Perf Monitor` and reload JS `CMD+R` the Perf Monitor will be hidden, but settings in dev menu will persist. So to fix this state and need to `Hide Perf Monitor` and `Show Perf Monitor` again to see it.

[iOS] [Fixed] - Show Perf Monitor, after reloading JS
Pull Request resolved: https://github.com/facebook/react-native/pull/24073

Differential Revision: D14560025

Pulled By: cpojer

fbshipit-source-id: cd5602bd6ee041b8b3e61d163d10bd8bc47237b9
2019-03-29 15:15:05 +00:00
Sergei DryganetsandLorenzo Sciandra e4f9ee913b OkHttp is more strict than other http libraries. (#21231)
Summary:
It crashes with IllegalStateException in case you pass a wrong URL.
It crashes if it meets unexpected symbols in the header name and value,
while standard says it is not recommended to use those symbols not that
they are prohibited.

The headers handing is a special use case as a client might have an auth token in the header. In this case, we want to get 401 error response
from the server to find out that token is wrong. In case of the onerror
client will continue to retry with an existing token.

[ANDROID][Fixed] - Networking: Passing invalid URL not crashes the app instead onerror callback of HttpClient is called. Invalid symbols are stripped from the headers to allow HTTP query to fail with 401 error code in case of the broken token.

Pull Request resolved: https://github.com/facebook/react-native/pull/21231

Reviewed By: axe-fb

Differential Revision: D10222129

Pulled By: hramos

fbshipit-source-id: b23340692d0fb059a90e338fa85ad4d9612275f2
2019-03-29 15:14:57 +00:00
Bartol KaruzaandLorenzo Sciandra d7e7b3ef50 Fix #24053 prevent division by zero error in VirtualizedList debug overlay (#24058)
Summary:
This PR fixes the case where the content a VirtualizedList loads with a contentLength of 0,  causing a crash in the `renderDebugOverlay` function. The result of that crash is a red screen when turning on debug on FlatList and other VirtualizedList components as described in #24053.

[LIST] [FIX] - Fix VirtualizedList debug mode crash
Pull Request resolved: https://github.com/facebook/react-native/pull/24058

Differential Revision: D14538317

Pulled By: cpojer

fbshipit-source-id: 7b17bf51c388561c517bab1f775a31200abdc5a9
2019-03-29 15:14:45 +00:00
DulmandakhandLorenzo Sciandra 871290f33a improve RTL (#24069)
Summary:
Google recommends to use Gravity.START and Gravity.END instead of Gravity.LEFT and Gravity.RIGHT to support RTL better.

[Android] [Changed] - Improve RTL support
Pull Request resolved: https://github.com/facebook/react-native/pull/24069

Differential Revision: D14541569

Pulled By: cpojer

fbshipit-source-id: 5c104d8bd666e1270d5410216c7f2efa6152692a
2019-03-29 15:14:38 +00:00
Mike Grabowski 9bb5c32de9 [0.59.2] Bump version numbers 2019-03-25 22:22:14 +01:00
Mike Grabowski ad9eb8e935 Re-enable Text tests on iOS 2019-03-25 21:52:07 +01:00
Mike Grabowski 43d56c181c Update reference images for test_ios 2019-03-25 21:51:54 +01:00
zhongwuzwandMike Grabowski 0e8680f3d1 Fixed test_ios Switch test failed (#24009)
Summary:
In #23977 , it changed switch example, it leads snapshots test failed.

cc hramos .

[iOS] [Fixed] - Fixed test_ios Switch test failed
Pull Request resolved: https://github.com/facebook/react-native/pull/24009

Differential Revision: D14504806

Pulled By: cpojer

fbshipit-source-id: 0c47226a3da0cba2371c627f42f62835b3aac810
2019-03-25 17:04:22 +01:00
DulmandakhandMike Grabowski 3b06815272 allow HTTP in debug builds (#24066)
Summary:
It allows HTTP connections in debug builds, and requires no configuration compared to previous/current solution where you need to edit config file to test on device.

Consulted with Salakar about this.

[Android] [Changed] - Allow HTTP in debug builds
Pull Request resolved: https://github.com/facebook/react-native/pull/24066

Differential Revision: D14540255

Pulled By: cpojer

fbshipit-source-id: f1239154c27c36c21c9b080a826f8b1d0eb0fc7d
2019-03-25 16:51:49 +01:00
DulmandakhandMike Grabowski becc15468f fix switch trackColor on Android. fixes #23962 (#23977)
Summary:
fixes #23962, where trackColor is reset when value changed. This PR will set trackColor corresponding trackColor every-time value changes.

[Android] [Changed] - Fix Switch trackColor
Pull Request resolved: https://github.com/facebook/react-native/pull/23977

Differential Revision: D14495206

Pulled By: hramos

fbshipit-source-id: d712f540cd3f8359d6e85f79c12732689870a112
2019-03-22 18:27:23 +01:00
Emily JanzerandMike Grabowski 4260907b90 Pass through track color values for true/false to native component
Summary:
There's a bug in the OSS Switch component where the track color value is reset to the default value when the switch is toggled. It looks like the Java class resets the track color value in `setOn` (which fires in a press event): https://fburl.com/vmugfzja but these values aren't actually initialized from JS - in Switch.js we only pass through the current track color: https://fburl.com/vytekd0o.

The React component already has an API for defining both true/false track colors. However, we should also make sure not to reset these values for people using the old API of `tintColor`/`onTintColor`, so I'm changing it to only reset the value when both of those props are null.

Reviewed By: mdvacca

Differential Revision: D14035007

fbshipit-source-id: 12d968076bd47d54deedbfc15b12ff3cd77e2fd0
2019-03-22 18:27:21 +01:00
Matthieu LemoineandMike Grabowski 392b0845ce fix: Start Metro packager from project root (#24070)
Summary:
Fixes #23342.

Since Metro [v0.47](https://github.com/facebook/metro/releases/tag/v0.47.0), some babel plugins such as [babel-plugin-module-resolver](https://github.com/tleunen/babel-plugin-module-resolver) or [babel-plugin-import-graphql](https://github.com/detrohutt/babel-plugin-import-graphql) fail to resolve files if the packager is started through Xcode. They receive wrong filenames from Babel such as `${projectRoot}/node_modules/react-native/src/index.js` instead of `${projectRoot}/src/index.js`.

It happens because the start command of the local-cli is not executed in the projectRoot directory. In this case, the cwd will be `${projectRoot}/node_modules/react-native`.

This issue doesn't occur if you start the packager yourself using `node node_modules/react-native/local-cli/cli.js start` from your project root.

It comes from this [line](https://github.com/facebook/react-native/blob/b640b6faf77f7af955e64bd03ae630ce2fb09627/scripts/packager.sh#L11). This script changed the working directory to `${projectRoot}/node_modules/react-native` and started Metro from there.

Starting Metro from the project root fixes this issue.

[iOS] [Fixed] - Start Metro packager from project root
Pull Request resolved: https://github.com/facebook/react-native/pull/24070

Differential Revision: D14563996

Pulled By: cpojer

fbshipit-source-id: cdeff34610f1ebb5fb7bc82a96f4ac9eec750d16
2019-03-22 18:23:28 +01:00
zhongwuzwandMike Grabowski f6516d20ca Fix scrollview over bounds of content size (#23427)
Summary:
Fix scrollview `offset` out of content size in iOS, Android uses `scrollTo` and `smoothScrollTo` which not have this issue.

Fixes like #13594 #22768 #19970 .

[iOS] [Fixed] - Fixed scrollView offset out of content size.
Pull Request resolved: https://github.com/facebook/react-native/pull/23427

Differential Revision: D14162663

Pulled By: cpojer

fbshipit-source-id: a95371c8d703b6d5f604af0072f86c01c2018f4a
2019-03-22 18:22:45 +01:00
Danilo BürgerandMike Grabowski 699fad7d06 Fixed regression in SectionList caused by #21577 not being able to scroll to top on android (#24034)
Summary:
```
let index = params.itemIndex + 1;
```
to
```
let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex - 1;
```
to fix an issue on iOS. Note however, how the sign for non iOS changed from `+` to `-` causing a crash on Android when trying to scroll to index 0 as that will be evaluated to -1 instead of 1 and thus be out of bounds.

[Android] [Fixed] - Fixed regression in SectionList caused by #21577 not being able to scroll to top on android
Pull Request resolved: https://github.com/facebook/react-native/pull/24034

Differential Revision: D14520796

Pulled By: cpojer

fbshipit-source-id: bb49619f49752fd3f343ef3b7bf1b86ac48af7f8
2019-03-22 18:22:26 +01:00
DulmandakhandMike Grabowski fab86ee488 use Conscrypt as security provider if available (#23984)
Summary:
This PR adds support to use Conscrypt as Security Provider if available runtime. Consscrypt supports TLS 1.2 on Android 4.x and TLS 1.3 on all Android versions. Fixes issues (ex https://github.com/facebook/react-native/issues/23151) with HTTPS connections on Android 4.x.

Just add below to your project build.gradle and it'll use it.

```gradle
implementation('org.conscrypt:conscrypt-android:2.0.0')
```

[Android] [Changed] - Add TLS 1.3 support to all Android versions using Conscrypt.
Pull Request resolved: https://github.com/facebook/react-native/pull/23984

Differential Revision: D14506000

Pulled By: cpojer

fbshipit-source-id: 58bf18f7203d20519fb4451bae83f01e2f020a44
2019-03-22 18:21:44 +01:00
Peter ArganyandMike Grabowski a38dc732bb Revert of [D13948951]Apply the fix for CJK languages on single-line test fields.
Summary:
This PR (https://github.com/facebook/react-native/pull/22546) broke single line text inputs. After inputting some text and tapping away, the text input reverts back to default text.

Revert solved the issue.

Reviewed By: cpojer

Differential Revision: D14185897

fbshipit-source-id: cc7f0f2ebfb0494062afbc628c4fe27ad27fb1c6
2019-03-22 18:21:19 +01:00
Rostislav SimonikandMike Grabowski 6aca514b3a Add fix for refresh control state's race condition. (#21763)
Summary:
Fixes #21762
Pull Request resolved: https://github.com/facebook/react-native/pull/21763

Differential Revision: D14064621

Pulled By: cpojer

fbshipit-source-id: 63010248a46cb49ed17ed89d7c55945aa7b22973
2019-03-22 18:20:58 +01:00
Héctor RamosandMike Grabowski 7263a77b44 Do not use autofill methods on Android APIs older than Oreo (26)
Summary:
Autofill Hints were added in [Android API 26](https://developer.android.com/reference/android/view/View.html#setAutofillHints(java.lang.String...)). Without this runtime check, pre-26 devices will crash.

[Android][Fixed] - Fixes crash on pre-26 Android devices when setting text content type

Reviewed By: lunaleaps

Differential Revision: D14479468

fbshipit-source-id: 238c1efd6aea682a93ecb45e1123aaed6bdcd9e3
2019-03-22 18:20:25 +01:00
Peter ArganyandMike Grabowski 3f1d2b0f96 Turn off Metro JS Deltas by default for Android
Summary: JS Deltas have been killing productivity of RN engineers lately. There's been several posts and questions asked that end in "Turn off JS Deltas". Disabling them until we can make them more stable.

Reviewed By: fkgozali

Differential Revision: D14491774

fbshipit-source-id: 29b1c8e5e72369882c2890e3b6347ecd2fe4bed1
2019-03-22 18:19:51 +01:00
Mike Grabowski 60cf18fad4 [0.59.1] Bump version numbers 2019-03-14 12:12:02 +01:00
Mike Grabowski 4b996da470 [Android] Fixed template build gradle error on x86_64
See https://github.com/facebook/react-native/pull/23897
2019-03-13 17:57:25 +01:00
zhongwuzwandMike Grabowski 000119dea0 Fix build error warning of Text module (#23586)
Summary:
Throw error warning when build Text module, we can add tvOS available check to remove error.

[iOS] [Fixed] - Fix build error warning of Text module
Pull Request resolved: https://github.com/facebook/react-native/pull/23586

Differential Revision: D14181198

Pulled By: cpojer

fbshipit-source-id: 6a62c831ba119ddcbc6effa0b24f22bd4588b982
2019-03-13 17:52:46 +01:00
Mike Grabowski 7c73f2bb5a [0.59.0] Bump version numbers 2019-03-12 13:42:02 +01:00
Mike Grabowski fa190bab3f Fix flow error 2019-03-12 13:24:56 +01:00
Mike Grabowski 9f5946bdc2 Fix DatePicker tests 2019-03-12 13:11:02 +01:00
Vishwesh JainkuniyaandMike Grabowski f6ca4d0a96 Add prop to configure importantForAutofill. (#22763)
Summary:
In API 26, autofill framework was introduced in Android.
Read more about Autofill at https://developer.android.com/guide/topics/text/autofill.

Now, if in case for some text input if developer wants to disable
autofill then he can take help from this `importantForAutoFill` prop
and pass `no` to it.

Also important of auto fill can be configured with this prop, like:
* `auto`: Let the Android System use its heuristics to determine if the view is important for autofill.
* `no`: This view isn't important for autofill.
* `noExcludeDescendants`: This view and its children aren't important for autofill.
* `yes`: This view is important for autofill.
* `yesExcludeDescendants`: This view is important for autofill, but its children aren't important for autofill.

Default value if `auto`.

Read more at: https://developer.android.com/guide/topics/text/autofill-optimize

Changelog:
----------
[Android] [Added] - Add prop to configure `importantForAutofill` in `TextInput`.
Pull Request resolved: https://github.com/facebook/react-native/pull/22763

Differential Revision: D14121242

Pulled By: cpojer

fbshipit-source-id: aa4360480dd19f6dde66f0409d26a41a6a318c94
2019-03-12 06:43:00 +01:00
Mike Grabowski ffa6d2921a Disable Snapshot tests for Text component on iOS
One of the cherry-picks updates snapshot for Text component. We would need to cherry-pick
other few commits to make sure the code in this branch corresponds to the image provided.

Since re-generating an image takes a lot of time, I am going to skip running tests
for Text for now.
2019-03-11 21:51:10 +01:00
Tom DuncalfandMike Grabowski f0bc491452 Remove duplicated Yoga compile sources to prevent "duplicate symbols" errors when linking using -force_load (#23823)
Summary:
This change fixes https://github.com/facebook/react-native/issues/23645.

The issue is that the `YGMarker.cpp`, `YGValue.cpp`, `YGConfig.cpp` and `log.cpp` files are already included in the Yoga compilation unit, so including these files in React's compile sources too results in "duplicate symbols" errors when loading React Native with `-force_load` (which behaves slightly differently to `-ObjC` - according to a colleague, "ObjC will scan through each object file in each library and force linking of any object file that contains Objective C code, while force_load will link every object file in a particular staticlib (regardless of whether or not the object file contains Objective C code)").

These changes seemed to be introduced by a few commits:
- D13819111 -> https://github.com/facebook/react-native/commit/43601f1a1735c59c90a73ba2dc127ec4dcfa4fa6
- D13439602 -> https://github.com/facebook/react-native/commit/b5c66a3fbe869daf56b1b29d0a69efa2d83e30ce
- D14123390-> https://github.com/facebook/react-native/commit/e8f95dc7a1a630d9e90d3e044a0ccf6c9d76f651
- D7530369 -> https://github.com/facebook/react-native/commit/95f625e151c7abbb05efcd14404c8aa9583faa83

Perhaps we need to check with the original authors/any C++ experts to confirm if this fix is correct - it compiles for me but I'm not sure what the original intention of these changes was.

[iOS] [Fixed] - Remove duplicated Yoga compile sources to prevent "duplicate symbols" errors when linking using -force_load
Pull Request resolved: https://github.com/facebook/react-native/pull/23823

Reviewed By: davidaurelio

Differential Revision: D14387657

Pulled By: hramos

fbshipit-source-id: d85221b6dc1a0377662624f4201b27222aed8219
2019-03-11 21:22:37 +01:00
zhongwuzwandMike Grabowski 456a984722 Fix image wrong scale factor when load image from file system (#23446)
Summary:
Regression, fix image load from `~/Library` not respect scale factor.
Fixes #22383 , the bug comes from [Clean up some URL path handling](https://github.com/facebook/react-native/commit/998197f444aca06cde0d5258469b3d314f8ea8b9).

[iOS] [Fixed] - Fix image wrong scale factor when load image from file system
Pull Request resolved: https://github.com/facebook/react-native/pull/23446

Differential Revision: D14099614

Pulled By: cpojer

fbshipit-source-id: eb2267b195a05eb70cdc4671536a4c1d47fb03e2
2019-03-11 21:20:02 +01:00
Sunny LuoandMike Grabowski 8d95e734bb Text: Implement textAlign justify for android O+ (#22477)
Summary:
Add textAlign justify for android O+(api level >=26)
Resolves https://github.com/facebook/react-native/issues/22475

<img src="https://user-images.githubusercontent.com/615282/49341207-35e3b980-f685-11e8-91ab-dbc19c1ee4d0.gif" width="400" />

Changelog:
----------
[Android] [Added] - Implement textAlign justify for android O+
Pull Request resolved: https://github.com/facebook/react-native/pull/22477

Differential Revision: D13512004

Pulled By: cpojer

fbshipit-source-id: e20f4976bfd957a5faeae0bbed2ff27c03023bb1
2019-03-11 21:19:23 +01:00
ericlewisandMike Grabowski caba1cb2e1 Fix crash when calling substring() on a string containing emoji. (#23609)
Summary:
Fixes #23459. It is not legal to write the character array of a std::string, and can result in undefined behavior.

[General] [Fixed] - Crash when substring intersects with emoji
Pull Request resolved: https://github.com/facebook/react-native/pull/23609

Differential Revision: D14198159

Pulled By: mdvacca

fbshipit-source-id: 71060b1b99ddab89793c98c09f99ec9974479e62
2019-03-11 21:16:21 +01:00
Mike Grabowski 370947d2b2 Bump Jest version 2019-03-11 20:17:33 +01:00
Mike Grabowski 9cb4d3f2c1 [0.59.0-rc.3] Bump version numbers 2019-02-27 22:21:55 +01:00
Héctor RamosandMike Grabowski 52cdb7cf26 React sync for revisions f24a0da...8e25ed2
Summary:
This sync includes the following changes:

- **[8e25ed20b](https://github.com/facebook/react/commit/8e25ed20b )**: Unify noop and test renderer assertion APIs (#14952) //<Andrew Clark>//
- **[870214f37](https://github.com/facebook/react/commit/870214f37 )**: Deprecate ref.setNativeProps in favor of ReactNative.setNativeProps (#14912) //<Eli White>//
- **[3989c0950](https://github.com/facebook/react/commit/3989c0950 )**: eslint-plugin-react-hooks@1.3.0 //<Dan Abramov>//
- **[1bbfbc98d](https://github.com/facebook/react/commit/1bbfbc98d )**: [ESLint] Add more cases to exhaustive-deps rule (#14930) //<Dan Abramov>//
- **[412f88296](https://github.com/facebook/react/commit/412f88296 )**: fix(eslint-plugin-react-hooks): node engine updated to version 7 because of object.entries(#14951) //<Farhad Yasir>//
- **[ba708fa79](https://github.com/facebook/react/commit/ba708fa79 )**: Remove ReactNoop.flushDeferredPri and flushUnitsOfWork (#14934) //<Andrew Clark>//
- **[920b0bbb3](https://github.com/facebook/react/commit/920b0bbb3 )**: [scheduler] Pass didTimeout argument to callbacks (#14931) //<Andrew Clark>//
- **[f99fca3cb](https://github.com/facebook/react/commit/f99fca3cb )**: Fix sample ESLint configuration (#14926) //<Matt Thomson>//
- **[22bb94764](https://github.com/facebook/react/commit/22bb94764 )**: Release eslint-plugin-react-hooks@1.2.0 //<Dan Abramov>//
- **[a77bbf1a1](https://github.com/facebook/react/commit/a77bbf1a1 )**: [ESLint] Warn against assignments from inside Hooks (#14916) //<Dan Abramov>//
- **[219ce8a9c](https://github.com/facebook/react/commit/219ce8a9c )**: Fix tracing fixture (#14917) //<Dan Abramov>//
- **[8c1966590](https://github.com/facebook/react/commit/8c1966590 )**: Release 16.8.3 //<Dan Abramov>//
- **[7de4d2391](https://github.com/facebook/react/commit/7de4d2391 )**: Fix UMD builds by re-exporting the scheduler priorities (#14914) //<Dan Abramov>//
- **[d0318fb3f](https://github.com/facebook/react/commit/d0318fb3f )**: Updating copyright headers, dropping the year (#14893) //<Nathan Hunzaker>//
- **[f978d5fde](https://github.com/facebook/react/commit/f978d5fde )**: Fix warning message for new setNativeProps method. on -> with (#14909) //<Eli White>//
- **[b0f45c0fc](https://github.com/facebook/react/commit/b0f45c0fc )**: Adding ReactNative.setNativeProps that takes a ref (#14907) //<Eli White>//
- **[4f4aa69f1](https://github.com/facebook/react/commit/4f4aa69f1 )**: Adding setNativeProps tests for NativeMethodsMixin (#14901) //<Eli White>//
- **[b96b61dc4](https://github.com/facebook/react/commit/b96b61dc4 )**: Use the canonical nativeTag for Fabric's setNativeProps (#14900) //<Eli White>//
- **[dab2fdbbb](https://github.com/facebook/react/commit/dab2fdbbb )**: Add eslint-plugin-react-hooks/exhaustive-deps rule to check stale closure dependencies (#14636) //<Dan Abramov>//
- **[1493abd7e](https://github.com/facebook/react/commit/1493abd7e )**: Deleted empty App.css (#14149) //<Josh R>//
- **[13645d224](https://github.com/facebook/react/commit/13645d224 )**: Deal with fallback content in Partial Hydration (#14884) //<Sebastian Markbåge>//
- **[c506ded3b](https://github.com/facebook/react/commit/c506ded3b )**: Don't discard render phase state updates with the eager reducer optimization (#14852) //<Dan Abramov>//
- **[0e67969cb](https://github.com/facebook/react/commit/0e67969cb )**: Prompt to include UMD build artifact links in GitHub release (#14864) //<Brian Vaughn>//
- **[fad0842fd](https://github.com/facebook/react/commit/fad0842fd )**: Release scripts documentation (#14863) //<Brian Vaughn>//
- **[ab7a67b1d](https://github.com/facebook/react/commit/ab7a67b1d )**: Fix react-dom/server context leaks when render stream destroyed early (#14706) //<overlookmotel>//
- **[3e5556043](https://github.com/facebook/react/commit/3e5556043 )**: Release 16.8.2 //<Dan Abramov>//
- **[dfabb77a9](https://github.com/facebook/react/commit/dfabb77a9 )**: Include another change in 16.8.2 //<Dan Abramov>//
- **[c555c008b](https://github.com/facebook/react/commit/c555c008b )**: Include component stack in 'act(...)' warning (#14855) //<Sunil Pai>//
- **[ff188d666](https://github.com/facebook/react/commit/ff188d666 )**: Add React 16.8.2 changelog (#14851) //<Dan Abramov>//
- **[c4d8ef643](https://github.com/facebook/react/commit/c4d8ef643 )**: Fix typo in code comment (#14836) //<Deniz Susman>//
- **[08e955435](https://github.com/facebook/react/commit/08e955435 )**: Statically enable suspense/partial hydration flag in www (#14842) //<Sebastian Markbåge>//
- **[0e4135e8c](https://github.com/facebook/react/commit/0e4135e8c )**: Revert "[ShallowRenderer] Queue/rerender on dispatched action after render component with hooks (#14802)" (#14839) //<Dan Abramov>//
- **[6d4038f0a](https://github.com/facebook/react/commit/6d4038f0a )**: [ShallowRenderer] Queue/rerender on dispatched action after render component with hooks (#14802) //<Rodrigo Ribeiro>//
- **[fa6205d52](https://github.com/facebook/react/commit/fa6205d52 )**: Special case crossOrigin for SVG image elements (#14832) //<Brandon Dail>//
- **[c6bee765b](https://github.com/facebook/react/commit/c6bee765b )**: Remove false positive warning and add TODOs about `current` being non-null (#14821) //<DanAbramov>//
- **[3ae94e188](https://github.com/facebook/react/commit/3ae94e188 )**: Fix ignored sync work in passive effects (#14799) //<Dan Abramov>//
- **[f3a14951a](https://github.com/facebook/react/commit/f3a14951a )**: Partial Hydration (#14717) //<Sebastian Markbåge>//

Changelog:

[GENERAL] [Changed] React sync for revisions f24a0da...22bb947

Reviewed By: gaearon

Differential Revision: D14160361

fbshipit-source-id: fffdc922f3ee5dfeeee656a8f213a6d3c03e8481
2019-02-27 21:24:27 +01:00
Eric LewisandMike Grabowski c1392c2ff3 Toggle secureTextEntry cursor spacing (#23524)
Summary:
This is a fix for #5859, based on the feedback in #18587. Instead of using `didSetProps` it uses a setter. I will also note that setting to `nil` no longer works (crashes) so setting it to a blank string then back to the original works fine.

[iOS] [Fixed] - Toggling secureTextEntry correctly places cursor.
Pull Request resolved: https://github.com/facebook/react-native/pull/23524

Differential Revision: D14143028

Pulled By: cpojer

fbshipit-source-id: 5f3203d56b1329eb7359465f8ab50eb4f4fa5507
2019-02-27 21:22:31 +01:00
Wei YangandMike Grabowski 8e5eb6389f add talkback navigation support for links and header (#22447)
Summary:
1. add role description for heading
2. add talkback navigation support for link and header

Fixes #22440
Pull Request resolved: https://github.com/facebook/react-native/pull/22447

Differential Revision: D14205822

Pulled By: cpojer

fbshipit-source-id: 86bfc3bfc851f3544b1962012abaf8d1a357a9d2
2019-02-27 21:22:14 +01:00
Mike LambertandMike Grabowski 2b7346f4b3 Fix two bugs with Location when not using ACCESS_FINE_LOCATION (#10291)
Summary:
Fix two bugs with Location when not using ACCESS_FINE_LOCATION:
- If we request highAccuracy=false, because we don't have ACCESS_FINE_LOCATION, but we don't have access to the NETWORK_PROVIDER...then the code should not trigger a SecurityException because it fell-back to using GPS_PROVIDER (which we don't have permission for)
- If the device is pre-lollipop, and doesn't have a provider, we should detect this properly instead of letting the pre-lollipop code raise a SecurityException.

Unfortunately, SecurityExceptions cannot be caught by the calling JS code. But I am not fixing that one here, instead choosing to fix/obviate the SecurityExceptions altogether.
Pull Request resolved: https://github.com/facebook/react-native/pull/10291

Differential Revision: D4163659

Pulled By: cpojer

fbshipit-source-id: 18bb4ee7401bc4eac4fcc97341fc2b3a2a0957c9
2019-02-27 21:21:48 +01:00
Nate HunzakerandMike Grabowski d7c4c37f09 Use existing character set in POST body when possible (#23603)
Summary:
This commit fixes a bug introduced in a previous attempt (https://github.com/facebook/react-native/pull/23580) to address an issue where okhttp appended `charset=utf-8` to the Content-Type header when otherwise not specified.

In that commit, I converted all characters to UTF-8, however it should instead use an existing encoding when possible.

Related issues:
https://github.com/facebook/react-native/issues/8237#issuecomment-466304854

[Android][fixed] - Respect existing character set when specified in fetch() POST request
Pull Request resolved: https://github.com/facebook/react-native/pull/23603

Differential Revision: D14191750

Pulled By: hramos

fbshipit-source-id: 11c1bfd98ccd33cd8e54ea426285b7d2ce9c2d7c
2019-02-27 21:21:39 +01:00
Nate HunzakerandMike Grabowski 4cad737315 Prevent okhttp from adding ;charset=utf8 to ContentType Header (#23580)
Summary:
Before this commit, `fetch()` calls append `"charset=utf8"` to the `Content-Type` header on Android (and not on iOS). This is because of an implementation detail in the okhttp library. This means that you can make a call on the JavaScript side like:

```javascript
let body = JSON.stringify({ key: "value" });

let headers = {
  "Content-Type": "application/json"
};

fetch("http://10.0.2.2:3000", { method: "POST", body, headers });
```

However the resulting request appends the utf8 character:

```
POST - 13:34:32:
  content-type: application/json; charset=utf-8
  content-length: 15
  host: 10.0.2.2:3000
  connection: Keep-Alive
  accept-encoding: gzip
  user-agent: okhttp/3.12.1
```

Passing byte array into the RequestBody avoids this, as recommended by a maintainer of okhttp:

https://github.com/square/okhttp/issues/2099#issuecomment-366757161

Related issues:
https://github.com/facebook/react-native/issues/8237

[Android][fixed] - Prevent fetch() POST requests on Android from appending `charset=utf-8` to `Content-Type` header.
Pull Request resolved: https://github.com/facebook/react-native/pull/23580

Differential Revision: D14180849

Pulled By: cpojer

fbshipit-source-id: b84cadf83361331a9f64d1ff5f2e6399a55527a6
2019-02-27 21:21:34 +01:00
David VaccaandMike Grabowski fee5031748 Fix IllegalArgumentException when creating CookieManager
Summary:
This prevents this https://bugs.chromium.org/p/chromium/issues/detail?id=559720 to crash the app.
When using this fix the webView will not function correctly

More details about the bug https://bugs.chromium.org/p/chromium/issues/detail?id=559720

Reviewed By: fkgozali

Differential Revision: D14181851

fbshipit-source-id: 5a8c149df82a7373fe8b5b32006f034868532485
2019-02-27 21:21:25 +01:00
DulmandakhandMike Grabowski fbf039b126 add nullable annotations to some ViewManager methods (#23610)
Summary:
Add nullable annotations to BaseViewManager and ViewManager methods. This will improve Kotlin developer experience and help Android Studio to offer better autocomplete.

[Android] [Changed] - add nullable annotations to BaseViewManager and ViewManager methods. Might break ViewManagers in Kotlin.
Pull Request resolved: https://github.com/facebook/react-native/pull/23610

Differential Revision: D14198630

Pulled By: mdvacca

fbshipit-source-id: c596c88254e1d02f0af233a466f685200fac8917
2019-02-27 21:16:10 +01:00
Mikael SandandMike Grabowski f9097017de Don't reconnect inspector if connection refused (#22625)
Summary:
(Together with a pr to react-devtools) Fixes https://github.com/facebook/react-native/issues/21030

[iOS] [Fixed] - Fix infinite retry loop of inspector
Pull Request resolved: https://github.com/facebook/react-native/pull/22625

Differential Revision: D14169392

Pulled By: hramos

fbshipit-source-id: 2e301fd9d458598b62399fc61a9859ad29928483
2019-02-27 21:15:46 +01:00
DulmandakhandMike Grabowski 52e51368eb ReactTextView extends AppCompatTextView (#23321)
Summary:
Google recommends to use AppCompat widgets, and this PR changes ReactTextView to extend AppCompatTextView.

[Android] [Changed] - ReactTextView extends AppCompatTextView
Pull Request resolved: https://github.com/facebook/react-native/pull/23321

Differential Revision: D13986149

Pulled By: cpojer

fbshipit-source-id: 878849fff12dc5478bb0d0952b2c22695391e81a
2019-02-27 21:15:20 +01:00
DulmandakhandMike Grabowski 56fc630368 SYSTEM_ALERT_WINDOW only in debug builds (#23504)
Summary:
SYSTEM_ALERT_WINDOW permission is used only for debug builds to show draw overlay views or show warnings/errors. This permissions is unused in release builds, and there is an issue regarding removing unused permissions on Android build https://github.com/facebook/react-native/issues/5886#issuecomment-464495388. This PR removes SYSTEM_ALERT_WINDOW from all builds bug debug.

[Android] [Changed] - SYSTEM_ALERT_WINDOW permissions available only in debug builds
Pull Request resolved: https://github.com/facebook/react-native/pull/23504

Differential Revision: D14123045

Pulled By: cpojer

fbshipit-source-id: 68829a774ff23c7cb2721076a9d3870405f48fea
2019-02-27 21:14:41 +01:00
Levi BuzolicandMike Grabowski dff3f609f4 Map TextInput textContentType strings to Objective-C constants (#22611)
Summary:
This is an updated version of #22579 which uses compile conditionals to prevent `use of undeclared identifier` errors when compiling on older versions of Xcode.

--------

Currently the only `textContentType` values that work are: `username`, `password`, `location`, `name` and `nickname`. This is due to the strings provided by React Native not matching up with the underlying string constants used in iOS (with the exception of the aforementioned types). Issue #22578 has more detail examples/explanation.
Pull Request resolved: https://github.com/facebook/react-native/pull/22611

Differential Revision: D13460949

Pulled By: cpojer

fbshipit-source-id: e6d1108422b850ebc3aea05693ed05118b77b5de
2019-02-27 21:14:20 +01:00
Mike Grabowski 40603bc9c4 [0.59.0-rc.2] Bump version numbers 2019-02-18 18:04:25 +01:00
Michael DiarmidandMike Grabowski 415cc25788 Add folly_compiler_flags to Core subspec (#23488)
Summary:
This fixes the following iOS build error when using React via pods (using the new Xcode build system);

> project/Pods/Folly/folly/portability/Config.h:20:10: 'folly/folly-config.h' file not found

https://github.com/react-native-community/react-native-releases/issues/79#issuecomment-463628317
https://github.com/react-native-community/react-native-releases/issues/79#issuecomment-463675118
https://github.com/react-native-community/react-native-releases/issues/79#issuecomment-464117823

[iOS] [Fixed] - Fixed a "'folly/folly-config.h' file not found" build error when using React via CocoaPods
Pull Request resolved: https://github.com/facebook/react-native/pull/23488

Differential Revision: D14121296

Pulled By: cpojer

fbshipit-source-id: 5eb2ba3066aef2bc9cfb95a9172cbef921c47170
2019-02-18 17:31:23 +01:00
Cassio ZenandMike Grabowski 179d490607 Add autoComplete prop (#21575)
Summary:
TL;DR: Setting `autoComplete` will allow the system to suggest autofill options for the `<TextInput>` component.

Android Oreo introduced the AutoFill Framework, for secure communication between an app and autofill services (e.g. Password managers). When using `<TextInput>` on Android Oreo+, the system already tries to autofill (based on heuristics), but there is no way to set configuring options or disable.

The quick solution would be to just add the same Android attributes (`autofillHints` & `importantForAutofill`) in React Native TextInput, but that doesn't bond well with the cross-platform nature of the library.

Introduces an `autoComplete` prop based on HTML's `autocomplete` attribute, mapping to Android `autofillHints` & `importantForAutofill` and serving as a proper placeholder for autofill/autocomplete in other platforms:

Also gives you the ability to disable autofill by setting autocomplete="off".
Pull Request resolved: https://github.com/facebook/react-native/pull/21575

Differential Revision: D14102949

Pulled By: hramos

fbshipit-source-id: 7601aeaca0332a1f3ce8da8020dba037b700853a
2019-02-18 17:30:38 +01:00
Kevin GozaliandMike Grabowski 2f33b50f4f Don't attempt to load RCTDevLoadingView lazily
Summary:
There's a very old issue with reload logic: invalidation and resetting up of the bridge could be racing. In this case, we hit a redbox when:
* Chrome debugger is enabled in previous app run, then we launch the app again
* The bridge starts, then immediately reloads itself to connect to Chrome
* On the 2nd setup, the logic to update the green loading bar, with the % indicator for loading off metro, failed to find the DevLoadingView module instance because the bridge is in the middle of invalidating

See https://github.com/facebook/react-native/issues/23235

To test:
Using react-native init from github, do the steps in https://github.com/facebook/react-native/issues/23235, no more redbox. Note that the loading indicator % won't be proper still, but at least it doesn't crash/redbox.

Reviewed By: JoshuaGross

Differential Revision: D14110814

fbshipit-source-id: 835061e50acc6968bffbcc2ddfbe8da79a100df9
2019-02-18 14:50:35 +01:00
Mike Grabowski 1768655971 [0.59.0-rc.1] Bump version numbers 2019-02-15 16:38:54 +01:00
Mike Grabowski 7df6416180 Invalidate Gradle cache 2019-02-15 16:18:14 +01:00
Mike Grabowski a7906b0d16 Invalidate Buck cache 2019-02-15 16:03:35 +01:00
Mike Grabowski 171c24d9d1 Invalidate Yarn cache 2019-02-15 15:52:29 +01:00
Mike Grabowski 72f44a2731 Merge branch '0.59-stable' of github.com:facebook/react-native into 0.59-stable 2019-02-15 15:38:21 +01:00
DulmandakhandMike Grabowski 51a7ad55ac bump android plugin to 3.3.1 (#23473)
Summary:
Bump Android Plugin to 3.3.1, with many bug fixes and performance improvements. Split the change from https://github.com/facebook/react-native/pull/23324 to make cherry-pick easy to 0.59 branch.

[Android] [Changed] - bump Android Plugin to 3.3.1
Pull Request resolved: https://github.com/facebook/react-native/pull/23473

Differential Revision: D14099741

Pulled By: cpojer

fbshipit-source-id: 7491c49cd2467f1bb8776345bdda2ab9cea11c06
2019-02-15 15:36:20 +01:00
DulmandakhandMike Grabowski 01d5a3bccf react_native_config available to all Android versions (#23470)
Summary:
Move react_native_config.xml so that it's available to all Android versions, and fixes https://github.com/facebook/react-native/issues/23445. It's my bad, I should've tested previous change on multiple versions of Android.

[Android] [Changed] - Fix network security
Pull Request resolved: https://github.com/facebook/react-native/pull/23470

Differential Revision: D14099612

Pulled By: cpojer

fbshipit-source-id: 15b5e5f575de8033bbfd524d9ad2aa0e22daa813
2019-02-15 15:36:10 +01:00
Mike Grabowski 560a484fc6 Revert "[0.59.0-rc.1] Bump version numbers"
This reverts commit 199de26f42.
2019-02-15 15:36:00 +01:00
Héctor Ramos 99ebebdee6 Revert "Use current user in cache key"
This reverts commit c532dfd237.
2019-02-14 13:26:56 -08:00
Héctor Ramos 85a2e7146e Revert "Fix id command"
This reverts commit ad279eef3d.
2019-02-14 13:26:48 -08:00
Héctor Ramos ad279eef3d Fix id command 2019-02-14 13:23:02 -08:00
Héctor Ramos c532dfd237 Use current user in cache key 2019-02-14 13:15:18 -08:00
Héctor Ramos ce046f0b10 Individually accept licenses 2019-02-14 12:52:23 -08:00
Héctor Ramos dcb7e5c2a1 Auto-accept licenses and unblock CI 2019-02-14 10:15:06 -08:00
Mike Grabowski 199de26f42 [0.59.0-rc.1] Bump version numbers 2019-02-14 10:12:20 +01:00
Mike Grabowski 4cb1646703 fix: bring local-cli back 2019-02-14 10:12:10 +01:00
Alejandro RuperezandMike Grabowski 11c12d522a Resolves #23390: cxxreact, jsi and jsiexecutor depends on DoubleConversion and glog. (#23430)
Summary:
Resolves #23390: **cxxreact**, **jsi** and **jsiexecutor** depends on **DoubleConversion** and **glog**.

This cause:
```
Undefined symbols for architecture x86_64:
  "google::LogMessage::LogMessage(char const*, int, int)", referenced from:
      std::__1::__function::__func<facebook::react::CxxNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_1, std::__1::allocator<facebook::react::CxxNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_1>, void ()>::operator()() in CxxNativeModule.o
      std::__1::__function::__func<facebook::react::NativeToJsBridge::callFunction(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, folly::dynamic&&)::$_1, std::__1::allocator<facebook::react::NativeToJsBridge::callFunction(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, folly::dynamic&&)::$_1>, void (facebook::react::JSExecutor*)>::operator()(facebook::react::JSExecutor*&&) in NativeToJsBridge.o
      std::__1::__function::__func<facebook::react::NativeToJsBridge::invokeCallback(double, folly::dynamic&&)::$_2, std::__1::allocator<facebook::react::NativeToJsBridge::invokeCallback(double, folly::dynamic&&)::$_2>, void (facebook::react::JSExecutor*)>::operator()(facebook::react::JSExecutor*&&) in NativeToJsBridge.o
  "double_conversion::DoubleToStringConverter::ToShortestIeeeNumber(double, double_conversion::StringBuilder*, double_conversion::DoubleToStringConverter::DtoaMode) const", referenced from:
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in CxxNativeModule.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in JSIDynamic.o
      double_conversion::DoubleToStringConverter::ToShortest(double, double_conversion::StringBuilder*) const in JSIDynamic.o
      double_conversion::DoubleToStringConverter::ToShortestSingle(float, double_conversion::StringBuilder*) const in JSIDynamic.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in JSIExecutor.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in MethodCall.o
  "double_conversion::DoubleToStringConverter::ToFixed(double, int, double_conversion::StringBuilder*) const", referenced from:
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in CxxNativeModule.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in JSIDynamic.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in JSIExecutor.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in MethodCall.o
  "google::LogMessageFatal::LogMessageFatal(char const*, int)", referenced from:
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in CxxNativeModule.o
      facebook::react::Instance::initializeBridge(std::__1::unique_ptr<facebook::react::InstanceCallback, std::__1::default_delete<facebook::react::InstanceCallback> >, std::__1::shared_ptr<facebook::react::JSExecutorFactory>, std::__1::shared_ptr<facebook::react::MessageQueueThread>, std::__1::shared_ptr<facebook::react::ModuleRegistry>) in Instance.o
      folly::detail::ScopeGuardImpl<facebook::react::JSBigFileString::fromPath(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0, true>::~ScopeGuardImpl() in JSBigString.o
      facebook::react::JSBigFileString::c_str() const in JSBigString.o
      facebook::jsi::valueFromDynamic(facebook::jsi::Runtime&, folly::dynamic const&) in JSIDynamic.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in JSIDynamic.o
      facebook::react::JSIExecutor::callNativeModules(facebook::jsi::Value const&, bool) in JSIExecutor.o
      ...
  "double_conversion::DoubleToStringConverter::ToPrecision(double, int, double_conversion::StringBuilder*) const", referenced from:
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in CxxNativeModule.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in JSIDynamic.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in JSIExecutor.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in MethodCall.o
  "google::LogMessage::stream()", referenced from:
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in CxxNativeModule.o
      std::__1::__function::__func<facebook::react::CxxNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_1, std::__1::allocator<facebook::react::CxxNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_1>, void ()>::operator()() in CxxNativeModule.o
      facebook::react::Instance::initializeBridge(std::__1::unique_ptr<facebook::react::InstanceCallback, std::__1::default_delete<facebook::react::InstanceCallback> >, std::__1::shared_ptr<facebook::react::JSExecutorFactory>, std::__1::shared_ptr<facebook::react::MessageQueueThread>, std::__1::shared_ptr<facebook::react::ModuleRegistry>) in Instance.o
      folly::detail::ScopeGuardImpl<facebook::react::JSBigFileString::fromPath(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0, true>::~ScopeGuardImpl() in JSBigString.o
      facebook::react::JSBigFileString::c_str() const in JSBigString.o
      facebook::jsi::valueFromDynamic(facebook::jsi::Runtime&, folly::dynamic const&) in JSIDynamic.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in JSIDynamic.o
      ...
  "google::LogMessage::~LogMessage()", referenced from:
      std::__1::__function::__func<facebook::react::CxxNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_1, std::__1::allocator<facebook::react::CxxNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_1>, void ()>::operator()() in CxxNativeModule.o
      std::__1::__function::__func<facebook::react::NativeToJsBridge::callFunction(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, folly::dynamic&&)::$_1, std::__1::allocator<facebook::react::NativeToJsBridge::callFunction(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, folly::dynamic&&)::$_1>, void (facebook::react::JSExecutor*)>::operator()(facebook::react::JSExecutor*&&) in NativeToJsBridge.o
      std::__1::__function::__func<facebook::react::NativeToJsBridge::invokeCallback(double, folly::dynamic&&)::$_2, std::__1::allocator<facebook::react::NativeToJsBridge::invokeCallback(double, folly::dynamic&&)::$_2>, void (facebook::react::JSExecutor*)>::operator()(facebook::react::JSExecutor*&&) in NativeToJsBridge.o
  "google::LogMessageFatal::~LogMessageFatal()", referenced from:
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in CxxNativeModule.o
      facebook::react::Instance::initializeBridge(std::__1::unique_ptr<facebook::react::InstanceCallback, std::__1::default_delete<facebook::react::InstanceCallback> >, std::__1::shared_ptr<facebook::react::JSExecutorFactory>, std::__1::shared_ptr<facebook::react::MessageQueueThread>, std::__1::shared_ptr<facebook::react::ModuleRegistry>) in Instance.o
      folly::detail::ScopeGuardImpl<facebook::react::JSBigFileString::fromPath(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0, true>::~ScopeGuardImpl() in JSBigString.o
      facebook::react::JSBigFileString::c_str() const in JSBigString.o
      facebook::jsi::valueFromDynamic(facebook::jsi::Runtime&, folly::dynamic const&) in JSIDynamic.o
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in JSIDynamic.o
      facebook::react::JSIExecutor::callNativeModules(facebook::jsi::Value const&, bool) in JSIExecutor.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

[iOS] [Fixed] - Added `DoubleConversion` and `glog` to `cxxreact`, `jsi` and `jsiexecutor` subspecs in `React.podspec` file.

The goal of this PR is to have no need to fix #23390 by manually adding **DoubleConversion** and **glog** to _Link Binary With Libraries_ of **React** framework target in cocoapods project.

![captura de pantalla 2019-02-12 a las 17 12 05](https://user-images.githubusercontent.com/297950/52650102-deb25e80-2ee9-11e9-9595-f7fbd4730671.png)
Pull Request resolved: https://github.com/facebook/react-native/pull/23430

Differential Revision: D14065309

Pulled By: cpojer

fbshipit-source-id: 4318c3770c54087f198856c983f7cb73ff30000f
2019-02-14 10:05:53 +01:00
Héctor Ramos 5a314690f2 [0.59.0-rc.0] Bump version numbers 2019-02-13 12:14:47 -08:00
Héctor Ramos 51b66c02f3 Do not use cache during release deploy 2019-02-13 12:14:14 -08:00
Héctor Ramos 2bc055a227 Revert "[0.59.0-rc.0] Bump version numbers"
This reverts commit af6de4e8c8.
2019-02-13 12:13:49 -08:00
Héctor Ramos af6de4e8c8 [0.59.0-rc.0] Bump version numbers 2019-02-13 12:03:09 -08:00
Héctor Ramos b2f5e451cf Revert to prior Circle CI Android config
The new Docker image lacks git and is blocking the 0.59 release
2019-02-13 11:59:26 -08:00
Héctor Ramos cef5ad6964 Revert "[0.59.0-rc.0] Bump version numbers"
This reverts commit 517c165dae.
2019-02-13 11:52:49 -08:00
Mike Grabowski 517c165dae [0.59.0-rc.0] Bump version numbers 2019-02-13 20:15:31 +01:00
Mike Grabowski 8b75677fdb Revert "[0.59.0-rc.0] Bump version numbers"
This reverts commit d47aa28ef7.
2019-02-13 20:15:00 +01:00
Mike Grabowski d47aa28ef7 [0.59.0-rc.0] Bump version numbers 2019-02-13 18:04:43 +01:00
Mike Grabowski aca5f05ffe Set ReactNativePath while building RNTester 2019-02-13 17:40:06 +01:00
Mike Grabowski 7f5e04443f Fix Android Gradle build 2019-02-13 17:33:10 +01:00
DulmandakhandMike Grabowski 724d83a966 improve Android Network Security config (#23429)
Summary:
This PR is trying to improve Android Network Security configuration introduced in https://github.com/facebook/react-native/commit/84572c4051f11f68ddf0928d2c3df5850ae15491. I found that Android merges all manifest files into a single manifest file when building an app, so this PR provides AndroidManifest.xml with network security config in debug folder, that will be used only for debug builds. Also the network security configuration will be applied to only app that target API 28. Moved security config file to xml-v28, so that it'll only visible to API 28 and above.

See https://developer.android.com/studio/build/manifest-merge

[Android] [Changed] -  Android Network Security configuration.
Pull Request resolved: https://github.com/facebook/react-native/pull/23429

Differential Revision: D14065124

Pulled By: cpojer

fbshipit-source-id: 0f5ac5addbe968ed7e5cb57f356e2572de2690a8
2019-02-13 17:12:28 +01:00
DulmandakhandMike Grabowski e6d8ac8424 @Nonnull annotation for ReactPackage (#23415)
Summary:
Here are some leftovers from nullable annotations for native modules, discovered while developing native module in Kotlin. This will help improve Kotlin developer experience

[Android] [Changed] - Add Nonnull annotations to ReactPackage
Pull Request resolved: https://github.com/facebook/react-native/pull/23415

Differential Revision: D14064607

Pulled By: cpojer

fbshipit-source-id: af2ce1fc1911ee03c54b20a4fc3a6d1aba9267da
2019-02-13 17:12:21 +01:00
DulmandakhandMike Grabowski 818f6bb248 bump targetSdkVersion to 28 (#23431)
Summary:
Bump targetSdkVersion to 28

[Android] [Changed] - Bump targetSdkVersion to 28
Pull Request resolved: https://github.com/facebook/react-native/pull/23431

Differential Revision: D14065177

Pulled By: cpojer

fbshipit-source-id: a161d1d385b7b40ec93d70851e5a41baeb58f830
2019-02-13 17:12:08 +01:00
Mike Grabowski d37ffc3cfd Fix React Native calling CLI wo location 2019-02-13 17:10:41 +01:00
Mike Grabowski a962cb659f Revert "[0.59.0-rc.0] Bump version numbers"
This reverts commit d059e74704.
2019-02-13 17:10:19 +01:00
Mike Grabowski d059e74704 [0.59.0-rc.0] Bump version numbers 2019-02-13 16:47:58 +01:00
Mike Grabowski 1f099672be Fix React Native calling private CLI APIs 2019-02-13 16:47:52 +01:00
Mike Grabowski 9f96606d32 Revert "[0.59.0-rc.0] Bump version numbers"
This reverts commit 69e5c2ddc1.
2019-02-13 16:47:27 +01:00
Mike Grabowski 69e5c2ddc1 [0.59.0-rc.0] Bump version numbers 2019-02-13 16:37:12 +01:00
Mike Grabowski 977458442c Revert "add basic signature in template (#22665)"
This reverts commit 63ebbd6bfc.
2019-02-13 16:35:06 +01:00
Mike Grabowski a252aee2ea Bump CLI dependency 2019-02-13 16:35:02 +01:00
Mike Grabowski 06bc4b5b7c Explicitly set path to React Native for development 2019-02-13 15:23:30 +01:00
Mike Grabowski 5e1504b0fc Update CLI dependency 2019-02-13 15:21:28 +01:00
130 changed files with 4234 additions and 1704 deletions
+101 -24
View File
@@ -2,12 +2,12 @@ aliases:
# Cache Management
- &restore-yarn-cache
keys:
- v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}
- v1-yarn-cache-{{ arch }}
- v2-yarn-cache-{{ arch }}-{{ checksum "package.json" }}
- v2-yarn-cache-{{ arch }}
- &save-yarn-cache
paths:
- ~/.cache/yarn
key: v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}
key: v2-yarn-cache-{{ arch }}-{{ checksum "package.json" }}
- &restore-node-modules
keys:
@@ -26,28 +26,44 @@ aliases:
- node_modules
key: v1-analysis-dependencies-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}
- &restore-cache-android-packages
keys:
- v1-android-sdkmanager-packages-api-28-alpha-{{ checksum "scripts/.tests.env" }}
- &save-cache-android-packages
paths:
- /opt/android/sdk
key: v1-android-sdkmanager-packages-api-28-alpha-{{ checksum "scripts/.tests.env" }}
- &restore-cache-gradle
keys:
- v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
- v2-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
# Fallback in case checksum fails
- v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-
- v1-gradle-{{ .Branch }}-
- v2-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-
- v2-gradle-{{ .Branch }}-
# Fallback in case this is a first-time run on a fork
- v1-gradle-master-
- v2-gradle-master-
- &save-cache-gradle
paths:
- ~/.gradle
key: v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
key: v2-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
- &restore-cache-ndk
keys:
- v3-android-ndk-r17c-{{ checksum "scripts/android-setup.sh" }}
- &save-cache-ndk
paths:
- /opt/ndk
key: v3-android-ndk-r17c-{{ checksum "scripts/android-setup.sh" }}
- &restore-cache-downloads-buck
keys:
- v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}}
- v3-buck-v2019.01.10.01-
- v4-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}}
- v4-buck-v2019.01.10.01-
- &save-cache-downloads-buck
paths:
- ~/buck
- ~/okbuck
key: v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}
key: v4-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}
- &restore-cache-watchman
keys:
@@ -59,14 +75,14 @@ aliases:
- &restore-cache-downloads-gradle
keys:
- v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
- v1-gradle-
- v2-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
- v2-gradle-
- &save-cache-downloads-gradle
paths:
- ~/.gradle
- ReactAndroid/build/downloads
- ReactAndroid/build/third-party-ndk
key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
key: v2-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
- &restore-cache-homebrew
keys:
@@ -99,6 +115,11 @@ aliases:
- /.*-stable/
- gh-pages
# Dependency Management
- &install-ndk
name: Install Android NDK
command: source scripts/android-setup.sh && getAndroidNDK
- &yarn
name: Run Yarn
command: |
@@ -108,9 +129,20 @@ aliases:
yarn install --non-interactive --cache-folder ~/.cache/yarn
fi
- &install-yarn
name: Install Yarn
command: |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
- &install-buck
name: Install BUCK
command: |
if [[ ! -e ~/buck ]]; then
git clone https://github.com/facebook/buck.git ~/buck --branch v2019.01.10.01 --depth=1
fi
cd ~/buck && ant
buck --version
# Install related tooling
if [[ ! -e ~/okbuck ]]; then
@@ -118,6 +150,30 @@ aliases:
fi
mkdir -p ~/react-native/tooling/junit
cp -R ~/okbuck/tooling/junit/* ~/react-native/tooling/junit/.
- &create-ndk-directory
name: Create Android NDK Directory
command: |
if [[ ! -e /opt/ndk ]]; then
sudo mkdir /opt/ndk
fi
sudo chown ${USER:=$(/usr/bin/id -run)}:$USER /opt/ndk
# CircleCI does not support interpolating env variables in the environment
# https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
- &configure-android-path
name: Configure Environment Variables
command: |
echo 'export PATH=${ANDROID_NDK}:~/buck/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
- &install-android-packages
name: Install Android SDK Packages
command: source scripts/android-setup.sh && getAndroidPackages
- &install-android-build-dependencies
name: Install Android Build Dependencies
command: ./scripts/circleci/apt-get-android-deps.sh
- &validate-android-sdk
name: Validate Android SDK Install
command: ./scripts/validate-android-sdk.sh
@@ -187,7 +243,7 @@ aliases:
- &build-js-bundle
name: Build JavaScript Bundle
command: node cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
command: node cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js --reactNativePath .
- &compile-native-libs
name: Compile Native Libs for Unit and Integration Tests
@@ -208,7 +264,7 @@ aliases:
- &build-android-rntester-app
name: Build Android RNTester App
command: ./gradlew RNTester:android:app:assembleRelease
command: ./gradlew RNTester:android:app:assembleRelease -Pjobs=$BUILD_THREADS
- &collect-android-test-results
name: Collect Test Results
@@ -283,13 +339,14 @@ js_defaults: &js_defaults
android_defaults: &android_defaults
<<: *defaults
docker:
- image: reactnativecommunity/react-native-android
- image: circleci/android:api-28-node8-alpha
resource_class: "large"
environment:
- TERM: "dumb"
- ADB_INSTALL_TIMEOUT: 10
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
- GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
- ANDROID_NDK: '/opt/ndk/android-ndk-r17c'
- BUILD_THREADS: 2
macos_defaults: &macos_defaults
@@ -415,6 +472,15 @@ jobs:
- attach_workspace:
at: ~/react-native
# Configure Android SDK and related dependencies
- run: *configure-android-path
# Android build deps install from the network faster than cache
- run: *install-android-build-dependencies
- restore-cache: *restore-cache-android-packages
- run: *install-android-packages
- save-cache: *save-cache-android-packages
# Validate Android SDK installation and packages
- run: *validate-android-sdk
@@ -424,6 +490,12 @@ jobs:
# Keep configuring Android dependencies while AVD boots up
# Install Android NDK
- run: *create-ndk-directory
- restore-cache: *restore-cache-ndk
- run: *install-ndk
- save-cache: *save-cache-ndk
# Install Buck
- restore-cache: *restore-cache-downloads-buck
- run: *install-buck
@@ -547,21 +619,26 @@ jobs:
<<: *android_defaults
steps:
- checkout
- restore-cache: *restore-yarn-cache
- run: *yarn
# Configure Android SDK and related dependencies
- run: *configure-android-path
- run: *install-android-build-dependencies
- run: *install-android-packages
# Install Android NDK
- run: *create-ndk-directory
- restore-cache: *restore-cache-ndk
- run: *install-ndk
# Fetch dependencies using Buck
- restore-cache: *restore-cache-downloads-buck
- run: *install-buck
- run: *download-dependencies-buck
# Fetch dependencies using Gradle
- restore-cache: *restore-cache-downloads-gradle
- run: *download-dependencies-gradle
- restore-cache: *restore-yarn-cache
- run: *yarn
- run:
name: Authenticate with npm
command: echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
@@ -31,7 +31,7 @@ watchman shutdown-server
# integration tests
# build JS bundle for instrumentation tests
node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js --reactNativePath .
# build test APK
# shellcheck disable=SC1091
@@ -803,6 +803,47 @@ describe('Animated tests', () => {
expect(value1.__getValue()).toBe(1492);
});
it('should get updates for derived animated nodes', () => {
const value1 = new Animated.Value(40);
const value2 = new Animated.Value(50);
const value3 = new Animated.Value(0);
const value4 = Animated.add(value3, Animated.multiply(value1, value2));
const callback = jest.fn();
const view = new Animated.__PropsOnlyForTests(
{
style: {
transform: [
{
translateX: value4,
},
],
},
},
callback,
);
const listener = jest.fn();
const id = value4.addListener(listener);
value3.setValue(137);
expect(listener.mock.calls.length).toBe(1);
expect(listener).toBeCalledWith({value: 2137});
value1.setValue(0);
expect(listener.mock.calls.length).toBe(2);
expect(listener).toBeCalledWith({value: 137});
expect(view.__getValue()).toEqual({
style: {
transform: [
{
translateX: 137,
},
],
},
});
value4.removeListener(id);
value1.setValue(40);
expect(listener.mock.calls.length).toBe(2);
expect(value4.__getValue()).toBe(2137);
});
it('should removeAll', () => {
const value1 = new Animated.Value(0);
const listener = jest.fn();
@@ -19,11 +19,34 @@ describe('Animated Mock', () => {
Object.keys(AnimatedImplementation),
);
});
it('matches implementation params', () => {
Object.keys(AnimatedImplementation).forEach(key =>
expect(AnimatedImplementation[key].length).toEqual(
AnimatedMock[key].length,
),
);
it('matches implementation params', done => {
Object.keys(AnimatedImplementation).forEach(key => {
if (AnimatedImplementation[key].length !== AnimatedMock[key].length) {
done(
new Error(
'key ' +
key +
' had different lengths: ' +
JSON.stringify(
{
impl: {
len: AnimatedImplementation[key].length,
type: typeof AnimatedImplementation[key],
val: AnimatedImplementation[key].toString(),
},
mock: {
len: AnimatedMock[key].length,
type: typeof AnimatedMock[key],
val: AnimatedMock[key].toString(),
},
},
null,
2,
),
),
);
}
});
done();
});
});
@@ -14,4 +14,6 @@ const ScrollView = require('ScrollView');
const createAnimatedComponent = require('createAnimatedComponent');
module.exports = createAnimatedComponent(ScrollView);
module.exports = createAnimatedComponent(ScrollView, {
scrollEventThrottle: 0.0001,
});
@@ -16,7 +16,7 @@ const DeprecatedViewStylePropTypes = require('DeprecatedViewStylePropTypes');
const invariant = require('invariant');
function createAnimatedComponent(Component: any): any {
function createAnimatedComponent(Component: any, defaultProps: any): any {
invariant(
typeof Component !== 'function' ||
(Component.prototype && Component.prototype.isReactComponent),
@@ -149,6 +149,7 @@ function createAnimatedComponent(Component: any): any {
const props = this._propsAnimated.__getValue();
return (
<Component
{...defaultProps}
{...props}
ref={this._setComponentRef}
// The native driver updates views directly through the UI thread so we
@@ -11,11 +11,18 @@
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
const NativeAnimatedAPI = NativeAnimatedHelper.API;
const invariant = require('invariant');
type ValueListenerCallback = (state: {value: number}) => mixed;
let _uniqueId = 1;
// Note(vjeux): this would be better as an interface but flow doesn't
// support them yet
class AnimatedNode {
_listeners: {[key: string]: ValueListenerCallback};
__nativeAnimatedValueListener: ?any;
__attach(): void {}
__detach(): void {
if (this.__isNative && this.__nativeTag != null) {
@@ -36,11 +43,103 @@ class AnimatedNode {
/* Methods and props used by native Animated impl */
__isNative: boolean;
__nativeTag: ?number;
constructor() {
this._listeners = {};
}
__makeNative() {
if (!this.__isNative) {
throw new Error('This node cannot be made a "native" animated node');
}
if (this.hasListeners()) {
this._startListeningToNativeValueUpdates();
}
}
/**
* Adds an asynchronous listener to the value so you can observe updates from
* animations. This is useful because there is no way to
* synchronously read the value because it might be driven natively.
*
* See http://facebook.github.io/react-native/docs/animatedvalue.html#addlistener
*/
addListener(callback: (value: any) => mixed): string {
const id = String(_uniqueId++);
this._listeners[id] = callback;
if (this.__isNative) {
this._startListeningToNativeValueUpdates();
}
return id;
}
/**
* Unregister a listener. The `id` param shall match the identifier
* previously returned by `addListener()`.
*
* See http://facebook.github.io/react-native/docs/animatedvalue.html#removelistener
*/
removeListener(id: string): void {
delete this._listeners[id];
if (this.__isNative && !this.hasListeners()) {
this._stopListeningForNativeValueUpdates();
}
}
/**
* Remove all registered listeners.
*
* See http://facebook.github.io/react-native/docs/animatedvalue.html#removealllisteners
*/
removeAllListeners(): void {
this._listeners = {};
if (this.__isNative) {
this._stopListeningForNativeValueUpdates();
}
}
hasListeners(): boolean {
return !!Object.keys(this._listeners).length;
}
_startListeningToNativeValueUpdates() {
if (this.__nativeAnimatedValueListener) {
return;
}
NativeAnimatedAPI.startListeningToAnimatedNodeValue(this.__getNativeTag());
this.__nativeAnimatedValueListener = NativeAnimatedHelper.nativeEventEmitter.addListener(
'onAnimatedValueUpdate',
data => {
if (data.tag !== this.__getNativeTag()) {
return;
}
this._onAnimatedValueUpdateReceived(data.value);
},
);
}
_onAnimatedValueUpdateReceived(value: number) {
this.__callListeners(value);
}
__callListeners(value: number): void {
for (const key in this._listeners) {
this._listeners[key]({value});
}
}
_stopListeningForNativeValueUpdates() {
if (!this.__nativeAnimatedValueListener) {
return;
}
this.__nativeAnimatedValueListener.remove();
this.__nativeAnimatedValueListener = null;
NativeAnimatedAPI.stopListeningToAnimatedNodeValue(this.__getNativeTag());
}
__getNativeTag(): ?number {
NativeAnimatedHelper.assertNativeAnimatedModule();
invariant(
+5 -86
View File
@@ -20,10 +20,6 @@ import type AnimatedTracking from './AnimatedTracking';
const NativeAnimatedAPI = NativeAnimatedHelper.API;
type ValueListenerCallback = (state: {value: number}) => void;
let _uniqueId = 1;
/**
* Animated works by building a directed acyclic graph of dependencies
* transparently when you render your Animated components.
@@ -77,15 +73,12 @@ class AnimatedValue extends AnimatedWithChildren {
_offset: number;
_animation: ?Animation;
_tracking: ?AnimatedTracking;
_listeners: {[key: string]: ValueListenerCallback};
__nativeAnimatedValueListener: ?any;
constructor(value: number) {
super();
this._startingValue = this._value = value;
this._offset = 0;
this._animation = null;
this._listeners = {};
}
__detach() {
@@ -97,14 +90,6 @@ class AnimatedValue extends AnimatedWithChildren {
return this._value + this._offset;
}
__makeNative() {
super.__makeNative();
if (Object.keys(this._listeners).length) {
this._startListeningToNativeValueUpdates();
}
}
/**
* Directly set the value. This will stop any animations running on the value
* and update all the bound properties.
@@ -167,74 +152,6 @@ class AnimatedValue extends AnimatedWithChildren {
}
}
/**
* Adds an asynchronous listener to the value so you can observe updates from
* animations. This is useful because there is no way to
* synchronously read the value because it might be driven natively.
*
* See http://facebook.github.io/react-native/docs/animatedvalue.html#addlistener
*/
addListener(callback: ValueListenerCallback): string {
const id = String(_uniqueId++);
this._listeners[id] = callback;
if (this.__isNative) {
this._startListeningToNativeValueUpdates();
}
return id;
}
/**
* Unregister a listener. The `id` param shall match the identifier
* previously returned by `addListener()`.
*
* See http://facebook.github.io/react-native/docs/animatedvalue.html#removelistener
*/
removeListener(id: string): void {
delete this._listeners[id];
if (this.__isNative && Object.keys(this._listeners).length === 0) {
this._stopListeningForNativeValueUpdates();
}
}
/**
* Remove all registered listeners.
*
* See http://facebook.github.io/react-native/docs/animatedvalue.html#removealllisteners
*/
removeAllListeners(): void {
this._listeners = {};
if (this.__isNative) {
this._stopListeningForNativeValueUpdates();
}
}
_startListeningToNativeValueUpdates() {
if (this.__nativeAnimatedValueListener) {
return;
}
NativeAnimatedAPI.startListeningToAnimatedNodeValue(this.__getNativeTag());
this.__nativeAnimatedValueListener = NativeAnimatedHelper.nativeEventEmitter.addListener(
'onAnimatedValueUpdate',
data => {
if (data.tag !== this.__getNativeTag()) {
return;
}
this._updateValue(data.value, false /* flush */);
},
);
}
_stopListeningForNativeValueUpdates() {
if (!this.__nativeAnimatedValueListener) {
return;
}
this.__nativeAnimatedValueListener.remove();
this.__nativeAnimatedValueListener = null;
NativeAnimatedAPI.stopListeningToAnimatedNodeValue(this.__getNativeTag());
}
/**
* Stops any running animation or tracking. `callback` is invoked with the
* final value after stopping the animation, which is useful for updating
@@ -259,6 +176,10 @@ class AnimatedValue extends AnimatedWithChildren {
this._value = this._startingValue;
}
_onAnimatedValueUpdateReceived(value: number): void {
this._updateValue(value, false /*flush*/);
}
/**
* Interpolates the value before updating the property, e.g. mapping 0-1 to
* 0-10.
@@ -321,9 +242,7 @@ class AnimatedValue extends AnimatedWithChildren {
if (flush) {
_flush(this);
}
for (const key in this._listeners) {
this._listeners[key]({value: this.__getValue()});
}
super.__callListeners(this.__getValue());
}
__getNativeConfig(): Object {
@@ -14,7 +14,7 @@ const AnimatedWithChildren = require('./AnimatedWithChildren');
const invariant = require('invariant');
type ValueXYListenerCallback = (value: {x: number, y: number}) => void;
type ValueXYListenerCallback = (value: {x: number, y: number}) => mixed;
let _uniqueId = 1;
@@ -31,6 +31,7 @@ class AnimatedWithChildren extends AnimatedNode {
);
}
}
super.__makeNative();
}
__addChild(child: AnimatedNode): void {
@@ -69,6 +70,17 @@ class AnimatedWithChildren extends AnimatedNode {
__getChildren(): Array<AnimatedNode> {
return this._children;
}
__callListeners(value: number): void {
super.__callListeners(value);
if (!this.__isNative) {
for (const child of this._children) {
if (child.__getValue) {
child.__callListeners(child.__getValue());
}
}
}
}
}
module.exports = AnimatedWithChildren;
+6 -1
View File
@@ -52,9 +52,14 @@ RCT_EXPORT_MODULE(ImagePickerIOS);
return self;
}
+ (BOOL)requiresMainQueueSetup
{
return NO;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"AVCaptureDeviceDidStartRunningNotification" object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"AVCaptureDeviceDidStartRunningNotification" object:nil];
}
- (dispatch_queue_t)methodQueue
@@ -65,6 +65,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
_frame: ?ViewLayout = null;
_subscriptions: Array<EmitterSubscription> = [];
viewRef: {current: React.ElementRef<any> | null};
_initialFrameHeight: number = 0;
constructor(props: Props) {
super(props);
@@ -113,19 +114,11 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
_onLayout = (event: ViewLayoutEvent) => {
this._frame = event.nativeEvent.layout;
};
UNSAFE_componentWillUpdate(nextProps: Props, nextState: State): void {
if (
nextState.bottom === this.state.bottom &&
this.props.behavior === 'height' &&
nextProps.behavior === 'height'
) {
// If the component rerenders without an internal state change, e.g.
// triggered by parent component re-rendering, no need for bottom to change.
nextState.bottom = 0;
if (!this._initialFrameHeight) {
// save the initial frame height, before the keyboard is visible
this._initialFrameHeight = this._frame.height;
}
}
};
componentDidMount(): void {
if (Platform.OS === 'ios') {
@@ -166,7 +159,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
// this.frame.height will never go back to its original value.
// When height changes, we need to disable flex.
heightStyle = {
height: this._frame.height - bottomHeight,
height: this._initialFrameHeight - bottomHeight,
flex: 0,
};
}
+28 -5
View File
@@ -195,11 +195,16 @@ type IOSProps = $ReadOnly<{|
* (as a time interval in ms). A lower number yields better accuracy for code
* that is tracking the scroll position, but can lead to scroll performance
* problems due to the volume of information being send over the bridge.
* You will not notice a difference between values set between 1-16 as the
* JS run loop is synced to the screen refresh rate. If you do not need precise
* scroll position tracking, set this value higher to limit the information
* being sent across the bridge. The default value is zero, which results in
* the scroll event being sent only once each time the view is scrolled.
*
* Values between 0 and 17ms indicate 60fps updates are needed and throttling
* will be disabled.
*
* If you do not need precise scroll position tracking, set this value higher
* to limit the information being sent across the bridge.
*
* The default value is zero, which results in the scroll event being sent only
* once each time the view is scrolled.
*
* @platform ios
*/
scrollEventThrottle?: ?number,
@@ -210,6 +215,12 @@ type IOSProps = $ReadOnly<{|
* @platform ios
*/
scrollIndicatorInsets?: ?EdgeInsetsProp,
/**
* When true, the scroll view can be programmatically scrolled beyond its
* content size. The default value is false.
* @platform ios
*/
scrollToOverflowEnabled?: ?boolean,
/**
* When true, the scroll view scrolls to top when the status bar is tapped.
* The default value is true.
@@ -651,6 +662,18 @@ class ScrollView extends React.Component<Props, State> {
this._headerLayoutYs = new Map();
}
UNSAFE_componentWillReceiveProps(nextProps: Props) {
const currentContentInsetTop = this.props.contentInset
? this.props.contentInset.top
: 0;
const nextContentInsetTop = nextProps.contentInset
? nextProps.contentInset.top
: 0;
if (currentContentInsetTop !== nextContentInsetTop) {
this._scrollAnimatedValue.setOffset(nextContentInsetTop || 0);
}
}
componentDidMount() {
this._updateAnimatedNodeAttachment();
}
+2
View File
@@ -137,6 +137,8 @@ class Switch extends React.Component<Props> {
on: value === true,
style,
thumbTintColor: _thumbColor,
trackColorForFalse: _trackColorForFalse,
trackColorForTrue: _trackColorForTrue,
trackTintColor:
value === true ? _trackColorForTrue : _trackColorForFalse,
}: NativeAndroidProps)
@@ -223,6 +223,21 @@ type IOSProps = $ReadOnly<{|
|}>;
type AndroidProps = $ReadOnly<{|
autoCompleteType?: ?(
| 'cc-csc'
| 'cc-exp'
| 'cc-exp-month'
| 'cc-exp-year'
| 'cc-number'
| 'email'
| 'name'
| 'password'
| 'postal-code'
| 'street-address'
| 'tel'
| 'username'
| 'off'
),
returnKeyLabel?: ?string,
numberOfLines?: ?number,
disableFullscreenUI?: ?boolean,
@@ -230,6 +245,13 @@ type AndroidProps = $ReadOnly<{|
underlineColorAndroid?: ?ColorValue,
inlineImageLeft?: ?string,
inlineImagePadding?: ?number,
importantForAutofill?: ?(
| 'auto'
| 'no'
| 'noExcludeDescendants'
| 'yes'
| 'yesExcludeDescendants'
),
|}>;
type Props = $ReadOnly<{|
@@ -413,6 +435,45 @@ const TextInput = createReactClass({
'words',
'characters',
]),
/**
* Determines which content to suggest on auto complete, e.g.`username`.
* To disable auto complete, use `off`.
*
* *Android Only*
*
* The following values work on Android only:
*
* - `username`
* - `password`
* - `email`
* - `name`
* - `tel`
* - `street-address`
* - `postal-code`
* - `cc-number`
* - `cc-csc`
* - `cc-exp`
* - `cc-exp-month`
* - `cc-exp-year`
* - `off`
*
* @platform android
*/
autoCompleteType: PropTypes.oneOf([
'cc-csc',
'cc-exp',
'cc-exp-month',
'cc-exp-year',
'cc-number',
'email',
'name',
'password',
'postal-code',
'street-address',
'tel',
'username',
'off',
]),
/**
* If `false`, disables auto-correct. The default value is `true`.
*/
+7 -1
View File
@@ -484,6 +484,7 @@ const TouchableMixin = {
* Place as callback for a DOM element's `onResponderRelease` event.
*/
touchableHandleResponderRelease: function(e: PressEvent) {
this.pressInLocation = null;
this._receiveSignal(Signals.RESPONDER_RELEASE, e);
},
@@ -491,6 +492,7 @@ const TouchableMixin = {
* Place as callback for a DOM element's `onResponderTerminate` event.
*/
touchableHandleResponderTerminate: function(e: PressEvent) {
this.pressInLocation = null;
this._receiveSignal(Signals.RESPONDER_TERMINATED, e);
},
@@ -558,9 +560,13 @@ const TouchableMixin = {
dimensionsOnActivate.height +
pressExpandBottom;
if (isTouchWithinActive) {
const prevState = this.state.touchable.touchState;
this._receiveSignal(Signals.ENTER_PRESS_RECT, e);
const curState = this.state.touchable.touchState;
if (curState === States.RESPONDER_INACTIVE_PRESS_IN) {
if (
curState === States.RESPONDER_INACTIVE_PRESS_IN &&
prevState !== States.RESPONDER_INACTIVE_PRESS_IN
) {
// fix for t7967420
this._cancelLongPressDelayTimeout();
}
@@ -46,6 +46,22 @@ type FocusEvent = TargetEvent;
const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
const OVERRIDE_PROPS = [
'accessibilityComponentType',
'accessibilityLabel',
'accessibilityHint',
'accessibilityIgnoresInvertColors',
'accessibilityRole',
'accessibilityStates',
'accessibilityTraits',
'hitSlop',
'nativeID',
'onBlur',
'onFocus',
'onLayout',
'testID',
];
export type Props = $ReadOnly<{|
accessible?: ?boolean,
accessibilityComponentType?: ?AccessibilityComponentType,
@@ -92,6 +108,7 @@ const TouchableWithoutFeedback = ((createReactClass({
accessibilityComponentType: PropTypes.oneOf(
DeprecatedAccessibilityComponentTypes,
),
accessibilityIgnoresInvertColors: PropTypes.bool,
accessibilityRole: PropTypes.oneOf(DeprecatedAccessibilityRoles),
accessibilityStates: PropTypes.arrayOf(
PropTypes.oneOf(DeprecatedAccessibilityStates),
@@ -239,18 +256,17 @@ const TouchableWithoutFeedback = ((createReactClass({
Touchable.renderDebugView({color: 'red', hitSlop: this.props.hitSlop}),
);
}
const overrides = {};
for (const prop of OVERRIDE_PROPS) {
if (this.props[prop] !== undefined) {
overrides[prop] = this.props[prop];
}
}
return (React: any).cloneElement(child, {
...overrides,
accessible: this.props.accessible !== false,
accessibilityLabel: this.props.accessibilityLabel,
accessibilityHint: this.props.accessibilityHint,
accessibilityComponentType: this.props.accessibilityComponentType,
accessibilityRole: this.props.accessibilityRole,
accessibilityStates: this.props.accessibilityStates,
accessibilityTraits: this.props.accessibilityTraits,
nativeID: this.props.nativeID,
testID: this.props.testID,
onLayout: this.props.onLayout,
hitSlop: this.props.hitSlop,
onStartShouldSetResponder: this.touchableHandleStartShouldSetResponder,
onResponderTerminationRequest: this
.touchableHandleResponderTerminationRequest,
+4 -4
View File
@@ -1,17 +1,17 @@
/**
* @generated by scripts/bump-oss-version.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @generated by scripts/bump-oss-version.js
* @flow
*/
exports.version = {
major: 0,
minor: 0,
patch: 0,
minor: 59,
patch: 8,
prerelease: null,
};
@@ -14,8 +14,6 @@ const {freeze, seal, preventExtensions} = Object;
function setup() {
jest.setMock('../../vendor/core/_shouldPolyfillES6Collection', () => true);
jest.unmock('_wrapObjectFreezeAndFriends');
require('_wrapObjectFreezeAndFriends');
}
function cleanup() {
-2
View File
@@ -18,10 +18,8 @@ const {polyfillGlobal} = require('PolyfillFunctions');
*/
const _shouldPolyfillCollection = require('_shouldPolyfillES6Collection');
if (_shouldPolyfillCollection('Map')) {
require('_wrapObjectFreezeAndFriends');
polyfillGlobal('Map', () => require('Map'));
}
if (_shouldPolyfillCollection('Set')) {
require('_wrapObjectFreezeAndFriends');
polyfillGlobal('Set', () => require('Set'));
}
+54 -2
View File
@@ -14,6 +14,7 @@ const BorderBox = require('BorderBox');
const React = require('React');
const StyleSheet = require('StyleSheet');
const View = require('View');
const Dimensions = require('Dimensions');
const flattenStyle = require('flattenStyle');
const resolveBoxStyle = require('resolveBoxStyle');
@@ -21,8 +22,8 @@ const resolveBoxStyle = require('resolveBoxStyle');
class ElementBox extends React.Component<$FlowFixMeProps> {
render() {
const style = flattenStyle(this.props.style) || {};
const margin = resolveBoxStyle('margin', style);
const padding = resolveBoxStyle('padding', style);
let margin = resolveBoxStyle('margin', style);
let padding = resolveBoxStyle('padding', style);
const frameStyle = {...this.props.frame};
const contentStyle = {
@@ -31,6 +32,8 @@ class ElementBox extends React.Component<$FlowFixMeProps> {
};
if (margin != null) {
margin = resolveRelativeSizes(margin);
frameStyle.top -= margin.top;
frameStyle.left -= margin.left;
frameStyle.height += margin.top + margin.bottom;
@@ -51,6 +54,8 @@ class ElementBox extends React.Component<$FlowFixMeProps> {
}
if (padding != null) {
padding = resolveRelativeSizes(padding);
contentStyle.width -= padding.left + padding.right;
contentStyle.height -= padding.top + padding.bottom;
}
@@ -82,4 +87,51 @@ const styles = StyleSheet.create({
},
});
type Style = {
top: number,
right: number,
bottom: number,
left: number,
};
/**
* Resolves relative sizes (percentages and auto) in a style object.
*
* @param style the style to resolve
* @return a modified copy
*/
function resolveRelativeSizes(style: $ReadOnly<Style>): Style {
let resolvedStyle = Object.assign({}, style);
resolveSizeInPlace(resolvedStyle, 'top', 'height');
resolveSizeInPlace(resolvedStyle, 'right', 'width');
resolveSizeInPlace(resolvedStyle, 'bottom', 'height');
resolveSizeInPlace(resolvedStyle, 'left', 'width');
return resolvedStyle;
}
/**
* Resolves the given size of a style object in place.
*
* @param style the style object to modify
* @param direction the direction to resolve (e.g. 'top')
* @param dimension the window dimension that this direction belongs to (e.g. 'height')
*/
function resolveSizeInPlace(
style: Style,
direction: string,
dimension: string,
) {
if (style[direction] !== null && typeof style[direction] === 'string') {
if (style[direction].indexOf('%') !== -1) {
style[direction] =
(parseFloat(style[direction]) / 100.0) *
Dimensions.get('window')[dimension];
}
if (style[direction] === 'auto') {
// Ignore auto sizing in frame drawing due to complexity of correctly rendering this
style[direction] = 0;
}
}
}
module.exports = ElementBox;
+41 -6
View File
@@ -88,6 +88,16 @@ class NetworkOverlay extends React.Component<Props, State> {
_requestsListView: ?React.ElementRef<typeof FlatList>;
_detailScrollView: ?React.ElementRef<typeof ScrollView>;
// Metrics are used to decide when if the request list should be sticky, and
// scroll to the bottom as new network requests come in, or if the user has
// intentionally scrolled away from the bottom - to instead flash the scroll bar
// and keep the current position
_requestsListViewScrollMetrics = {
offset: 0,
visibleLength: 0,
contentLength: 0,
};
// Map of `socketId` -> `index in `this.state.requests`.
_socketIdMap = {};
// Map of `xhr._index` -> `index in `this.state.requests`.
@@ -121,7 +131,7 @@ class NetworkOverlay extends React.Component<Props, State> {
{
requests: this.state.requests.concat(_xhr),
},
this._scrollRequestsToBottom,
this._indicateAdditionalRequests,
);
});
@@ -214,7 +224,7 @@ class NetworkOverlay extends React.Component<Props, State> {
{
requests: this.state.requests.concat(_webSocket),
},
this._scrollRequestsToBottom,
this._indicateAdditionalRequests,
);
},
);
@@ -383,11 +393,35 @@ class NetworkOverlay extends React.Component<Props, State> {
);
}
_scrollRequestsToBottom(): void {
_indicateAdditionalRequests = (): void => {
if (this._requestsListView) {
this._requestsListView.scrollToEnd();
const distanceFromEndThreshold = LISTVIEW_CELL_HEIGHT * 2;
const {
offset,
visibleLength,
contentLength,
} = this._requestsListViewScrollMetrics;
const distanceFromEnd = contentLength - visibleLength - offset;
const isCloseToEnd = distanceFromEnd <= distanceFromEndThreshold;
if (isCloseToEnd) {
this._requestsListView.scrollToEnd();
} else {
this._requestsListView.flashScrollIndicators();
}
}
}
};
_captureRequestsListView = (listRef: ?FlatList<NetworkRequestInfo>): void => {
this._requestsListView = listRef;
};
_requestsListViewOnScroll = (e: Object): void => {
this._requestsListViewScrollMetrics.offset = e.nativeEvent.contentOffset.y;
this._requestsListViewScrollMetrics.visibleLength =
e.nativeEvent.layoutMeasurement.height;
this._requestsListViewScrollMetrics.contentLength =
e.nativeEvent.contentSize.height;
};
/**
* Popup a scrollView to dynamically show detailed information of
@@ -446,7 +480,8 @@ class NetworkOverlay extends React.Component<Props, State> {
</View>
<FlatList
ref={listRef => (this._requestsListView = listRef)}
ref={this._captureRequestsListView}
onScroll={this._requestsListViewOnScroll}
style={styles.listView}
data={requests}
renderItem={this._renderItem}
+6 -1
View File
@@ -22,6 +22,11 @@
+ (BOOL)application:(nonnull UIApplication *)application
continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:(nonnull void (^)(NSArray *__nullable))restorationHandler;
restorationHandler:
#if __has_include(<UIKitCore/UIUserActivity.h>) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */
(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler;
#else
(nonnull void (^)(NSArray *_Nullable))restorationHandler;
#endif
@end
+6 -2
View File
@@ -67,8 +67,12 @@ RCT_EXPORT_MODULE()
+ (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray * __nullable))restorationHandler
{
restorationHandler:
#if __has_include(<UIKitCore/UIUserActivity.h>) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */
(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler {
#else
(nonnull void (^)(NSArray *_Nullable))restorationHandler {
#endif
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
NSDictionary *payload = @{@"url": userActivity.webpageURL.absoluteString};
[[NSNotificationCenter defaultCenter] postNotificationName:kOpenURLNotification
+27 -6
View File
@@ -893,7 +893,10 @@ class VirtualizedList extends React.PureComponent<Props, State> {
element.props.onLayout(event);
}
},
style: [element.props.style, inversionStyle],
style: StyleSheet.compose(
inversionStyle,
element.props.style,
),
}),
);
}
@@ -937,7 +940,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
: this.props.inverted,
stickyHeaderIndices,
};
if (inversionStyle && itemCount !== 0) {
if (inversionStyle) {
/* $FlowFixMe(>=0.70.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.70 was deployed. To see the error delete
* this comment and run Flow. */
@@ -979,7 +982,19 @@ class VirtualizedList extends React.PureComponent<Props, State> {
tuple.viewabilityHelper.resetViewableIndices();
});
}
// The `this._hiPriInProgress` is guaranteeing a hiPri cell update will only happen
// once per fiber update. The `_scheduleCellsToRenderUpdate` will set it to true
// if a hiPri update needs to perform. If `componentDidUpdate` is triggered with
// `this._hiPriInProgress=true`, means it's triggered by the hiPri update. The
// `_scheduleCellsToRenderUpdate` will check this condition and not perform
// another hiPri update.
const hiPriInProgress = this._hiPriInProgress;
this._scheduleCellsToRenderUpdate();
// Make sure setting `this._hiPriInProgress` back to false after `componentDidUpdate`
// is triggered with `this._hiPriInProgress = true`
if (hiPriInProgress) {
this._hiPriInProgress = false;
}
}
_averageCellLength = 0;
@@ -990,13 +1005,14 @@ class VirtualizedList extends React.PureComponent<Props, State> {
_frames = {};
_footerLength = 0;
_hasDataChangedSinceEndReached = true;
_hasDoneInitialScroll = false;
_hasInteracted = false;
_hasMore = false;
_hasWarned = {};
_highestMeasuredFrameIndex = 0;
_headerLength = 0;
_hiPriInProgress: boolean = false; // flag to prevent infinite hiPri cell limit update
_highestMeasuredFrameIndex = 0;
_indicesToKeys: Map<number, string> = new Map();
_hasDoneInitialScroll = false;
_nestedChildLists: Map<
string,
{ref: ?VirtualizedList, state: ?ChildListState},
@@ -1106,6 +1122,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
}
this._computeBlankness();
this._updateViewableItems(this.props.data);
}
_onCellUnmount = (cellKey: string) => {
@@ -1181,7 +1198,8 @@ class VirtualizedList extends React.PureComponent<Props, State> {
_renderDebugOverlay() {
const normalize =
this._scrollMetrics.visibleLength / this._scrollMetrics.contentLength;
this._scrollMetrics.visibleLength /
(this._scrollMetrics.contentLength || 1);
const framesInLayout = [];
const itemCount = this.props.getItemCount(this.props.data);
for (let ii = 0; ii < itemCount; ii++) {
@@ -1418,7 +1436,10 @@ class VirtualizedList extends React.PureComponent<Props, State> {
// Otherwise, it would just render as many cells as it can (of zero dimension),
// each time through attempting to render more (limited by maxToRenderPerBatch),
// starving the renderer from actually laying out the objects and computing _averageCellLength.
if (hiPri && this._averageCellLength) {
// If this is triggered in an `componentDidUpdate` followed by a hiPri cellToRenderUpdate
// We shouldn't do another hipri cellToRenderUpdate
if (hiPri && this._averageCellLength && !this._hiPriInProgress) {
this._hiPriInProgress = true;
// Don't worry about interactions when scrolling quickly; focus on filling content as fast
// as possible.
this._updateCellsToRenderBatcher.dispose({abort: true});
+13 -10
View File
@@ -146,7 +146,7 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
sectionIndex: number,
viewPosition?: number,
}) {
let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex - 1;
let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex + 1;
for (let ii = 0; ii < params.sectionIndex; ii++) {
index += this.props.sections[ii].data.length + 2;
}
@@ -221,9 +221,9 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
trailingSection?: ?SectionT,
} {
let itemIndex = index;
const defaultKeyExtractor = this.props.keyExtractor;
for (let ii = 0; ii < this.props.sections.length; ii++) {
const section = this.props.sections[ii];
const {sections} = this.props;
for (let ii = 0; ii < sections.length; ii++) {
const section = sections[ii];
const key = section.key || String(ii);
itemIndex -= 1; // The section adds an item for the header
if (itemIndex >= section.data.length + 1) {
@@ -234,7 +234,7 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
key: key + ':header',
index: null,
header: true,
trailingSection: this.props.sections[ii + 1],
trailingSection: sections[ii + 1],
};
} else if (itemIndex === section.data.length) {
return {
@@ -242,18 +242,21 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
key: key + ':footer',
index: null,
header: false,
trailingSection: this.props.sections[ii + 1],
trailingSection: sections[ii + 1],
};
} else {
const keyExtractor = section.keyExtractor || defaultKeyExtractor;
const keyExtractor = section.keyExtractor || this.props.keyExtractor;
return {
section,
key: key + ':' + keyExtractor(section.data[itemIndex], itemIndex),
index: itemIndex,
leadingItem: section.data[itemIndex - 1],
leadingSection: this.props.sections[ii - 1],
trailingItem: section.data[itemIndex + 1],
trailingSection: this.props.sections[ii + 1],
leadingSection: sections[ii - 1],
trailingItem:
section.data.length > itemIndex + 1
? section.data[itemIndex + 1]
: undefined,
trailingSection: sections[ii + 1],
};
}
}
+1 -1
View File
@@ -1 +1 @@
f24a0da6e0f59484e5aafd0825bb1a6ed27d7182
8e25ed20bd27d126f670d04680db85209f779056
File diff suppressed because it is too large Load Diff
+95 -74
View File
@@ -3188,6 +3188,8 @@ function updateReducer(reducer) {
is(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseUpdate === queue.last && (hook.baseState = newState);
queue.eagerReducer = reducer;
queue.eagerState = newState;
return [newState, _dispatch];
}
}
@@ -3508,6 +3510,8 @@ function tryHydrate(fiber, nextInstance) {
(nextInstance = shim$1(nextInstance, fiber.pendingProps)),
null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1
);
case 13:
return !1;
default:
return !1;
}
@@ -4571,19 +4575,19 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
null !== dependency &&
dependency.expirationTime < renderExpirationTime &&
(dependency.expirationTime = renderExpirationTime);
dependency = renderExpirationTime;
for (var node = oldValue.return; null !== node; ) {
dependency = node.alternate;
if (node.childExpirationTime < renderExpirationTime)
(node.childExpirationTime = renderExpirationTime),
null !== dependency &&
dependency.childExpirationTime <
renderExpirationTime &&
(dependency.childExpirationTime = renderExpirationTime);
var alternate = node.alternate;
if (node.childExpirationTime < dependency)
(node.childExpirationTime = dependency),
null !== alternate &&
alternate.childExpirationTime < dependency &&
(alternate.childExpirationTime = dependency);
else if (
null !== dependency &&
dependency.childExpirationTime < renderExpirationTime
null !== alternate &&
alternate.childExpirationTime < dependency
)
dependency.childExpirationTime = renderExpirationTime;
alternate.childExpirationTime = dependency;
else break;
node = node.return;
}
@@ -4713,12 +4717,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime
)
);
default:
invariant(
!1,
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
);
}
invariant(
!1,
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
);
}
var valueCursor = { current: null },
currentlyRenderingFiber = null,
@@ -5361,6 +5364,8 @@ function unwindWork(workInProgress) {
workInProgress)
: null
);
case 18:
return null;
case 4:
return popHostContainer(workInProgress), null;
case 10:
@@ -5686,6 +5691,7 @@ function commitPassiveEffects(root, firstEffect) {
isRendering = previousIsRendering;
previousIsRendering = root.expirationTime;
0 !== previousIsRendering && requestWork(root, previousIsRendering);
isBatchingUpdates || isRendering || performWork(1073741823, !1);
}
function flushPassiveEffects() {
if (null !== passiveEffectCallbackHandle) {
@@ -5960,6 +5966,8 @@ function completeUnitOfWork(workInProgress) {
case 17:
isContextProvider(current$$1.type) && popContext(current$$1);
break;
case 18:
break;
default:
invariant(
!1,
@@ -6050,7 +6058,7 @@ function renderRoot(root$jscomp$0, isYieldy) {
do {
try {
if (isYieldy)
for (; null !== nextUnitOfWork && !shouldYieldToRenderer(); )
for (; null !== nextUnitOfWork && !(frameDeadline <= now$1()); )
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
else
for (; null !== nextUnitOfWork; )
@@ -6136,27 +6144,24 @@ function renderRoot(root$jscomp$0, isYieldy) {
sourceFiber$jscomp$0.expirationTime = 1073741823;
break a;
}
sourceFiber$jscomp$0 = root.pingCache;
null === sourceFiber$jscomp$0
? ((sourceFiber$jscomp$0 = root.pingCache = new PossiblyWeakMap()),
(returnFiber$jscomp$0 = new Set()),
sourceFiber$jscomp$0.set(thenable, returnFiber$jscomp$0))
: ((returnFiber$jscomp$0 = sourceFiber$jscomp$0.get(
thenable
)),
void 0 === returnFiber$jscomp$0 &&
((returnFiber$jscomp$0 = new Set()),
sourceFiber$jscomp$0.set(
thenable,
returnFiber$jscomp$0
)));
returnFiber$jscomp$0.has(returnFiber) ||
(returnFiber$jscomp$0.add(returnFiber),
sourceFiber$jscomp$0 = root;
returnFiber$jscomp$0 = returnFiber;
var pingCache = sourceFiber$jscomp$0.pingCache;
null === pingCache
? ((pingCache = sourceFiber$jscomp$0.pingCache = new PossiblyWeakMap()),
(current$$1 = new Set()),
pingCache.set(thenable, current$$1))
: ((current$$1 = pingCache.get(thenable)),
void 0 === current$$1 &&
((current$$1 = new Set()),
pingCache.set(thenable, current$$1)));
current$$1.has(returnFiber$jscomp$0) ||
(current$$1.add(returnFiber$jscomp$0),
(sourceFiber$jscomp$0 = pingSuspendedRoot.bind(
null,
root,
sourceFiber$jscomp$0,
thenable,
returnFiber
returnFiber$jscomp$0
)),
thenable.then(sourceFiber$jscomp$0, sourceFiber$jscomp$0));
-1 === earliestTimeoutMs
@@ -6200,24 +6205,25 @@ function renderRoot(root$jscomp$0, isYieldy) {
break a;
case 1:
if (
((thenable = value),
(earliestTimeoutMs = root.type),
(startTimeMs = root.stateNode),
((earliestTimeoutMs = value),
(startTimeMs = root.type),
(sourceFiber$jscomp$0 = root.stateNode),
0 === (root.effectTag & 64) &&
("function" ===
typeof earliestTimeoutMs.getDerivedStateFromError ||
(null !== startTimeMs &&
"function" === typeof startTimeMs.componentDidCatch &&
typeof startTimeMs.getDerivedStateFromError ||
(null !== sourceFiber$jscomp$0 &&
"function" ===
typeof sourceFiber$jscomp$0.componentDidCatch &&
(null === legacyErrorBoundariesThatAlreadyFailed ||
!legacyErrorBoundariesThatAlreadyFailed.has(
startTimeMs
sourceFiber$jscomp$0
)))))
) {
root.effectTag |= 2048;
root.expirationTime = returnFiber;
returnFiber = createClassErrorUpdate(
root,
thenable,
earliestTimeoutMs,
returnFiber
);
enqueueCapturedUpdate(root, returnFiber);
@@ -6477,7 +6483,7 @@ function onSuspend(
msUntilTimeout
) {
root.expirationTime = rootExpirationTime;
0 !== msUntilTimeout || shouldYieldToRenderer()
0 !== msUntilTimeout || frameDeadline <= now$1()
? 0 < msUntilTimeout &&
(root.timeoutHandle = scheduleTimeout(
onTimeout.bind(null, root, finishedWork, suspendedExpirationTime),
@@ -6577,27 +6583,19 @@ function findHighestPriorityRoot() {
nextFlushedRoot = highestPriorityRoot;
nextFlushedExpirationTime = highestPriorityWork;
}
var didYield = !1;
function shouldYieldToRenderer() {
return didYield ? !0 : frameDeadline <= now$1() ? (didYield = !0) : !1;
}
function performAsyncWork() {
try {
if (!shouldYieldToRenderer() && null !== firstScheduledRoot) {
recomputeCurrentRendererTime();
var root = firstScheduledRoot;
do {
var expirationTime = root.expirationTime;
0 !== expirationTime &&
currentRendererTime <= expirationTime &&
(root.nextExpirationTimeToWorkOn = currentRendererTime);
root = root.nextScheduledRoot;
} while (root !== firstScheduledRoot);
}
performWork(0, !0);
} finally {
didYield = !1;
function performAsyncWork(didTimeout) {
if (didTimeout && null !== firstScheduledRoot) {
recomputeCurrentRendererTime();
didTimeout = firstScheduledRoot;
do {
var expirationTime = didTimeout.expirationTime;
0 !== expirationTime &&
currentRendererTime <= expirationTime &&
(didTimeout.nextExpirationTimeToWorkOn = currentRendererTime);
didTimeout = didTimeout.nextScheduledRoot;
} while (didTimeout !== firstScheduledRoot);
}
performWork(0, !0);
}
function performWork(minExpirationTime, isYieldy) {
findHighestPriorityRoot();
@@ -6608,7 +6606,10 @@ function performWork(minExpirationTime, isYieldy) {
null !== nextFlushedRoot &&
0 !== nextFlushedExpirationTime &&
minExpirationTime <= nextFlushedExpirationTime &&
!(didYield && currentRendererTime > nextFlushedExpirationTime);
!(
frameDeadline <= now$1() &&
currentRendererTime > nextFlushedExpirationTime
);
)
performWorkOnRoot(
@@ -6676,7 +6677,7 @@ function performWorkOnRoot(root, expirationTime, isYieldy) {
renderRoot(root, isYieldy),
(_finishedWork = root.finishedWork),
null !== _finishedWork &&
(shouldYieldToRenderer()
(frameDeadline <= now$1()
? (root.finishedWork = _finishedWork)
: completeRoot$1(root, _finishedWork, expirationTime)));
} else
@@ -6917,18 +6918,20 @@ var roots = new Map(),
maybeInstance = findHostInstance(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig =
var nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
maybeInstance =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
viewConfig.validAttributes
maybeInstance.validAttributes
);
null != nativeProps &&
UIManager.updateView(
maybeInstance._nativeTag,
viewConfig.uiViewClassName,
nativeTag,
maybeInstance.uiViewClassName,
nativeProps
);
}
@@ -6937,6 +6940,21 @@ var roots = new Map(),
})(React.Component);
})(findNodeHandle, findHostInstance),
findNodeHandle: findNodeHandle,
setNativeProps: function(handle, nativeProps) {
null != handle._nativeTag &&
((nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
handle.viewConfig.validAttributes
)),
null != nativeProps &&
UIManager.updateView(
handle._nativeTag,
handle.viewConfig.uiViewClassName,
nativeProps
));
},
render: function(element, containerTag, callback) {
var root = roots.get(containerTag);
if (!root) {
@@ -7022,17 +7040,20 @@ var roots = new Map(),
maybeInstance = findHostInstance(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig;
var nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
maybeInstance =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
viewConfig.validAttributes
maybeInstance.validAttributes
);
null != nativeProps &&
UIManager.updateView(
maybeInstance._nativeTag,
viewConfig.uiViewClassName,
nativeTag,
maybeInstance.uiViewClassName,
nativeProps
);
}
@@ -7068,7 +7089,7 @@ var roots = new Map(),
findFiberByHostInstance: getInstanceFromInstance,
getInspectorDataForViewTag: getInspectorDataForViewTag,
bundleType: 0,
version: "16.8.1",
version: "16.8.3",
rendererPackageName: "react-native-renderer"
});
var ReactFabric$2 = { default: ReactFabric },
+93 -69
View File
@@ -3208,6 +3208,8 @@ function updateReducer(reducer) {
is(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseUpdate === queue.last && (hook.baseState = newState);
queue.eagerReducer = reducer;
queue.eagerState = newState;
return [newState, _dispatch];
}
}
@@ -3538,6 +3540,8 @@ function tryHydrate(fiber, nextInstance) {
(nextInstance = shim$1(nextInstance, fiber.pendingProps)),
null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1
);
case 13:
return !1;
default:
return !1;
}
@@ -4644,19 +4648,19 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
null !== dependency &&
dependency.expirationTime < renderExpirationTime &&
(dependency.expirationTime = renderExpirationTime);
dependency = renderExpirationTime;
for (var node = oldValue.return; null !== node; ) {
dependency = node.alternate;
if (node.childExpirationTime < renderExpirationTime)
(node.childExpirationTime = renderExpirationTime),
null !== dependency &&
dependency.childExpirationTime <
renderExpirationTime &&
(dependency.childExpirationTime = renderExpirationTime);
var alternate = node.alternate;
if (node.childExpirationTime < dependency)
(node.childExpirationTime = dependency),
null !== alternate &&
alternate.childExpirationTime < dependency &&
(alternate.childExpirationTime = dependency);
else if (
null !== dependency &&
dependency.childExpirationTime < renderExpirationTime
null !== alternate &&
alternate.childExpirationTime < dependency
)
dependency.childExpirationTime = renderExpirationTime;
alternate.childExpirationTime = dependency;
else break;
node = node.return;
}
@@ -4786,12 +4790,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime
)
);
default:
invariant(
!1,
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
);
}
invariant(
!1,
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
);
}
var valueCursor = { current: null },
currentlyRenderingFiber = null,
@@ -5465,22 +5468,23 @@ function throwException(
sourceFiber.expirationTime = 1073741823;
return;
}
sourceFiber = root.pingCache;
null === sourceFiber
? ((sourceFiber = root.pingCache = new PossiblyWeakMap()),
(returnFiber = new Set()),
sourceFiber.set(thenable, returnFiber))
: ((returnFiber = sourceFiber.get(thenable)),
void 0 === returnFiber &&
((returnFiber = new Set()),
sourceFiber.set(thenable, returnFiber)));
returnFiber.has(renderExpirationTime) ||
(returnFiber.add(renderExpirationTime),
sourceFiber = root;
returnFiber = renderExpirationTime;
var pingCache = sourceFiber.pingCache;
null === pingCache
? ((pingCache = sourceFiber.pingCache = new PossiblyWeakMap()),
(current$$1 = new Set()),
pingCache.set(thenable, current$$1))
: ((current$$1 = pingCache.get(thenable)),
void 0 === current$$1 &&
((current$$1 = new Set()), pingCache.set(thenable, current$$1)));
current$$1.has(returnFiber) ||
(current$$1.add(returnFiber),
(sourceFiber = pingSuspendedRoot.bind(
null,
root,
sourceFiber,
thenable,
renderExpirationTime
returnFiber
)),
(sourceFiber = tracing.unstable_wrap(sourceFiber)),
thenable.then(sourceFiber, sourceFiber));
@@ -5528,21 +5532,21 @@ function throwException(
return;
case 1:
if (
((thenable = value),
(earliestTimeoutMs = root.type),
(startTimeMs = root.stateNode),
((earliestTimeoutMs = value),
(startTimeMs = root.type),
(sourceFiber = root.stateNode),
0 === (root.effectTag & 64) &&
("function" === typeof earliestTimeoutMs.getDerivedStateFromError ||
(null !== startTimeMs &&
"function" === typeof startTimeMs.componentDidCatch &&
("function" === typeof startTimeMs.getDerivedStateFromError ||
(null !== sourceFiber &&
"function" === typeof sourceFiber.componentDidCatch &&
(null === legacyErrorBoundariesThatAlreadyFailed ||
!legacyErrorBoundariesThatAlreadyFailed.has(startTimeMs)))))
!legacyErrorBoundariesThatAlreadyFailed.has(sourceFiber)))))
) {
root.effectTag |= 2048;
root.expirationTime = renderExpirationTime;
renderExpirationTime = createClassErrorUpdate(
root,
thenable,
earliestTimeoutMs,
renderExpirationTime
);
enqueueCapturedUpdate(root, renderExpirationTime);
@@ -5583,6 +5587,8 @@ function unwindWork(workInProgress) {
workInProgress)
: null
);
case 18:
return null;
case 4:
return popHostContainer(workInProgress), null;
case 10:
@@ -5927,6 +5933,7 @@ function commitPassiveEffects(root, firstEffect) {
isRendering = previousIsRendering;
previousIsRendering = root.expirationTime;
0 !== previousIsRendering && requestWork(root, previousIsRendering);
isBatchingUpdates || isRendering || performWork(1073741823, !1);
}
function flushPassiveEffects() {
if (null !== passiveEffectCallbackHandle) {
@@ -6241,6 +6248,8 @@ function completeUnitOfWork(workInProgress) {
case 17:
isContextProvider(current$$1.type) && popContext(current$$1);
break;
case 18:
break;
default:
invariant(
!1,
@@ -6387,7 +6396,7 @@ function renderRoot(root, isYieldy) {
do {
try {
if (isYieldy)
for (; null !== nextUnitOfWork && !shouldYieldToRenderer(); )
for (; null !== nextUnitOfWork && !(frameDeadline <= now$1()); )
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
else
for (; null !== nextUnitOfWork; )
@@ -6680,7 +6689,7 @@ function onSuspend(
msUntilTimeout
) {
root.expirationTime = rootExpirationTime;
0 !== msUntilTimeout || shouldYieldToRenderer()
0 !== msUntilTimeout || frameDeadline <= now$1()
? 0 < msUntilTimeout &&
(root.timeoutHandle = scheduleTimeout(
onTimeout.bind(null, root, finishedWork, suspendedExpirationTime),
@@ -6780,27 +6789,19 @@ function findHighestPriorityRoot() {
nextFlushedRoot = highestPriorityRoot;
nextFlushedExpirationTime = highestPriorityWork;
}
var didYield = !1;
function shouldYieldToRenderer() {
return didYield ? !0 : frameDeadline <= now$1() ? (didYield = !0) : !1;
}
function performAsyncWork() {
try {
if (!shouldYieldToRenderer() && null !== firstScheduledRoot) {
recomputeCurrentRendererTime();
var root = firstScheduledRoot;
do {
var expirationTime = root.expirationTime;
0 !== expirationTime &&
currentRendererTime <= expirationTime &&
(root.nextExpirationTimeToWorkOn = currentRendererTime);
root = root.nextScheduledRoot;
} while (root !== firstScheduledRoot);
}
performWork(0, !0);
} finally {
didYield = !1;
function performAsyncWork(didTimeout) {
if (didTimeout && null !== firstScheduledRoot) {
recomputeCurrentRendererTime();
didTimeout = firstScheduledRoot;
do {
var expirationTime = didTimeout.expirationTime;
0 !== expirationTime &&
currentRendererTime <= expirationTime &&
(didTimeout.nextExpirationTimeToWorkOn = currentRendererTime);
didTimeout = didTimeout.nextScheduledRoot;
} while (didTimeout !== firstScheduledRoot);
}
performWork(0, !0);
}
function performWork(minExpirationTime, isYieldy) {
findHighestPriorityRoot();
@@ -6811,7 +6812,10 @@ function performWork(minExpirationTime, isYieldy) {
null !== nextFlushedRoot &&
0 !== nextFlushedExpirationTime &&
minExpirationTime <= nextFlushedExpirationTime &&
!(didYield && currentRendererTime > nextFlushedExpirationTime);
!(
frameDeadline <= now$1() &&
currentRendererTime > nextFlushedExpirationTime
);
)
performWorkOnRoot(
@@ -6879,7 +6883,7 @@ function performWorkOnRoot(root, expirationTime, isYieldy) {
renderRoot(root, isYieldy),
(_finishedWork = root.finishedWork),
null !== _finishedWork &&
(shouldYieldToRenderer()
(frameDeadline <= now$1()
? (root.finishedWork = _finishedWork)
: completeRoot$1(root, _finishedWork, expirationTime)));
} else
@@ -7120,18 +7124,20 @@ var roots = new Map(),
maybeInstance = findHostInstance(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig =
var nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
maybeInstance =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
viewConfig.validAttributes
maybeInstance.validAttributes
);
null != nativeProps &&
UIManager.updateView(
maybeInstance._nativeTag,
viewConfig.uiViewClassName,
nativeTag,
maybeInstance.uiViewClassName,
nativeProps
);
}
@@ -7140,6 +7146,21 @@ var roots = new Map(),
})(React.Component);
})(findNodeHandle, findHostInstance),
findNodeHandle: findNodeHandle,
setNativeProps: function(handle, nativeProps) {
null != handle._nativeTag &&
((nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
handle.viewConfig.validAttributes
)),
null != nativeProps &&
UIManager.updateView(
handle._nativeTag,
handle.viewConfig.uiViewClassName,
nativeProps
));
},
render: function(element, containerTag, callback) {
var root = roots.get(containerTag);
if (!root) {
@@ -7230,17 +7251,20 @@ var roots = new Map(),
maybeInstance = findHostInstance(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig;
var nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
maybeInstance =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
viewConfig.validAttributes
maybeInstance.validAttributes
);
null != nativeProps &&
UIManager.updateView(
maybeInstance._nativeTag,
viewConfig.uiViewClassName,
nativeTag,
maybeInstance.uiViewClassName,
nativeProps
);
}
@@ -7276,7 +7300,7 @@ var roots = new Map(),
findFiberByHostInstance: getInstanceFromInstance,
getInspectorDataForViewTag: getInspectorDataForViewTag,
bundleType: 0,
version: "16.8.1",
version: "16.8.3",
rendererPackageName: "react-native-renderer"
});
var ReactFabric$2 = { default: ReactFabric },
File diff suppressed because it is too large Load Diff
@@ -3224,6 +3224,8 @@ function updateReducer(reducer) {
is(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseUpdate === queue.last && (hook.baseState = newState);
queue.eagerReducer = reducer;
queue.eagerState = newState;
return [newState, _dispatch];
}
}
@@ -3544,6 +3546,8 @@ function tryHydrate(fiber, nextInstance) {
(nextInstance = shim$1(nextInstance, fiber.pendingProps)),
null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1
);
case 13:
return !1;
default:
return !1;
}
@@ -4607,19 +4611,19 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
null !== dependency &&
dependency.expirationTime < renderExpirationTime &&
(dependency.expirationTime = renderExpirationTime);
dependency = renderExpirationTime;
for (var node = oldValue.return; null !== node; ) {
dependency = node.alternate;
if (node.childExpirationTime < renderExpirationTime)
(node.childExpirationTime = renderExpirationTime),
null !== dependency &&
dependency.childExpirationTime <
renderExpirationTime &&
(dependency.childExpirationTime = renderExpirationTime);
var alternate = node.alternate;
if (node.childExpirationTime < dependency)
(node.childExpirationTime = dependency),
null !== alternate &&
alternate.childExpirationTime < dependency &&
(alternate.childExpirationTime = dependency);
else if (
null !== dependency &&
dependency.childExpirationTime < renderExpirationTime
null !== alternate &&
alternate.childExpirationTime < dependency
)
dependency.childExpirationTime = renderExpirationTime;
alternate.childExpirationTime = dependency;
else break;
node = node.return;
}
@@ -4749,12 +4753,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime
)
);
default:
invariant(
!1,
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
);
}
invariant(
!1,
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
);
}
var valueCursor = { current: null },
currentlyRenderingFiber = null,
@@ -5091,7 +5094,7 @@ function logCapturedError(capturedError) {
: Error("Unspecified error at:" + componentStack);
ExceptionsManager.handleException(error, !1);
}
var PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set;
var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set;
function logError(boundary, errorInfo) {
var source = errorInfo.source,
stack = errorInfo.stack;
@@ -5304,7 +5307,7 @@ function commitPlacement(finishedWork) {
parentFiber.sibling.return = parentFiber.return;
for (
parentFiber = parentFiber.sibling;
5 !== parentFiber.tag && 6 !== parentFiber.tag;
5 !== parentFiber.tag && 6 !== parentFiber.tag && 18 !== parentFiber.tag;
) {
if (parentFiber.effectTag & 2) continue b;
@@ -5548,9 +5551,9 @@ function commitWork(current$$1, finishedWork) {
finishedWork.updateQueue = null;
var retryCache = finishedWork.stateNode;
null === retryCache &&
(retryCache = finishedWork.stateNode = new PossiblyWeakSet());
(retryCache = finishedWork.stateNode = new PossiblyWeakSet$1());
instance.forEach(function(thenable) {
var retry = retryTimedOutBoundary.bind(null, finishedWork, thenable);
var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
retryCache.has(thenable) ||
(retryCache.add(thenable), thenable.then(retry, retry));
});
@@ -5635,6 +5638,8 @@ function unwindWork(workInProgress) {
workInProgress)
: null
);
case 18:
return null;
case 4:
return popHostContainer(workInProgress), null;
case 10:
@@ -5890,6 +5895,7 @@ function commitPassiveEffects(root, firstEffect) {
isRendering = previousIsRendering;
previousIsRendering = root.expirationTime;
0 !== previousIsRendering && requestWork(root, previousIsRendering);
isBatchingUpdates || isRendering || performWork(1073741823, !1);
}
function flushPassiveEffects() {
if (null !== passiveEffectCallbackHandle) {
@@ -6167,6 +6173,8 @@ function completeUnitOfWork(workInProgress) {
case 17:
isContextProvider(current$$1.type) && popContext(current$$1);
break;
case 18:
break;
default:
invariant(
!1,
@@ -6260,7 +6268,7 @@ function renderRoot(root$jscomp$0, isYieldy) {
do {
try {
if (isYieldy)
for (; null !== nextUnitOfWork && !shouldYieldToRenderer(); )
for (; null !== nextUnitOfWork && !(frameDeadline <= now$1()); )
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
else
for (; null !== nextUnitOfWork; )
@@ -6346,27 +6354,24 @@ function renderRoot(root$jscomp$0, isYieldy) {
sourceFiber$jscomp$0.expirationTime = 1073741823;
break a;
}
sourceFiber$jscomp$0 = root.pingCache;
null === sourceFiber$jscomp$0
? ((sourceFiber$jscomp$0 = root.pingCache = new PossiblyWeakMap()),
(returnFiber$jscomp$0 = new Set()),
sourceFiber$jscomp$0.set(thenable, returnFiber$jscomp$0))
: ((returnFiber$jscomp$0 = sourceFiber$jscomp$0.get(
thenable
)),
void 0 === returnFiber$jscomp$0 &&
((returnFiber$jscomp$0 = new Set()),
sourceFiber$jscomp$0.set(
thenable,
returnFiber$jscomp$0
)));
returnFiber$jscomp$0.has(returnFiber) ||
(returnFiber$jscomp$0.add(returnFiber),
sourceFiber$jscomp$0 = root;
returnFiber$jscomp$0 = returnFiber;
var pingCache = sourceFiber$jscomp$0.pingCache;
null === pingCache
? ((pingCache = sourceFiber$jscomp$0.pingCache = new PossiblyWeakMap()),
(current$$1 = new Set()),
pingCache.set(thenable, current$$1))
: ((current$$1 = pingCache.get(thenable)),
void 0 === current$$1 &&
((current$$1 = new Set()),
pingCache.set(thenable, current$$1)));
current$$1.has(returnFiber$jscomp$0) ||
(current$$1.add(returnFiber$jscomp$0),
(sourceFiber$jscomp$0 = pingSuspendedRoot.bind(
null,
root,
sourceFiber$jscomp$0,
thenable,
returnFiber
returnFiber$jscomp$0
)),
thenable.then(sourceFiber$jscomp$0, sourceFiber$jscomp$0));
-1 === earliestTimeoutMs
@@ -6410,24 +6415,25 @@ function renderRoot(root$jscomp$0, isYieldy) {
break a;
case 1:
if (
((thenable = value),
(earliestTimeoutMs = root.type),
(startTimeMs = root.stateNode),
((earliestTimeoutMs = value),
(startTimeMs = root.type),
(sourceFiber$jscomp$0 = root.stateNode),
0 === (root.effectTag & 64) &&
("function" ===
typeof earliestTimeoutMs.getDerivedStateFromError ||
(null !== startTimeMs &&
"function" === typeof startTimeMs.componentDidCatch &&
typeof startTimeMs.getDerivedStateFromError ||
(null !== sourceFiber$jscomp$0 &&
"function" ===
typeof sourceFiber$jscomp$0.componentDidCatch &&
(null === legacyErrorBoundariesThatAlreadyFailed ||
!legacyErrorBoundariesThatAlreadyFailed.has(
startTimeMs
sourceFiber$jscomp$0
)))))
) {
root.effectTag |= 2048;
root.expirationTime = returnFiber;
returnFiber = createClassErrorUpdate(
root,
thenable,
earliestTimeoutMs,
returnFiber
);
enqueueCapturedUpdate(root, returnFiber);
@@ -6604,7 +6610,7 @@ function pingSuspendedRoot(root, thenable, pingTime) {
0 !== pingTime && requestWork(root, pingTime);
}
}
function retryTimedOutBoundary(boundaryFiber, thenable) {
function resolveRetryThenable(boundaryFiber, thenable) {
var retryCache = boundaryFiber.stateNode;
null !== retryCache && retryCache.delete(thenable);
thenable = requestCurrentTime();
@@ -6701,7 +6707,7 @@ function onSuspend(
msUntilTimeout
) {
root.expirationTime = rootExpirationTime;
0 !== msUntilTimeout || shouldYieldToRenderer()
0 !== msUntilTimeout || frameDeadline <= now$1()
? 0 < msUntilTimeout &&
(root.timeoutHandle = scheduleTimeout(
onTimeout.bind(null, root, finishedWork, suspendedExpirationTime),
@@ -6801,27 +6807,19 @@ function findHighestPriorityRoot() {
nextFlushedRoot = highestPriorityRoot;
nextFlushedExpirationTime = highestPriorityWork;
}
var didYield = !1;
function shouldYieldToRenderer() {
return didYield ? !0 : frameDeadline <= now$1() ? (didYield = !0) : !1;
}
function performAsyncWork() {
try {
if (!shouldYieldToRenderer() && null !== firstScheduledRoot) {
recomputeCurrentRendererTime();
var root = firstScheduledRoot;
do {
var expirationTime = root.expirationTime;
0 !== expirationTime &&
currentRendererTime <= expirationTime &&
(root.nextExpirationTimeToWorkOn = currentRendererTime);
root = root.nextScheduledRoot;
} while (root !== firstScheduledRoot);
}
performWork(0, !0);
} finally {
didYield = !1;
function performAsyncWork(didTimeout) {
if (didTimeout && null !== firstScheduledRoot) {
recomputeCurrentRendererTime();
didTimeout = firstScheduledRoot;
do {
var expirationTime = didTimeout.expirationTime;
0 !== expirationTime &&
currentRendererTime <= expirationTime &&
(didTimeout.nextExpirationTimeToWorkOn = currentRendererTime);
didTimeout = didTimeout.nextScheduledRoot;
} while (didTimeout !== firstScheduledRoot);
}
performWork(0, !0);
}
function performWork(minExpirationTime, isYieldy) {
findHighestPriorityRoot();
@@ -6832,7 +6830,10 @@ function performWork(minExpirationTime, isYieldy) {
null !== nextFlushedRoot &&
0 !== nextFlushedExpirationTime &&
minExpirationTime <= nextFlushedExpirationTime &&
!(didYield && currentRendererTime > nextFlushedExpirationTime);
!(
frameDeadline <= now$1() &&
currentRendererTime > nextFlushedExpirationTime
);
)
performWorkOnRoot(
@@ -6900,7 +6901,7 @@ function performWorkOnRoot(root, expirationTime, isYieldy) {
renderRoot(root, isYieldy),
(_finishedWork = root.finishedWork),
null !== _finishedWork &&
(shouldYieldToRenderer()
(frameDeadline <= now$1()
? (root.finishedWork = _finishedWork)
: completeRoot(root, _finishedWork, expirationTime)));
} else
@@ -7141,18 +7142,20 @@ var roots = new Map(),
maybeInstance = findHostInstance(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig =
var nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
maybeInstance =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
viewConfig.validAttributes
maybeInstance.validAttributes
);
null != nativeProps &&
UIManager.updateView(
maybeInstance._nativeTag,
viewConfig.uiViewClassName,
nativeTag,
maybeInstance.uiViewClassName,
nativeProps
);
}
@@ -7161,6 +7164,21 @@ var roots = new Map(),
})(React.Component);
})(findNodeHandle, findHostInstance),
findNodeHandle: findNodeHandle,
setNativeProps: function(handle, nativeProps) {
null != handle._nativeTag &&
((nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
handle.viewConfig.validAttributes
)),
null != nativeProps &&
UIManager.updateView(
handle._nativeTag,
handle.viewConfig.uiViewClassName,
nativeProps
));
},
render: function(element, containerTag, callback) {
var root = roots.get(containerTag);
if (!root) {
@@ -7251,17 +7269,20 @@ var roots = new Map(),
maybeInstance = findHostInstance(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig;
var nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
maybeInstance =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
viewConfig.validAttributes
maybeInstance.validAttributes
);
null != nativeProps &&
UIManager.updateView(
maybeInstance._nativeTag,
viewConfig.uiViewClassName,
nativeTag,
maybeInstance.uiViewClassName,
nativeProps
);
}
@@ -7302,7 +7323,7 @@ var roots = new Map(),
findFiberByHostInstance: getInstanceFromTag,
getInspectorDataForViewTag: getInspectorDataForViewTag,
bundleType: 0,
version: "16.8.1",
version: "16.8.3",
rendererPackageName: "react-native-renderer"
});
var ReactNativeRenderer$2 = { default: ReactNativeRenderer },
@@ -3244,6 +3244,8 @@ function updateReducer(reducer) {
is(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseUpdate === queue.last && (hook.baseState = newState);
queue.eagerReducer = reducer;
queue.eagerState = newState;
return [newState, _dispatch];
}
}
@@ -3574,6 +3576,8 @@ function tryHydrate(fiber, nextInstance) {
(nextInstance = shim$1(nextInstance, fiber.pendingProps)),
null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1
);
case 13:
return !1;
default:
return !1;
}
@@ -4680,19 +4684,19 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
null !== dependency &&
dependency.expirationTime < renderExpirationTime &&
(dependency.expirationTime = renderExpirationTime);
dependency = renderExpirationTime;
for (var node = oldValue.return; null !== node; ) {
dependency = node.alternate;
if (node.childExpirationTime < renderExpirationTime)
(node.childExpirationTime = renderExpirationTime),
null !== dependency &&
dependency.childExpirationTime <
renderExpirationTime &&
(dependency.childExpirationTime = renderExpirationTime);
var alternate = node.alternate;
if (node.childExpirationTime < dependency)
(node.childExpirationTime = dependency),
null !== alternate &&
alternate.childExpirationTime < dependency &&
(alternate.childExpirationTime = dependency);
else if (
null !== dependency &&
dependency.childExpirationTime < renderExpirationTime
null !== alternate &&
alternate.childExpirationTime < dependency
)
dependency.childExpirationTime = renderExpirationTime;
alternate.childExpirationTime = dependency;
else break;
node = node.return;
}
@@ -4822,12 +4826,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime
)
);
default:
invariant(
!1,
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
);
}
invariant(
!1,
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
);
}
var valueCursor = { current: null },
currentlyRenderingFiber = null,
@@ -5164,7 +5167,7 @@ function logCapturedError(capturedError) {
: Error("Unspecified error at:" + componentStack);
ExceptionsManager.handleException(error, !1);
}
var PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set;
var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set;
function logError(boundary, errorInfo) {
var source = errorInfo.source,
stack = errorInfo.stack;
@@ -5377,7 +5380,7 @@ function commitPlacement(finishedWork) {
parentFiber.sibling.return = parentFiber.return;
for (
parentFiber = parentFiber.sibling;
5 !== parentFiber.tag && 6 !== parentFiber.tag;
5 !== parentFiber.tag && 6 !== parentFiber.tag && 18 !== parentFiber.tag;
) {
if (parentFiber.effectTag & 2) continue b;
@@ -5621,9 +5624,9 @@ function commitWork(current$$1, finishedWork) {
finishedWork.updateQueue = null;
var retryCache = finishedWork.stateNode;
null === retryCache &&
(retryCache = finishedWork.stateNode = new PossiblyWeakSet());
(retryCache = finishedWork.stateNode = new PossiblyWeakSet$1());
instance.forEach(function(thenable) {
var retry = retryTimedOutBoundary.bind(null, finishedWork, thenable);
var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
retry = tracing.unstable_wrap(retry);
retryCache.has(thenable) ||
(retryCache.add(thenable), thenable.then(retry, retry));
@@ -5740,22 +5743,23 @@ function throwException(
sourceFiber.expirationTime = 1073741823;
return;
}
sourceFiber = root.pingCache;
null === sourceFiber
? ((sourceFiber = root.pingCache = new PossiblyWeakMap()),
(returnFiber = new Set()),
sourceFiber.set(thenable, returnFiber))
: ((returnFiber = sourceFiber.get(thenable)),
void 0 === returnFiber &&
((returnFiber = new Set()),
sourceFiber.set(thenable, returnFiber)));
returnFiber.has(renderExpirationTime) ||
(returnFiber.add(renderExpirationTime),
sourceFiber = root;
returnFiber = renderExpirationTime;
var pingCache = sourceFiber.pingCache;
null === pingCache
? ((pingCache = sourceFiber.pingCache = new PossiblyWeakMap()),
(current$$1 = new Set()),
pingCache.set(thenable, current$$1))
: ((current$$1 = pingCache.get(thenable)),
void 0 === current$$1 &&
((current$$1 = new Set()), pingCache.set(thenable, current$$1)));
current$$1.has(returnFiber) ||
(current$$1.add(returnFiber),
(sourceFiber = pingSuspendedRoot.bind(
null,
root,
sourceFiber,
thenable,
renderExpirationTime
returnFiber
)),
(sourceFiber = tracing.unstable_wrap(sourceFiber)),
thenable.then(sourceFiber, sourceFiber));
@@ -5803,21 +5807,21 @@ function throwException(
return;
case 1:
if (
((thenable = value),
(earliestTimeoutMs = root.type),
(startTimeMs = root.stateNode),
((earliestTimeoutMs = value),
(startTimeMs = root.type),
(sourceFiber = root.stateNode),
0 === (root.effectTag & 64) &&
("function" === typeof earliestTimeoutMs.getDerivedStateFromError ||
(null !== startTimeMs &&
"function" === typeof startTimeMs.componentDidCatch &&
("function" === typeof startTimeMs.getDerivedStateFromError ||
(null !== sourceFiber &&
"function" === typeof sourceFiber.componentDidCatch &&
(null === legacyErrorBoundariesThatAlreadyFailed ||
!legacyErrorBoundariesThatAlreadyFailed.has(startTimeMs)))))
!legacyErrorBoundariesThatAlreadyFailed.has(sourceFiber)))))
) {
root.effectTag |= 2048;
root.expirationTime = renderExpirationTime;
renderExpirationTime = createClassErrorUpdate(
root,
thenable,
earliestTimeoutMs,
renderExpirationTime
);
enqueueCapturedUpdate(root, renderExpirationTime);
@@ -5858,6 +5862,8 @@ function unwindWork(workInProgress) {
workInProgress)
: null
);
case 18:
return null;
case 4:
return popHostContainer(workInProgress), null;
case 10:
@@ -6132,6 +6138,7 @@ function commitPassiveEffects(root, firstEffect) {
isRendering = previousIsRendering;
previousIsRendering = root.expirationTime;
0 !== previousIsRendering && requestWork(root, previousIsRendering);
isBatchingUpdates || isRendering || performWork(1073741823, !1);
}
function flushPassiveEffects() {
if (null !== passiveEffectCallbackHandle) {
@@ -6453,6 +6460,8 @@ function completeUnitOfWork(workInProgress) {
case 17:
isContextProvider(current$$1.type) && popContext(current$$1);
break;
case 18:
break;
default:
invariant(
!1,
@@ -6607,7 +6616,7 @@ function renderRoot(root, isYieldy) {
do {
try {
if (isYieldy)
for (; null !== nextUnitOfWork && !shouldYieldToRenderer(); )
for (; null !== nextUnitOfWork && !(frameDeadline <= now$1()); )
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
else
for (; null !== nextUnitOfWork; )
@@ -6788,7 +6797,7 @@ function pingSuspendedRoot(root, thenable, pingTime) {
0 !== pingTime && requestWork(root, pingTime);
}
}
function retryTimedOutBoundary(boundaryFiber, thenable) {
function resolveRetryThenable(boundaryFiber, thenable) {
var retryCache = boundaryFiber.stateNode;
null !== retryCache && retryCache.delete(thenable);
thenable = requestCurrentTime();
@@ -6911,7 +6920,7 @@ function onSuspend(
msUntilTimeout
) {
root.expirationTime = rootExpirationTime;
0 !== msUntilTimeout || shouldYieldToRenderer()
0 !== msUntilTimeout || frameDeadline <= now$1()
? 0 < msUntilTimeout &&
(root.timeoutHandle = scheduleTimeout(
onTimeout.bind(null, root, finishedWork, suspendedExpirationTime),
@@ -7011,27 +7020,19 @@ function findHighestPriorityRoot() {
nextFlushedRoot = highestPriorityRoot;
nextFlushedExpirationTime = highestPriorityWork;
}
var didYield = !1;
function shouldYieldToRenderer() {
return didYield ? !0 : frameDeadline <= now$1() ? (didYield = !0) : !1;
}
function performAsyncWork() {
try {
if (!shouldYieldToRenderer() && null !== firstScheduledRoot) {
recomputeCurrentRendererTime();
var root = firstScheduledRoot;
do {
var expirationTime = root.expirationTime;
0 !== expirationTime &&
currentRendererTime <= expirationTime &&
(root.nextExpirationTimeToWorkOn = currentRendererTime);
root = root.nextScheduledRoot;
} while (root !== firstScheduledRoot);
}
performWork(0, !0);
} finally {
didYield = !1;
function performAsyncWork(didTimeout) {
if (didTimeout && null !== firstScheduledRoot) {
recomputeCurrentRendererTime();
didTimeout = firstScheduledRoot;
do {
var expirationTime = didTimeout.expirationTime;
0 !== expirationTime &&
currentRendererTime <= expirationTime &&
(didTimeout.nextExpirationTimeToWorkOn = currentRendererTime);
didTimeout = didTimeout.nextScheduledRoot;
} while (didTimeout !== firstScheduledRoot);
}
performWork(0, !0);
}
function performWork(minExpirationTime, isYieldy) {
findHighestPriorityRoot();
@@ -7042,7 +7043,10 @@ function performWork(minExpirationTime, isYieldy) {
null !== nextFlushedRoot &&
0 !== nextFlushedExpirationTime &&
minExpirationTime <= nextFlushedExpirationTime &&
!(didYield && currentRendererTime > nextFlushedExpirationTime);
!(
frameDeadline <= now$1() &&
currentRendererTime > nextFlushedExpirationTime
);
)
performWorkOnRoot(
@@ -7110,7 +7114,7 @@ function performWorkOnRoot(root, expirationTime, isYieldy) {
renderRoot(root, isYieldy),
(_finishedWork = root.finishedWork),
null !== _finishedWork &&
(shouldYieldToRenderer()
(frameDeadline <= now$1()
? (root.finishedWork = _finishedWork)
: completeRoot(root, _finishedWork, expirationTime)));
} else
@@ -7351,18 +7355,20 @@ var roots = new Map(),
maybeInstance = findHostInstance(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig =
var nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
maybeInstance =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
viewConfig.validAttributes
maybeInstance.validAttributes
);
null != nativeProps &&
UIManager.updateView(
maybeInstance._nativeTag,
viewConfig.uiViewClassName,
nativeTag,
maybeInstance.uiViewClassName,
nativeProps
);
}
@@ -7371,6 +7377,21 @@ var roots = new Map(),
})(React.Component);
})(findNodeHandle, findHostInstance),
findNodeHandle: findNodeHandle,
setNativeProps: function(handle, nativeProps) {
null != handle._nativeTag &&
((nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
handle.viewConfig.validAttributes
)),
null != nativeProps &&
UIManager.updateView(
handle._nativeTag,
handle.viewConfig.uiViewClassName,
nativeProps
));
},
render: function(element, containerTag, callback) {
var root = roots.get(containerTag);
if (!root) {
@@ -7466,17 +7487,20 @@ var roots = new Map(),
maybeInstance = findHostInstance(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig;
var nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
maybeInstance =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
nativeProps = diffProperties(
null,
emptyObject,
nativeProps,
viewConfig.validAttributes
maybeInstance.validAttributes
);
null != nativeProps &&
UIManager.updateView(
maybeInstance._nativeTag,
viewConfig.uiViewClassName,
nativeTag,
maybeInstance.uiViewClassName,
nativeProps
);
}
@@ -7517,7 +7541,7 @@ var roots = new Map(),
findFiberByHostInstance: getInstanceFromTag,
getInspectorDataForViewTag: getInspectorDataForViewTag,
bundleType: 0,
version: "16.8.1",
version: "16.8.3",
rendererPackageName: "react-native-renderer"
});
var ReactNativeRenderer$2 = { default: ReactNativeRenderer },
@@ -131,6 +131,7 @@ type SecretInternalsFabricType = {
export type ReactNativeType = {
NativeComponent: typeof ReactNativeComponent,
findNodeHandle(componentOrHandle: any): ?number,
setNativeProps(handle: any, nativeProps: Object): void,
render(
element: React$Element<any>,
containerTag: any,
@@ -146,6 +147,7 @@ export type ReactNativeType = {
export type ReactFabricType = {
NativeComponent: typeof ReactNativeComponent,
findNodeHandle(componentOrHandle: any): ?number,
setNativeProps(handle: any, nativeProps: Object): void,
render(
element: React$Element<any>,
containerTag: any,
+1 -1
View File
@@ -159,7 +159,7 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
}
// Shadow
if (!CGSizeEqualToSize(_textShadowOffset, CGSizeZero)) {
if (!isnan(_textShadowRadius)) {
NSShadow *shadow = [NSShadow new];
shadow.shadowOffset = _textShadowOffset;
shadow.shadowBlurRadius = _textShadowRadius;
+7
View File
@@ -35,6 +35,13 @@
return self;
}
- (void)didSetProps:(NSArray<NSString *> *)changedProps
{
[super didSetProps:changedProps];
self.textAttributes.opacity = NAN;
}
- (BOOL)isYogaLeafNode
{
return YES;
@@ -43,6 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL blurOnSubmit;
@property (nonatomic, assign) BOOL selectTextOnFocus;
@property (nonatomic, assign) BOOL clearTextOnFocus;
@property (nonatomic, assign) BOOL secureTextEntry;
@property (nonatomic, copy) RCTTextSelection *selection;
@property (nonatomic, strong, nullable) NSNumber *maxLength;
@property (nonatomic, copy) NSAttributedString *attributedText;
+81 -14
View File
@@ -141,9 +141,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
[attributedTextCopy removeAttribute:RCTTextAttributesTagAttributeName
range:NSMakeRange(0, attributedTextCopy.length)];
textNeedsUpdate = ([self textOf:attributedTextCopy equals:backedTextInputViewTextCopy] == NO);
if (eventLag == 0 && textNeedsUpdate) {
UITextRange *selection = self.backedTextInputView.selectedTextRange;
NSInteger oldTextLength = self.backedTextInputView.attributedText.string.length;
@@ -203,9 +203,65 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
{
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
if (@available(iOS 10.0, *)) {
static dispatch_once_t onceToken;
static NSDictionary<NSString *, NSString *> *contentTypeMap;
dispatch_once(&onceToken, ^{
contentTypeMap = @{@"none": @"",
@"URL": UITextContentTypeURL,
@"addressCity": UITextContentTypeAddressCity,
@"addressCityAndState":UITextContentTypeAddressCityAndState,
@"addressState": UITextContentTypeAddressState,
@"countryName": UITextContentTypeCountryName,
@"creditCardNumber": UITextContentTypeCreditCardNumber,
@"emailAddress": UITextContentTypeEmailAddress,
@"familyName": UITextContentTypeFamilyName,
@"fullStreetAddress": UITextContentTypeFullStreetAddress,
@"givenName": UITextContentTypeGivenName,
@"jobTitle": UITextContentTypeJobTitle,
@"location": UITextContentTypeLocation,
@"middleName": UITextContentTypeMiddleName,
@"name": UITextContentTypeName,
@"namePrefix": UITextContentTypeNamePrefix,
@"nameSuffix": UITextContentTypeNameSuffix,
@"nickname": UITextContentTypeNickname,
@"organizationName": UITextContentTypeOrganizationName,
@"postalCode": UITextContentTypePostalCode,
@"streetAddressLine1": UITextContentTypeStreetAddressLine1,
@"streetAddressLine2": UITextContentTypeStreetAddressLine2,
@"sublocality": UITextContentTypeSublocality,
@"telephoneNumber": UITextContentTypeTelephoneNumber,
};
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
if (@available(iOS 11.0, tvOS 11.0, *)) {
NSDictionary<NSString *, NSString *> * iOS11extras = @{@"username": UITextContentTypeUsername,
@"password": UITextContentTypePassword};
NSMutableDictionary<NSString *, NSString *> * iOS11baseMap = [contentTypeMap mutableCopy];
[iOS11baseMap addEntriesFromDictionary:iOS11extras];
contentTypeMap = [iOS11baseMap copy];
}
#endif
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 /* __IPHONE_12_0 */
if (@available(iOS 12.0, tvOS 12.0, *)) {
NSDictionary<NSString *, NSString *> * iOS12extras = @{@"newPassword": UITextContentTypeNewPassword,
@"oneTimeCode": UITextContentTypeOneTimeCode};
NSMutableDictionary<NSString *, NSString *> * iOS12baseMap = [contentTypeMap mutableCopy];
[iOS12baseMap addEntriesFromDictionary:iOS12extras];
contentTypeMap = [iOS12baseMap copy];
}
#endif
});
// Setting textContentType to an empty string will disable any
// default behaviour, like the autofill bar for password inputs
self.backedTextInputView.textContentType = [type isEqualToString:@"none"] ? @"" : type;
self.backedTextInputView.textContentType = contentTypeMap[type] ?: type;
}
#endif
}
@@ -227,6 +283,24 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
}
}
- (BOOL)secureTextEntry {
return self.backedTextInputView.secureTextEntry;
}
- (void)setSecureTextEntry:(BOOL)secureTextEntry {
UIView<RCTBackedTextInputViewProtocol> *textInputView = self.backedTextInputView;
if (textInputView.secureTextEntry != secureTextEntry) {
textInputView.secureTextEntry = secureTextEntry;
// Fix #5859, see https://stackoverflow.com/questions/14220187/uitextfield-has-trailing-whitespace-after-securetextentry-toggle/22537788#22537788
NSAttributedString *originalText = [textInputView.attributedText copy];
self.backedTextInputView.attributedText = [NSAttributedString new];
self.backedTextInputView.attributedText = originalText;
}
}
#pragma mark - RCTBackedTextInputDelegate
- (BOOL)textInputShouldBeginEditing
@@ -330,18 +404,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
}
}
if (range.location + range.length > _predictedText.length) {
// _predictedText got out of sync in a bad way, so let's just force sync it. Haven't been able to repro this, but
// it's causing a real crash here: #6523822
NSString *previousText = backedTextInputView.attributedText.string ?: @"";
if (range.location + range.length > backedTextInputView.attributedText.string.length) {
_predictedText = backedTextInputView.attributedText.string;
}
NSString *previousText = [_predictedText substringWithRange:range] ?: @"";
if (!_predictedText || backedTextInputView.attributedText.string.length == 0) {
_predictedText = text;
} else {
_predictedText = [_predictedText stringByReplacingCharactersInRange:range withString:text];
_predictedText = [backedTextInputView.attributedText.string stringByReplacingCharactersInRange:range withString:text];
}
if (_onTextInput) {
@@ -376,7 +444,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
[self textInputShouldChangeTextInRange:predictionRange replacementText:replacement];
// JS will assume the selection changed based on the location of our shouldChangeTextInRange, so reset it.
[self textInputDidChangeSelection];
_predictedText = backedTextInputView.attributedText.string;
}
_nativeEventCount++;
@@ -43,12 +43,12 @@ RCT_REMAP_VIEW_PROPERTY(keyboardAppearance, backedTextInputView.keyboardAppearan
RCT_REMAP_VIEW_PROPERTY(placeholder, backedTextInputView.placeholder, NSString)
RCT_REMAP_VIEW_PROPERTY(placeholderTextColor, backedTextInputView.placeholderColor, UIColor)
RCT_REMAP_VIEW_PROPERTY(returnKeyType, backedTextInputView.returnKeyType, UIReturnKeyType)
RCT_REMAP_VIEW_PROPERTY(secureTextEntry, backedTextInputView.secureTextEntry, BOOL)
RCT_REMAP_VIEW_PROPERTY(selectionColor, backedTextInputView.tintColor, UIColor)
RCT_REMAP_VIEW_PROPERTY(spellCheck, backedTextInputView.spellCheckingType, UITextSpellCheckingType)
RCT_REMAP_VIEW_PROPERTY(caretHidden, backedTextInputView.caretHidden, BOOL)
RCT_REMAP_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode)
RCT_REMAP_VIEW_PROPERTY(scrollEnabled, backedTextInputView.scrollEnabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(secureTextEntry, BOOL)
RCT_EXPORT_VIEW_PROPERTY(blurOnSubmit, BOOL)
RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL)
RCT_EXPORT_VIEW_PROPERTY(keyboardType, UIKeyboardType)
@@ -14,7 +14,6 @@
@implementation RCTUITextField {
RCTBackedTextFieldDelegateAdapter *_textInputDelegateAdapter;
NSMutableAttributedString *_attributesHolder;
}
- (instancetype)initWithFrame:(CGRect)frame
@@ -26,7 +25,6 @@
object:self];
_textInputDelegateAdapter = [[RCTBackedTextFieldDelegateAdapter alloc] initWithTextField:self];
_attributesHolder = [[NSMutableAttributedString alloc] init];
}
return self;
@@ -119,48 +117,6 @@
return [super caretRectForPosition:position];
}
#pragma mark - Fix for CJK Languages
/*
* The workaround to fix inputting complex locales (like CJK languages).
* When we use `setAttrbutedText:` while user is inputting text in a complex
* locale (like Chinese, Japanese or Korean), some internal state breaks and
* input stops working.
*
* To workaround that, we don't skip underlying attributedString in the text
* field if only attributes were changed. We keep track of these attributes in
* a local variable.
*
* There are two methods that are altered by this workaround:
*
* (1) `-setAttributedText:`
* Applies the attributed string change to a local variable `_attributesHolder` instead of calling `-[super setAttributedText:]`.
* If new attributed text differs from the existing one only in attributes,
* skips `-[super setAttributedText:`] completely.
*
* (2) `-attributedText`
* Return `_attributesHolder` context.
* Updates `_atributesHolder` before returning if the underlying `super.attributedText.string` was changed.
*
*/
- (void)setAttributedText:(NSAttributedString *)attributedText
{
BOOL textWasChanged = ![_attributesHolder.string isEqualToString:attributedText.string];
[_attributesHolder setAttributedString:attributedText];
if (textWasChanged) {
[super setAttributedText:attributedText];
}
}
- (NSAttributedString *)attributedText
{
if (![super.attributedText.string isEqualToString:_attributesHolder.string]) {
[_attributesHolder setAttributedString:super.attributedText];
}
return _attributesHolder;
}
#pragma mark - Positioning Overrides
@@ -148,9 +148,9 @@ static void my_os_log_error_impl(void *dso, os_log_t log, os_log_type_t type, co
{
__weak RCTSRWebSocket *socket = _socket;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// Only reconnect if the observer wasn't stoppped while we were waiting
if (socket) {
[self start];
[self start];
if (!socket) {
[self reconnect];
}
});
}
-3
View File
@@ -26,9 +26,6 @@ module.exports = (function(global, undefined) {
return global.Map;
}
// In case this module has not already been evaluated, import it now.
require('./_wrapObjectFreezeAndFriends');
const hasOwn = Object.prototype.hasOwnProperty;
/**
-39
View File
@@ -1,39 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @author Ben Newman (@benjamn) <ben@benjamn.com>
* @flow
* @format
*/
'use strict';
let testMap; // Initialized lazily.
function getTestMap() {
return testMap || (testMap = new (require('./Map'))());
}
// Wrap Object.{freeze,seal,preventExtensions} so each function adds its
// argument to a Map first, which gives our ./Map.js polyfill a chance to
// tag the object before it becomes non-extensible.
['freeze', 'seal', 'preventExtensions'].forEach(name => {
const method = Object[name];
if (typeof method === 'function') {
(Object: any)[name] = function(obj) {
try {
// If .set succeeds, also call .delete to avoid leaking memory.
getTestMap()
.set(obj, obj)
.delete(obj);
} finally {
// If .set fails, the exception will be silently swallowed
// by this return-from-finally statement, and the method will
// behave exactly as it did before it was wrapped.
return method.call(Object, obj);
}
};
}
});
+9 -1
View File
@@ -16,6 +16,8 @@ const EventSubscriptionVendor = require('EventSubscriptionVendor');
const invariant = require('invariant');
const sparseFilterPredicate = () => true;
/**
* @class EventEmitter
* @description
@@ -151,7 +153,13 @@ class EventEmitter {
listeners(eventType: string): [EmitterSubscription] {
const subscriptions = this._subscriber.getSubscriptionsForType(eventType);
return subscriptions
? subscriptions.map(subscription => subscription.listener)
? subscriptions
// We filter out missing entries because the array is sparse.
// "callbackfn is called only for elements of the array which actually
// exist; it is not called for missing elements of the array."
// https://www.ecma-international.org/ecma-262/9.0/index.html#sec-array.prototype.filter
.filter(sparseFilterPredicate)
.map(subscription => subscription.listener)
: [];
}
+1 -1
View File
@@ -1688,7 +1688,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n";
shellScript = "export EXTRA_PACKAGER_ARGS=\"--reactNativePath $SRCROOT/../\"\nexport NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n";
};
/* End PBXShellScriptBuildPhase section */
Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 KiB

After

Width:  |  Height:  |  Size: 309 KiB

+3 -2
View File
@@ -69,7 +69,8 @@ project.ext.react = [
bundleAssetName: "RNTesterApp.android.bundle",
entryFile: file("../../js/RNTesterApp.android.js"),
root: "$rootDir",
inputExcludes: ["android/**", "./**", ".gradle/**"]
inputExcludes: ["android/**", "./**", ".gradle/**"],
extraPackagerArgs: ["--reactNativePath", "$rootDir"]
]
apply from: "../../../react.gradle"
@@ -101,7 +102,7 @@ android {
defaultConfig {
applicationId "com.facebook.react.uiapp"
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
+9 -8
View File
@@ -27,33 +27,34 @@ describe('DatePickerIOS', () => {
it('Should change indicator with datetime picker', async () => {
await openExampleWithTitle('Date and time picker');
const testID = 'date-and-time';
const indicatorID = 'date-and-time-indicator';
const testElement = await element(
by.type('UIPickerView').withAncestor(by.id(testID)),
);
const indicator = await element(by.id(indicatorID));
const dateIndicator = await element(by.id('date-indicator'));
const timeIndicator = await element(by.id('time-indicator'));
await expect(testElement).toBeVisible();
await expect(indicator).toBeVisible();
await expect(dateIndicator).toBeVisible();
await expect(timeIndicator).toBeVisible();
await testElement.setColumnToValue(0, 'Dec 4');
await testElement.setColumnToValue(1, '4');
await testElement.setColumnToValue(2, '10');
await testElement.setColumnToValue(3, 'AM');
await expect(indicator).toHaveText('12/4/2005 4:10 AM');
await expect(dateIndicator).toHaveText('12/4/2005');
await expect(timeIndicator).toHaveText('4:10 AM');
});
it('Should change indicator with date-only picker', async () => {
await openExampleWithTitle('Date only');
await openExampleWithTitle('Date only picker');
const testID = 'date-only';
const indicatorID = 'date-and-time-indicator';
const testElement = await element(
by.type('UIPickerView').withAncestor(by.id(testID)),
);
const indicator = await element(by.id(indicatorID));
const indicator = await element(by.id('date-indicator'));
await expect(testElement).toBeVisible();
await expect(indicator).toBeVisible();
@@ -62,6 +63,6 @@ describe('DatePickerIOS', () => {
await testElement.setColumnToValue(1, '3');
await testElement.setColumnToValue(2, '2006');
await expect(indicator).toHaveText('11/3/2006 4:10 AM');
await expect(indicator).toHaveText('11/3/2006');
});
});
@@ -111,6 +111,31 @@ class AccessibilityAndroidExample extends React.Component {
</View>
</RNTesterBlock>
<RNTesterBlock title="Touchable with accessibilityRole = header">
<View
accessible={true}
accessibilityLabel="I'm a header, so I read it instead of embedded text."
accessibilityRole="header">
<Text style={{color: 'green'}}>This is</Text>
<Text style={{color: 'blue'}}>
nontouchable accessible view with label.
</Text>
</View>
</RNTesterBlock>
<RNTesterBlock title="Touchable with accessibilityRole = link">
<TouchableWithoutFeedback
onPress={() =>
ToastAndroid.show('Toasts work by default', ToastAndroid.SHORT)
}
accessibilityRole="link">
<View style={styles.embedded}>
<Text>Click me</Text>
<Text>Or not</Text>
</View>
</TouchableWithoutFeedback>
</RNTesterBlock>
<RNTesterBlock title="Touchable with accessibilityRole = button">
<TouchableWithoutFeedback
onPress={() =>
+13 -34
View File
@@ -12,11 +12,10 @@
const React = require('react');
const ReactNative = require('react-native');
const {DatePickerIOS, StyleSheet, Text, TextInput, View} = ReactNative;
const {DatePickerIOS, StyleSheet, Text, View} = ReactNative;
type State = {|
date: Date,
timeZoneOffsetInHours: number,
|};
type Props = {|
@@ -26,43 +25,25 @@ type Props = {|
class WithDatePickerData extends React.Component<Props, State> {
state = {
date: new Date(),
timeZoneOffsetInHours: (-1 * new Date().getTimezoneOffset()) / 60,
};
onDateChange = date => {
this.setState({date: date});
};
onTimezoneChange = event => {
const offset = parseInt(event.nativeEvent.text, 10);
if (isNaN(offset)) {
return;
}
this.setState({timeZoneOffsetInHours: offset});
};
render() {
// Ideally, the timezone input would be a picker rather than a
// text input, but we don't have any pickers yet :(
return (
<View>
<WithLabel label="Value:">
<Text testID="date-and-time-indicator">
{this.state.date.toLocaleDateString() +
' ' +
this.state.date.toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit',
})}
<Text testID="date-indicator">
{this.state.date.toLocaleDateString()}
</Text>
<Text testID="time-indicator">
{this.state.date.toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit',
})}
</Text>
</WithLabel>
<WithLabel label="Timezone:">
<TextInput
onChange={this.onTimezoneChange}
style={styles.textinput}
value={this.state.timeZoneOffsetInHours.toString()}
/>
<Text> hours from UTC</Text>
</WithLabel>
{this.props.children(this.state, this.onDateChange)}
</View>
@@ -124,7 +105,6 @@ exports.examples = [
testID="date-and-time"
date={state.date}
mode="datetime"
timeZoneOffsetInMinutes={state.timeZoneOffsetInHours * 60}
onDateChange={onDateChange}
/>
)}
@@ -142,7 +122,6 @@ exports.examples = [
testID="date-only"
date={state.date}
mode="date"
timeZoneOffsetInMinutes={state.timeZoneOffsetInHours * 60}
onDateChange={onDateChange}
/>
)}
@@ -151,16 +130,16 @@ exports.examples = [
},
},
{
title: 'Time only picker, 10-minute interval',
title: 'Picker with 20-minute interval',
render: function(): React.Element<any> {
return (
<WithDatePickerData>
{(state, onDateChange) => (
<DatePickerIOS
testID="time-only"
testID="date-and-time-with-interval"
date={state.date}
mode="time"
timeZoneOffsetInMinutes={state.timeZoneOffsetInHours * 60}
minuteInterval={20}
mode="datetime"
onDateChange={onDateChange}
/>
)}
+4
View File
@@ -54,6 +54,10 @@ class BasicSwitchExample extends React.Component<
<Switch
testID="on-off-initial-off"
onValueChange={value => this.setState({falseSwitchIsOn: value})}
trackColor={{
true: 'yellow',
false: 'purple',
}}
value={this.state.falseSwitchIsOn}
/>
<OnOffIndicator
+9 -1
View File
@@ -325,6 +325,12 @@ class TextExample extends React.Component<{}> {
right right right right right right right right right right right
right right
</Text>
<Text style={{textAlign: 'justify'}}>
justify (works when api level >= 26 otherwise fallbacks to "left"):
this text component{"'"}s contents are laid out with "textAlign:
justify" and as you can see all of the lines except the last one
span the available width of the parent container.
</Text>
</RNTesterBlock>
<RNTesterBlock title="Unicode">
<View>
@@ -615,11 +621,13 @@ class TextExample extends React.Component<{}> {
Works with other text styles
</Text>
</RNTesterBlock>
<RNTesterBlock title="Substring Emoji (should only see 'test')">
<Text>{'test🙃'.substring(0, 5)}</Text>
</RNTesterBlock>
</RNTesterPage>
);
}
}
const styles = StyleSheet.create({
backgroundColorText: {
left: 5,
+6
View File
@@ -428,6 +428,12 @@ exports.examples = [
);
},
},
{
title: "Substring Emoji (should only see 'test')",
render: function() {
return <Text>{'test🙃'.substring(0, 5)}</Text>;
},
},
{
title: 'Text metrics',
render: function() {
+40 -1
View File
@@ -212,7 +212,11 @@ class SecureEntryExample extends React.Component<$FlowFixMeProps, any> {
* comment and run Flow. */
constructor(props) {
super(props);
this.state = {text: ''};
this.state = {
text: '',
password: '',
isSecureTextEntry: true,
};
}
render() {
return (
@@ -225,6 +229,26 @@ class SecureEntryExample extends React.Component<$FlowFixMeProps, any> {
value={this.state.text}
/>
<Text>Current text is: {this.state.text}</Text>
<View
style={{
flex: 1,
flexDirection: 'row',
}}>
<TextInput
style={styles.default}
defaultValue="cde"
onChangeText={text => this.setState({password: text})}
secureTextEntry={this.state.isSecureTextEntry}
value={this.state.password}
/>
<Switch
onValueChange={value => {
this.setState({isSecureTextEntry: value});
}}
style={{marginLeft: 4}}
value={this.state.isSecureTextEntry}
/>
</View>
</View>
);
}
@@ -1085,4 +1109,19 @@ exports.examples = [
);
},
},
{
title: 'Text Content Type',
render: function() {
return (
<View>
<WithLabel label="emailAddress">
<TextInput textContentType="emailAddress" style={styles.default} />
</WithLabel>
<WithLabel label="name">
<TextInput textContentType="name" style={styles.default} />
</WithLabel>
</View>
);
},
},
];
+7
View File
@@ -66,6 +66,7 @@ Pod::Spec.new do |s|
"React/Views/RCTSlider*",
"React/Views/RCTSwitch*",
"React/Views/RCTWebView*"
ss.compiler_flags = folly_compiler_flags
ss.header_dir = "React"
ss.framework = "JavaScriptCore"
ss.libraries = "stdc++"
@@ -116,6 +117,8 @@ Pod::Spec.new do |s|
ss.dependency "React/cxxreact"
ss.dependency "React/jsi"
ss.dependency "Folly", folly_version
ss.dependency "DoubleConversion"
ss.dependency "glog"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/jsiexecutor/jsireact/*.{cpp,h}"
ss.private_header_files = "ReactCommon/jsiexecutor/jsireact/*.h"
@@ -125,6 +128,8 @@ Pod::Spec.new do |s|
s.subspec "jsi" do |ss|
ss.dependency "Folly", folly_version
ss.dependency "DoubleConversion"
ss.dependency "glog"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/jsi/*.{cpp,h}"
ss.private_header_files = "ReactCommon/jsi/*.h"
@@ -142,6 +147,8 @@ Pod::Spec.new do |s|
ss.dependency "React/jsinspector"
ss.dependency "boost-for-react-native", "1.63.0"
ss.dependency "Folly", folly_version
ss.dependency "DoubleConversion"
ss.dependency "glog"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}"
ss.exclude_files = "ReactCommon/cxxreact/SampleCxxModule.*"
+2
View File
@@ -292,6 +292,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
* Any thread
*/
dispatch_async(dispatch_get_main_queue(), ^{
// WARNING: Invalidation is async, so it may not finish before re-setting up the bridge,
// causing some issues. TODO: revisit this post-Fabric/TurboModule.
[self invalidate];
// Reload is a special case, do not preserve launchOptions and treat reload as a fresh start
self->_launchOptions = nil;
+12 -1
View File
@@ -73,6 +73,17 @@ RCT_EXTERN void RCTRegisterModule(Class); \
+ (NSString *)moduleName { return @#js_name; } \
+ (void)load { RCTRegisterModule(self); }
/**
* Same as RCT_EXPORT_MODULE, but uses __attribute__((constructor)) for module
* registration. Useful for registering swift classes that forbids use of load
* Used in RCT_EXTERN_REMAP_MODULE
*/
#define RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name) \
RCT_EXTERN void RCTRegisterModule(Class); \
+ (NSString *)moduleName { return @#js_name; } \
__attribute__((constructor)) static void \
RCT_CONCAT(initialize_, objc_name)() { RCTRegisterModule([objc_name class]); }
/**
* To improve startup performance users may want to generate their module lists
* at build time and hook the delegate to merge with the runtime list. This
@@ -250,7 +261,7 @@ RCT_EXTERN void RCTRegisterModule(Class); \
@interface objc_name (RCTExternModule) <RCTBridgeModule> \
@end \
@implementation objc_name (RCTExternModule) \
RCT_EXPORT_MODULE(js_name)
RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name)
/**
* Use this macro in accordance with RCT_EXTERN_MODULE to export methods
+10 -1
View File
@@ -53,12 +53,21 @@ RCT_NUMBER_CONVERTER(NSUInteger, unsignedIntegerValue)
RCT_JSON_CONVERTER(NSArray)
RCT_JSON_CONVERTER(NSDictionary)
RCT_JSON_CONVERTER(NSString)
RCT_JSON_CONVERTER(NSNumber)
RCT_CUSTOM_CONVERTER(NSSet *, NSSet, [NSSet setWithArray:json])
RCT_CUSTOM_CONVERTER(NSData *, NSData, [json dataUsingEncoding:NSUTF8StringEncoding])
+ (NSString *)NSString:(id)json
{
if ([json isKindOfClass:NSString.class]) {
return json;
} else if (json && json != (id)kCFNull) {
return [NSString stringWithFormat:@"%@",json];
}
return nil;
}
+ (NSIndexSet *)NSIndexSet:(id)json
{
json = [self NSNumberArray:json];
+4 -6
View File
@@ -708,13 +708,11 @@ UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL)
if (!image) {
// Attempt to load from the file system
NSData *fileData;
if (imageURL.pathExtension.length == 0) {
fileData = [NSData dataWithContentsOfURL:[imageURL URLByAppendingPathExtension:@"png"]];
} else {
fileData = [NSData dataWithContentsOfURL:imageURL];
NSString *filePath = [NSString stringWithUTF8String:[imageURL fileSystemRepresentation]];
if (filePath.pathExtension.length == 0) {
filePath = [filePath stringByAppendingPathExtension:@"png"];
}
image = [UIImage imageWithData:fileData];
image = [UIImage imageWithContentsOfFile:filePath];
}
if (!image && !bundle) {
+2 -2
View File
@@ -21,8 +21,8 @@ static void __makeVersion()
{
__rnVersion = @{
RCTVersionMajor: @(0),
RCTVersionMinor: @(0),
RCTVersionPatch: @(0),
RCTVersionMinor: @(59),
RCTVersionPatch: @(8),
RCTVersionPrerelease: [NSNull null],
};
}
+3 -1
View File
@@ -357,7 +357,9 @@ struct RCTInstanceCallback : public InstanceCallback {
dispatch_group_leave(prepareBridge);
} onProgress:^(RCTLoadingProgress *progressData) {
#if RCT_DEV && __has_include("RCTDevLoadingView.h")
RCTDevLoadingView *loadingView = [weakSelf moduleForClass:[RCTDevLoadingView class]];
// Note: RCTDevLoadingView should have been loaded at this point, so no need to allow lazy loading.
RCTDevLoadingView *loadingView = [weakSelf moduleForName:RCTBridgeModuleNameForClass([RCTDevLoadingView class])
lazilyLoadIfNecessary:NO];
[loadingView updateProgress:progressData];
#endif
}];
@@ -201,7 +201,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
[self abort:@"Websocket exception"
withCause:error];
}
if (!_closed) {
if (!_closed && [error code] != ECONNREFUSED) {
[self reconnect];
}
}
+44 -4
View File
@@ -16,6 +16,7 @@
@implementation RCTDeviceInfo {
#if !TARGET_OS_TV
UIInterfaceOrientation _currentInterfaceOrientation;
NSDictionary *_currentInterfaceDimensions;
#endif
}
@@ -48,6 +49,13 @@ RCT_EXPORT_MODULE()
selector:@selector(interfaceOrientationDidChange)
name:UIApplicationDidChangeStatusBarOrientationNotification
object:nil];
_currentInterfaceDimensions = RCTExportedDimensions(_bridge);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(interfaceFrameDidChange)
name:UIApplicationDidBecomeActiveNotification
object:nil];
#endif
}
@@ -77,16 +85,23 @@ static NSDictionary *RCTExportedDimensions(RCTBridge *bridge)
RCTAssertMainQueue();
RCTDimensions dimensions = RCTGetDimensions(bridge.accessibilityManager.multiplier);
typeof (dimensions.window) window = dimensions.window; // Window and Screen are considered equal for iOS.
NSDictionary<NSString *, NSNumber *> *dims = @{
typeof (dimensions.window) window = dimensions.window;
NSDictionary<NSString *, NSNumber *> *dimsWindow = @{
@"width": @(window.width),
@"height": @(window.height),
@"scale": @(window.scale),
@"fontScale": @(window.fontScale)
};
typeof (dimensions.screen) screen = dimensions.screen;
NSDictionary<NSString *, NSNumber *> *dimsScreen = @{
@"width": @(screen.width),
@"height": @(screen.height),
@"scale": @(screen.scale),
@"fontScale": @(screen.fontScale)
};
return @{
@"window": dims,
@"screen": dims
@"window": dimsWindow,
@"screen": dimsScreen
};
}
@@ -163,6 +178,31 @@ static NSDictionary *RCTExportedDimensions(RCTBridge *bridge)
_currentInterfaceOrientation = nextOrientation;
}
- (void)interfaceFrameDidChange
{
__weak typeof(self) weakSelf = self;
RCTExecuteOnMainQueue(^{
[weakSelf _interfaceFrameDidChange];
});
}
- (void)_interfaceFrameDidChange
{
NSDictionary *nextInterfaceDimensions = RCTExportedDimensions(_bridge);
if (!([nextInterfaceDimensions isEqual:_currentInterfaceDimensions])) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[_bridge.eventDispatcher sendDeviceEventWithName:@"didUpdateDimensions"
body:nextInterfaceDimensions];
#pragma clang diagnostic pop
}
_currentInterfaceDimensions = nextInterfaceDimensions;
}
#endif // TARGET_OS_TV
+9 -5
View File
@@ -9,13 +9,15 @@
#import <React/RCTBridgeModule.h>
NS_ASSUME_NONNULL_BEGIN
@protocol RCTExceptionsManagerDelegate <NSObject>
- (void)handleSoftJSExceptionWithMessage:(NSString *)message stack:(NSArray *)stack exceptionId:(NSNumber *)exceptionId;
- (void)handleFatalJSExceptionWithMessage:(NSString *)message stack:(NSArray *)stack exceptionId:(NSNumber *)exceptionId;
- (void)handleSoftJSExceptionWithMessage:(nullable NSString *)message stack:(nullable NSArray *)stack exceptionId:(NSNumber *)exceptionId;
- (void)handleFatalJSExceptionWithMessage:(nullable NSString *)message stack:(nullable NSArray *)stack exceptionId:(NSNumber *)exceptionId;
@optional
- (void)updateJSExceptionWithMessage:(NSString *)message stack:(NSArray *)stack exceptionId:(NSNumber *)exceptionId;
- (void)updateJSExceptionWithMessage:(nullable NSString *)message stack:(nullable NSArray *)stack exceptionId:(NSNumber *)exceptionId;
@end
@@ -23,11 +25,13 @@
- (instancetype)initWithDelegate:(id<RCTExceptionsManagerDelegate>)delegate;
- (void)reportSoftException:(NSString *)message stack:(NSArray<NSDictionary *> *)stack exceptionId:(nonnull NSNumber *)exceptionId;
- (void)reportFatalException:(NSString *)message stack:(NSArray<NSDictionary *> *)stack exceptionId:(nonnull NSNumber *)exceptionId;
- (void)reportSoftException:(nullable NSString *)message stack:(nullable NSArray<NSDictionary *> *)stack exceptionId:(NSNumber *)exceptionId;
- (void)reportFatalException:(nullable NSString *)message stack:(nullable NSArray<NSDictionary *> *)stack exceptionId:(NSNumber *)exceptionId;
@property (nonatomic, weak) id<RCTExceptionsManagerDelegate> delegate;
@property (nonatomic, assign) NSUInteger maxReloadAttempts;
@end
NS_ASSUME_NONNULL_END
+3
View File
@@ -156,6 +156,9 @@ RCT_EXPORT_MODULE()
if (!_devMenuItem) {
__weak __typeof__(self) weakSelf = self;
__weak RCTDevSettings *devSettings = self.bridge.devSettings;
if (devSettings.isPerfMonitorShown) {
[weakSelf show];
}
_devMenuItem =
[RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{
return (devSettings.isPerfMonitorShown) ?
-6
View File
@@ -985,7 +985,6 @@
59EDBCC61FDF4E55003573DE /* (null) in Copy Headers */ = {isa = PBXBuildFile; };
59EDBCC71FDF4E55003573DE /* RCTScrollView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA31FDF4E0C003573DE /* RCTScrollView.h */; };
59EDBCC81FDF4E55003573DE /* RCTScrollViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA51FDF4E0C003573DE /* RCTScrollViewManager.h */; };
5CE2080220772F7D009A43B3 /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CE2080020772F7C009A43B3 /* YGConfig.cpp */; };
5CE2080320772F7D009A43B3 /* YGConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE2080120772F7C009A43B3 /* YGConfig.h */; };
657734841EE834C900A0E9EA /* RCTInspectorDevServerHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 657734821EE834C900A0E9EA /* RCTInspectorDevServerHelper.h */; };
657734851EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 657734831EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm */; };
@@ -1047,13 +1046,11 @@
A2440AA21DF8D854006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; };
A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */; };
A2440AA41DF8D865006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; };
AC4A6AF921FB4EA900FBEC39 /* YGMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */; };
AC4A6AFA21FB4EBF00FBEC39 /* YGMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */; };
AC4A6AFB21FB4ECA00FBEC39 /* YGMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */; };
AC52CEDE21FB3FF9003C6BEC /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */; };
AC52CEDF21FB401D003C6BEC /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */; };
AC52CEE021FB403B003C6BEC /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */; };
AC6B69E321B1467C00B2B68A /* YGValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC6B69E121B1467C00B2B68A /* YGValue.cpp */; };
AC6B69E421B1467C00B2B68A /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; };
AC6B69E521B1469A00B2B68A /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; };
AC6B69E621B146A500B2B68A /* YGValue.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; };
@@ -4427,7 +4424,6 @@
352DCFF01D19F4C20056D623 /* RCTI18nUtil.m in Sources */,
66CD94B71F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */,
008341F61D1DB34400876D9A /* RCTJSStackFrame.m in Sources */,
AC4A6AF921FB4EA900FBEC39 /* YGMarker.cpp in Sources */,
13134C961E296B2A00B9F3CB /* RCTObjcExecutor.mm in Sources */,
59D031FB1F8353D3008361F0 /* RCTSafeAreaViewManager.m in Sources */,
83CBBACC1A6023D300E9B192 /* RCTConvert.m in Sources */,
@@ -4459,7 +4455,6 @@
13134C8E1E296B2A00B9F3CB /* RCTMessageThread.mm in Sources */,
599FAA381FB274980058CCF6 /* RCTSurface.mm in Sources */,
59D031EF1F8353D3008361F0 /* RCTSafeAreaShadowView.m in Sources */,
AC6B69E321B1467C00B2B68A /* YGValue.cpp in Sources */,
3D1E68DB1CABD13900DD7465 /* RCTDisplayLink.m in Sources */,
14F3620E1AABD06A001CE568 /* RCTSwitchManager.m in Sources */,
13B080201A69489C00A75B9A /* RCTActivityIndicatorViewManager.m in Sources */,
@@ -4516,7 +4511,6 @@
13A1F71E1A75392D00D3D453 /* RCTKeyCommands.m in Sources */,
83CBBA531A601E3B00E9B192 /* RCTUtils.m in Sources */,
130443C61E401A8C00D93A67 /* RCTConvert+Transform.m in Sources */,
5CE2080220772F7D009A43B3 /* YGConfig.cpp in Sources */,
191E3EC11C29DC3800C180A6 /* RCTRefreshControl.m in Sources */,
3DCE532B1FEAB23100613583 /* RCTDatePickerManager.m in Sources */,
13C156051AB1A2840079392D /* RCTWebView.m in Sources */,
+16 -3
View File
@@ -7,19 +7,32 @@
#import "RCTUIUtils.h"
#import "RCTUtils.h"
RCTDimensions RCTGetDimensions(CGFloat fontScale)
{
UIScreen *mainScreen = UIScreen.mainScreen;
CGSize screenSize = mainScreen.bounds.size;
UIView *mainWindow;
mainWindow = RCTKeyWindow();
CGSize windowSize = mainWindow.bounds.size;
RCTDimensions result;
typeof (result.window) dims = {
typeof (result.screen) dimsScreen = {
.width = screenSize.width,
.height = screenSize.height,
.scale = mainScreen.scale,
.fontScale = fontScale
};
result.window = dims;
result.screen = dims;
typeof (result.window) dimsWindow = {
.width = windowSize.width,
.height = windowSize.height,
.scale = mainScreen.scale,
.fontScale = fontScale
};
result.screen = dimsScreen;
result.window = dimsWindow;
return result;
}
+9 -7
View File
@@ -224,13 +224,15 @@ static UIImage *RCTGetSolidBorderImage(RCTCornerRadii cornerRadii,
borderInsets.right + MAX(cornerInsets.bottomRight.width, cornerInsets.topRight.width)
};
// Asymmetrical edgeInsets cause strange artifacting on iOS 10 and earlier.
edgeInsets = (UIEdgeInsets){
MAX(edgeInsets.top, edgeInsets.bottom),
MAX(edgeInsets.left, edgeInsets.right),
MAX(edgeInsets.top, edgeInsets.bottom),
MAX(edgeInsets.left, edgeInsets.right),
};
if (hasCornerRadii) {
// Asymmetrical edgeInsets cause strange artifacting on iOS 10 and earlier.
edgeInsets = (UIEdgeInsets){
MAX(edgeInsets.top, edgeInsets.bottom),
MAX(edgeInsets.left, edgeInsets.right),
MAX(edgeInsets.top, edgeInsets.bottom),
MAX(edgeInsets.left, edgeInsets.right),
};
}
const CGSize size = makeStretchable ? (CGSize){
// 1pt for the middle stretchable area along each axis
+22 -4
View File
@@ -12,6 +12,8 @@
@implementation RCTRefreshControl {
BOOL _isInitialRender;
BOOL _currentRefreshingState;
UInt64 _currentRefreshingStateClock;
UInt64 _currentRefreshingStateTimestamp;
BOOL _refreshingProgrammatically;
NSString *_title;
UIColor *_titleColor;
@@ -21,6 +23,8 @@
{
if ((self = [super init])) {
[self addTarget:self action:@selector(refreshControlValueChanged) forControlEvents:UIControlEventValueChanged];
_currentRefreshingStateClock = 1;
_currentRefreshingStateTimestamp = 0;
_isInitialRender = true;
_currentRefreshingState = false;
}
@@ -49,6 +53,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
- (void)beginRefreshingProgrammatically
{
UInt64 beginRefreshingTimestamp = _currentRefreshingStateTimestamp;
_refreshingProgrammatically = YES;
// When using begin refreshing we need to adjust the ScrollView content offset manually.
UIScrollView *scrollView = (UIScrollView *)self.superview;
@@ -62,7 +67,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
animations:^(void) {
[scrollView setContentOffset:offset];
} completion:^(__unused BOOL finished) {
[super beginRefreshing];
if(beginRefreshingTimestamp == self->_currentRefreshingStateTimestamp) {
[super beginRefreshing];
[self setCurrentRefreshingState:super.refreshing];
}
}];
}
@@ -72,6 +80,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
// endRefreshing otherwise the next pull to refresh will not work properly.
UIScrollView *scrollView = (UIScrollView *)self.superview;
if (_refreshingProgrammatically && scrollView.contentOffset.y < 0) {
UInt64 endRefreshingTimestamp = _currentRefreshingStateTimestamp;
CGPoint offset = {scrollView.contentOffset.x, 0};
[UIView animateWithDuration:0.25
delay:0
@@ -79,7 +88,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
animations:^(void) {
[scrollView setContentOffset:offset];
} completion:^(__unused BOOL finished) {
[super endRefreshing];
if(endRefreshingTimestamp == self->_currentRefreshingStateTimestamp) {
[super endRefreshing];
[self setCurrentRefreshingState:super.refreshing];
}
}];
} else {
[super endRefreshing];
@@ -120,7 +132,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
- (void)setRefreshing:(BOOL)refreshing
{
if (_currentRefreshingState != refreshing) {
_currentRefreshingState = refreshing;
[self setCurrentRefreshingState:refreshing];
if (refreshing) {
if (!_isInitialRender) {
@@ -132,9 +144,15 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
}
}
- (void)setCurrentRefreshingState:(BOOL)refreshing
{
_currentRefreshingState = refreshing;
_currentRefreshingStateTimestamp = _currentRefreshingStateClock++;
}
- (void)refreshControlValueChanged
{
_currentRefreshingState = super.refreshing;
[self setCurrentRefreshingState:super.refreshing];
_refreshingProgrammatically = NO;
if (_onRefresh) {
+1
View File
@@ -44,6 +44,7 @@
@property (nonatomic, assign) NSTimeInterval scrollEventThrottle;
@property (nonatomic, assign) BOOL centerContent;
@property (nonatomic, copy) NSDictionary *maintainVisibleContentPosition;
@property (nonatomic, assign) BOOL scrollToOverflowEnabled;
@property (nonatomic, assign) int snapToInterval;
@property (nonatomic, copy) NSArray<NSNumber *> *snapToOffsets;
@property (nonatomic, assign) BOOL snapToStart;
+16 -2
View File
@@ -588,8 +588,19 @@ static inline void RCTApplyTransformationAccordingLayoutDirection(UIView *view,
- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
{
if (!CGPointEqualToPoint(_scrollView.contentOffset, offset)) {
CGRect maxRect = CGRectMake(fmin(-_scrollView.contentInset.left, 0),
fmin(-_scrollView.contentInset.top, 0),
fmax(_scrollView.contentSize.width - _scrollView.bounds.size.width + _scrollView.contentInset.right + fmax(_scrollView.contentInset.left, 0), 0.01),
fmax(_scrollView.contentSize.height - _scrollView.bounds.size.height + _scrollView.contentInset.bottom + fmax(_scrollView.contentInset.top, 0), 0.01)); // Make width and height greater than 0
// Ensure at least one scroll event will fire
_allowNextScrollNoMatterWhat = YES;
if (!CGRectContainsPoint(maxRect, offset) && !self.scrollToOverflowEnabled) {
CGFloat x = fmax(offset.x, CGRectGetMinX(maxRect));
x = fmin(x, CGRectGetMaxX(maxRect));
CGFloat y = fmax(offset.y, CGRectGetMinY(maxRect));
y = fmin(y, CGRectGetMaxY(maxRect));
offset = CGPointMake(x, y);
}
[_scrollView setContentOffset:offset animated:animated];
}
}
@@ -665,16 +676,19 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self updateClippedSubviews];
NSTimeInterval now = CACurrentMediaTime();
[self updateClippedSubviews];
/**
* TODO: this logic looks wrong, and it may be because it is. Currently, if _scrollEventThrottle
* is set to zero (the default), the "didScroll" event is only sent once per scroll, instead of repeatedly
* while scrolling as expected. However, if you "fix" that bug, ScrollView will generate repeated
* warnings, and behave strangely (ListView works fine however), so don't fix it unless you fix that too!
*
* We limit the delta to 17ms so that small throttles intended to enable 60fps updates will not
* inadvertantly filter out any scroll events.
*/
if (_allowNextScrollNoMatterWhat ||
(_scrollEventThrottle > 0 && _scrollEventThrottle < (now - _lastScrollDispatchTime))) {
(_scrollEventThrottle > 0 && _scrollEventThrottle < MAX(17, now - _lastScrollDispatchTime))) {
if (_DEPRECATED_sendUpdatedChildFrames) {
// Calculate changed frames
@@ -80,6 +80,7 @@ RCT_EXPORT_VIEW_PROPERTY(scrollEventThrottle, NSTimeInterval)
RCT_EXPORT_VIEW_PROPERTY(zoomScale, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets)
RCT_EXPORT_VIEW_PROPERTY(scrollIndicatorInsets, UIEdgeInsets)
RCT_EXPORT_VIEW_PROPERTY(scrollToOverflowEnabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(snapToInterval, int)
RCT_EXPORT_VIEW_PROPERTY(snapToOffsets, NSArray<NSNumber *>)
RCT_EXPORT_VIEW_PROPERTY(snapToStart, BOOL)
+1 -1
View File
@@ -274,7 +274,7 @@ android {
defaultConfig {
minSdkVersion(16)
targetSdkVersion(27)
targetSdkVersion(28)
versionCode(1)
versionName("1.0")
+1 -1
View File
@@ -1,4 +1,4 @@
VERSION_NAME=1000.0.0-master
VERSION_NAME=0.59.8
GROUP=com.facebook.react
POM_NAME=ReactNative
@@ -1,7 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.facebook.react">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application />
</manifest>
@@ -34,10 +34,12 @@ public interface ReactPackage {
* @param reactContext react application context that can be used to create modules
* @return list of native modules to register with the newly created catalyst instance
*/
@Nonnull
List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext);
/**
* @return a list of view managers that should be registered with {@link UIManagerModule}
*/
@Nonnull
List<ViewManager> createViewManagers(@Nonnull ReactApplicationContext reactContext);
}
@@ -7,6 +7,7 @@
package com.facebook.react.modules.core;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import android.net.Uri;
@@ -27,7 +28,7 @@ import com.facebook.react.module.annotations.ReactModule;
public class DeviceEventManagerModule extends ReactContextBaseJavaModule {
public static final String NAME = "DeviceEventManager";
public interface RCTDeviceEventEmitter extends JavaScriptModule {
void emit(String eventName, @Nullable Object data);
void emit(@Nonnull String eventName, @Nullable Object data);
}
private final Runnable mInvokeDefaultBackPressRunnable;
@@ -8,6 +8,7 @@ rn_android_library(
],
deps = [
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
react_native_dep("third-party/android/support/v4:lib-support-v4"),
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_target("java/com/facebook/react/bridge:bridge"),
@@ -9,6 +9,7 @@ package com.facebook.react.modules.location;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
@@ -16,6 +17,7 @@ import android.location.LocationProvider;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.content.ContextCompat;
import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
@@ -193,7 +195,7 @@ public class LocationModule extends ReactContextBaseJavaModule {
}
@Nullable
private static String getValidProvider(LocationManager locationManager, boolean highAccuracy) {
private String getValidProvider(LocationManager locationManager, boolean highAccuracy) {
String provider =
highAccuracy ? LocationManager.GPS_PROVIDER : LocationManager.NETWORK_PROVIDER;
if (!locationManager.isProviderEnabled(provider)) {
@@ -204,6 +206,11 @@ public class LocationModule extends ReactContextBaseJavaModule {
return null;
}
}
// If it's an enabled provider, but we don't have permissions, ignore it
int finePermission = ContextCompat.checkSelfPermission(getReactApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION);
if (provider.equals(LocationManager.GPS_PROVIDER) && finePermission != PackageManager.PERMISSION_GRANTED) {
return null;
}
return provider;
}
@@ -56,7 +56,10 @@ public class ForwardingCookieHandler extends CookieHandler {
@Override
public Map<String, List<String>> get(URI uri, Map<String, List<String>> headers)
throws IOException {
String cookies = getCookieManager().getCookie(uri.toString());
CookieManager cookieManager = getCookieManager();
if (cookieManager == null) return Collections.emptyMap();
String cookies = cookieManager.getCookie(uri.toString());
if (TextUtils.isEmpty(cookies)) {
return Collections.emptyMap();
}
@@ -80,7 +83,10 @@ public class ForwardingCookieHandler extends CookieHandler {
new GuardedResultAsyncTask<Boolean>(mContext) {
@Override
protected Boolean doInBackgroundGuarded() {
getCookieManager().removeAllCookie();
CookieManager cookieManager = getCookieManager();
if (cookieManager != null) {
cookieManager.removeAllCookie();
}
mCookieSaver.onCookiesModified();
return true;
}
@@ -96,31 +102,40 @@ public class ForwardingCookieHandler extends CookieHandler {
}
private void clearCookiesAsync(final Callback callback) {
getCookieManager().removeAllCookies(
new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean value) {
mCookieSaver.onCookiesModified();
callback.invoke(value);
}
});
CookieManager cookieManager = getCookieManager();
if (cookieManager != null) {
cookieManager.removeAllCookies(
new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean value) {
mCookieSaver.onCookiesModified();
callback.invoke(value);
}
});
}
}
public void destroy() {
if (USES_LEGACY_STORE) {
getCookieManager().removeExpiredCookie();
CookieManager cookieManager = getCookieManager();
if (cookieManager != null) {
cookieManager.removeExpiredCookie();
}
mCookieSaver.persistCookies();
}
}
private void addCookies(final String url, final List<String> cookies) {
final CookieManager cookieManager = getCookieManager();
if (cookieManager == null) return;
if (USES_LEGACY_STORE) {
runInBackground(
new Runnable() {
@Override
public void run() {
for (String cookie : cookies) {
getCookieManager().setCookie(url, cookie);
cookieManager.setCookie(url, cookie);
}
mCookieSaver.onCookiesModified();
}
@@ -129,14 +144,17 @@ public class ForwardingCookieHandler extends CookieHandler {
for (String cookie : cookies) {
addCookieAsync(url, cookie);
}
getCookieManager().flush();
cookieManager.flush();
mCookieSaver.onCookiesModified();
}
}
@TargetApi(21)
private void addCookieAsync(String url, String cookie) {
getCookieManager().setCookie(url, cookie, null);
CookieManager cookieManager = getCookieManager();
if (cookieManager != null) {
cookieManager.setCookie(url, cookie, null);
}
}
private static boolean isCookieHeader(String name) {
@@ -156,10 +174,26 @@ public class ForwardingCookieHandler extends CookieHandler {
* Instantiating CookieManager in KitKat+ will load the Chromium task taking a 100ish ms so we
* do it lazily to make sure it's done on a background thread as needed.
*/
private CookieManager getCookieManager() {
private @Nullable CookieManager getCookieManager() {
if (mCookieManager == null) {
possiblyWorkaroundSyncManager(mContext);
mCookieManager = CookieManager.getInstance();
try {
mCookieManager = CookieManager.getInstance();
} catch (IllegalArgumentException ex) {
// https://bugs.chromium.org/p/chromium/issues/detail?id=559720
return null;
} catch (Exception exception) {
String message = exception.getMessage();
// We cannot catch MissingWebViewPackageException as it is in a private / system API
// class. This validates the exception's message to ensure we are only handling this
// specific exception.
// https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/webkit/WebViewFactory.java#98
if (message != null && message.contains("No WebView installed")) {
return null;
} else {
throw exception;
}
}
if (USES_LEGACY_STORE) {
mCookieManager.removeExpiredCookie();
@@ -228,7 +262,10 @@ public class ForwardingCookieHandler extends CookieHandler {
@TargetApi(21)
private void flush() {
getCookieManager().flush();
CookieManager cookieManager = getCookieManager();
if (cookieManager != null) {
cookieManager.flush();
}
}
}
}
@@ -0,0 +1,47 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.modules.network;
/**
*
* The class purpose is to weaken too strict OkHttp restriction on http headers.
* See: https://github.com/square/okhttp/issues/2016
* Auth headers might have an Authentication information. It is better to get 401 from the
* server in this case, rather than non descriptive error as 401 could be handled to invalidate
* the wrong token in the client code.
*/
public class HeaderUtil {
public static String stripHeaderName(String name) {
StringBuilder builder = new StringBuilder(name.length());
boolean modified = false;
for (int i = 0, length = name.length(); i < length; i++) {
char c = name.charAt(i);
if (c > '\u0020' && c < '\u007f') {
builder.append(c);
} else {
modified = true;
}
}
return modified ? builder.toString() : name;
}
public static String stripHeaderValue(String value) {
StringBuilder builder = new StringBuilder(value.length());
boolean modified = false;
for (int i = 0, length = value.length(); i < length; i++) {
char c = value.charAt(i);
if ((c > '\u001f' && c < '\u007f') || c == '\t' ) {
builder.append(c);
} else {
modified = true;
}
}
return modified ? builder.toString() : value;
}
}
@@ -9,6 +9,7 @@ package com.facebook.react.modules.network;
import android.net.Uri;
import android.util.Base64;
import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.GuardedAsyncTask;
import com.facebook.react.bridge.ReactApplicationContext;
@@ -104,6 +105,7 @@ public final class NetworkingModule extends ReactContextBaseJavaModule {
protected static final String NAME = "Networking";
private static final String TAG = "NetworkingModule";
private static final String CONTENT_ENCODING_HEADER_NAME = "content-encoding";
private static final String CONTENT_TYPE_HEADER_NAME = "content-type";
private static final String REQUEST_BODY_KEY_STRING = "string";
@@ -234,10 +236,29 @@ public final class NetworkingModule extends ReactContextBaseJavaModule {
}
@ReactMethod
public void sendRequest(
String method,
String url,
final int requestId,
ReadableArray headers,
ReadableMap data,
final String responseType,
final boolean useIncrementalUpdates,
int timeout,
boolean withCredentials) {
try {
sendRequestInternal(method, url, requestId, headers, data, responseType,
useIncrementalUpdates, timeout, withCredentials);
} catch (Throwable th) {
FLog.e(TAG, "Failed to send url request: " + url, th);
ResponseUtil.onRequestError(getEventEmitter(), requestId, th.getMessage(), th);
}
}
/**
* @param timeout value of 0 results in no timeout
*/
public void sendRequest(
public void sendRequestInternal(
String method,
String url,
final int requestId,
@@ -372,7 +393,13 @@ public final class NetworkingModule extends ReactContextBaseJavaModule {
return;
}
} else {
requestBody = RequestBody.create(contentMediaType, body);
// Use getBytes() to convert the body into a byte[], preventing okhttp from
// appending the character set to the Content-Type header when otherwise unspecified
// https://github.com/facebook/react-native/issues/8237
Charset charset = contentMediaType == null
? StandardCharsets.UTF_8
: contentMediaType.charset(StandardCharsets.UTF_8);
requestBody = RequestBody.create(contentMediaType, body.getBytes(charset));
}
} else if (data.hasKey(REQUEST_BODY_KEY_BASE64)) {
if (contentType == null) {
@@ -714,8 +741,8 @@ public final class NetworkingModule extends ReactContextBaseJavaModule {
if (header == null || header.size() != 2) {
return null;
}
String headerName = header.getString(0);
String headerValue = header.getString(1);
String headerName = HeaderUtil.stripHeaderName(header.getString(0));
String headerValue = HeaderUtil.stripHeaderValue(header.getString(1));
if (headerName == null || headerValue == null) {
return null;
}
@@ -13,6 +13,8 @@ import android.os.Build;
import com.facebook.common.logging.FLog;
import java.io.File;
import java.security.Provider;
import java.security.Security;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -69,7 +71,14 @@ public class OkHttpClientProvider {
.writeTimeout(0, TimeUnit.MILLISECONDS)
.cookieJar(new ReactCookieJarContainer());
return enableTls12OnPreLollipop(client);
try {
Class ConscryptProvider = Class.forName("org.conscrypt.OpenSSLProvider");
Security.insertProviderAt(
(Provider) ConscryptProvider.newInstance(), 1);
return client;
} catch (Exception e) {
return enableTls12OnPreLollipop(client);
}
}
public static OkHttpClient.Builder createClientBuilder(Context context) {
@@ -85,7 +85,7 @@ public class ResponseUtil {
RCTDeviceEventEmitter eventEmitter,
int requestId,
String error,
IOException e) {
Throwable e) {
WritableArray args = Arguments.createArray();
args.pushInt(requestId);
args.pushString(error);
@@ -16,7 +16,7 @@ import java.util.Map;
public class ReactNativeVersion {
public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
"major", 0,
"minor", 0,
"patch", 0,
"minor", 59,
"patch", 8,
"prerelease", null);
}
@@ -9,6 +9,9 @@ import android.content.Context;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.CollectionItemInfoCompat;
import android.text.SpannableString;
import android.text.style.URLSpan;
import android.view.View;
import com.facebook.react.R;
import java.util.Locale;
@@ -98,7 +101,6 @@ public class AccessibilityDelegateUtil {
public void onInitializeAccessibilityNodeInfo(
View host, AccessibilityNodeInfoCompat info) {
super.onInitializeAccessibilityNodeInfo(host, info);
setRole(info, accessibilityRole, view.getContext());
if (!(accessibilityHint == null)) {
String contentDescription=(String)info.getContentDescription();
if (contentDescription != null) {
@@ -108,6 +110,8 @@ public class AccessibilityDelegateUtil {
info.setContentDescription(accessibilityHint);
}
}
setRole(info, accessibilityRole, view.getContext());
}
});
}
@@ -127,6 +131,18 @@ public class AccessibilityDelegateUtil {
if (Locale.getDefault().getLanguage().equals(new Locale("en").getLanguage())) {
if (role.equals(AccessibilityRole.LINK)) {
nodeInfo.setRoleDescription(context.getString(R.string.link_description));
if (nodeInfo.getContentDescription() != null) {
SpannableString spannable = new SpannableString(nodeInfo.getContentDescription());
spannable.setSpan(new URLSpan(""), 0, spannable.length(), 0);
nodeInfo.setContentDescription(spannable);
}
if (nodeInfo.getText() != null) {
SpannableString spannable = new SpannableString(nodeInfo.getText());
spannable.setSpan(new URLSpan(""), 0, spannable.length(), 0);
nodeInfo.setText(spannable);
}
}
if (role.equals(AccessibilityRole.SEARCH)) {
nodeInfo.setRoleDescription(context.getString(R.string.search_description));
@@ -140,6 +156,12 @@ public class AccessibilityDelegateUtil {
if (role.equals(AccessibilityRole.ADJUSTABLE)) {
nodeInfo.setRoleDescription(context.getString(R.string.adjustable_description));
}
if (role.equals(AccessibilityRole.HEADER)) {
nodeInfo.setRoleDescription(context.getString(R.string.header_description));
final AccessibilityNodeInfoCompat.CollectionItemInfoCompat itemInfo =
AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(0, 1, 0, 1, true);
nodeInfo.setCollectionItemInfo(itemInfo);
}
}
if (role.equals(AccessibilityRole.IMAGEBUTTON)) {
nodeInfo.setClickable(true);
@@ -15,7 +15,9 @@ import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.AccessibilityDelegateUtil.AccessibilityRole;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.util.ReactFindViewUtil;
import java.util.Locale;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Base class that should be suitable for the majority of subclasses of {@link ViewManager}.
@@ -58,12 +60,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
private static double[] sTransformDecompositionArray = new double[16];
@ReactProp(name = PROP_BACKGROUND_COLOR, defaultInt = Color.TRANSPARENT, customType = "Color")
public void setBackgroundColor(T view, int backgroundColor) {
public void setBackgroundColor(@Nonnull T view, int backgroundColor) {
view.setBackgroundColor(backgroundColor);
}
@ReactProp(name = PROP_TRANSFORM)
public void setTransform(T view, ReadableArray matrix) {
public void setTransform(@Nonnull T view, @Nullable ReadableArray matrix) {
if (matrix == null) {
resetTransformProperty(view);
} else {
@@ -72,20 +74,17 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
@ReactProp(name = ViewProps.OPACITY, defaultFloat = 1.f)
public void setOpacity(T view, float opacity) {
public void setOpacity(@Nonnull T view, float opacity) {
view.setAlpha(opacity);
}
@ReactProp(name = PROP_ELEVATION)
public void setElevation(T view, float elevation) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
view.setElevation(PixelUtil.toPixelFromDIP(elevation));
}
// Do nothing on API < 21
public void setElevation(@Nonnull T view, float elevation) {
ViewCompat.setElevation(view, PixelUtil.toPixelFromDIP(elevation));
}
@ReactProp(name = PROP_Z_INDEX)
public void setZIndex(T view, float zIndex) {
public void setZIndex(@Nonnull T view, float zIndex) {
int integerZIndex = Math.round(zIndex);
ViewGroupManager.setViewZIndex(view, integerZIndex);
ViewParent parent = view.getParent();
@@ -95,12 +94,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
@ReactProp(name = PROP_RENDER_TO_HARDWARE_TEXTURE)
public void setRenderToHardwareTexture(T view, boolean useHWTexture) {
public void setRenderToHardwareTexture(@Nonnull T view, boolean useHWTexture) {
view.setLayerType(useHWTexture ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE, null);
}
@ReactProp(name = PROP_TEST_ID)
public void setTestId(T view, String testId) {
public void setTestId(@Nonnull T view, String testId) {
view.setTag(R.id.react_test_id, testId);
// temporarily set the tag and keyed tags to avoid end to end test regressions
@@ -108,28 +107,28 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
@ReactProp(name = PROP_NATIVE_ID)
public void setNativeId(T view, String nativeId) {
public void setNativeId(@Nonnull T view, String nativeId) {
view.setTag(R.id.view_tag_native_id, nativeId);
ReactFindViewUtil.notifyViewRendered(view);
}
@ReactProp(name = PROP_ACCESSIBILITY_LABEL)
public void setAccessibilityLabel(T view, String accessibilityLabel) {
public void setAccessibilityLabel(@Nonnull T view, String accessibilityLabel) {
view.setContentDescription(accessibilityLabel);
}
@ReactProp(name = PROP_ACCESSIBILITY_COMPONENT_TYPE)
public void setAccessibilityComponentType(T view, String accessibilityComponentType) {
public void setAccessibilityComponentType(@Nonnull T view, String accessibilityComponentType) {
AccessibilityHelper.updateAccessibilityComponentType(view, accessibilityComponentType);
}
@ReactProp(name = PROP_ACCESSIBILITY_HINT)
public void setAccessibilityHint(T view, String accessibilityHint) {
public void setAccessibilityHint(@Nonnull T view, String accessibilityHint) {
view.setTag(R.id.accessibility_hint, accessibilityHint);
}
@ReactProp(name = PROP_ACCESSIBILITY_ROLE)
public void setAccessibilityRole(T view, String accessibilityRole) {
public void setAccessibilityRole(@Nonnull T view, @Nullable String accessibilityRole) {
if (accessibilityRole == null) {
return;
}
@@ -138,7 +137,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
@ReactProp(name = PROP_ACCESSIBILITY_STATES)
public void setViewStates(T view, ReadableArray accessibilityStates) {
public void setViewStates(@Nonnull T view, @Nullable ReadableArray accessibilityStates) {
view.setSelected(false);
view.setEnabled(true);
if (accessibilityStates == null) {
@@ -155,7 +154,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
@ReactProp(name = PROP_IMPORTANT_FOR_ACCESSIBILITY)
public void setImportantForAccessibility(T view, String importantForAccessibility) {
public void setImportantForAccessibility(@Nonnull T view, @Nullable String importantForAccessibility) {
if (importantForAccessibility == null || importantForAccessibility.equals("auto")) {
ViewCompat.setImportantForAccessibility(view, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
} else if (importantForAccessibility.equals("yes")) {
@@ -169,48 +168,46 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
@Deprecated
@ReactProp(name = PROP_ROTATION)
public void setRotation(T view, float rotation) {
public void setRotation(@Nonnull T view, float rotation) {
view.setRotation(rotation);
}
@Deprecated
@ReactProp(name = PROP_SCALE_X, defaultFloat = 1f)
public void setScaleX(T view, float scaleX) {
public void setScaleX(@Nonnull T view, float scaleX) {
view.setScaleX(scaleX);
}
@Deprecated
@ReactProp(name = PROP_SCALE_Y, defaultFloat = 1f)
public void setScaleY(T view, float scaleY) {
public void setScaleY(@Nonnull T view, float scaleY) {
view.setScaleY(scaleY);
}
@Deprecated
@ReactProp(name = PROP_TRANSLATE_X, defaultFloat = 0f)
public void setTranslateX(T view, float translateX) {
public void setTranslateX(@Nonnull T view, float translateX) {
view.setTranslationX(PixelUtil.toPixelFromDIP(translateX));
}
@Deprecated
@ReactProp(name = PROP_TRANSLATE_Y, defaultFloat = 0f)
public void setTranslateY(T view, float translateY) {
public void setTranslateY(@Nonnull T view, float translateY) {
view.setTranslationY(PixelUtil.toPixelFromDIP(translateY));
}
@ReactProp(name = PROP_ACCESSIBILITY_LIVE_REGION)
public void setAccessibilityLiveRegion(T view, String liveRegion) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
public void setAccessibilityLiveRegion(@Nonnull T view, @Nullable String liveRegion) {
if (liveRegion == null || liveRegion.equals("none")) {
view.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE);
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_NONE);
} else if (liveRegion.equals("polite")) {
view.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE);
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE);
} else if (liveRegion.equals("assertive")) {
view.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE);
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_ASSERTIVE);
}
}
}
private static void setTransformProperty(View view, ReadableArray transforms) {
private static void setTransformProperty(@Nonnull View view, ReadableArray transforms) {
TransformHelper.processTransform(transforms, sTransformDecompositionArray);
MatrixMathHelper.decomposeMatrix(sTransformDecompositionArray, sMatrixDecompositionContext);
view.setTranslationX(
@@ -246,7 +243,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
}
private static void resetTransformProperty(View view) {
private static void resetTransformProperty(@Nonnull View view) {
view.setTranslationX(PixelUtil.toPixelFromDIP(0));
view.setTranslationY(PixelUtil.toPixelFromDIP(0));
view.setRotation(0);
@@ -257,12 +254,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
view.setCameraDistance(0);
}
private void updateViewAccessibility(T view) {
private void updateViewAccessibility(@Nonnull T view) {
AccessibilityDelegateUtil.setDelegate(view);
}
@Override
protected void onAfterUpdateTransaction(T view) {
protected void onAfterUpdateTransaction(@Nonnull T view) {
super.onAfterUpdateTransaction(view);
updateViewAccessibility(view);
}
@@ -43,6 +43,7 @@ import javax.annotation.Nullable;
* shadow node hierarchy that is then mapped to a native view hierarchy.
*/
public class UIImplementation {
protected Object uiImplementationThreadLock = new Object();
protected final EventDispatcher mEventDispatcher;
protected final ReactApplicationContext mReactContext;
@@ -197,23 +198,25 @@ public class UIImplementation {
*/
public <T extends SizeMonitoringFrameLayout & MeasureSpecProvider> void registerRootView(
T rootView, int tag, ThemedReactContext context) {
final ReactShadowNode rootCSSNode = createRootShadowNode();
rootCSSNode.setReactTag(tag);
rootCSSNode.setThemedContext(context);
synchronized (uiImplementationThreadLock) {
final ReactShadowNode rootCSSNode = createRootShadowNode();
rootCSSNode.setReactTag(tag);
rootCSSNode.setThemedContext(context);
int widthMeasureSpec = rootView.getWidthMeasureSpec();
int heightMeasureSpec = rootView.getHeightMeasureSpec();
updateRootView(rootCSSNode, widthMeasureSpec, heightMeasureSpec);
int widthMeasureSpec = rootView.getWidthMeasureSpec();
int heightMeasureSpec = rootView.getHeightMeasureSpec();
updateRootView(rootCSSNode, widthMeasureSpec, heightMeasureSpec);
context.runOnNativeModulesQueueThread(new Runnable() {
@Override
public void run() {
mShadowNodeRegistry.addRootNode(rootCSSNode);
}
});
context.runOnNativeModulesQueueThread(new Runnable() {
@Override
public void run() {
mShadowNodeRegistry.addRootNode(rootCSSNode);
}
});
// register it within NativeViewHierarchyManager
mOperationsQueue.addRootView(tag, rootView, context);
// register it within NativeViewHierarchyManager
mOperationsQueue.addRootView(tag, rootView, context);
}
}
/**
@@ -228,7 +231,9 @@ public class UIImplementation {
* Unregisters a root node with a given tag from the shadow node registry
*/
public void removeRootShadowNode(int rootViewTag) {
mShadowNodeRegistry.removeRootNode(rootViewTag);
synchronized (uiImplementationThreadLock) {
mShadowNodeRegistry.removeRootNode(rootViewTag);
}
}
/**
@@ -279,23 +284,25 @@ public class UIImplementation {
* Invoked by React to create a new node with a given tag, class name and properties.
*/
public void createView(int tag, String className, int rootViewTag, ReadableMap props) {
ReactShadowNode cssNode = createShadowNode(className);
ReactShadowNode rootNode = mShadowNodeRegistry.getNode(rootViewTag);
Assertions.assertNotNull(rootNode, "Root node with tag " + rootViewTag + " doesn't exist");
cssNode.setReactTag(tag);
cssNode.setViewClassName(className);
cssNode.setRootTag(rootNode.getReactTag());
cssNode.setThemedContext(rootNode.getThemedContext());
synchronized (uiImplementationThreadLock) {
ReactShadowNode cssNode = createShadowNode(className);
ReactShadowNode rootNode = mShadowNodeRegistry.getNode(rootViewTag);
Assertions.assertNotNull(rootNode, "Root node with tag " + rootViewTag + " doesn't exist");
cssNode.setReactTag(tag);
cssNode.setViewClassName(className);
cssNode.setRootTag(rootNode.getReactTag());
cssNode.setThemedContext(rootNode.getThemedContext());
mShadowNodeRegistry.addNode(cssNode);
mShadowNodeRegistry.addNode(cssNode);
ReactStylesDiffMap styles = null;
if (props != null) {
styles = new ReactStylesDiffMap(props);
cssNode.updateProperties(styles);
ReactStylesDiffMap styles = null;
if (props != null) {
styles = new ReactStylesDiffMap(props);
cssNode.updateProperties(styles);
}
handleCreateView(cssNode, rootViewTag, styles);
}
handleCreateView(cssNode, rootViewTag, styles);
}
protected void handleCreateView(
@@ -363,106 +370,108 @@ public class UIImplementation {
@Nullable ReadableArray addChildTags,
@Nullable ReadableArray addAtIndices,
@Nullable ReadableArray removeFrom) {
ReactShadowNode cssNodeToManage = mShadowNodeRegistry.getNode(viewTag);
synchronized (uiImplementationThreadLock) {
ReactShadowNode cssNodeToManage = mShadowNodeRegistry.getNode(viewTag);
int numToMove = moveFrom == null ? 0 : moveFrom.size();
int numToAdd = addChildTags == null ? 0 : addChildTags.size();
int numToRemove = removeFrom == null ? 0 : removeFrom.size();
int numToMove = moveFrom == null ? 0 : moveFrom.size();
int numToAdd = addChildTags == null ? 0 : addChildTags.size();
int numToRemove = removeFrom == null ? 0 : removeFrom.size();
if (numToMove != 0 && (moveTo == null || numToMove != moveTo.size())) {
throw new IllegalViewOperationException("Size of moveFrom != size of moveTo!");
}
if (numToAdd != 0 && (addAtIndices == null || numToAdd != addAtIndices.size())) {
throw new IllegalViewOperationException("Size of addChildTags != size of addAtIndices!");
}
// We treat moves as an add and a delete
ViewAtIndex[] viewsToAdd = new ViewAtIndex[numToMove + numToAdd];
int[] indicesToRemove = new int[numToMove + numToRemove];
int[] tagsToRemove = new int[indicesToRemove.length];
int[] tagsToDelete = new int[numToRemove];
if (numToMove > 0) {
Assertions.assertNotNull(moveFrom);
Assertions.assertNotNull(moveTo);
for (int i = 0; i < numToMove; i++) {
int moveFromIndex = moveFrom.getInt(i);
int tagToMove = cssNodeToManage.getChildAt(moveFromIndex).getReactTag();
viewsToAdd[i] = new ViewAtIndex(
tagToMove,
moveTo.getInt(i));
indicesToRemove[i] = moveFromIndex;
tagsToRemove[i] = tagToMove;
if (numToMove != 0 && (moveTo == null || numToMove != moveTo.size())) {
throw new IllegalViewOperationException("Size of moveFrom != size of moveTo!");
}
}
if (numToAdd > 0) {
Assertions.assertNotNull(addChildTags);
Assertions.assertNotNull(addAtIndices);
for (int i = 0; i < numToAdd; i++) {
int viewTagToAdd = addChildTags.getInt(i);
int indexToAddAt = addAtIndices.getInt(i);
viewsToAdd[numToMove + i] = new ViewAtIndex(viewTagToAdd, indexToAddAt);
if (numToAdd != 0 && (addAtIndices == null || numToAdd != addAtIndices.size())) {
throw new IllegalViewOperationException("Size of addChildTags != size of addAtIndices!");
}
}
if (numToRemove > 0) {
Assertions.assertNotNull(removeFrom);
for (int i = 0; i < numToRemove; i++) {
int indexToRemove = removeFrom.getInt(i);
int tagToRemove = cssNodeToManage.getChildAt(indexToRemove).getReactTag();
indicesToRemove[numToMove + i] = indexToRemove;
tagsToRemove[numToMove + i] = tagToRemove;
tagsToDelete[i] = tagToRemove;
// We treat moves as an add and a delete
ViewAtIndex[] viewsToAdd = new ViewAtIndex[numToMove + numToAdd];
int[] indicesToRemove = new int[numToMove + numToRemove];
int[] tagsToRemove = new int[indicesToRemove.length];
int[] tagsToDelete = new int[numToRemove];
if (numToMove > 0) {
Assertions.assertNotNull(moveFrom);
Assertions.assertNotNull(moveTo);
for (int i = 0; i < numToMove; i++) {
int moveFromIndex = moveFrom.getInt(i);
int tagToMove = cssNodeToManage.getChildAt(moveFromIndex).getReactTag();
viewsToAdd[i] = new ViewAtIndex(
tagToMove,
moveTo.getInt(i));
indicesToRemove[i] = moveFromIndex;
tagsToRemove[i] = tagToMove;
}
}
}
// NB: moveFrom and removeFrom are both relative to the starting state of the View's children.
// moveTo and addAt are both relative to the final state of the View's children.
//
// 1) Sort the views to add and indices to remove by index
// 2) Iterate the indices being removed from high to low and remove them. Going high to low
// makes sure we remove the correct index when there are multiple to remove.
// 3) Iterate the views being added by index low to high and add them. Like the view removal,
// iteration direction is important to preserve the correct index.
Arrays.sort(viewsToAdd, ViewAtIndex.COMPARATOR);
Arrays.sort(indicesToRemove);
// Apply changes to CSSNodeDEPRECATED hierarchy
int lastIndexRemoved = -1;
for (int i = indicesToRemove.length - 1; i >= 0; i--) {
int indexToRemove = indicesToRemove[i];
if (indexToRemove == lastIndexRemoved) {
throw new IllegalViewOperationException("Repeated indices in Removal list for view tag: "
+ viewTag);
if (numToAdd > 0) {
Assertions.assertNotNull(addChildTags);
Assertions.assertNotNull(addAtIndices);
for (int i = 0; i < numToAdd; i++) {
int viewTagToAdd = addChildTags.getInt(i);
int indexToAddAt = addAtIndices.getInt(i);
viewsToAdd[numToMove + i] = new ViewAtIndex(viewTagToAdd, indexToAddAt);
}
}
cssNodeToManage.removeChildAt(indicesToRemove[i]);
lastIndexRemoved = indicesToRemove[i];
}
for (int i = 0; i < viewsToAdd.length; i++) {
ViewAtIndex viewAtIndex = viewsToAdd[i];
ReactShadowNode cssNodeToAdd = mShadowNodeRegistry.getNode(viewAtIndex.mTag);
if (cssNodeToAdd == null) {
throw new IllegalViewOperationException("Trying to add unknown view tag: "
+ viewAtIndex.mTag);
if (numToRemove > 0) {
Assertions.assertNotNull(removeFrom);
for (int i = 0; i < numToRemove; i++) {
int indexToRemove = removeFrom.getInt(i);
int tagToRemove = cssNodeToManage.getChildAt(indexToRemove).getReactTag();
indicesToRemove[numToMove + i] = indexToRemove;
tagsToRemove[numToMove + i] = tagToRemove;
tagsToDelete[i] = tagToRemove;
}
}
cssNodeToManage.addChildAt(cssNodeToAdd, viewAtIndex.mIndex);
}
if (!cssNodeToManage.isVirtual() && !cssNodeToManage.isVirtualAnchor()) {
mNativeViewHierarchyOptimizer.handleManageChildren(
cssNodeToManage,
indicesToRemove,
tagsToRemove,
viewsToAdd,
tagsToDelete);
}
// NB: moveFrom and removeFrom are both relative to the starting state of the View's children.
// moveTo and addAt are both relative to the final state of the View's children.
//
// 1) Sort the views to add and indices to remove by index
// 2) Iterate the indices being removed from high to low and remove them. Going high to low
// makes sure we remove the correct index when there are multiple to remove.
// 3) Iterate the views being added by index low to high and add them. Like the view removal,
// iteration direction is important to preserve the correct index.
for (int i = 0; i < tagsToDelete.length; i++) {
removeShadowNode(mShadowNodeRegistry.getNode(tagsToDelete[i]));
Arrays.sort(viewsToAdd, ViewAtIndex.COMPARATOR);
Arrays.sort(indicesToRemove);
// Apply changes to CSSNodeDEPRECATED hierarchy
int lastIndexRemoved = -1;
for (int i = indicesToRemove.length - 1; i >= 0; i--) {
int indexToRemove = indicesToRemove[i];
if (indexToRemove == lastIndexRemoved) {
throw new IllegalViewOperationException("Repeated indices in Removal list for view tag: "
+ viewTag);
}
cssNodeToManage.removeChildAt(indicesToRemove[i]);
lastIndexRemoved = indicesToRemove[i];
}
for (int i = 0; i < viewsToAdd.length; i++) {
ViewAtIndex viewAtIndex = viewsToAdd[i];
ReactShadowNode cssNodeToAdd = mShadowNodeRegistry.getNode(viewAtIndex.mTag);
if (cssNodeToAdd == null) {
throw new IllegalViewOperationException("Trying to add unknown view tag: "
+ viewAtIndex.mTag);
}
cssNodeToManage.addChildAt(cssNodeToAdd, viewAtIndex.mIndex);
}
if (!cssNodeToManage.isVirtual() && !cssNodeToManage.isVirtualAnchor()) {
mNativeViewHierarchyOptimizer.handleManageChildren(
cssNodeToManage,
indicesToRemove,
tagsToRemove,
viewsToAdd,
tagsToDelete);
}
for (int i = 0; i < tagsToDelete.length; i++) {
removeShadowNode(mShadowNodeRegistry.getNode(tagsToDelete[i]));
}
}
}
@@ -476,22 +485,23 @@ public class UIImplementation {
public void setChildren(
int viewTag,
ReadableArray childrenTags) {
synchronized (uiImplementationThreadLock) {
ReactShadowNode cssNodeToManage = mShadowNodeRegistry.getNode(viewTag);
ReactShadowNode cssNodeToManage = mShadowNodeRegistry.getNode(viewTag);
for (int i = 0; i < childrenTags.size(); i++) {
ReactShadowNode cssNodeToAdd = mShadowNodeRegistry.getNode(childrenTags.getInt(i));
if (cssNodeToAdd == null) {
throw new IllegalViewOperationException("Trying to add unknown view tag: "
+ childrenTags.getInt(i));
for (int i = 0; i < childrenTags.size(); i++) {
ReactShadowNode cssNodeToAdd = mShadowNodeRegistry.getNode(childrenTags.getInt(i));
if (cssNodeToAdd == null) {
throw new IllegalViewOperationException("Trying to add unknown view tag: "
+ childrenTags.getInt(i));
}
cssNodeToManage.addChildAt(cssNodeToAdd, i);
}
cssNodeToManage.addChildAt(cssNodeToAdd, i);
}
if (!cssNodeToManage.isVirtual() && !cssNodeToManage.isVirtualAnchor()) {
mNativeViewHierarchyOptimizer.handleSetChildren(
cssNodeToManage,
childrenTags);
if (!cssNodeToManage.isVirtual() && !cssNodeToManage.isVirtualAnchor()) {
mNativeViewHierarchyOptimizer.handleSetChildren(
cssNodeToManage,
childrenTags);
}
}
}
@@ -20,6 +20,8 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup;
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
import com.facebook.yoga.YogaMeasureMode;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
@@ -31,7 +33,7 @@ import javax.annotation.Nullable;
public abstract class ViewManager<T extends View, C extends ReactShadowNode>
extends BaseJavaModule {
public final void updateProperties(T viewToUpdate, ReactStylesDiffMap props) {
public final void updateProperties(@Nonnull T viewToUpdate, ReactStylesDiffMap props) {
ViewManagerPropertyUpdater.updateProps(this, viewToUpdate, props);
onAfterUpdateTransaction(viewToUpdate);
}
@@ -39,8 +41,8 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
/**
* Creates a view and installs event emitters on it.
*/
public final T createView(
ThemedReactContext reactContext,
public final @Nonnull T createView(
@Nonnull ThemedReactContext reactContext,
JSResponderHandler jsResponderHandler) {
T view = createViewInstance(reactContext);
addEventEmitters(reactContext, view);
@@ -54,7 +56,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
* @return the name of this view manager. This will be the name used to reference this view
* manager from JavaScript in createReactNativeComponentClass.
*/
public abstract String getName();
public abstract @Nonnull String getName();
/**
* This method should return a subclass of {@link ReactShadowNode} which will be then used for
@@ -65,7 +67,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
throw new RuntimeException("ViewManager subclasses must implement createShadowNodeInstance()");
}
public C createShadowNodeInstance(ReactApplicationContext context) {
public @Nonnull C createShadowNodeInstance(@Nonnull ReactApplicationContext context) {
return createShadowNodeInstance();
}
@@ -85,13 +87,13 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
* Subclasses should return a new View instance of the proper type.
* @param reactContext
*/
protected abstract T createViewInstance(ThemedReactContext reactContext);
protected abstract @Nonnull T createViewInstance(@Nonnull ThemedReactContext reactContext);
/**
* Called when view is detached from view hierarchy and allows for some additional cleanup by
* the {@link ViewManager} subclass.
*/
public void onDropViewInstance(T view) {
public void onDropViewInstance(@Nonnull T view) {
}
/**
@@ -99,7 +101,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
* might want to override this method if your view needs to emit events besides basic touch events
* to JS (e.g. scroll events).
*/
protected void addEventEmitters(ThemedReactContext reactContext, T view) {
protected void addEventEmitters(@Nonnull ThemedReactContext reactContext, @Nonnull T view) {
}
/**
@@ -108,7 +110,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
* you want to override this method you should call super.onAfterUpdateTransaction from it as
* the parent class of the ViewManager may rely on callback being executed.
*/
protected void onAfterUpdateTransaction(T view) {
protected void onAfterUpdateTransaction(@Nonnull T view) {
}
/**
@@ -122,7 +124,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
*
* TODO(7247021): Replace updateExtraData with generic update props mechanism after D2086999
*/
public abstract void updateExtraData(T root, Object extraData);
public abstract void updateExtraData(@Nonnull T root, Object extraData);
/**
* Subclasses may use this method to receive events/commands directly from JS through the
@@ -133,7 +135,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
* @param commandId code of the command
* @param args optional arguments for the command
*/
public void receiveCommand(T root, int commandId, @Nullable ReadableArray args) {
public void receiveCommand(@Nonnull T root, int commandId, @Nullable ReadableArray args) {
}
/**
@@ -209,7 +211,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
/**
*
*/
public @Nullable Object updateLocalData(T view, ReactStylesDiffMap props, ReactStylesDiffMap localData) {
public @Nullable Object updateLocalData(@Nonnull T view, ReactStylesDiffMap props, ReactStylesDiffMap localData) {
return null;
}
@@ -24,8 +24,18 @@ public class JSStackTrace {
stringBuilder
.append(frame.getString("methodName"))
.append("@")
.append(parseFileId(frame))
.append(frame.getInt("lineNumber"));
.append(parseFileId(frame));
if (frame.hasKey("lineNumber") &&
!frame.isNull("lineNumber") &&
frame.getType("lineNumber") == ReadableType.Number) {
stringBuilder
.append(frame.getInt("lineNumber"));
} else {
stringBuilder
.append(-1);
}
if (frame.hasKey("column") &&
!frame.isNull("column") &&
frame.getType("column") == ReadableType.Number) {
@@ -33,6 +43,7 @@ public class JSStackTrace {
.append(":")
.append(frame.getInt("column"));
}
stringBuilder.append("\n");
}
return stringBuilder.toString();
@@ -36,6 +36,7 @@ import javax.annotation.Nullable;
if (mAllowChange && isChecked() != checked) {
mAllowChange = false;
super.setChecked(checked);
setTrackColor(checked);
}
}
@@ -59,8 +60,7 @@ import javax.annotation.Nullable;
// If the switch has a different value than the value sent by JS, we must change it.
if (isChecked() != on) {
super.setChecked(on);
Integer currentTrackColor = on ? mTrackColorForTrue : mTrackColorForFalse;
setTrackColor(currentTrackColor);
setTrackColor(on);
}
mAllowChange = true;
}
@@ -86,4 +86,13 @@ import javax.annotation.Nullable;
setTrackColor(mTrackColorForFalse);
}
}
private void setTrackColor(boolean checked) {
if (mTrackColorForTrue != null || mTrackColorForFalse != null) {
// Update the track color to reflect the new value. We only want to do this if these
// props were actually set from JS; otherwise we'll just reset the color to the default.
Integer currentTrackColor = checked ? mTrackColorForTrue : mTrackColorForFalse;
setTrackColor(currentTrackColor);
}
}
}
@@ -9,6 +9,8 @@ rn_android_library(
],
deps = [
YOGA_TARGET,
react_native_dep("third-party/android/support/v4:lib-support-v4"),
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
@@ -265,6 +265,9 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
protected int mTextAlign = Gravity.NO_GRAVITY;
protected int mTextBreakStrategy =
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.BREAK_STRATEGY_HIGH_QUALITY;
protected int mJustificationMode =
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? 0 : Layout.JUSTIFICATION_MODE_NONE;
protected TextTransform mTextTransform = TextTransform.UNSET;
protected float mTextShadowOffsetDx = 0;
protected float mTextShadowOffsetDy = 0;
@@ -357,19 +360,28 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
@ReactProp(name = ViewProps.TEXT_ALIGN)
public void setTextAlign(@Nullable String textAlign) {
if (textAlign == null || "auto".equals(textAlign)) {
mTextAlign = Gravity.NO_GRAVITY;
} else if ("left".equals(textAlign)) {
mTextAlign = Gravity.LEFT;
} else if ("right".equals(textAlign)) {
mTextAlign = Gravity.RIGHT;
} else if ("center".equals(textAlign)) {
mTextAlign = Gravity.CENTER_HORIZONTAL;
} else if ("justify".equals(textAlign)) {
// Fallback gracefully for cross-platform compat instead of error
if ("justify".equals(textAlign)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mJustificationMode = Layout.JUSTIFICATION_MODE_INTER_WORD;
}
mTextAlign = Gravity.LEFT;
} else {
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mJustificationMode = Layout.JUSTIFICATION_MODE_NONE;
}
if (textAlign == null || "auto".equals(textAlign)) {
mTextAlign = Gravity.NO_GRAVITY;
} else if ("left".equals(textAlign)) {
mTextAlign = Gravity.LEFT;
} else if ("right".equals(textAlign)) {
mTextAlign = Gravity.RIGHT;
} else if ("center".equals(textAlign)) {
mTextAlign = Gravity.CENTER_HORIZONTAL;
} else {
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
}
}
markUpdated();
}
@@ -99,14 +99,18 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
new StaticLayout(
text, textPaint, hintWidth, alignment, 1.f, 0.f, mIncludeFontPadding);
} else {
layout =
StaticLayout.Builder builder =
StaticLayout.Builder.obtain(text, 0, text.length(), textPaint, hintWidth)
.setAlignment(alignment)
.setLineSpacing(0.f, 1.f)
.setIncludePad(mIncludeFontPadding)
.setBreakStrategy(mTextBreakStrategy)
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL)
.build();
.setAlignment(alignment)
.setLineSpacing(0.f, 1.f)
.setIncludePad(mIncludeFontPadding)
.setBreakStrategy(mTextBreakStrategy)
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setJustificationMode(mJustificationMode);
}
layout = builder.build();
}
} else if (boring != null && (unconstrainedWidth || boring.width <= width)) {
@@ -217,7 +221,8 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
getPadding(Spacing.END),
getPadding(Spacing.BOTTOM),
getTextAlign(),
mTextBreakStrategy);
mTextBreakStrategy,
mJustificationMode);
uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
}
}
@@ -26,6 +26,7 @@ public class ReactTextUpdate {
private final float mPaddingBottom;
private final int mTextAlign;
private final int mTextBreakStrategy;
private final int mJustificationMode;
/**
* @deprecated Use a non-deprecated constructor for ReactTextUpdate instead. This one remains
@@ -49,7 +50,8 @@ public class ReactTextUpdate {
paddingEnd,
paddingBottom,
textAlign,
Layout.BREAK_STRATEGY_HIGH_QUALITY);
Layout.BREAK_STRATEGY_HIGH_QUALITY,
Layout.JUSTIFICATION_MODE_NONE);
}
public ReactTextUpdate(
@@ -61,7 +63,8 @@ public class ReactTextUpdate {
float paddingEnd,
float paddingBottom,
int textAlign,
int textBreakStrategy) {
int textBreakStrategy,
int justificationMode) {
mText = text;
mJsEventCounter = jsEventCounter;
mContainsImages = containsImages;
@@ -71,6 +74,7 @@ public class ReactTextUpdate {
mPaddingBottom = paddingBottom;
mTextAlign = textAlign;
mTextBreakStrategy = textBreakStrategy;
mJustificationMode = justificationMode;
}
public Spannable getText() {
@@ -108,4 +112,8 @@ public class ReactTextUpdate {
public int getTextBreakStrategy() {
return mTextBreakStrategy;
}
public int getJustificationMode() {
return mJustificationMode;
}
}
@@ -10,13 +10,13 @@ package com.facebook.react.views.text;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.widget.AppCompatTextView;
import android.text.Layout;
import android.text.Spannable;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.TextView;
import com.facebook.common.logging.FLog;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.uimanager.ReactCompoundView;
@@ -24,7 +24,7 @@ import com.facebook.react.uimanager.ViewDefaults;
import com.facebook.react.views.view.ReactViewBackgroundManager;
import javax.annotation.Nullable;
public class ReactTextView extends TextView implements ReactCompoundView {
public class ReactTextView extends AppCompatTextView implements ReactCompoundView {
private static final ViewGroup.LayoutParams EMPTY_LAYOUT_PARAMS =
new ViewGroup.LayoutParams(0, 0);
@@ -72,6 +72,11 @@ public class ReactTextView extends TextView implements ReactCompoundView {
setBreakStrategy(update.getTextBreakStrategy());
}
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (getJustificationMode() != update.getJustificationMode()) {
setJustificationMode(update.getJustificationMode());
}
}
}
@Override
@@ -82,8 +82,10 @@ public class ReactTextViewManager
// TODO add textBreakStrategy prop into local Data
int textBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY;
return
new ReactTextUpdate(
// TODO add justificationMode prop into local Data
int justificationMode = Layout.JUSTIFICATION_MODE_NONE;
return new ReactTextUpdate(
spanned,
-1, // TODO add this into local Data?
false, // TODO add this into local Data
@@ -92,7 +94,8 @@ public class ReactTextViewManager
textViewProps.getEndPadding(),
textViewProps.getBottomPadding(),
textViewProps.getTextAlign(),
textBreakStrategy
textBreakStrategy,
justificationMode
);
}
@@ -50,6 +50,8 @@ public class TextAttributeProps {
protected int mTextAlign = Gravity.NO_GRAVITY;
protected int mTextBreakStrategy =
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.BREAK_STRATEGY_HIGH_QUALITY;
protected int mJustificationMode =
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? 0 : Layout.JUSTIFICATION_MODE_NONE;
protected TextTransform mTextTransform = TextTransform.UNSET;
protected float mTextShadowOffsetDx = 0;
@@ -204,19 +206,28 @@ public class TextAttributeProps {
}
public void setTextAlign(@Nullable String textAlign) {
if (textAlign == null || "auto".equals(textAlign)) {
mTextAlign = Gravity.NO_GRAVITY;
} else if ("left".equals(textAlign)) {
mTextAlign = Gravity.LEFT;
} else if ("right".equals(textAlign)) {
mTextAlign = Gravity.RIGHT;
} else if ("center".equals(textAlign)) {
mTextAlign = Gravity.CENTER_HORIZONTAL;
} else if ("justify".equals(textAlign)) {
// Fallback gracefully for cross-platform compat instead of error
if ("justify".equals(textAlign)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mJustificationMode = Layout.JUSTIFICATION_MODE_INTER_WORD;
}
mTextAlign = Gravity.LEFT;
} else {
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mJustificationMode = Layout.JUSTIFICATION_MODE_NONE;
}
if (textAlign == null || "auto".equals(textAlign)) {
mTextAlign = Gravity.NO_GRAVITY;
} else if ("left".equals(textAlign)) {
mTextAlign = Gravity.LEFT;
} else if ("right".equals(textAlign)) {
mTextAlign = Gravity.RIGHT;
} else if ("center".equals(textAlign)) {
mTextAlign = Gravity.CENTER_HORIZONTAL;
} else {
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
}
}
}
@@ -12,6 +12,7 @@ rn_android_library(
],
deps = [
YOGA_TARGET,
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_target("java/com/facebook/react/bridge:bridge"),

Some files were not shown because too many files have changed in this diff Show More