-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Deadlock in RCTi18nUtil (iOS) #31032
Conversation
Hi @Saadnajmi! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Base commit: 099e7aa |
Base commit: 099e7aa |
…act-native-macos into rcti18nutil-deadlock-fix-fb
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
But... the point of |
I think so. The method The alternative would be to use something like |
To follow up here @shergin , the two values that could be saved were |
@RSNara has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
This change looks reasonable. I'll pull it in and do some internal testing to see if it breaks anything. If not, I'll merge it! |
Thanks @RSNara ! Just an FYI, I think we figured out what was causing the deadlock for us in downstream Microsoft code and fixed it, so it's a possibility this change is no longer an issue (I haven't tested without this change to see if I can repro the deadlock again, it was a while ago). That being said, I still feel like this change is safe and a worthy addition! |
Summary: This reverts commit fcead14. This should close #32509 . There was a bug where il8nManager.forceRTL() wouldn't work on app launch, and required an app restart. That was caused by an earlier change (#31032) which should not be necessary (the deadlock it was attempting to fix was actually caused by separate code). ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - Fixed bug where forceRTL did not work on app launch Pull Request resolved: #32574 Test Plan: Simple revert back to previously working code. Reviewed By: RSNara Differential Revision: D32315034 Pulled By: GijsWeterings fbshipit-source-id: dae6c1f0a2481e53f2f1e80f1ac083947681ef99
Summary: This reverts commit fcead14. This should close #32509 . There was a bug where il8nManager.forceRTL() wouldn't work on app launch, and required an app restart. That was caused by an earlier change (#31032) which should not be necessary (the deadlock it was attempting to fix was actually caused by separate code). ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - Fixed bug where forceRTL did not work on app launch Pull Request resolved: #32574 Test Plan: Simple revert back to previously working code. Reviewed By: RSNara Differential Revision: D32315034 Pulled By: GijsWeterings fbshipit-source-id: dae6c1f0a2481e53f2f1e80f1ac083947681ef99
…#32574) Summary: This reverts commit fcead14. This should close facebook#32509 . There was a bug where il8nManager.forceRTL() wouldn't work on app launch, and required an app restart. That was caused by an earlier change (facebook#31032) which should not be necessary (the deadlock it was attempting to fix was actually caused by separate code). ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - Fixed bug where forceRTL did not work on app launch Pull Request resolved: facebook#32574 Test Plan: Simple revert back to previously working code. Reviewed By: RSNara Differential Revision: D32315034 Pulled By: GijsWeterings fbshipit-source-id: dae6c1f0a2481e53f2f1e80f1ac083947681ef99
Summary: This reverts commit fcead14. This should close #32509 . There was a bug where il8nManager.forceRTL() wouldn't work on app launch, and required an app restart. That was caused by an earlier change (#31032) which should not be necessary (the deadlock it was attempting to fix was actually caused by separate code). ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - Fixed bug where forceRTL did not work on app launch Pull Request resolved: #32574 Test Plan: Simple revert back to previously working code. Reviewed By: RSNara Differential Revision: D32315034 Pulled By: GijsWeterings fbshipit-source-id: dae6c1f0a2481e53f2f1e80f1ac083947681ef99 Co-authored-by: Saad Najmi <sanajmi@microsoft.com>
* Rename immediate to ReactNativeMicrotask in Bridge Summary: Changelog: [Internal] This diff replaced all the internal occurrences of "Immediate" with "ReactNativeMicrotask" in the legacy bridge and then polyfilled the original immediate APIs during the timer setup phases as aliases of them. Note that this diff is part of a larger refactoring. Reviewed By: RSNara Differential Revision: D29785430 fbshipit-source-id: 7325d2a7358a6c9baa3e9abb8acf90414de5072f * Implement View.removeClippedSubviews prop Summary: Changelog: [internal] Fabric didn't have prop [removeClippedSubviews](https://reactnative.dev/docs/view#removeclippedsubviews) implemented. This diff adds it. It is Reviewed By: JoshuaGross Differential Revision: D29906458 fbshipit-source-id: 5851fa41d7facea9aab73ca131b4a0d23a2411ea * Add "Use Native Driver" control to RNTester Animated Composing example Summary: Changelog: [Internal] Reviewed By: yungsters Differential Revision: D29832704 fbshipit-source-id: dfd37d08d0f25fe86716a21682648894e8adad8b * docs: Fix dead links in README for rn-tester (#31901) Summary: Part of https://github.com/facebook/react-native/issues/31788 ~Updated link in README that was pointing to master branch to main branch~ Realized that link in rn-tester README and ReactAndroid README leads to a dead link, so I've fixed the links ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [INTERNAL] [FIXED] - Fix dead links in README Pull Request resolved: https://github.com/facebook/react-native/pull/31901 Test Plan: - [ ] Updated link directs you to appropriate page Reviewed By: PeteTheHeat Differential Revision: D29933044 Pulled By: GijsWeterings fbshipit-source-id: c1f301626acbb2995d74f78d8bc19214c70e9319 * docs: update links to forwarded page (#31903) Summary: Some of the links in `CONTRIBUTING.md` redirects you to a different page. I've fixed the links so each link would directly send users to the appropriate page. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [INTERNAL] [Changed] - update links in CONTRIBUTING.md Pull Request resolved: https://github.com/facebook/react-native/pull/31903 Test Plan: - [ ] Change links shows the appropriate content Reviewed By: lunaleaps Differential Revision: D29933105 Pulled By: GijsWeterings fbshipit-source-id: b5be74181f8a8e88d8f43e44c469337b7393dedf * Remove redundant warnings for RCTMountingManager Summary: Changelog: [internal] The warnings are in-actionable for product engineers. Reviewed By: JoshuaGross Differential Revision: D29911438 fbshipit-source-id: f0f81588e8cbe88059e531c8be302ab19b8eb83f * Ignore when a text string or number is supplied as a child. Summary: Currently, React Native throws an invariant violation error when a text string or number is supplied as a child. This is undesirable because core library components should be fault-tolerant and degrade gracefully (with soft errors, if relevant). This change will work when a change in the host configs are landed (https://github.com/facebook/react/pull/21953). Changelog: [internal] Reviewed By: yungsters, sammy-SC Differential Revision: D29894182 fbshipit-source-id: 827ff299991a476b57981382d196c7ee1396ec28 * React Native sync for revisions cae6350...419cc9c Summary: This sync includes the following changes: - **[419cc9c37](https://github.com/facebook/react/commit/419cc9c37 )**: Fix: Hide new/updated nodes in already hidden tree ([#21929](https://github.com/facebook/react/pull/21929)) //<Andrew Clark>// - **[4758e4533](https://github.com/facebook/react/commit/4758e4533 )**: React Native: Export getInspectorDataForInstance API ([#21572](https://github.com/facebook/react/pull/21572)) //<Brian Vaughn>// - **[ae5d26154](https://github.com/facebook/react/commit/ae5d26154 )**: Fix: LegacyHidden should not toggle effects ([#21928](https://github.com/facebook/react/pull/21928)) //<Andrew Clark>// - **[9ab90de60](https://github.com/facebook/react/commit/9ab90de60 )**: Clean-up: Move Offscreen logic from Suspense fiber ([#21925](https://github.com/facebook/react/pull/21925)) //<Andrew Clark>// - **[3f62dec84](https://github.com/facebook/react/commit/3f62dec84 )**: Typo fix ([#21729](https://github.com/facebook/react/pull/21729)) //<Deniz Susman>// - **[5579f1dc8](https://github.com/facebook/react/commit/5579f1dc8 )**: Update test comments with explanations ([#21857](https://github.com/facebook/react/pull/21857)) //<Ricky>// - **[262ff7ad2](https://github.com/facebook/react/commit/262ff7ad2 )**: Refactor "disappear" logic into its own traversal ([#21901](https://github.com/facebook/react/pull/21901)) //<Andrew Clark>// - **[34600f4fa](https://github.com/facebook/react/commit/34600f4fa )**: Refactor "reappear" logic into its own traversal ([#21898](https://github.com/facebook/react/pull/21898)) //<Andrew Clark>// - **[310187264](https://github.com/facebook/react/commit/310187264 )**: Clean up flushSync flow types ([#21887](https://github.com/facebook/react/pull/21887)) //<Ricky>// - **[a97b5ac07](https://github.com/facebook/react/commit/a97b5ac07 )**: [Bugfix] Don't hide/unhide unless visibility changes ([#21875](https://github.com/facebook/react/pull/21875)) //<Andrew Clark>// - **[81346764b](https://github.com/facebook/react/commit/81346764b )**: Run persistent tests in more configurations in CI ([#21880](https://github.com/facebook/react/pull/21880)) //<Andrew Clark>// - **[9090257e6](https://github.com/facebook/react/commit/9090257e6 )**: fix: restore execution context after RetryAfterError completed ([#21766](https://github.com/facebook/react/pull/21766)) //<Sebastian Silbermann>// - **[14bac6193](https://github.com/facebook/react/commit/14bac6193 )**: Allow components to render undefined ([#21869](https://github.com/facebook/react/pull/21869)) //<Ricky>// - **[87b67d319](https://github.com/facebook/react/commit/87b67d319 )**: Enable scheduling profiler flag for react-dom profiling builds ([#21867](https://github.com/facebook/react/pull/21867)) //<Brian Vaughn>// - **[464f27572](https://github.com/facebook/react/commit/464f27572 )**: Update link to flow ([#21862](https://github.com/facebook/react/pull/21862)) //<Ehsan Hosseini>// - **[9f5224a9c](https://github.com/facebook/react/commit/9f5224a9c )**: Restore DevTools console message ([#21864](https://github.com/facebook/react/pull/21864)) //<Dan Abramov>// - **[a4ecd85e8](https://github.com/facebook/react/commit/a4ecd85e8 )**: act: Batch updates, even in legacy roots ([#21797](https://github.com/facebook/react/pull/21797)) //<Andrew Clark>// - **[c2c6ea1fd](https://github.com/facebook/react/commit/c2c6ea1fd )**: Capture suspense boundaries with undefined fallbacks ([#21854](https://github.com/facebook/react/pull/21854)) //<Ricky>// - **[0f09f14ae](https://github.com/facebook/react/commit/0f09f14ae )**: Check if already rendering before flushing //<Andrew Clark>// - **[54e88ed12](https://github.com/facebook/react/commit/54e88ed12 )**: Bugfix: Flush legacy sync passive effects at beginning of event ([#21846](https://github.com/facebook/react/pull/21846)) //<Andrew Clark>// - **[cb8afda18](https://github.com/facebook/react/commit/cb8afda18 )**: Add test for #21837 ([#21842](https://github.com/facebook/react/pull/21842)) //<Andrew Clark>// - **[f85f429d5](https://github.com/facebook/react/commit/f85f429d5 )**: Use `act()` in ReactFabric tests ([#21839](https://github.com/facebook/react/pull/21839)) ([#21841](https://github.com/facebook/react/pull/21841)) //<Andrew Clark>// - **[84639ab53](https://github.com/facebook/react/commit/84639ab53 )**: Guard against reused fibers in React Native commands ([#21837](https://github.com/facebook/react/pull/21837)) //<Timothy Yung>// - **[c549bc491](https://github.com/facebook/react/commit/c549bc491 )**: Revert "Use `act()` in ReactFabric tests ([#21839](https://github.com/facebook/react/pull/21839))" ([#21840](https://github.com/facebook/react/pull/21840)) //<Timothy Yung>// - **[59d3aca68](https://github.com/facebook/react/commit/59d3aca68 )**: Use `act()` in ReactFabric tests ([#21839](https://github.com/facebook/react/pull/21839)) //<Timothy Yung>// - **[9ccc25a0e](https://github.com/facebook/react/commit/9ccc25a0e )**: Reverting recent flushSync changes ([#21816](https://github.com/facebook/react/pull/21816)) //<Brian Vaughn>// - **[ed6c091fe](https://github.com/facebook/react/commit/ed6c091fe )**: Replace unbatchedUpdates with flushSync ([#21776](https://github.com/facebook/react/pull/21776)) //<Andrew Clark>// - **[32eefcb3c](https://github.com/facebook/react/commit/32eefcb3c )**: Replace flushDiscreteUpdates with flushSync ([#21775](https://github.com/facebook/react/pull/21775)) //<Andrew Clark>// - **[ab390c65e](https://github.com/facebook/react/commit/ab390c65e )**: ReactDebugHooks optionally includes fileName, and line/column numbers ([#21781](https://github.com/facebook/react/pull/21781)) //<Brian Vaughn>// - **[c96761c7b](https://github.com/facebook/react/commit/c96761c7b )**: Delete batchedEventUpdates ([#21774](https://github.com/facebook/react/pull/21774)) //<Andrew Clark>// - **[3e8c86c1c](https://github.com/facebook/react/commit/3e8c86c1c )**: fix: maxYieldInterval should not compare with currentTime directly in Scheduler-shouldYieldToHost //<郭帅彬>// - **[d483463bc](https://github.com/facebook/react/commit/d483463bc )**: Updated scripts and config to replace "master" with "main" branch ([#21768](https://github.com/facebook/react/pull/21768)) //<Brian Vaughn>// Changelog: [General][Changed] - React Native sync for revisions cae6350...419cc9c jest_e2e[run_all_tests] Reviewed By: JoshuaGross Differential Revision: D29913856 fbshipit-source-id: 58e4903766a312a64a17cfba0b0f684cf4bcacb0 * Remove option to make measure calls asynchronous Summary: Changelog: [internal] Making measure calls asynchronous in Fabric regresses core metrics, let's remove the option. Reviewed By: JoshuaGross Differential Revision: D29909385 fbshipit-source-id: eea3fefc8da757c8db82cb0af340650e2ce6a947 * Fix android view dimensions Summary: This diff fixes the Android View dimensions in VR PixelUtil.toSPFromPixel and PixelUtil.getDisplayMetricDensity() are both using getScreenDisplayMetrics() to perform conversion of dimensions. This is not correct because we should take into consideration the density of the Context / Activity instead of the Screen. This problem didn't raise before in Fabric Android because it seems that android OS on phones usually share the scale between the screen and the Activity? These two methods are only used in Fabric and they were introduced by D9583972 (https://github.com/facebook/react-native/commit/5c0da011cbaa788c52519f8091157ca6d87d8abb) and D9173758 (https://github.com/facebook/react-native/commit/8b5e3fc16b1e58441318b6ada629dcff572dd120) As part of this diff I'm also deleting the method toSPFromPixel in favor of toDIPFromPixel because I noticed the usages of these methods are meant to use toDIPFromPixel() changelog: [Internal] internal Reviewed By: JoshuaGross Differential Revision: D29864944 fbshipit-source-id: a0a093c120bde21a6cf9e1043a83c31e870d4368 * Refactor DevServerHelper to separate checking if packager running Summary: Changelog: [Internal] Separate the functionality of the isPackagerRunning() function into a new class PackagerStatusCheck with the intention of being able to use this without needing a DevServerHelper Reviewed By: makovkastar, ShikaSD Differential Revision: D29933318 fbshipit-source-id: d708bb987b08634015d6ee6b6c8989faba416c5a * Introduce queueMicrotask API Summary: Changelog: [General][Added] - Add global.queueMicrotask `queueMicrotask` is a relatively recent API defined in the WHATWG HTML spec and it's been widely adopted by all web browsers and Node.js. This diff introduced it to React Native by polyfilling it via a lazily-allocated resolved Promise, or calling directly into a fast path provided by Hermes. Reviewed By: RSNara Differential Revision: D29838852 fbshipit-source-id: 8c4378b1b713fb8b0da5e67f92ba2ea9838766f7 * Shim Immediate APIs when Promise is queueing to JSVM Summary: Changelog: [Internal] Historically, Immediate API is implemented upon the React Native's internal microtask-y queue (known as "immediate queue"), which is the same queue Promise polyfill is operating on. To make React Native suitable of using the built-in Promises from JSVMs, which usually enqueues to the JSVM internal microtask queue and has no access to React Native microtask-y queue, we need to migrate the Immediate API to use the JSVM microtask queue as well to preserve the semantics of code relies on the interleaving of promises and immediates. To do that, this diff implement a shim layer for immediate APIs via the new `global.queueMicrotask` API (which enqueues to JSVM) in JS, by wrapping the immediate callback into a "microtask callback", which validate the `immediate ID` against `clearedImmediate` Set before invoking it. Reviewed By: RSNara Differential Revision: D29845305 fbshipit-source-id: c2ed3fed426a5316b1e0dfbfaad51706d1765d4d * Attempt to fix undefined instance handle in EventTarget Summary: changelog: [internal] Completion block can retain `_eventEmitter` beyond existence of the component. To fix this, do not retain `_eventEmitter` by block but try to acquire it inside it. Reviewed By: JoshuaGross Differential Revision: D29969189 fbshipit-source-id: 456c42f816acc160f9d6bbd3f9c8c55d611940b2 * Makes "force" property available to Apple Pencil based events. (#31780) Summary: Fixes https://github.com/facebook/react-native/issues/31779 For more detailed explanation, see issue https://github.com/facebook/react-native/issues/31779 React Native touch handler events (onTouchStart, onTouchMoved, etc..) are intended to have "force" properties when used on devices which support pressure input (3D Touch & Apple Pencil events). However, due to a check in RCTForceTouchAvailable() function which checks for UITraitCollection's "forceTouchCapability" to be equal to UIForceTouchCapabilityAvailable, the check returns NO on iPad-based devices, due to iPad devices returning UIForceTouchCapabilityUnavailable at all times. This causes "force" values of Apple Pencils to never be passed on to React Native. Since simply passing 0 as a value for force across the RN bridge for every touch event seemed like a change that might seem jarring to some, I decided that a simple additional boolean check if the touch event's type is UITouchTypePencil (this is the same as UITouchTypeStylus) should also suffice. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - Fixed "force" property of touch events for Apple Pencil/Stylus devices. [iOS] [Feature] - Added "altitudeAngle" property to touch events from Apple Pencil/Stylus devices. Pull Request resolved: https://github.com/facebook/react-native/pull/31780 Test Plan: The code compiles and runs, and trying a simple handler for a View like ```` touchMove = (e: GestureResponderEvent) => { console.log(`pressure, altitude (${e.nativeEvent.force}, ${e.nativeEvent.altitudeAngle})`); ```` results in <img width="424" alt="Screen Shot 2564-06-28 at 17 13 22" src="https://user-images.githubusercontent.com/5000572/123621055-0b563f00-d835-11eb-9eff-526ba27fdf7b.png"> and when pencil is oriented perpendicular to the screen and pressed with full force shows <img width="412" alt="Screen Shot 2564-06-28 at 17 13 58" src="https://user-images.githubusercontent.com/5000572/123621139-1c06b500-d835-11eb-8207-68a49720d708.png"> Reviewed By: sammy-SC Differential Revision: D29964102 Pulled By: sota000 fbshipit-source-id: 5a1f41d64c6fe325afbd2b9579eaf20a522e92dc * Fix typo in VirtualizedList-test.js (#31756) Summary: occured -> occurred ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Internal] [Fixed] - Fixed typo in VirtualizedList-test.js Pull Request resolved: https://github.com/facebook/react-native/pull/31756 Test Plan: NONE Reviewed By: lunaleaps Differential Revision: D29975153 Pulled By: charlesbdudley fbshipit-source-id: 966d90df0bf015b4a6a2e3b1bf88c66b61161a7a * Pass context through to all prop parser (core changes) Summary: Unfortunately, parsing some props requires stateful context - namely, PlatformColor on Android. We explored several different options but they all seemed inferior to the approach of using ContextContainer, and most would require using global state. By introducing this change everywhere as early as possible, we can avoid later pain. It is likely that some prop, on some platform, will require this mechanism. We'll be ready for it! Because we can pass a constref of the ContextContainer through to all props and because the context and context data is never retained by prop parsers, perf and memory hit should be ~0. This diff contains core changes only. Leaf changes to all props structs and conversions files will be in next diff(s). Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D29838789 fbshipit-source-id: f5090e7f02eb6e8fbe0ef4dd201e7d12104a3e3c * Pass context through to all prop parser (props structs changes) Summary: See previous diffs for context. This updates all of the relevant props structs. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D29855426 fbshipit-source-id: 30177c3380ef82ecf8f2a4321f128cfbe8a576e0 * Pass context through to all prop parser (conversions.h) Summary: See previous diffs for context. This updates all conversions.h files. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D29855425 fbshipit-source-id: d5751ddfc2724392e3a35f5e22bb68574e95e737 * Pass PropsParserContext to prop parsing layer Summary: Changelog: [internal] Reviewed By: mdvacca Differential Revision: D29921232 fbshipit-source-id: ba045f545b564aedf1b287045a0e75428de30a0f * Fix typo in Constants.h (#31049) Summary: controling -> controlling ## Changelog [Internal] [Fixed] - Fixed typo in comment Pull Request resolved: https://github.com/facebook/react-native/pull/31049 Test Plan: NONE Reviewed By: lunaleaps Differential Revision: D29980007 Pulled By: charlesbdudley fbshipit-source-id: 419f28f08d74faa07db18a07ab41b62c41776344 * Daily `arc lint --take CLANGFORMAT` Reviewed By: zertosh Differential Revision: D29983521 fbshipit-source-id: bebd38e79180c544c8c1986605cc1af4b1f4df98 * Update Dimension.js typo (#29858) Summary: preferred instead of preffered ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [CATEGORY] [TYPE] - Message Pull Request resolved: https://github.com/facebook/react-native/pull/29858 Reviewed By: charlesbdudley Differential Revision: D29998754 Pulled By: sota000 fbshipit-source-id: f13fef58e9154ddf8087944d53e022fb9afa6b1b * Make existential type an error in xplat Summary: This diff updates the xplat flowconfigs to make existential types an error. Changelog: [Internal] Reviewed By: pieterv Differential Revision: D29967838 fbshipit-source-id: f08bbafe2a0269adb2c9afa4572b7a34fd254a4d * Remove unused import (#30544) Summary: Remove unused import ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [performance] - Remove unused import Pull Request resolved: https://github.com/facebook/react-native/pull/30544 Test Plan: Should build on CI Reviewed By: lunaleaps Differential Revision: D30000901 Pulled By: charlesbdudley fbshipit-source-id: 3d3310917823b7af57564ca1ea397cd32cd0c4d5 * Updated TextInput autoCompleteType prop to autoComplete 1/2 (#26010) Summary: Fix for bug https://github.com/facebook/react-native/issues/26003 Rename TextInput prop "autoCompleteType" to "autoComplete". ## Changelog [Android] [Changed] - Updated `autoCompleteType` prop of `TextInput` to `autoComplete` Pull Request resolved: https://github.com/facebook/react-native/pull/26010 Test Plan: Test Pass PR for [Doc Update](https://github.com/facebook/react-native-website/pull/1184) Reviewed By: mdvacca Differential Revision: D29980220 Pulled By: lunaleaps fbshipit-source-id: 3c9e7d3250b5f95b0dbd523fdb0d917a039cd6a9 * Implement PlatformColor in Fabric Android Summary: This diff implements PlatformColor in Fabric Android changelog: [internal] internal Reviewed By: JoshuaGross Differential Revision: D29841461 fbshipit-source-id: 63a523626b021c634bc399e749b639b55730391a * Allows to set individual (left,top,right,bottom) dotted/dashed borders (#29099) Summary: This issue: fixes https://github.com/facebook/react-native/issues/24224 fixes https://github.com/facebook/react-native/issues/28695 fixes https://github.com/facebook/react-native/issues/23651 fixes https://github.com/facebook/react-native/issues/23475 fixes https://github.com/facebook/react-native/issues/22256 fixes https://github.com/facebook/react-native/issues/22226 fixes https://github.com/facebook/react-native/issues/19234 fixes https://github.com/facebook/react-native/issues/18285 fixes https://github.com/facebook/react-native/issues/17344 fixes https://github.com/facebook/react-native/issues/17343 fixes https://github.com/facebook/react-native/issues/17251 fixes https://github.com/facebook/react-native/issues/12817 fixes https://github.com/facebook/react-native/issues/12403 fixes https://github.com/facebook/react-native/issues/11042 fixes https://github.com/facebook/react-native/issues/9343 fixes https://github.com/facebook/react-native/issues/8236 fixes https://github.com/facebook/react-native/issues/8105 fixes https://github.com/facebook/react-native/issues/7838 fixes https://github.com/facebook/react-native/issues/6721 fixes https://github.com/facebook/react-native/issues/5411 fixes https://github.com/facebook/react-native/issues/3159 fixes https://github.com/facebook/react-native/issues/2335 fixes https://github.com/facebook/react-native/issues/840 fixes https://github.com/facebook/react-native/issues/27133 fixes https://github.com/facebook/react-native/issues/28695 Allows to set individual (left,top,right,bottom) dotted/dashed borders. If a single border is specified and the borderStyle is dotted or dashed, each border will be drawn with moveTo and lineTo taking in consideration of the border style and thickness. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Quickfix individual border style dotted or dashed rendering as solid Pull Request resolved: https://github.com/facebook/react-native/pull/29099 Test Plan: **<details><summary>CLICK TO OPEN TESTS RESULTS</summary>** <p> | **AFTER** | **AFTER** | |:-------------------------:|:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/84158300-05e05800-aa6c-11ea-96a3-40007b2ca611.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158309-07aa1b80-aa6c-11ea-973b-51e8e68b5808.png" width="300" height="" /> | | **AFTER** | **AFTER** | |:-------------------------:|:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/84158320-0d9ffc80-aa6c-11ea-9d7f-dfba49fbfe41.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158334-11cc1a00-aa6c-11ea-8422-cd5b9384f391.png" width="300" height="" /> | | **AFTER** | **AFTER** | |:-------------------------:|:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/84158556-4c35b700-aa6c-11ea-9a4d-eea791b3813a.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158574-51930180-aa6c-11ea-8e84-526cfb168f49.png" width="300" height="" /> | | **AFTER** | **AFTER** | |:-------------------------:|:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/84158586-55268880-aa6c-11ea-9540-51d79a8e4cb0.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158601-5952a600-aa6c-11ea-82e7-85d54b858f1a.png" width="300" height="" /> | | **AFTER** | **AFTER** | |:-------------------------:|:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/84158638-62dc0e00-aa6c-11ea-8765-ecba0d9d126f.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158652-67a0c200-aa6c-11ea-8336-e6eb8aa52e96.png" width="300" height="" /> | | **AFTER** | **AFTER** | |:-------------------------:|:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/84158690-738c8400-aa6c-11ea-9cf1-edec72d27cb7.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158912-b6e6f280-aa6c-11ea-94a7-0ee0db685f38.png" width="300" height="" /> | </p> </details> Reviewed By: mdvacca Differential Revision: D28688914 Pulled By: RSNara fbshipit-source-id: 34781d63265dcf55e30f11c014e6b4a35d67dcbd * Correct error message in getViewState method Summary: Changelog: [internal] Here, getting `viewState` has failed, not its view property. Reviewed By: mdvacca Differential Revision: D30042652 fbshipit-source-id: 42831b577f17db1f64860e68be33870f5be27207 * Clean up RAIICallbackManager experiment Summary: This experiment was shipped in D27436402 (https://github.com/facebook/react-native/commit/3d1afbbda301d48a75e45f73b96cd51ae5105dd8). Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D30023039 fbshipit-source-id: 5f7335f2ddaf6f4e2d876a917aaff2cf3d906b5c * Stop sharing LongLivedObjectCollection with the bridge Summary: ## Context Previously, when you'd call TurboModule methods with JavaScript callbacks, we'd [store the callbacks](https://www.internalfb.com/code/fbsource/[c503ff1b38621aebca87b2bbebeae088b01886c4]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm?lines=173%2C248-249) into [this global LongLivedObjectCollection collection](https://www.internalfb.com/code/fbsource/[c503ff1b38621aebca87b2bbebeae088b01886c4]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h?lines=65). Then, when React Native's JavaScript VM got torn down, we'd [clear the global collection](https://www.internalfb.com/code/fbsource/[e26f476ce208c578f05b1edb7639d1dad5612c7d]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp?lines=49), which would ensure that we deleted all held jsi::Functions, before deleting the jsi::Runtime. ## Problem With bridgeless mode enabled, there can be two TurboModule systems. Further, it is possible to tear down bridgeless mode, or the bridge, without tearing down the other initialization infra. In this scenario, the jsi::Function for the other initialization infra would also get deleted, which could lead to mysterious problems. ## Fix In this diff, I refactored the jsi::Function cleanup in the TurboModule system. Now, there are 3 modes: - kGlobalScope: Everything works as it did before - kRCTGlobalScopeUsingRetainJSCallback: We still use the global LongLivedObjectCollection, but we do it through invoking a block passed to every ObjCTurboModule by the TurboModuleManager. This group exists to assess the impact of having each TurboModule retain/use the block. I suspect this will be negligible, but it'd be good to have actual data to back this claim. - kRCTTurboModuleManagerScope: Every TurboModule uses a LongLivedObjectCollection that is owned by its TurboModuleManager. This should effectively fix the problem I outlined above. Changelog: [Internal] Reviewed By: p-sun Differential Revision: D30019833 fbshipit-source-id: da50d884c7e37190107f570d8ed70eeda7d9ae83 * Stop sharing LongLivedObjectCollection with the bridge Summary: This is the Android analogue to D30019833. Changelog: [Internal] Reviewed By: p-sun Differential Revision: D30029295 fbshipit-source-id: 13df0dfb915697eeedcc527dcdb6c246e89afb0c * setup fragment based tab bar navigation Summary: `Changelog: [Android] [Changed] - Make ReactFragment variables protected instead of private, create getter for ReactDelegate` Reviewed By: keoskate Differential Revision: D29981436 fbshipit-source-id: 3e5df811cd07edccf37f72c9f917f9ea0882be0b * Remove 'using namespace facebook::jni' Summary: Ez diff to remove 'using namespace facebook::jni' changelog: [internal] internal Reviewed By: sshic Differential Revision: D30046080 fbshipit-source-id: 52100970a408d772854cc0783fa13edd0cc39235 * Add TODO to fix and enable 'generated_tests-codegen_testsAndroid' Summary: Add TODO to fix and enable 'generated_tests-codegen_testsAndroid' changelog: [internal] internal Reviewed By: JoshuaGross Differential Revision: D30046143 fbshipit-source-id: dbeba6f1d51b32c069bda8bb9ca976014d299dae * Move RNTester Buck library to GitHub (#31435) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/31435 Moves the Facebook-internal Buck target definition for RNTester closer to the actual source files. This does not affect how RNTester is built in open source. Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D27942209 fbshipit-source-id: 66c970a5464a9329597d155ceeca78fb7f4834e8 * Move react-native Buck library to GitHub Summary: Moves the Facebook-internal Buck target definition for React Native closer to the actual JS source files. This does not affect how React Native is built in open source. Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D27942687 fbshipit-source-id: 328febb661ed6597feafdfd8efb2a95365325348 * Extract feature detection as an utilitiy module Summary: Changelog: [Internal] This diff only extracted the `isNativeFunction` used in `setUpTimers` into the `FeatureDetection` utility, but later we will add more functions in it and reuse them in other places. Reviewed By: RSNara Differential Revision: D29986750 fbshipit-source-id: 6e48e38d92ceccb35eead3c52e00e1eecb81b5b0 * Conditionalize the Regenerator Setup Summary: Changelog: [Internal] If generators are provided natively, that should suggest that the JS source code did not go through the regenerator-transform (e.g. in Metro Hermes profile), then there is no need to set up the regenerator runtime. This should save some work during the Core initialization. Reviewed By: motiz88 Differential Revision: D29986751 fbshipit-source-id: 129f5122e8e4c05535ee2aa5da6970a66843e8cd * Protect against crashes when over-releasing a TouchEvent Summary: It seems that, possibly due to optimizations and refactoring elsewhere in the event system, some TouchEvents are being over-disposed. This doesn't really pose a problem besides performance; and could even indicate that an Event was in a pool but never properly initialized. In these cases it seems perfectly reasonable to silently continue, and to log a soft exception. This WILL still crash in debug mode, so we can gather more information if we find a good repro; otherwise we will continue to get production data from this soft exception if it's an issue and we can investigate further. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D30061178 fbshipit-source-id: 05d1f60afc382ce0a202ac8f3de34770cf9a760d * Co-locate Buck targets for JS polyfills with their sources Summary: Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D30032230 fbshipit-source-id: 0d714b4e0a79a9c5c1c21e79f782635d8bd9c5f1 * chore: update Dimensions API Flow types (#31898) Summary: This small PR updates the Flow types used in Dimensions. The following changes has been made: * generic types has been replaced with types from `NativeDeviceInfo` (which already were used in event subscription update) * ~simplification of `DisplayMetricsAndroid` by spreading via intersection with `DisplayMetrics` type and removing shared properties~ > I have tried both notations, but according to the lint, it looks like a Native Modules typing limitation which requires redundancy / code duplication in cases like this. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Internal] [Changed] - update Dimensions API Flow types Pull Request resolved: https://github.com/facebook/react-native/pull/31898 Test Plan: Running `yarn flow` in the workspace yields no errors. Reviewed By: yungsters Differential Revision: D29932940 Pulled By: GijsWeterings fbshipit-source-id: bf97bb972964c585207e2450ccf71d932555e291 * Fix order of calls for Native Animated Module Summary: Changelog: [internal] Make sure the order of call is preserved for `NativeAnimatedModule`. The order of calls to NativeAnimatedModule needs to be preserved because its internals depend on it. For example, if you `getValue` is called before `createAnimatedNode`, it causes a crash. To resolve it, we need to enqueue `getValue` onto operationQueue. Reviewed By: JoshuaGross Differential Revision: D30035911 fbshipit-source-id: bbd698a96cada5d2b1312a1a689ca99b04a07cdc * Merge BUCK file at Libraries/ into root Summary: Merges the Facebook-internal Buck target definitions in `Libraries/` into the BUCK file at the root of the repo (which is currently not synced to GitHub at all). This does not affect how React Native is built in open source. Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D27967499 fbshipit-source-id: 39c51a544b3868242598072d24cb6cfb5a6e2d8c * Fix Buck package boundary violation in core components schema Summary: Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D29996246 fbshipit-source-id: e560c7261c4274da5219dc1e2d59d46b60e7549e * Allow resolving view from FabricUIManager Summary: Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D30043188 fbshipit-source-id: d8675754b29fb58a28a06777f602098da6dbc27f * Flush operations queue when animation starts Summary: changelog: [internal] If nodesManager has the information if animated node is managed by Fabric, we can't decide if the operation queue should be flushed before it is flushed. Therefore, keep the information about animated nodes inside a set instead of nodesManager. For simplicity, I will refer to class `RCTNativeAnimatedTurboModule` as *NativeAnimated* and to `RCTNativeAnimatedNodesManager` as *NodesManager* Notice that each call to *NativeAnimated* is queued up in `_operations` or `_preOperations`. When the queues are flushed, only then methods are called on `RCTNativeAnimatedNodesManager`. There are two mechanisms that flush operations. One is triggered by `RCTMountingManager` before mounting operations are applied and after they are applied. This works fine but is important to paint the picture. The second mechanism is inside `[RCTNativeAnimatedTurboModule startAnimatingNode]`. It flushes the queues for Fabric nodes only (not sure why Fabric nodes only, I couldn't find any explanation in old diffs). It checks with *NativeAnimated* if a node is managed by Fabric. Keep in mind, *NodesManager* only knows about the nodes when the queues have been flushed. Exampe: JavaScript calls methods on *NativeAnimated*. For example: 1. `createNode` 2. `connectAnimatedNodeToView` 3. `startAnimatingNode`. (here, the queues should be flushed, since we are in Fabric) All of these operations are queued up and for as long as `RCTMountingManager` executes mounting, all proceeds as expected. But if those operations happen after mounting phase, `startAnimatingNode` will not flush the operations queues, because it can't tell if nodeTag is managed by fabric or it isn't. This is because *NodesManager* hasn't been notified about any new nodes. Reviewed By: JoshuaGross, p-sun Differential Revision: D30053890 fbshipit-source-id: b7fe24861d5300f9cfefa813a53df8330fa56d86 * iOS: Log error when invalid NSNull data is passed to RCTAsyncLocalStorage Summary: Changelog: [Internal] Differential Revision: D30081478 fbshipit-source-id: 7d425e71b020eaeb4eb1b33b500fbf5df7ea9c29 * fbshipit-source-id: 909b2667480ed96ae376896d966f6c27f5e73964 * Update OSS Buck definitions (#31948) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/31948 Changelog: [Internal] Adds necessary shims to bring our BUCK files closer to parsing/building correctly in open source. This is part of fixing the Buck-based tests on CircleCI which were broken by https://github.com/facebook/react-native/commit/d4ee734f3297463fe7b54af6d69e4ea151cf4cf9. Reviewed By: sammy-SC Differential Revision: D30072866 fbshipit-source-id: 4aebd9f67dd0a102516603915d9a021032611279 * Update Android Dockerfile to include root BUCK file (#31950) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/31950 Changelog: [Internal] Adds the root BUCK file to the Docker image we use to test RNTester on CircleCI. See https://github.com/facebook/react-native/commit/df9cd05621f58fe5c67f889b741bfff20c780b0e Reviewed By: ShikaSD Differential Revision: D30099261 fbshipit-source-id: 936c505a0f4e7b791743901a06fa3b14c40b183e * Check for negative `numberOfLines` in TextView Summary: Negative `numberOfLines` prop is not supported by Android and causes a crash during layout measurement. This change adds a check in JS to catch the error earlier. Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D30047103 fbshipit-source-id: 4248a0f573c3b6facd25c7ae6ce007a357a1469b * Fix NPE when hierarchy return null values Summary: This diff fixes a NullPointer that was being thorwn when hierarchy values are null changelog: [internal] internal Reviewed By: sammy-SC Differential Revision: D30095407 fbshipit-source-id: b0a13661b4506cf94eeb5d99923d4c12cba0f972 * Extend getInspectorDataForInstance to return props Summary: This diff extends the FabricUIManager.getInspectorDataForInstance to return the props of the React Native component associated to the view passed as a parameter. changelog: [internal] internal Reviewed By: sammy-SC Differential Revision: D30095406 fbshipit-source-id: 50fdba6636a1f5042dbc113e341c3cb2534a1b04 * Add documentation for FabricUIManager.getInspectorDataForInstance Summary: Add documentation for FabricUIManager.getInspectorDataForInstance changelog: [internal] internal Reviewed By: sammy-SC Differential Revision: D30095818 fbshipit-source-id: dfe8590598099e7581460ca45bc0e779690463a6 * chore: remove FlowFixMe (#29468) Summary: Removed FlowFixMe that has been fixed ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [General] [Fixed] - Removed FlowFixMe that has been fixed Pull Request resolved: https://github.com/facebook/react-native/pull/29468 Test Plan: flow check passes Reviewed By: JoshuaGross Differential Revision: D29967702 Pulled By: lunaleaps fbshipit-source-id: 541279287ba6f21c5c7290bcba7c282f092126ff * Move RCT* Buck targets to GitHub Summary: Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D30030454 fbshipit-source-id: 02a4c36f5c5ca519e4de3d1a3d79708d0d0b6d01 * Move integration test Buck targets to GitHub Summary: Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D30032467 fbshipit-source-id: 56e293c821f02e78fe13f5e7f22bcb2b2050019a * Move RNTester unit/integration test Buck targets to GitHub Summary: Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D30032476 fbshipit-source-id: d1f9a39a6d2fc92f69b9ee931c2a0f3ba37687f6 * Move RCTTestApple into packages/rn-tester Summary: Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D30056021 fbshipit-source-id: 9012ca6934f95946ff157ca472aa6a6e84d7d7e9 * React Native sync for revisions 419cc9c...19092ac Summary: This sync includes the following changes: - **[19092ac8c](https://github.com/facebook/react/commit/19092ac8c )**: Re-add old Fabric Offscreen impl behind flag ([#22018](https://github.com/facebook/react/pull/22018)) //<Andrew Clark>// - **[215db465a](https://github.com/facebook/react/commit/215db465a )**: [Fabric] Add `flex: 1` to Offscreen view container ([#22019](https://github.com/facebook/react/pull/22019)) //<Andrew Clark>// - **[8a37b0ef3](https://github.com/facebook/react/commit/8a37b0ef3 )**: typos fixed ([#21955](https://github.com/facebook/react/pull/21955)) //<Sinan Sonmez (Chaush)>// - **[e3049bb85](https://github.com/facebook/react/commit/e3049bb85 )**: DevTools scheduling profiler: Add React component measures ([#22013](https://github.com/facebook/react/pull/22013)) //<Brian Vaughn>// - **[27bf6f9a8](https://github.com/facebook/react/commit/27bf6f9a8 )**: Scheduling profiler UX changes ([#21990](https://github.com/facebook/react/pull/21990)) //<Brian Vaughn>// - **[f0d354efc](https://github.com/facebook/react/commit/f0d354efc )**: [Fabric] Fix reparenting bug in legacy Suspense mount ([#21995](https://github.com/facebook/react/pull/21995)) //<Andrew Clark>// - **[34308b5ad](https://github.com/facebook/react/commit/34308b5ad )**: Tidy up early bailout logic at start of begin phase ([#21852](https://github.com/facebook/react/pull/21852)) //<Andrew Clark>// - **[321087d13](https://github.com/facebook/react/commit/321087d13 )**: [Fizz] Don't add aborted segments to the completedSegments list ([#21976](https://github.com/facebook/react/pull/21976)) //<Sebastian Markbåge>// - **[4cc8ec64c](https://github.com/facebook/react/commit/4cc8ec64c )**: Separate unit tests for ReactFabricHostComponent ([#21969](https://github.com/facebook/react/pull/21969)) //<Timothy Yung>// - **[d4d786493](https://github.com/facebook/react/commit/d4d786493 )**: Fix `ReactFabricHostComponent` methods if detached ([#21967](https://github.com/facebook/react/pull/21967)) //<Timothy Yung>// - **[392253a77](https://github.com/facebook/react/commit/392253a77 )**: [Fabric] Use container node to toggle the visibility of Offscreen and Suspense trees ([#21960](https://github.com/facebook/react/pull/21960)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 419cc9c...19092ac jest_e2e[run_all_tests] Reviewed By: JoshuaGross Differential Revision: D30092460 fbshipit-source-id: 9f118db2419a9a5db26a9b873868f91ab88f2f89 * refactor!: drop deprecated `StatusBarIOS` (#31466) Summary: This component has been merged with `StatusBar` and deprecated since [Jun 24, 2019](https://github.com/facebook/react-native/commit/a8337785539d572009d2cc4263aef7755ae03097) ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [JavaScript] [Removed] - refactor!: drop deprecated `StatusBarIOS` Pull Request resolved: https://github.com/facebook/react-native/pull/31466 Test Plan: Warning when user imports `StatusBarIOS` Reviewed By: yungsters Differential Revision: D30109324 Pulled By: lunaleaps fbshipit-source-id: fa2d3aa2cf35206ed8a196e09f12af57d3b61ccc * Fix OSS Buck parsing errors (#31957) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/31957 Changelog: [Internal] Some fixes for the GitHub shims for FB-internal Buck macros. Should fix the Buck-related breakages in the `test_android` and `test_docker` CI jobs. Also adds license headers to some recently-added files that didn't have them. Reviewed By: mdvacca Differential Revision: D30114177 fbshipit-source-id: 88a24fa7130bd98dd60568566bde51fcfc89df60 * Fix Buck package boundary violation involving RCTEventDispatcher.h (#31965) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/31965 Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D30030580 fbshipit-source-id: 3b4140a831c7ad7282aae0ff79c54014dcd82615 * Remove package boundary exceptions in OSS Buck config Summary: Changelog: [Internal] Reviewed By: stepancheg Differential Revision: D30102445 fbshipit-source-id: 571ab5dc41379e01d4482f64418f6383f660dbfa * Update JSLoader.cpp (#29270) Summary: Since react-native-cli is deprecated, the correct command should be `npx react-native start` Pull Request resolved: https://github.com/facebook/react-native/pull/29270 Reviewed By: sammy-SC Differential Revision: D30017028 Pulled By: sota000 fbshipit-source-id: cfcf9e1d150f51750a4e86133bd3167506ee7348 * Warn when negative `numberOfLines` prop set on <Text/> component Summary: Updates previous variant that was crashing a surface to the non-crashing variant. Now it prints error in console and modifies value to be 0. Changelog: [General][Fixed] Clamp negative values for `numberOfLines` in <Text> component Reviewed By: yungsters Differential Revision: D30129658 fbshipit-source-id: fda47a262365573514d3e1e4bf8a26f6d30cdae0 * Make So loading inside generated TMM delegates less confusing Summary: ## Rationale Inlining the maybeLoadSoLibrary private static method makes following the So load chain from TurboModuleManagerDelegate through ReactPackageTurboModuleManagerDelegate to each app's TurboModuleManagerDelegate much easier to understand. Changelog: [Internal] Reviewed By: sshic Differential Revision: D30082675 fbshipit-source-id: ff467d6ac8c792317dd9bdcd91844d3b480cbb60 * Add TODOs to unify component names between JS - Android - iOS - C++ Summary: EZ diff that adds a few TODOs to unify component names between JS - Android - iOS - C++ see task: T97384889 changelog: [internal] internal Reviewed By: sammy-SC Differential Revision: D30139942 fbshipit-source-id: 91f51d04e7e7ecba7f059f94a121be43d820647d * Replace Paper -> old renderer Summary: Replace Paper -> old renderer changelog: [internal] internal Reviewed By: sammy-SC Differential Revision: D30139941 fbshipit-source-id: 3bb1e81a3df018aa669f3dba1de445107d70116c * Fix Deadlock in RCTi18nUtil (iOS) (#31032) Summary: Note: PR to react-native-macos here https://github.com/microsoft/react-native-macos/pull/733 Internally in Microsoft code, we ran into a deadlock where the main queue and the UIManager queue were both trying to access `[RCTI18nUtil sharedInstance]`, and were blocked on each other. This is similar to an earlier issue with RCTScreenScale decsribed [here](https://github.com/facebook/react-native/issues/18096). To summarize: 1- RCTShadowView (on the UIManager queue) and RCTView (on the main queue) both try to access `[RCTI18nUtil sharedInstance]` 2- The UIManager thread gets there first, and lazily initializes the sharedInstance. Meanwhile, the main thread is waiting on a lock possessed by the UIManager thread 3- As part of the initialization, we set an NSUserDefault, which seems to require the (blocked) main thread. 4- Deadlock. For whatever reason, this only happens on debug. I did not figure out why, but I do know based on [this comment](https://github.com/facebook/react-native/issues/18096#issuecomment-368718081), that the UIManagerQueue should never block the main queue. The fix is to not use NSUserDefaults, and simpy use atomic properties instead. We get the thread safety for free, and it also simplifies the code somewhat without changing the public API. The downside is values aren't persisted anymore, but I do not think that was necessary / intended. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - Fix deadlock on RCTi18nUtil Pull Request resolved: https://github.com/facebook/react-native/pull/31032 Test Plan: Ran the RTLExample in RNTester, and ensured switching to RTL still worked, and that setting forceRTL would still work after reloading the bundle. https://user-images.githubusercontent.com/6722175/108775429-aefdae80-7526-11eb-9a89-3114f7ddc2af.mov Reviewed By: javache Differential Revision: D29522152 Pulled By: RSNara fbshipit-source-id: 160840f63a7b1d6721b0fd8294fb11990a4509fa * Codegen: Always prepare filesystem Summary: For any Pod that uses the codegen, create references to code-gen'd files in local filesystem regardless of Pod install status by invoking the same command used by `prepare_command` whenever `pod install` is run. This works around the issue where CocoaPods may decide to skip running `prepare_command`. While this is expected CocoaPods behavior, external factors may result in the deletion of the original code-gen'd files in which case we need to make sure that running `pod install` will bring these files back. See Test Plan for more details on how to reproduce the issue being fixed. Fixes T97404254. Changelog: [Internal] Codegen invoked with every `pod install` regardless of pod install status Differential Revision: D30116640 fbshipit-source-id: 81db5dff1d4c4f8ae22b5dbe822609c770789ac8 * - Bump CLI to ^6.0.0 (#31971) Summary: Upgrade CLI to the v6 stable. [Changelog](https://github.com/react-native-community/cli/releases/tag/v6.0.0) ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [General] [Fix] - Bump CLI to ^6.0.0 Pull Request resolved: https://github.com/facebook/react-native/pull/31971 Test Plan: cc kelset grabbou Reviewed By: TheSavior Differential Revision: D30158170 Pulled By: ShikaSD fbshipit-source-id: 392e22cb112a830778149b4a2b4a19198facf42b * Fix to make taps on views outside parent bounds work on Android (#29039) Summary: By default, Views in React Native have `overflow: visible`. When a child view is outside of the parent view's boundaries, it's visible on Android, but not tappable. This behaviour is incorrect, and doesn't match iOS behaviour. - Taps on Views outside the bounds of a parent with `overflow: visible` (or unset) should register - Taps on Views outside the bounds of a parent with `overflow: hidden` should continue to not register Related issues: - fixes https://github.com/facebook/react-native/issues/21455 - fixes https://github.com/facebook/react-native/issues/27061 - fixes https://github.com/facebook/react-native/issues/27232 ### Fix - Made `findTouchTargetView` not check that the touch was in the bounds of the immediate children, but instead - Check that the touch is in its own bounds when returning itself - Check that the touch for a child is in its own bounds only when `overflow: hidden` is set - Modified related code to adjust to this change - Added RNTesterApp test ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Allow taps on views outside the bounds of a parent with `overflow: hidden` Pull Request resolved: https://github.com/facebook/react-native/pull/29039 Test Plan: This can be tested with 2 examples added to the bottom of the PointerEvents page of the RNTesterApp: | Before | After | | --- | --- | | ![Before](https://user-images.githubusercontent.com/2937410/83610933-19079b00-a535-11ea-8add-22daae0191e1.gif) | ![After](https://user-images.githubusercontent.com/2937410/83610583-8830bf80-a534-11ea-97e2-71e180a70343.gif) | Reviewed By: ShikaSD Differential Revision: D30104853 Pulled By: JoshuaGross fbshipit-source-id: 644a109706258bfe829096354dfe477599e2db23 * Create slider accessibility delegate in createViewInstance (#31942) Summary: Recent change in https://github.com/facebook/react-native/pull/31865 made it so if `ReactSliderManager` is created on the react context creation thread it will crash with the following error. This happens because `ReactAccessibilityDelegate` tries to create a handler on a thread without a looper. This seems to happen because react-native-reanimated tries to get the UIManager module during its initialization which will cause view managers to be created and explains why the crash probably does not happens in RNTester or using only RN bundled modules. ``` 08-03 14:44:56.318 21206 21360 E AndroidRuntime: FATAL EXCEPTION: create_react_context 08-03 14:44:56.318 21206 21360 E AndroidRuntime: Process: com.th3rdwave, PID: 21206 08-03 14:44:56.318 21206 21360 E AndroidRuntime: java.lang.ExceptionInInitializerError 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.shell.MainReactPackage.createViewManagers(MainReactPackage.java:166) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.getOrCreateViewManagers(ReactInstanceManager.java:882) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:137) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.CoreModulesPackage.getModule(CoreModulesPackage.java:102) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:159) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:147) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:153) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:486) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:462) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.bridge.ReactContext.getNativeModule(ReactContext.java:176) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.swmansion.reanimated.NodesManager.<init>(NodesManager.java:153) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.swmansion.reanimated.ReanimatedModule.getNodesManager(ReanimatedModule.java:101) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.swmansion.reanimated.ReanimatedJSIModulePackage.getJSIModules(ReanimatedJSIModulePackage.java:17) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.th3rdwave.MainApplication$1$1.getJSIModules(MainApplication.java:135) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1329) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:136) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1058) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at java.lang.Thread.run(Thread.java:923) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: Caused by: java.lang.RuntimeException: Can't create handler inside thread Thread[create_react_context,5,main] that has not called Looper.prepare() 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at android.os.Handler.<init>(Handler.java:227) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at android.os.Handler.<init>(Handler.java:129) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.uimanager.ReactAccessibilityDelegate$1.<init>(ReactAccessibilityDelegate.java:185) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.uimanager.ReactAccessibilityDelegate.<init>(ReactAccessibilityDelegate.java:184) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.views.slider.ReactSliderManager$ReactSliderAccessibilityDelegate.<init>(ReactSliderManager.java:281) 08-03 14:44:56.318 21206 21360 E AndroidRuntime: at com.facebook.react.views.slider.ReactSliderManager.<clinit>(ReactSliderManager.java:301) ``` To fix it I changed the delegate creation to be done in `createViewInstance` which will be called on main thread. This is also more in line with how other accessibility delegates are created for other view managers. Since Slider is probably not used a lot, creating more delegate instance won't be an issue. Another alternative could be to initialize a Looper on the thread that creates the react context, but it seems more involved and probably not needed. ## Changelog [Android] [Fixed] - Create slider accessibility delegate in createViewInstance Pull Request resolved: https://github.com/facebook/react-native/pull/31942 Test Plan: Reproduced the crash in an app and made sure this patch fixes it. Reviewed By: JoshuaGross Differential Revision: D30167451 Pulled By: p-sun fbshipit-source-id: 5327130064db52ac0086e1ae5541a1b3e3954f15 * Flush operations queue when animation starts in RCTNativeAnimatedModule Summary: changelog: [internal] If nodesManager has the information if animated node is managed by Fabric, we can't decide if the operation queue should be flushed before it is flushed. Therefore, keep the information about animated nodes inside a set instead of nodesManager. For simplicity, I will refer to class `RCTNativeAnimatedTurboModule` as *NativeAnimated* and to `RCTNativeAnimatedNodesManager` as *NodesManager* Notice that each call to *NativeAnimated* is queued up in `_operations` or `_preOperations`. When the queues are flushed, only then methods are called on `RCTNativeAnimatedNodesManager`. There are two mechanisms that flush operations. One is triggered by `RCTMountingManager` before mounting operations are applied and after they are applied. This works fine but is important to paint the picture. The second mechanism is inside `[RCTNativeAnimatedTurboModule startAnimatingNode]`. It flushes the queues for Fabric nodes only (not sure why Fabric nodes only, I couldn't find any explanation in old diffs). It checks with *NativeAnimated* if a node is managed by Fabric. Keep in mind, *NodesManager* only knows about the nodes when the queues have been flushed. Exampe: JavaScript calls methods on *NativeAnimated*. For example: 1. `createNode` 2. `connectAnimatedNodeToView` 3. `startAnimatingNode`. (here, the queues should be flushed, since we are in Fabric) All of these operations are queued up and for as long as `RCTMountingManager` executes mounting, all proceeds as expected. But if those operations happen after mounting phase, `startAnimatingNode` will not flush the operations queues, because it can't tell if nodeTag is managed by fabric or it isn't. This is because *NodesManager* hasn't been notified about any new nodes. Reviewed By: RSNara Differential Revision: D30099010 fbshipit-source-id: d3fc021dd4346d1cbbda3b49ecd9d982c543e705 * Add Flow libdefs for `global` Summary: Changelog: [Internal] Currently, `global` is typed as `any` and any `global` properties accesses are untyped. This diff add a flow libdefs for the `global` object as a start point. Reviewed By: yungsters Differential Revision: D30000895 fbshipit-source-id: ab6988d01921a3c2a3434b534b2f69083570fb6d * Feat/dynamic color borders (#31140) Summary: Following up my issue https://github.com/facebook/react-native/issues/30377 I decided to have a look myself and contribute. On iOS, border colors using `PlatformColor` or `DynamicColorIOS` do not update on the fly when the system appearance updates. When the component mounts, the color is correct for the current appearance, but a component unmout/remount is required in order to see the color changing after a system appearance change. Fixes https://github.com/facebook/react-native/issues/30377 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Internal] [Added] - Added `PlatformColor` and `DynamicColorIOS` examples to RNTester Pull Request resolved: https://github.com/facebook/react-native/pull/31140 Test Plan: I added 2 border examples, one using `PlatformColor` and the other using `DynamicColorIOS`. I recorded the following before/after videos showing the effect of my changes: https://user-images.githubusercontent.com/4186230/110828711-9c5dd600-8297-11eb-8bc8-bdc9054b6b44.mov https://user-images.githubusercontent.com/4186230/110828800-b4cdf080-8297-11eb-9d23-07f69dc3a702.mov Reviewed By: lunaleaps Differential Revision: D30073335 Pulled By: charlesbdudley fbshipit-source-id: 2990a6ed40dd08fc2b1f20e93d6f21ec3d8980da * Cleanup warnings in the NDK build Summary: This diff is cleaning up some configurations in the `Android.mk` files of the native build. Specifically I simplified some of the rules and removed a duplicate file specification. Changelog: Internal - Cleanup warnings in the NDK build Reviewed By: ShikaSD Differential Revision: D30220715 fbshipit-source-id: a100953fe977879a6d28cb0a2ef4b3358fb7c774 * Back out "Flush operations queue when animation starts in RCTNativeAnimatedModule" Summary: Changelog: [internal] Original commit changeset: d3fc021dd434 Reviewed By: motiz88 Differential Revision: D30223203 fbshipit-source-id: 8edf79e109858855d13a36fabab2bcae36180df2 * Fix Undefined symbol: __swift_FORCE_LOAD_$_swiftFileProvider when building with Xcode 13 Summary: Changelog: Fix Xcode 13 build error in HelloWorld template Error: {F640400959} Fix: Embed `libswiftFileProvider.tbd` in app. Reviewed By: hramos Differential Revision: D30192423 fbshipit-source-id: 59dbde441e61bc6ab870e2324e5202f4772bee8e * introduce RCTPlatformColorUtils Summary: Changelog: [Internal] in this diff, we add the logic to handle converting PlatformColor strings to their corresponding RGBA values, using `UIColor`'s API as the source of truth of these colors. functionality not covered yet: - customColor - iOS Dynamic Colors - Variant Colors Reviewed By: sammy-SC Differential Revision: D30103451 fbshipit-source-id: 7d7be0f08dc2fb95b606b8f5d73784766787a574 * hook up PlatformColorParser to RCTPlatformColorUtils Summary: Changelog: [Internal] in this diff, we iterate through the list of color passed down in the props, and write the RGBA value of the first valid UIColor Reviewed By: sammy-SC Differential Revision: D30110297 fbshipit-source-id: c6730110129d0fe1f784fa89cd26b46d3dda7f28 * replace SharedColor alias with class for more reliable template deduction Summary: Changelog: [Internal] when we try to write a `SharedColor` type prop in the renderer, the template function we match to is the following: https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/ReactCommon/react/renderer/core/propsConversions.h?commit=28dacb972cda702d37dedd4612bc67c212d4d9eb&lines=108-132 this is because `SharedColor` is an alias of `better::optional<Color>`. ultimately, this causes a crash in L130 - the template deduction in L130 interprets the T as an `int`, rather than `SharedColor`, but our `rawValue` is pointing …
Summary
Note: PR to react-native-macos here microsoft#733
Internally in Microsoft code, we ran into a deadlock where the main queue and the UIManager queue were both trying to access
[RCTI18nUtil sharedInstance]
, and were blocked on each other. This is similar to an earlier issue with RCTScreenScale decsribed here.To summarize:
1- RCTShadowView (on the UIManager queue) and RCTView (on the main queue) both try to access
[RCTI18nUtil sharedInstance]
2- The UIManager thread gets there first, and lazily initializes the sharedInstance. Meanwhile, the main thread is waiting on a lock possessed by the UIManager thread
3- As part of the initialization, we set an NSUserDefault, which seems to require the (blocked) main thread.
4- Deadlock.
For whatever reason, this only happens on debug. I did not figure out why, but I do know based on this comment, that the UIManagerQueue should never block the main queue.
The fix is to not use NSUserDefaults, and simpy use atomic properties instead. We get the thread safety for free, and it also simplifies the code somewhat without changing the public API. The downside is values aren't persisted anymore, but I do not think that was necessary / intended.
Changelog
[iOS] [Fixed] - Fix deadlock on RCTi18nUtil
Test Plan
Ran the RTLExample in RNTester, and ensured switching to RTL still worked, and that setting forceRTL would still work after reloading the bundle.
Screen.Recording.2021-02-22.at.2.43.50.PM.mov