Summary: This diff switches `Text.style` from `DangerouslyImpreciseStyle` to `TextStyleProps` and fixes/ignores the related flow issues
Reviewed By: TheSavior
Differential Revision: D13568053
fbshipit-source-id: b4b6f8c22323faf9592ef13697043bb181c77423
Summary:
This diff moves the dispatching of views to the React Choreographer, this help to sort the mount of views following the order specified in the ReactChoreographer class.
This also enables synchronous and correct order for mounting of views that are dispatched in the UI Thread.
Reviewed By: sahrens
Differential Revision: D13444487
fbshipit-source-id: d8a43f473b07c9ccf7ea3bc9ab90545ec3c9ecee
Summary: It was pointed out to me in https://github.com/facebook/react-native/pull/22508 by raphael-liu that the error message refers to the wrong tag. I didn't merge the PR because I don't have good insight into the effects it could cause, but we should at least fix the error message.
Reviewed By: TheSavior
Differential Revision: D13564266
fbshipit-source-id: fa76f0888364df329d052dbcc2050f906d39dcef
Summary:
Fixes#21086.
Fixes#6117.
This PR fixes a crash caused by a race condition when `webSocket` deallocated and `NSStream` delegate callback, because `NSStream`'s delegate callback be called on `RCTSR_networkRunLoop`.
This PR mainly changes:
* Remove unnecessary `nil` operation in `dealloc` method.
* Add a new method `_scheduleCleanUp` to schedule `webSocket` cleanup also on `RCTSR_networkRunLoop`.
* In `stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode` delegate method, add a `wself` to make safe further.
Pull Request resolved: https://github.com/facebook/react-native/pull/22439
Differential Revision: D13564247
Pulled By: cpojer
fbshipit-source-id: 675c1b2805aa45c54d7708d796f5843ef7ea34e2
Summary:
This PR adds flow types for the RNTester examples, and updates all of the RNTester examples to match the flow type consistently.
Previously, there was a mix of static class definitions and whether or not pages exported examples or a component. Now we will always export the same way, enforced by flow types
Note: I also fixed most of the $FlowFixMe in changed components
Pull Request resolved: https://github.com/facebook/react-native/pull/22829
Reviewed By: cpojer
Differential Revision: D13563191
Pulled By: rickhanlonii
fbshipit-source-id: b697e3346a863d1b130881592b0522a96c202b63
Summary:
This PR adds filtering for e2e test examples using the new examples filter introduced in https://github.com/facebook/react-native/pull/22777
To do that we:
- Add a `testID` to `RNTesterExampleFilter` to select an example
- Refactor a few examples to export multiple examples for filtering
- Update all tests to filter by example title
Pull Request resolved: https://github.com/facebook/react-native/pull/22828
Reviewed By: TheSavior
Differential Revision: D13562664
Pulled By: rickhanlonii
fbshipit-source-id: efb0ca8050c1ca5c10d96bd77d35dd1143c3a3b3
Summary: Since we started relying on NativeModules' getConstants() method to access constants, we need to update our jest mocks of these NativeModules, so that the tests still pass. I do that in this diff.
Reviewed By: fkgozali
Differential Revision: D13561376
fbshipit-source-id: eaef3de82d842fd97d04be741d55bdded73c6a11
Summary:
This PR adds filtering functionality to individual example screens of RNTester. This is useful for Detox testing of RNTester, since Detox requires elements to be visible on the screen before they can be interacted with. Instead of needing to scroll an arbitrary amount, the test can enter the name of the example to be tested, just as is done on the main screen. This will lead to simpler and more reliable E2E tests for long example screens. This PR doesn't add any automated tests using the filter; those will be added in a separate PR.
This is implemented by extracting the existing filtering functionality out of `RNTesterExampleList` into a shared `RNTesterExampleFilter` component that can be used both within `RNTesterExampleList` (the main screen) and `RNTesterExampleContainer` (the example screen).


