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
Summary:
@public
In order to get out of pre-releases again, we move `YGSetUsedCachedEntries` from `Yoga.h` to `Yoga-internal.h`.
This way, it’s obvious that the function is not public, and we can remove it from future versions without breaking semver contracts.
Reviewed By: SidharthGuglani
Differential Revision: D14726029
fbshipit-source-id: 8d7e747e843bf5c4b5e1d4cfbfa37ca9d240dffb
Summary: All animations are scheduled by the UIManager while it processes a batch of changes, so we can just wait to see what the longest animation is and cancel+reschedule the callback.
Reviewed By: mdvacca
Differential Revision: D14656733
fbshipit-source-id: 4cbbb7e741219cd43f511f2ce750c53c30e2b2ca
Summary: This code was shipped as part of the initial open-source release but was never used.
Reviewed By: sahrens
Differential Revision: D14649389
fbshipit-source-id: 0c068ca69b91d275008f4a7af77a23a4f1470c18
Summary: Add additional logging around the exception to figure out what kind of uris are causing the exception for `getContentTypeForFileName`
Reviewed By: PeteTheHeat
Differential Revision: D14715917
fbshipit-source-id: 46299d2ff3f1f06991d7800784a025a85815ae8c
Summary:
It seems that the content view can sometimes be null when onOverScrolled is called (presumably when the scrollview gets unmounted while it's in the middle of scrolling?).
Changelog: [Android][fixed] - Guard against content view being null in onOverScrolled.
Reviewed By: mdvacca
Differential Revision: D14737534
fbshipit-source-id: e88ec6f585e50517b734a8809fc3843c0b22df10
Summary:
There is a timing issue when reloading the bridge (in dev mode) and the tear down of the TurboModules. This causes `Instance` to never get freed, hence the "bridge" isn't cleaning up properly. The side effect can be bogus error saying that it's unable to find a module.
To address this, JSCallInvoker should just take in weak_ptr<Instance>.
Reviewed By: RSNara
Differential Revision: D14739181
fbshipit-source-id: f9f2a55486debaeb28d3d293df3cf1d3f6b9a031
Summary: Add a target for JSBigString tests that can be run with a normal `buck test` invocation. Also fix an issue in the test when `getenv` returns null by defaulting to `/tmp`.
Reviewed By: ridiculousfish
Differential Revision: D14716270
fbshipit-source-id: f2eb6d3aab93c32a4b41f5786aedd04a70468d75
Summary:
@public
This resolves the iOS side of #20879.
Reviewed By: natestedman, cpojer
Differential Revision: D14712066
fbshipit-source-id: 88dd0ff80d3467b314cacb9349029dadca4ddf19
Summary: This moves the Java files to FB internal and updates all the buck files
Reviewed By: TheSavior
Differential Revision: D14622521
fbshipit-source-id: a8d293e9f9e08868cca3ed2986a08d0db16dec15
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
Summary:
Since template has a fixed version in `template/package.json`, we want to automate this process.
[General] [Added] - Bump react-native in `template/package.json`
Pull Request resolved: https://github.com/facebook/react-native/pull/24262
Differential Revision: D14724831
Pulled By: cpojer
fbshipit-source-id: 164d13001a889941398f3db3b9b96eb9d5114cc3
Summary:
Potential breaking change: The signature of ReactShadowNode's onBeforeLayout method was changed
- Before: public void onBeforeLayout()
- After: public void onBeforeLayout(NativeViewHierarchyOptimizer nativeViewHierarchyOptimizer)
Implements same feature as this iOS PR: https://github.com/facebook/react-native/pull/7304
Previously, only Text and Image could be nested within Text. Now, any view can be nested within Text. One restriction of this feature is that developers must give inline views a width and a height via the style prop.
Previously, inline Images were supported via FrescoBasedReactTextInlineImageSpan. To get support for nesting views within Text, we create one special kind of span per inline view. This span is called TextInlineViewPlaceholderSpan. It is the same size as the inline view. Its job is just to occupy space -- it doesn't render any visual. After the text is rendered, we query the Android Layout object associated with the TextView to find out where it has positioned each TextInlineViewPlaceholderSpan. We then position the views to be at those locations.
One tricky aspect of the implementation is that the Text component needs to be able to render native children (the inline views) but the Android TextView cannot have children. This is solved by having the native parent of the ReactTextView also host the inline views. Implementation-wise, this was accomplished by extending the NativeViewHierarchyOptimizer to handle this case. The optimizer now handles these cases:
- Node is not in the native tree. An ancestor must host its children.
- Node is in the native tree and it can host its own children.
- (new) Node is in the native tree but it cannot host its own children. An ancestor must host both this node and its children.
I added the `onInlineViewLayout` event which is useful for writing tests for verifying that the inline views are positioned properly.
Limitation: Clipping
----------
If Text's height/width is small such that an inline view doesn't completely fit, the inline view may still be fully visible due to hoisting (the inline view isn't actually parented to the Text which has the limited size. It is parented to an ancestor which may have a different clipping rectangle.). Prior to this change, layout-only views had a similar limitation.
Pull Request resolved: https://github.com/facebook/react-native/pull/23195
Differential Revision: D14014668
Pulled By: shergin
fbshipit-source-id: d46130f3d19cc83ac7ddf423adcc9e23988245d3
Summary: This removes the JS parts of Geolocation from React Native open source.
Reviewed By: yungsters
Differential Revision: D14693179
fbshipit-source-id: 1da5b7ec0e3e9d21d2019b7ee43e5f85661795b4
Summary: A retain-cycle regression was added by D14162776 and detected here: T41208740. Fix should be trivial.
Reviewed By: shergin
Differential Revision: D14709784
fbshipit-source-id: bad6ab31a5170e9320c4432cbd20d02ec6164f38
Summary:
D14423742 introduced a regression on OSS test_android due to androidx.core.os not being available. I spent some time investigating a fix forward this morning, with no success. Reverting.
Changelog:
[Android] [Changed] - Revert 92f019c666
Reviewed By: cpojer
Differential Revision: D14668728
fbshipit-source-id: c7542992805551dc4302626e1536759794efaa82
Summary:
It closes#24170.
I opened the issue yesterday, and I think I found the way how to resolve it. So, I'm opening this PR directly without any comment on the issue.
In the `endRefreshProgrammatically` of `RCTRefreshControl.m`, the comment says that " The contentOffset of the scrollview MUST be greater than 0". However, if the `contentInset` prop is set for the `FlatList`, I think `contentOffset` can be a negative value after refreshing and should be greater than `-contentInset.top`.
As I reported the bug in that issue, If I am using `contentInset` prop to the `FlatList`, making `contentOffset` value be always 0 when refreshing ends causes something wrong situation.
[iOS] [Fixed] - Fix setting the contnetOffset when refreshing ends
Pull Request resolved: https://github.com/facebook/react-native/pull/24191
Differential Revision: D14710987
Pulled By: sahrens
fbshipit-source-id: 03f06df9a93a2a46a7cc0b56269091778805917e
Summary:
Harmonizes the spacing after colons to have a more consistent coding style.
Pull Request resolved: https://github.com/facebook/react-native/pull/24186
Differential Revision: D14668167
Pulled By: cpojer
fbshipit-source-id: 8f1ba71eec186b3a2221d1f4fac851e51afc52cc
Summary:
Add the ability to set a custom handler on ReactWebViewManager to handle client certificate challenges during TLS authentication.
[Android][Added] - Public method setCustomClientCertRequestHandler to the native com.facebook.react.views.webview.ReactWebViewManager, that allows using a custom response for client certificate challenges.
Reviewed By: mjhu
Differential Revision: D14609697
fbshipit-source-id: 567c95458af638d1f8233fc3ca0d9cefc061c2bf
Summary:
We suspect that we have some error in diffing algorithm that cause some crashes in mounting layer, so we decided to write a comprehensive unit tests for that.
Writing them we realized that it would be cool to also enable that for normal app run in the debug more, so we can catch the problem in real environment when/if it happens.
Reviewed By: mdvacca
Differential Revision: D14587123
fbshipit-source-id: 6dcdf451b39489dec751cd6787de33f3b8ffb3fd
Summary: Because it's kinda more logical and we will rely on this in comming diffs.
Reviewed By: mdvacca
Differential Revision: D14587124
fbshipit-source-id: 94ae9410b4ffeffd0fcb4da4a0518f0bb0d2ba63
Summary: This is the first diff in an effort to remove Geolocation from React Native. This diff removes the globally injected navigator.geolocation feature and instead requires explicit importing of `Geolocation`. When using Web APIs, people will need to patch `navigator.geolocation` on their own from now on.
Reviewed By: sahrens
Differential Revision: D14692386
fbshipit-source-id: c57b290b49728101250d726d67b1956ff23a9a92
Summary: Looks like there are already a bunch of issues in the codebase because this wasn't on.
Reviewed By: cpojer
Differential Revision: D14701084
fbshipit-source-id: 09ff8e0d905b81fbe08c41d4f58758479b38187b
Summary:
Using a config flag to switch between different implementations of transferring layout outputs
- YogaNodeJNI uses multiple access of java fields to pass all properties like width, height, margin etc...
- YogaNodeJNIBatching uses a float array to pass all the data in one java field access
Reviewed By: davidaurelio
Differential Revision: D14378301
fbshipit-source-id: 0da5b28e6a67ad8fd60eb7efe622d9b2deaf177f
Summary: This diff adds the logic to transfer layout outputs using a float array
Reviewed By: davidaurelio
Differential Revision: D14368120
fbshipit-source-id: d1f22283bcea051d15657f42c15b90edaa0a8a7a
Summary: This diff adds a test for reset method in YogaNodeJNI to verify all layout outputs are reset properly
Reviewed By: davidaurelio
Differential Revision: D14643926
fbshipit-source-id: fffbcd07ccb6d2df83fc0bf187d992ef194f3bd0
Summary:
Moved layout outputs transfer logic from YogaNodeJNIBase to YogaNodeJNI.
This change set is for adding experiment for layout outputs batching using a float array
Reviewed By: davidaurelio
Differential Revision: D14642995
fbshipit-source-id: 5d0bc7fa18c1985be7e216d7351f5eab2e03861d
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
Summary:
If a NativeModule method requires an optional boolean argument, our codegen translates those optional booleans into `NSNumber*` instead of `BOOL`. The reason why is probably because this is the closest object analogue to `BOOL` in Objective C. The same boxing occurs with numbers. If the type of a number argument in JavaScript is optional, we'll map it to the `NSNumber*` Objective C type instead of `double`. Our existing TurboModules argument conversion code would not take this behaviour into account. Therefore, we'd try to insert a `BOOL` where the `NSInvocation` would expect a `NSNumber*`. This, in turn, would cause the app to crash. (Why would it crash at the point of NSInvocation retainArguments, I'm still not sure).
Our flow typechecking ensures that if the type of a method argument is a boolean, we pass in a boolean. Therefore, on the Native side, if we detect a boolean, we can check the type of the Native argument to see whether we should box the primitive. If the native argument type is an object, then we know it has to be an `NSNumber*` in both cases, so we simply wrap the `BOOL` or `double` in a `NSNumber*`.
Reviewed By: shergin
Differential Revision: D14679590
fbshipit-source-id: c394a878492aab8e98c71d74ec8740a94fc3a6c5
Summary:
Temporarily disable View Pooling in Fabric
Naming of classes will change in the near future
Reviewed By: JoshuaGross
Differential Revision: D14685009
fbshipit-source-id: 83573dd09af0202a67d0d0aa11e37c1660c3991f
Summary: Before the fix, the algorithm compares ShadowViews to make a decision should it recursively call itself or not; that didn't work properly because a ShadowView doesn't fully represent the state of the subtree tree (e.g. they don't have information about children nodes). After the fix, we compare pointers to ShadowNodes (by comparing pairs).
Reviewed By: mdvacca
Differential Revision: D14696996
fbshipit-source-id: 560d623b15a272f13b08a11745dec6be39a5dbdd
Summary: Moves a number of requireNativeComponent calls to standalone files to support codegen
Reviewed By: TheSavior
Differential Revision: D14654018
fbshipit-source-id: 349b975cd3a99a9373b2b9b1a19aa311d7c36399
Summary: This moves all the JS files and updates the BUCK files. The next step is to move the Android and iOS native files.
Reviewed By: TheSavior
Differential Revision: D14618890
fbshipit-source-id: 42984acdf5920e712f272d5742c778943be37ac5
Summary: With the recent change, JSCallInvoker now expects `Instance` to be passed in, not just the `MessageQueueThread`. There needs to be more plumbing to get the instance of `Instance` from the Java side, but this commit is just to unbreak the build temporarily.
Reviewed By: JoshuaGross
Differential Revision: D14687622
fbshipit-source-id: 42e0173ee8336fc5660fe8188a1e1f8517611521
Summary:
Otherwise reloading from metro deadlocks like this:
`[RCTSurfaceRegistry _stopAllSurfaces]` is calling `[RCTSurfaceRegistry enumerateWithBlock]` which locks `_mutex` and then we call `surfaceForRootTag` which then deadlocks on the same mutex:
https://pxl.cl/tmm1
Reviewed By: shergin
Differential Revision: D14679843
fbshipit-source-id: 9f4ecdfa7a79fcf7f3fc2ce437d4399b00910f26
Summary:
If size is zero, the `CGContext` would invalid, so we need to filter zero things.
cc. shergin
[iOS] [Fixed] - Fix invalid CGContext when invalidate layer
Pull Request resolved: https://github.com/facebook/react-native/pull/24195
Differential Revision: D14683396
Pulled By: shergin
fbshipit-source-id: b5b45fb86ca3158284281460cf1d95d1b22eab0d