* Rename `RCTUIGraphicsImageRenderer` to `RCTMakeUIGraphicsImageRenderer` (#46772)
Summary:
Because `UIGraphicsImageRenderer` doesn't exist on macOS, I need to shim it for React Native macOS (See https://github.com/microsoft/react-native-macos/pull/2209). I planned to use the name `RCTUIGraphicsImageRenderer`. However.. it seems that is used by a static helper function in `RCTBorderDrawing.m`. So.. let's rename it? The function is just a helper method to make an instance of the class, so I think the name `RCTMakeUIGraphicsImageRenderer` is slightly more idiomatic anyway.
This method is not public, so it should not break the public API of React Native.
[IOS] [CHANGED] - Rename `RCTUIGraphicsImageRenderer` to `RCTMakeUIGraphicsImageRenderer`
Pull Request resolved: https://github.com/facebook/react-native/pull/46772
Test Plan: CI should pass
Reviewed By: joevilches
Differential Revision: D63765490
Pulled By: cipolleschi
fbshipit-source-id: de68dce0f92ec249ea8586dbf7b9ba34a8476074
* fix(iOS): Replace uses of `CGColorRef` with UIColor to avoid manual memory management (#46847)
Summary:
Update React Native on iOS to do less manual memory management, by replacing uses of `CGColorRef` with `UIColor`, and only calling `UIColor.CGColor` when needed. This results in much less manual memory management, which is probably a good thing in 2024 :D. The downside is there is a breaking change: the signature of a method in `RCTBorderDrawing` changes.
This is a followup to https://github.com/facebook/react-native/issues/46797 . After that PR merged and I tested merging React Native macOS to the `0.76-stable` branch cut commit again, I saw even more places I needed to manually call `CGColorRetain` / `CGColorRelease`. The reason is due to React Native macOS specifics (explained below) and I could update React Native macOS to not need these changes, but I thought I would at least throw up a PR to propose the changes, as it may be good to move away from using Core Graphics' C base API as much as possible.
With https://github.com/microsoft/react-native-macos/pull/2209 , I wrote a shim of [UIGraphicsImageRenderer](https://developer.apple.com/documentation/uikit/uigraphicsimagerenderer) for macOS. The main difference is my shim calls the NSImage API [imageWithSize:flipped:drawingHandler:](https://developer.apple.com/documentation/appkit/nsimage/1519860-imagewithsize?language=objc) to shim the UIGraphicsImageRenderer API [imageWithData:](https://developer.apple.com/documentation/uikit/uiimage/1624137-imagewithdata). The difference between the two is that the macOS API copies the block, and executes it when Appkit is about to draw the image, while the iOS API executes the block right away. Because of this, I think I am hitting way more places where `CGColorRef` variables needed to be retained / released. Additionally, I hit more of them when I merge to the 0.76 branch cut commit (this is why I didn't catch it with https://github.com/facebook/react-native/issues/46797).
Given this constraint, I have a couple of options:
1. Refactor my macOS shim to use the deprecated API [[NSImage lockFocus]](https://developer.apple.com/documentation/appkit/nsimage/1519891-lockfocus)
- I am not a fan of this because `lockFocus` was deprecated for `imageWithSize:flipped:drawingHandler:`
2. Refactor my macOS shim to do what we used to do: Create a CGContext manually and write it to an image
- This is probably OK. Relies on less Appkit specifics, and potentially gives more control to RN on the rendering layer, which I recall lenaic told me is better for Fabric)
3. Refactor React Native to avoid CGColorRef altogether, and use `UIColor` (which ARC will memory manage for us) as much as possible.
- This is the approach of this PR and my preferred approach. The downside is this changes the signature of some of the methods in `RCTBorderDrawing` which is a breaking change. I've seen other PRs do this, so maybe its OK?
[IOS] [BREAKING] - Replace uses of `CGColorRef` with UIColor to avoid manual memory management
Pull Request resolved: https://github.com/facebook/react-native/pull/46847
Test Plan: Launching RNTester's View example (which tests a lot of the border / outline / shadow rendering) does not crash for me on both iOS and macOS.
Reviewed By: NickGerleman
Differential Revision: D63989547
Pulled By: joevilches
fbshipit-source-id: 5e85e17567e3dd8b4b0388452398954ad2e02464
* Followup fixes
* Remove extra scaleFactor argument that is now unused
* Further reduce diffs related to scaleFactor
* fix typos and dead code
Merge up to
6f7eae5c58
, the commit for the `0.75-stable` branch cut.
## Summary:
### Interesting upstream changes:
- Some commit removed `packages/react-native/local-cli`, as React Native
is reducing its dependency on `@react-native-community/cli`.
- We will keep this directory around so we can continue shipping our
`run-macos` command.
-
775713cef7
Upstream commit that replicates a diff we’ve had in RNM for a while to
have `focusable` consistent with `disabled`. I also modified our macOS
prop `acceptsFirstMouse` to match.
-
a1b318c18b
`TouchableWithoutFeedback` was rewritten as a Function component using
Pressability. We needed to update our implementation to match.
-
a40bd8e34a
Adds DisplayP3 Colorspace support. This mostly worked with NSColor,
minus a one line diff in `HostPlatformColor.mm` where we have to handle
an assert.
- I also opened https://github.com/facebook/react-native/pull/46071/ to
fix a nit on the implementation.
-
a977b2e69b
Ported DevSettingsModule.java to Kotlin, we needadd back our one method
`setIsSecondaryClickToShowDevMenuEnabled`
-
252ef19c8d
encouraged me to update some uses of `RCTUIView` to `RCTPlatformView`
inside RCTScrollView.
-
eadcebbb3e
Adds support for Text highlighting in Fabric
-
95a8c99f3f
encouraged me to undo a couple of ifdefs:
- `RCTSendScrollEventForNativeAnimations_DEPRECATED` is now implemented
for macOS
- We had a couple of ifdefs in RCTScrollView to use `self.contentView`
instead of `_contentView`. I undid these. We should make sure these are
proper, and if so, upstream the change.
-
8597727c28
Needed some diffs that need an `@availability` check for macOS 11…
-
f6badca2f9
was kept in for macOS as well.
- RCTSegmentedControl was removed from React Native Core.
- Followup: Upstream our macOS implementation.
### Other interesting changes:
- Disabled the RNTester Integration test WebsocketTest for macOS. This
passed locally for me, so I’m not sure why it’s failing in CI.
- Followup: Add a task to re-enable this test.
- Ifdeffed out most references of `InputAccessoryView` to only iOS. This
isn’t relevant for macOS or visionOS.
- Removed diffs in `RCTImageLoader` introduced way back with
4b19d14eba
. They don’t seem to be necessary anymore
- We ifdefed out the implementation for
`RCTPausedInDebuggerOverlayController`. This is used by the experimental
new debugger with Hermes.
- Followup: Implement this for macOS at a future time. For bonus points,
rewrite it in SwiftUI.
### Other notes There’s an increasing amount of places where upstream
code calls `UIView.backgroundColor = <>`. This is one of those things
that doesn’t entirely work properly without `RCTUIView`, but in most
places, I use `RCTPlatformView` (aka `NSView`) and shim it as
follows: ``` #if !TARGET_OS_OSX // [macOS]
view.backgroundColor = [UIColor systemBackgroundColor];
#else // [macOS
view.wantsLayer = true;
view.layer.backgroundColor = [[NSColor windowBackgroundColor] CGColor];
#endif // macOS]
``` This mostly works.. except for Light/Dark mode, because the background color won’t update. To properly implement `backgroundColor`, we need to override `displayLayer`. `RCTUIView` already does this, so perhaps the followup is to update most uses to use RCTUIView. Also, maybe `RCTUIKit` should be a separate pod altogether?
## Test Plan:
Ci should pass.
## List of merge conflicts
```
Unmerged paths:
(use "git add/rm <file>..." as appropriate to mark resolution)
both modified: jest.config.js
both modified: package.json
added by us: packages/helloworld/generate-macos.js
added by us: packages/helloworld/generator-common/index.js
added by us: packages/helloworld/generator-macos/index.js
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld-macOS/AppDelegate.h
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld-macOS/AppDelegate.mm
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld-macOS/Assets.xcassets/Contents.json
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld-macOS/Base.lproj/Main.storyboard
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld-macOS/HelloWorld.entitlements
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld-macOS/Info.plist
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld-macOS/main.m
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld.xcodeproj/project.pbxproj
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld-iOS.xcscheme
added by us:
packages/helloworld/generator-macos/templates/macos/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld-macOS.xcscheme
added by us: packages/helloworld/generator-macos/templates/macos/Podfile
added by us:
packages/helloworld/generator-macos/templates/macos/_gitignore
added by us: packages/helloworld/runMacOS/findXcodeProject.js
added by us: packages/helloworld/runMacOS/runMacOS.js
both modified: packages/react-native-test-renderer/package.json
both modified:
packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h
both modified:
packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm
both modified: packages/react-native/Libraries/Components/Button.js
both modified:
packages/react-native/Libraries/Components/ScrollView/ScrollView.js
both modified:
packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js
both modified:
packages/react-native/Libraries/Components/TextInput/TextInput.js
both modified:
packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js
both modified:
packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js
both modified:
packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js
both modified:
packages/react-native/Libraries/Components/View/ReactNativeStyleAttributes.js
both modified:
packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm
both modified:
packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h
both modified:
packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm
both modified:
packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts
both modified:
packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js
both modified:
packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm
both modified:
packages/react-native/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h
both modified:
packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm
both modified:
packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputViewManager.mm
both modified:
packages/react-native/Libraries/Text/TextInput/RCTInputAccessoryViewContent.mm
both modified: packages/react-native/Libraries/Text/TextProps.js
both modified:
packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap
both modified: packages/react-native/React/Base/RCTConvert.h
both modified: packages/react-native/React/Base/RCTConvert.mm
both modified:
packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm
both modified: packages/react-native/React/CoreModules/RCTDevSettings.mm
both modified: packages/react-native/React/CoreModules/RCTDeviceInfo.mm
both modified: packages/react-native/React/CoreModules/RCTRedBox.mm
both modified:
packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm
both modified:
packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
both modified:
packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
both modified:
packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
both modified: packages/react-native/React/Modules/RCTUIManager.m
both added: packages/react-native/React/Views/RCTCursor.h
both modified:
packages/react-native/React/Views/RCTModalHostViewManager.h
deleted by them: packages/react-native/React/Views/RCTSegmentedControl.h
deleted by them: packages/react-native/React/Views/RCTSegmentedControl.m
deleted by them:
packages/react-native/React/Views/RCTSegmentedControlManager.m
both modified: packages/react-native/React/Views/RCTView.h
both modified: packages/react-native/React/Views/RCTView.m
both modified: packages/react-native/React/Views/RCTViewManager.m
both modified:
packages/react-native/React/Views/ScrollView/RCTScrollView.m
deleted by them:
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DevSettingsModule.java
both modified:
packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm
both modified:
packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp
both modified:
packages/react-native/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp
both modified:
packages/react-native/ReactCommon/react/renderer/components/view/primitives.h
both modified:
packages/react-native/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm
both modified: packages/react-native/package.json
both modified: packages/react-native/react-native.config.js
both modified: packages/react-native/template/package.json
both modified: packages/rn-tester/Podfile.lock
both modified: packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
both modified:
packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js
both added: packages/rn-tester/js/examples/Cursor/CursorExample.js
both modified:
packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js
both modified: packages/rn-tester/js/examples/Text/TextExample.ios.js
both modified:
packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js
both modified: packages/rn-tester/package.json
both modified: packages/virtualized-lists/package.json
deleted by them: scripts/releases-ci/prepare-package-for-release.js
both modified: scripts/releases-ci/publish-npm.js
both modified: yarn.lock
```
* Cherry-pick d3e3e2a870
* Port the rest of code
* Support most cursors on paper
* remove unnecessary style
* Support Fabric as well
* Share Paper and Fabric implementation
* fix typos
* Remove SF Symbol cursors
* update snapshots
* lint --fix
* Add vertical text
* undo space
* update snapshot
* fixes
* Update macros
* Implement RCTCursorNone
* Mark vertical-text as a macOS diff
* Add _isUpdatingPlaceholderText to prevent spurious "did end editing" notifications
* Organize macOS tags and ifdef blocks
---------
Co-authored-by: Adam Gleitman <adgleitm@microsoft.com>
Picking up from
https://github.com/microsoft/react-native-macos/pull/2145, many thanks
to @falselobster for the bulk of the work :)
Merge up to 0.74 branch cut
(c99d96b7a1)
This PR combines most of the work into the single large merge commit for
a couple of reasons:
1. To preserve git history with upstream React Native, we cannot "squash
or rebase the commits. Therefore, we must do a merge commit.
2. I am personally not a fan of committing git merge markers and
resolving them in followup commits.
I did have a couple of extra commits after the merge commit for work
that I feel could be separated out. I will do my best to list
interesting changes in this merge, and what files to look at + what
changes I made in those files. For a more "exhaustive" list, I also
listed all files that had merge conflicts below. This isn't 100% of the
changes (I touched some extra files for some lint fixes / shimming of
`UIView` -> `RCTPlatformView` / `RCTUIView`) but it will get you a good
80-90%.
## Summary:
### Interesting upstream changes:
Each of these changes resulted in extra work to support macOS. See the
original commit, which files were touched, and then how those files are
diffed in this change.
-
1b85ed94a1
Moved RCTPushNotificationManager to use UNNotification APIs
-
3f621df189
RCTActionSheetManager was reworked for synchronous calls
-
e2eb26c951
RCTRedBox was reworked for iPad and orientation changes, the
functionality of RCTRedBoxWindow was reworked into the new
ViewController introduced upstream, RCTRedBoxController
-
0806ad7854
Introduced a new stable id for the inspector dev server based on UUID
which required a custom macOS implementation
-
4c108aaae4
Added support to dynamic colors in Fabric
### Other interesting changes:
- Removed a lot of diffs around adding a `scaleFactor` to places where
we manually calculate frames / sizes. With React Native 0.74, [Yoga 3.0
introduces Per-Node
`PointScaleFactor`](https://github.com/microsoft/react-native-macos/pull/356),
which is probably more accurate than the `scale` prop we added to
RCTShadowView that keys off the main screen.
- Reverted https://github.com/microsoft/react-native-macos/pull/356.
This change added an integratiion test, and introduced a bunch of JS
diffs. The test itself has since been disabled, many of the JS diffs
were actually redundant (applying background colors in macOS only diffs
that got overwritten by new styling that upstream changes added, etc),
the test was not ported to new platforms (visionOS), and Integration
tests in general are heading a different direction (Appium +
WebdriverIO). I figured let's revert this and the diffs it introduced
rather than fix the integration test
- I had to manually ifdef out the dev menu `PerfMonitor` option as we
haven't ported that to macOS yet. This presumably now because a problem
as recent changes to bridgeless + removing diffs has changed which
modules are loaded when. In this case, I think the PerfMonitor module is
lazy loaded when you create the dev menu. Without the ifdef, we would
Redbox every time we open the dev menu.
- New lint rules did re-order a lot of imports in macOS specific
packages like our local-cli. I also did my best to move macOS specific
imports in JS files to a new line to make the diffs a little cleaner.
- I had to implement `RCTUITextView.selectedTextRange` on macOS, as that
started erroring in RNTester.
Todo:
- [ ] Publish new version of virtualized-list package
## Test Plan:
CI should pass. I encourage reviewers to check out and build RNTester as
well.
## List of merge conflicts.
```
Unmerged paths:
(use "git add/rm <file>..." as appropriate to mark resolution)
both modified: Gemfile.lock
both modified: packages/community-cli-plugin/package.json
both modified: packages/metro-config/package.json
both modified: packages/normalize-color/package.json
both modified: packages/react-native/Libraries/Alert/NativeAlertManager.js
both modified: packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h
both modified: packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm
both modified: packages/react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js
deleted by them: packages/react-native/Libraries/Components/Button.flow.js
both modified: packages/react-native/Libraries/Components/Button.js
both modified: packages/react-native/Libraries/Components/ScrollView/ScrollView.js
both modified: packages/react-native/Libraries/Core/NativeExceptionsManager.js
both modified: packages/react-native/Libraries/Image/Image.ios.js
both modified: packages/react-native/Libraries/Image/RCTImageLoader.mm
both modified: packages/react-native/Libraries/NativeModules/specs/NativeDevSettings.js
both modified: packages/react-native/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js
both modified: packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h
both modified: packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm
both modified: packages/react-native/Libraries/Text/Text/RCTTextView.mm
both modified: packages/react-native/Libraries/Text/TextInput/RCTInputAccessoryViewManager.mm
both modified: packages/react-native/React-Core.podspec
both modified: packages/react-native/React/Base/RCTUtils.m
both modified: packages/react-native/React/CoreModules/RCTActionSheetManager.mm
both modified: packages/react-native/React/CoreModules/RCTAlertController.mm
both modified: packages/react-native/React/CoreModules/RCTAlertManager.mm
both modified: packages/react-native/React/CoreModules/RCTAppearance.mm
both modified: packages/react-native/React/CoreModules/RCTDevLoadingView.mm
both modified: packages/react-native/React/CoreModules/RCTDeviceInfo.mm
both modified: packages/react-native/React/CoreModules/RCTRedBox.mm
both modified: packages/react-native/React/CoreModules/RCTStatusBarManager.mm
both modified: packages/react-native/React/CoreModules/RCTTiming.mm
both modified: packages/react-native/React/CoreModules/React-CoreModules.podspec
both modified: packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm
both modified: packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm
both modified: packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm
both modified: packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
both modified: packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
both modified: packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
both modified: packages/react-native/React/Fabric/RCTConversions.h
both modified: packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm
both modified: packages/react-native/React/Fabric/RCTSurfacePresenter.mm
both modified: packages/react-native/React/Modules/RCTUIManager.m
both modified: packages/react-native/React/React-RCTFabric.podspec
both modified: packages/react-native/React/UIUtils/RCTUIUtils.m
both modified: packages/react-native/React/Views/RCTDebuggingOverlayManager.h
both modified: packages/react-native/React/Views/RCTModalHostViewController.m
both modified: packages/react-native/React/Views/RCTShadowView.m
both modified: packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m
both modified: packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h
both modified: packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm
both modified: packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h
both modified: packages/react-native/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/RCTPlatformColorUtils.mm
deleted by them: packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/NSTextStorage+FontScaling.h
both modified: packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h
both modified: packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp
both modified: packages/react-native/index.js
both modified: packages/react-native/package.json
both modified: packages/react-native/react-native.config.js
both modified: packages/react-native/scripts/cocoapods/helpers.rb
both modified: packages/react-native/scripts/cocoapods/jsengine.rb
both modified: packages/react-native/scripts/cocoapods/utils.rb
both modified: packages/react-native/third-party-podspecs/boost.podspec
both modified: packages/rn-tester/IntegrationTests/LayoutEventsTest.js
both modified: packages/rn-tester/NativeComponentExample/ios/RNTMyLegacyNativeViewManager.mm
both modified: packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.h
both modified: packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm
both modified: packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewManager.mm
both modified: packages/rn-tester/Podfile
both modified: packages/rn-tester/Podfile.lock
both modified: packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m
both modified: packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.m
both modified: packages/rn-tester/RNTester/AppDelegate.mm
deleted by them: packages/rn-tester/RNTester/RNTester.entitlements
both modified: packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
both modified: packages/rn-tester/js/RNTesterApp.ios.js
both modified: packages/rn-tester/js/components/RNTesterBlock.js
both modified: packages/rn-tester/js/components/RNTesterModuleList.js
both modified: packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js
both modified: packages/rn-tester/js/examples/Image/ImageExample.js
both modified: packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js
both modified: packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js
both modified: packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js
both modified: packages/virtualized-lists/Lists/VirtualizedList.js
both modified: packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js
both modified: packages/virtualized-lists/package.json
deleted by them: scripts/__tests__/publish-npm-test.js
deleted by them: scripts/monorepo/get-and-update-nightlies.js
deleted by them: scripts/prepare-package-for-release.js
deleted by them: scripts/publish-npm.js
both modified: scripts/releases/utils/release-utils.js
both modified: yarn.lock
```
* fix(iOS): adjust RCTRedBox to work for iPad and support orientation changes (#41217)
Summary:
When opening `RCTRedBox` on an iPad (and also visionOS) there was an issue with buttons width going out of screen. When changing screen orientation, RedBox wasn't recalculating view positions.
**Root cause**: Getting frame of root view to display this modal and basing all calculations on it.
**Solution**: Use Auto Layout to build UI that responds to orientation changes and device specific modal presentation.
I've also tested it with adding custom buttons to RedBox and it works properly.
[IOS] [FIXED] - adjust RCTRedBox to work for iPad and support orientation changes
Pull Request resolved: https://github.com/facebook/react-native/pull/41217
Test Plan:
Launch the app without metro running and check out RedBox that's shown there. Also change screen orientation to see proper recalculation of view positions.
https://github.com/facebook/react-native/assets/52801365/892dcfe7-246f-4f36-be37-12c139c207achttps://github.com/facebook/react-native/assets/52801365/dfd0c3d8-5997-462d-97ec-dcc3de452e26
Reviewed By: GijsWeterings
Differential Revision: D50734569
Pulled By: javache
fbshipit-source-id: 51b854a47caf90ae46fcd32c4adcc64ec2ceb63f
* refactor: use less verbose API for RCTRedBox constraints (#42261)
Summary:
This PR is a continuation of my previous PR where I refactored RCTRedBox to use Auto Layout (https://github.com/facebook/react-native/issues/41217). This PR uses less verbose API for defining constraints.
## Changelog:
[IOS] [CHANGED] - use less verbose Auto Layout API for RCTRedBox constraints
Pull Request resolved: https://github.com/facebook/react-native/pull/42261
Test Plan:
Launch the app without metro enabled to see the RCTRedBox
![CleanShot 2024-01-12 at 14 54 20@2x](https://github.com/facebook/react-native/assets/52801365/32ee9916-3e32-46c3-9f6b-c313631aa1e5)
![CleanShot 2024-01-12 at 14 54 16@2x](https://github.com/facebook/react-native/assets/52801365/c625b9b9-b462-4e67-831f-0192427bbe93)
Reviewed By: NickGerleman
Differential Revision: D52730458
Pulled By: javache
fbshipit-source-id: dc7227e7b6e3238c195342cb0460850b57eb75c3
* refactor Redbox on macOS and present as a sheet
* present RCTDevLoadingView as a sheet
* refactor Logbox and present as a sheet
* change RCTRootView.loadingView to RCTPlatformView
* update Podfile.lock
* PR feedback
---------
Co-authored-by: Oskar Kwaśniewski <oskarkwasniewski@icloud.com>
* [0.73-stable] New events for RCTUIView (#2137)
* Move mouse events from RCTView to superclass RCTUIView
* Add focus and responder events
* Move mouse event implementations to RCTUIView class
---------
Co-authored-by: Adam Gleitman <adgleitm@microsoft.com>
* [0.73-stable] Add mouse hover events to `RCTTextView` (#2143)
* Initial implementation
* Refactor and dedupe some code
* Basic error handling
* Clarify comment about mousemove order
* Cleanup: enumerate all text attributes at once instead of doing multiple passes
* Use *shadow* view traversal for handling nested mouse events
* Remove potentially confusing comment
* descendantViewTags doesn't need to worry about duplicates
* Distinguish between embedded views and virtual text subviews
* Scope _virtualSubviews to macOS only
* nit: use separate #if blocks for `setTextStorage:...` and `getRectForCharRange:` inclusions
* TARGET_OS_OSX blocks for virtualSubviewTags
* Remove #if TARGET_OS_OSX blocks, since these changes are potentially upstreamable
* Clarify a TODO
---------
Co-authored-by: Adam Gleitman <adgleitm@microsoft.com>
* Add an example for Text mouse hover events
* Add missing macOS props to Text.d.ts
* Fix flow errors
* Fix lint errors
---------
Co-authored-by: Adam Gleitman <adgleitm@microsoft.com>
## Summary:
Originally, I meant to just update the lock to resolve some CVEs. It
seems our lock is actually clean, so instead I'm updating yarn to the
latest version.
## Test Plan:
CI passes.
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45006
The steps were pointing to an incorrect folder. Updated to points to react-native/packages
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D58669426
fbshipit-source-id: b58b9bc7d8c7860f2f46c8bdf4bf0636e82ee357
Summary:
After updating my project to 0.73.2 I noticed that even though I had a specific port set in my `metro.config.js`, every time I'd start my project, it was running on port 8081. Passing the `--port` argument would allow me to change the port, but the config from metro did not. I checked if the metro config was being properly applied, using `--verbose` and it was.
So I dug a bit, trying to figure out what had changed and noticed the coalescing of the value, whenever the argument `--port` is not present. That seemed odd since it meant that there's always a port defined for the `options` of `loadMetroConfig`, which would always be used in the `loadConfig` step.
To confirm I was on the right track I went to the [cli-plugin-metro](https://github.com/react-native-community/cli/blob/v11.3.10/packages/cli-plugin-metro) repo, to the last release before the move here, and noticed that there was [no coalescing in the same method](https://github.com/react-native-community/cli/blob/v11.3.10/packages/cli-plugin-metro/src/commands/start/runServer.ts#L60).
In this PR, I remove the coalescing of the port from `runServer.js` from the `community-cli-plugin`, to allow the port configuration through `metro.config.js`.
## Changelog:
[INTERNAL] [FIXED] - Fix server port configuration via `metro.config.js`
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/44957
Test Plan:
Running `yarn start` and verifying that:
- it would listen to port `8081` if no argument nor a custom port was set in `metro.config.js`
- it would listen to port `8082` if that one was defined in `metro.config.js`
- it would listend to port `8083` if that port was passed as an argument to the command (i.e. `yarn start --port 8083` even though port 8082 was defined in `metro.config.js`
Reviewed By: cortinico
Differential Revision: D58605152
Pulled By: robhogan
fbshipit-source-id: 9cf7a8b6a0d9de3af1ca4092906b4c648acee373
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45005
We've had failures owing to running out of disk space, however this isn't a stable failure. Adding more data about disk availability and utilisation to help debug these issues.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D58667190
fbshipit-source-id: 3d5f7cc985ac71044818f7b5663ef7400ad691b5
Summary:
Implements `requestIdleCallback` and `cancelIdleCallback`
### Notes
Proposed implementation does yet cover all WHATWG eventloop requirements.
- Deadline computation is not implemented and is polyfilled by giving each callback `50ms`, rather than it being shared between other idle callbacks.
- The requested callbacks are called with lowest priority by the scheduler as of now, but the execution is not as described in the standard.
## Changelog:
- [GENERAL] [ADDED] - Implemented `requestIdleCallback` and `cancelIdleCallback`
Pull Request resolved: https://github.com/facebook/react-native/pull/44759
Reviewed By: javache, sammy-SC
Differential Revision: D58415077
Pulled By: rubennorte
fbshipit-source-id: 46189d4e3ca1d353fa6059a904d677c28c61b604
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44991
Updates the open source renderers for React 19. This is in preparation for React Native 0.75.
Notable, this incorporates the feature flag changes from [facebook/react#29903](https://github.com/facebook/react/pull/29903).
Changelog:
[General][Changed] - Upgrade Renderers for React 19
Reviewed By: robhogan
Differential Revision: D58632199
fbshipit-source-id: 674bb47554e4b0c6ab5127fb9683ed8284b7a4ce
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44990
Upgrades React Native and Relay to depend on React 19, which is currently published as release candidates. This is in preparation for React Native 0.75.
This will depend on updating open source renderers after [facebook/react#29903](https://github.com/facebook/react/pull/29903) is merged.
Changelog:
[General][Changed] - Upgrade to React 19
Reviewed By: robhogan
Differential Revision: D58625271
fbshipit-source-id: f9ad95b18716a9ce02f7cfbcc7248bdfb244c010
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44989
Enables these 2 global feature flags for React Native Jest testing:
- `IS_REACT_ACT_ENVIRONMENT`
- `IS_REACT_NATIVE_TEST_ENVIRONMENT`
Changelog:
[General][Changed] - Enables React global flag that causes Jest testing environment to require `act()`
Reviewed By: robhogan
Differential Revision: D58644562
fbshipit-source-id: 4de5ea3a89e8ca99ac4c1c21721872db4f5552b3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45002
There are a couple Jest unit test cases for `VirtualizedList-test.js` that require further investigation.
We believe that these are problems with Jest fake timers in the test and not with the component itself, so for now let's skip them so as to unblock the upgrade to React 19.
Changelog:
[Internal]
Reviewed By: robhogan
Differential Revision: D58656948
fbshipit-source-id: d52f3ad8277def6eae20cbbc11751d73b769d929
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44997
Wrap `VirtualizedList-test` uses of `react-test-renderer` in `act` as appropriate, so as to pass under current React and mostly pass under React 19, with further fixes to come.
Changelog: [Internal]
Reviewed By: robhogan
Differential Revision: D58649295
fbshipit-source-id: 5e0fa791d581fbf004a2ca7eaa5c4b4d9a15ddfe