Changelog:
----------
[General] [Added] - Added filtering to RNTester example screens
Pull Request resolved: https://github.com/facebook/react-native/pull/22777
Reviewed By: TheSavior
Differential Revision: D13561744
Pulled By: rickhanlonii
fbshipit-source-id: cb120626a8e2b8440f88b871557c0b92fbef5edc
Summary: Add a catch statement for NPE around ViewGroup's dispatchDraw and log it
Reviewed By: mdvacca
Differential Revision: D13554441
fbshipit-source-id: a94d3db71678e17ef6bcda46689a069b85e460c5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/22231
- Use clang instead of the deprecated gcc
- Use libc++ instead of the deprecated gnustl
- Updated gradle and android plugin version
- Fixed missing arch in local-cli template
- `clean` task should now always succeed
- `clean` task deletes build artifacts
- No need to specify buildToolsVersion. It's derived.
- Elvis operator for more readable code
Pull Request resolved: https://github.com/facebook/react-native/pull/22263
Reviewed By: hramos
Differential Revision: D13004499
Pulled By: DanielZlotin
fbshipit-source-id: da54bb744cedb4c6f3bda590f8c25d0ad64086ef
Summary:
This change enables defining the macro at a more global and central location. And thereby allowing us to building this file using MSVC.
Pull Request resolved: https://github.com/facebook/react-native/pull/22561
Reviewed By: fkgozali
Differential Revision: D13529762
Pulled By: RSNara
fbshipit-source-id: c78abb26f47aba25d50305c5bc0b23b6568f1243
Summary:
This diff fixes a NPE that can occur when we force the dispatching of events when the EventDispatcher is not initized.
The fix consists on avoid posting the frame callback, if the internals of EventDispatcher are not initialized yet (same behavior used by the dispatchEvent method)
Reviewed By: fkgozali
Differential Revision: D13549147
fbshipit-source-id: ef3baeb536e8772fbd83024352a37af01c21d589
Summary:
This is only the core C++ part of TurboModule - moving to github to make integration with existing NativeModules system slightly easier. Other bindings for iOS/Android are not yet ready to move.
Notes:
* TurboModules is not ready to use at the moment.
* Build configuration is not yet provided (cocoapods/.xcodeproj/gradle), just like Fabric.
* No effort was done to make this lib C++17 strictly compliant yet (there will be in the future).
Reviewed By: RSNara
Differential Revision: D13551211
fbshipit-source-id: cd3b458e6746ee9218451962ca65b1ad641a32db
Summary: Catch `IllegalArgumentException: ReactViewPager.onTouchEvent` and ignore it (but log something) to work around this known bug in the Android SDK per https://github.com/chrisbanes/PhotoView/issues/31#issuecomment-19803926. Note that `onInterceptTouchEvent()` is already doing the same thing.
Reviewed By: yungsters
Differential Revision: D13550425
fbshipit-source-id: 9fa3a7a0ca0cd95aafa3bcae6a59e0d1e690b564
Summary: Adds a workaround to `ReactTextView` for a crash that happens in `getOffsetForHorizontal`: https://issuetracker.google.com/issues/113348914
Reviewed By: mdvacca
Differential Revision: D13548917
fbshipit-source-id: 1c346283cd036c88d60a4b10890ade46c7e80eca
Summary:
This diff fixes a race condition that was detected on "Marketplace You" production test for Android.
The race condition happens when the method ShadowTree::complete is executed concurrently from two threads (in this case this is called from Scheduller::constraintSurfaceLayout and Scheduler::uiManagerDidFinishTransaction), based on the order of execution this bug makes MountViewItems to be dispatched to the UI in the wrong order.
The root cause of the bug is in the method:
```
bool ShadowTree::complete(
const SharedRootShadowNode &oldRootShadowNode,
const UnsharedRootShadowNode &newRootShadowNode) const {
newRootShadowNode->layout();
newRootShadowNode->sealRecursive();
auto mutations =
calculateShadowViewMutations(*oldRootShadowNode, *newRootShadowNode);
if (!commit(oldRootShadowNode, newRootShadowNode, mutations)) {
return false;
}
emitLayoutEvents(mutations);
if (delegate_) {
delegate_->shadowTreeDidCommit(*this, mutations);
}
return true;
}
```
Notes:
- the commit method is guarded by the commitMutex_
- the shadowTreeDidCommit() method dispatches mutations instructions to the platform side.
- If there are two threads running concurrently, there is no guarantee that the shadowTreeDidCommit() is going to be called in the correct order.
The solution is to include the execution to shadowTreeDidCommit() in the same commitMutex_
Possible solutions:
1 - move the commitMutex_ out of the commit method (to the completeMethod)
2 - synchronize the call to complete method() - this is the implemented solution.
I chose this solution to make it consistent with the way Scheduler::constraintSurfaceLayout is implemented (https://fburl.com/8l49no5x)
This mechanism is very likely to change in the refactor of threading mechanism that Valentin Shergin is going to be working on January.
I would like to land this, so we can fix this bug and run another experiment in production as soon as possible.
Reviewed By: sahrens
Differential Revision: D13535587
fbshipit-source-id: bedd4d85f5569ab3733c302d1328aa48017bcaad
Summary: In some rare race condition (usually involving network request handling vs bridge shutting down), there may be bad access to an RCTModuleData that may have been de-allocated. To prevent crashes, let's guard the access and return nil appropriately.
Reviewed By: yungsters
Differential Revision: D13548755
fbshipit-source-id: b97326524cd9ca70a13d15098a1eaadfc7f1a6a8
Summary: In D13307775, ScrollView was changed into a `React.Component` subclass. The solution needed a few touchups, so I added them in this diff.
Reviewed By: TheSavior
Differential Revision: D13404191
fbshipit-source-id: cba2ddab1fb92a2cbb91b59ac9ae5b5d51d91eb8
Summary:
As a part of https://github.com/facebook/react-native/pull/22301 it turned out that we need to first convert `ScrollView` to class component. As a first step to do so, here's removal of using `mixins` API, in favor of populating `_scrollResponder` field with `ScrollResponder.Mixin` (still used) methods.
Pull Request resolved: https://github.com/facebook/react-native/pull/22374
Reviewed By: TheSavior
Differential Revision: D13307775
Pulled By: RSNara
fbshipit-source-id: 16be1df8a0bf9ccc5cc32f3a017a1279f99268ed
Summary:
This removes the use of the legacy context API in `TextInput`.
Nothing in OSS appears to make use of the `focusEmitter`.
Pull Request resolved: https://github.com/facebook/react-native/pull/22220
Reviewed By: TheSavior
Differential Revision: D13408886
Pulled By: RSNara
fbshipit-source-id: 9ae597507ccc26a9bc944a44c1f51b91e73cd637
Summary: Replaced all deprecated ALAssets* references to roughly equivalent PHPhoto* references in RCTCameraRoll library. There are still some minor inconsistencies between iOS/Android and documentation that existed prior to this diff that need to be resolved after this.
Reviewed By: fkgozali, PeteTheHeat
Differential Revision: D13513777
fbshipit-source-id: 3f0c4ae259823fae78eba875a6c259733715ab56
Summary:
shergin mentioned that he'd like to move away from RTTI a bit and use explicit key strings for context container instances rather than relying on the `typeid`, so this does this.
We also fatal with a useful error message if we get a collision, rather than failing silently.
Reviewed By: shergin
Differential Revision: D13384308
fbshipit-source-id: 0b06d7555b082be89e8f130c23e94be99749a7a3
Summary:
`RCTSurfaceHostingProxyRootView` surfaces are still automatically started right after the initialization to match `RCTRootView` interface, but `RCTSurfaceHostingView` must be started explicitly now. Also fixed some internal stuff so start and register are clear and distinct.
Background / initial motivation:
One tricky bit - we render the template as part of init`ing the rootView, so we don't know what the surfaceId will be before hand to register the UITemplate. Two possible solutions:
1) Require start be called explicitly after initializing the rootView, and setup the context in between.
2) Do something like "setUITemplateConfigForNextSurface" before creating the rootView, and have some hook when the surfaceId is assigned that associates the surfaceId with that "next" UITemplate stuff before.
(1) seems a lot cleaner, but it requires ever user of rootView to explicitly call start on it - how do you feel about that? Seems like we could also use that start call to decide if the initial render should be synchronous or not? start vs. startSync?
Reviewed By: mdvacca
Differential Revision: D13372914
fbshipit-source-id: 6db297870610e6c231f8a78c0dd74d584cb64910
Summary: We need a way for different apps to inject dependencies or additional functionality into Fabric - ReactNativeConfig might be a special case, but I think this could clean up it's integration nicely, and I'm using this for a uitemplate cache system so we can use CompactDisk or other storage systems for caching depending on the app.
Reviewed By: mdvacca
Differential Revision: D13407287
fbshipit-source-id: 45481908434e6235850aa4d2d6b2bfb936a23be7
Summary:
Hi Team!
This PR fixes#22741
Thanks for labeling as Good First Issue!
Changelog:
----------
[General] [Fixed] - fix deprecation warning of testResultsProcessor flag in test-ci
Pull Request resolved: https://github.com/facebook/react-native/pull/22749
Differential Revision: D13542419
Pulled By: hramos
fbshipit-source-id: 84f33329a6b9431ed1db843a99e7db7dbeda5361
Summary:
The following tests are disabled in this PR:
- testTimersTest is failing due to undefined this.setTimeout, probably introduced back in 61346d3. Tracking a fix in https://github.com/facebook/react-native/issues/22695
- testTheTester_ExpectError is failing as RCTTestRunner is not properly passing through the error. Tracking a fix in https://github.com/facebook/react-native/issues/22697
I've added a comment regarding testWebSocketTest and how to ensure it passes locally.
This PR also fixes all remaining snapshot tests, which were failing due to the use of iPhone XS as a iOS Simulator on Circle CI. We are using iPhone 6s for SST internally, and this allows us to be consistent.
Pull Request resolved: https://github.com/facebook/react-native/pull/22720
Differential Revision: D13532788
Pulled By: hramos
fbshipit-source-id: 75681236032839bf88180611ee68826b53cc96eb
Summary:
This is very much a work in progress. Moving it into the open source repo to be able to hook it up to generate some Fabric files.
Will continue to iterate on it in the open.
Reviewed By: hramos, mdvacca
Differential Revision: D13500969
fbshipit-source-id: 79082447dc52b5834f24eb72bc6e07200b324238
Summary:
Some snapshot tests (particularly those for which there is a lot of test data) can still timeout with "Timed out waiting for bridge and UI idle!" error.
Increasing the timeout to 4 minutes from 2 minutes
Differential Revision: D13523429
fbshipit-source-id: 18f04ea93e342d123eea4c4cd812bd3b1cc85ee0
Summary:
These comments were confusing since we don't use flow-typed.
cc bvaughn.
I have replaced our local types by flow-typed, removed metro custom stub and deleted `flow-github` directory.
As result, createReactClass, PropTypes and Metro types won't be distributed to RN users. If you need it, you should relay on flow-typed.
Pull Request resolved: https://github.com/facebook/react-native/pull/20320
Reviewed By: TheSavior
Differential Revision: D13517157
Pulled By: rickhanlonii
fbshipit-source-id: e52c0b6114114a706f6152b2031c600e3dece0d2
Summary: Instead of ignoring the linter, it's better to fix the warnings :)
Differential Revision: D13512033
fbshipit-source-id: a3db1417ddfde2e05a0c03c204f3627cc15c5a2d
Summary:
The iOS snapshots have been out of date for months, but the failure was not caught in open source's `test_objc` job because `xcpretty` was swallowing the non-zero error code.
To fix this, I enabled recording mode in RNTesterSnapshotTests.m temporarily, and re-ran the tests in order to update the snapshots. I've also switched the test device used by Circle CI to iPhone 6s to be consistent with the snapshot tests that run internally at Facebook.
Integration tests are not fully fixed yet, but I can confirm the following tests are fixed by this diff:
```
-[RNTesterIntegrationTests testImageSnapshotTest]
-[RNTesterIntegrationTests testSimpleSnapshotTest]
-[RNTesterSnapshotTests testARTExample]
-[RNTesterSnapshotTests testLayoutExample]
-[RNTesterSnapshotTests testSliderExample]
-[RNTesterSnapshotTests testSwitchExample]
-[RNTesterSnapshotTests testTabBarExample]
-[RNTesterSnapshotTests testTextExample]
-[RNTesterSnapshotTests testViewExample]
```
I've also fixed a few shellcheck warnings in related scripts.
Reviewed By: fkgozali
Differential Revision: D13506865
fbshipit-source-id: dab985130c2ff3cb9dea19d1f87c8ee65d8c141e
Summary:
Switch E2E tests have been failing on master, although they pass locally.
Changelog:
----------
Help reviewers and the release process by writing your own changelog entry. See http://facebook.github.io/react-native/docs/contributing#changelog for an example.
[General] [Fixed] - Fix failing Switch E2E tests
Pull Request resolved: https://github.com/facebook/react-native/pull/22698
Differential Revision: D13511917
Pulled By: hramos
fbshipit-source-id: b2f5cac1927531a855699e34e1a37036773f0aad
Summary:
So, it does not start itself automatically right after instantiation.
(Classic RCTSurface still kinda start itself automatically but only because start/stop concept is not implemented for this yet.)
Reviewed By: sahrens
Differential Revision: D13461294
fbshipit-source-id: 05430688f69a0d9bf75d03e6d25f02ccd5d3176a
Summary:
@public
Further heap size reductions by using bitfields in `YGLayout` and `YGNode`.
Reviewed By: SidharthGuglani
Differential Revision: D13466325
fbshipit-source-id: ddcef0a1b3822e7449fe485d99c920d54139c893
Summary:
@public
Switches the storage in `facebook::yoga::detail::Values` from `YGValue` to `facebook::yoga::detail::CompactValue`.
This cuts heap size for arrays of values in half.
Reviewed By: SidharthGuglani
Differential Revision: D13465586
fbshipit-source-id: 49a4d6d29a73bdd44843b1f3c57bf746050c94d6
Summary:
@public
The storage format of `YGValue` in `YGStyle` is an implementation detail that is going to change soon. It is only guaranteed to be assignable from, and castable to `YGValue`.
Here, we remove tight coupling from the actual implementation in React Native.
Reviewed By: shergin
Differential Revision: D13465113
fbshipit-source-id: 41dfcb90c2a1cd825a6732854bf84d4c3318d835
Summary:
Similar to what was done here https://github.com/facebook/react-native/pull/22376
This allows using things like async functions with text input event props.
Changelog:
----------
[General] [Fixed] - Make TextInput event prop types less strict
Pull Request resolved: https://github.com/facebook/react-native/pull/22673
Reviewed By: TheSavior
Differential Revision: D13492029
Pulled By: hramos
fbshipit-source-id: 84e1a776a7ac1ae7567fbf4105b2be9be330610e
Summary:
This ensures the changelog is captured as part of the commit description, and not the test plan, when the PR is imported into Phabricator
Pull Request resolved: https://github.com/facebook/react-native/pull/22683
Differential Revision: D13498624
Pulled By: hramos
fbshipit-source-id: 59a7e7e8c6f76973d3cfb97dea0e56af43673a9b