Граф коммитов

26614 Коммитов

Автор SHA1 Сообщение Дата
chiuam a019ab9165
Improve VoiceOver accessibility support for Flatlist (#1341) 2022-08-12 11:43:19 -04:00
Julio César Rocha b9fb2dd1a0
Fix BAT line endings (#1142)
Co-authored-by: Saad Najmi <sanajmi@microsoft.com>
2022-08-11 21:56:18 -07:00
Ryan Linton 4eb3cd5585 remove view prop and fix build errors 2022-08-11 19:38:34 -06:00
Adam Gleitman 3e45617371 Remove .circleci folder 2022-08-11 17:51:15 -07:00
lyzhan7 8ed4340a48
Merge pull request #1352 from lyzhan7/lyzhan-shadowconsistency
Fix inconsistent shadows
2022-08-10 18:38:48 -07:00
lyzhan7 5c7a48c039 Fix build break attempt 2022-08-10 17:46:49 -07:00
lyzhan7 14bc46a090 Formatting in response to comments 2022-08-10 17:08:31 -07:00
lyzhan7 0051dac56d Update with shadowOpacity 2022-08-10 16:23:50 -07:00
lyzhan7 5f594b4c23 Copy Liron's fix 2022-08-10 16:23:33 -07:00
Christoph Purrer 2190b3b978
Cache local images into memory (#1279)
This introduces a cache for local image on macOS. There are no predefined limits set here (at least yet) since presumably we are loading a finite number of resources and we have the benefit of virtual memory swap on desktop so we don't really need to sweat a few extra megabytes of in-memory cache for images we know we'll need to repeatedly load.

Local images don't use the shared RN image cache, and on macOS there's no automatic in-memory cache for local resources (other than the OS-level disk cache) so the `RCTImageFromLocalBundleAssetURL` function will synchronously access the disk on the main thread many times over during thread switching in Messenger Desktop.

Added logging to confirmed cache works as expected in rn-tester, and instrumentation also confirms it.

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-08-10 15:09:20 -07:00
Christoph Purrer 4b9ab10e10
Refactor handling of keyDown/keyUp (#1338)
This refactors / simplifies certain keyUp|Down event handling.
It will make a later change (adding textInput handling for textInput fields) easier (to review)

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-08-09 17:45:14 -07:00
Christoph Purrer c3e847a890
Fix Appearance module to observe application appearance (#1340)
This fixes the `Appearance.getColorScheme()` API to return the application-level appearance instead of the last appearance of any root view, which breaks down in multi-window applications.

In Messenger Desktop we always respect the OS appearance for main and setting windows, but force a darkTheme in the calling UI.
W/o this change returning from the calling UI would result in a wrong appearance setting on light theme OS setting

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-08-09 17:34:46 -07:00
Christoph Purrer 24acd4090c
Pass callbacks for when grammarCheck, spellCheck and autoCorrect are changed on Mac [RFC] (#1325)
When users change spellCheck, grammarCheck or autoCorrect in the context menu, one of 3 callbacks for MULTILINE inputs are called:
- toggleGrammarChecking
- toggleContinuousSpellChecking
- toggleAutomaticSpellingCorrection

If JS is going to be the source of truth for text proofing settings, we should have a way to notify JS when these settings are changed from the native side.

Co-authored-by: Alex Chiu <ackchiu@fb.com>
2022-08-09 17:11:54 -07:00
Christoph Purrer 8c5d0eced6
Fix cursor not showing when tabbing into multiline TextInput (#1342)
This bug happens because `RCTUITextView` (which multiline TextInput uses) was overriding NSTextView's `becomeFirstResponder` method and didn't call `[super becomeFirstResponder]`.
This seems to mess with AppKit's logic of drawing the cursor initially.

This is alluded to in the [docs](https://developer.apple.com/documentation/appkit/nstextview/1807130-becomefirstresponder?language=objc#) for `[NSTextView becomeFirstResponder]`:

> If the previous first responder was not a text view on the same layout manager as the receiving text view, this method draws the selection and updates the insertion point if necessary.

Simply switching to call `[super becomeFirstResponder]` led to a cryptic exception within AppKit. This was likely because in the `reactFocus` (and `reactFocusIfNeeded`) we were calling `becomeFirstResponder` directly.
The [docs](https://developer.apple.com/documentation/appkit/nsresponder/1526750-becomefirstresponder?language=objc#) for `[NSResponder becomeFirstResponder]` say:

> Use the NSWindow makeFirstResponder: method, not this method, to make an object the first responder. Never invoke this method directly.

This fixed the issue

Co-authored-by: Liron Yahdav <lyahdav@fb.com>
2022-08-09 16:08:29 -07:00
Christoph Purrer 2b31eb9dec
Add fragmentLinePadding for multiline shadow view to track TextView correctly (#1332)
Shadow views are used to calculate the container's size using NSTextContainer + NSLayoutManager + NSTextStorage according to https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html.

However, when typing certain text, the TextView itself overflows, but its container doesn't.
This means our shadow view isn't tracking the TextView correctly.
Root cause was that we added a 1px lineFragmentPadding in https://github.com/microsoft/react-native-macos/pull/640, but we didn't add the save padding in our shadow view.

Test Plan:
- Shrink app to minimum width
- Type some text which overflows

Co-authored-by: Alex Chiu <ackchiu@fb.com>
2022-08-09 15:44:13 -07:00
Christoph Purrer 3ebfa694f3
Fix RCTImageCache on macOS (#1272)
The cache's `totalCostLimit` and the `_cacheStaleTimes` ivar were not getting set for Mac, presumably due to a merge mistake. I'm not sure what (if any) positive impact this will realistically have on memory consumption.

Tested rn-tester scrolling through several threads with lots of images. Everything works well.

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-08-09 15:23:10 -07:00
Ryan Linton 43542f8acb satisfy linter 2022-08-09 15:37:40 -06:00
Liron Yahdav 3205f54d3b Add cursor style to View
Summary: This brings in PR https://github.com/microsoft/react-native-macos/pull/760 to our repo.

Test Plan:
RNTester > View:

{F612877442}

Reviewers: skyle

Reviewed By: skyle

Subscribers: necolas, eliwhite

Differential Revision: https://phabricator.intern.facebook.com/D28158243

Tasks: T78743077

Signature: 28158243:1620330169:72c6c9e2371f2ac1a9edabedf3fd9d68468ccb8c

Remove Cursor for Text Component
2022-08-09 12:07:04 -07:00
Adam Gleitman 0890b47d2b Move `RCTRootShadowView` creation to main thread 2022-08-09 11:52:42 -07:00
Shawn Dempsey ae09ae4adb Merge remote-tracking branch 'microsoft/main' into feat/cursor
# Conflicts:
#	Libraries/Components/Touchable/TouchableBounce.js
#	Libraries/Components/Touchable/TouchableHighlight.js
#	Libraries/Components/Touchable/TouchableOpacity.js
#	Libraries/Components/View/ReactNativeViewViewConfigMacOS.js
#	Libraries/Components/View/ViewPropTypes.js
#	Libraries/StyleSheet/StyleSheetTypes.js
#	React/Views/RCTView.h
#	React/Views/RCTViewManager.m
2022-08-09 11:16:20 -07:00
Saad Najmi 90a371a413
Remove more stale folders/files/changes (#1337)
* Delete more stuff

* Remove some stale looking SDX platform scripts

* Remove remnant of `acceptsKeyboardFocus`

* Add back some missing newlines
2022-08-08 12:22:38 -07:00
Saad Najmi fdcec4d55b
Match package.json dependencies with RN Core + prettier (#1333)
* update package.json files and yarn lock

* yarn prettier --fix

* Fix remaining yarn lint issues

* Fix integration CI
2022-08-05 16:46:51 -07:00
Saad Najmi 9421f1a5d0
Remove stale files and folders from the root of our repo (#1328)
* add pull yml

* match handleOpenURLNotification event payload with iOS (#755) (#2)

Co-authored-by: Ryan Linton <ryanlntn@gmail.com>

* [pull] master from microsoft:master (#11)

* Deprecated api (#853)

* Remove deprecated/unused context param
* Update a few Mac deprecated APIs

* Packing RN dependencies, hermes and ignoring javadoc failure,  (#852)

* Ignore javadoc failure

* Bringing few more changes from 0.63-stable

* Fixing a patch in engine selection

* Fixing a patch in nuget spec

* Fixing the output directory of nuget pack

* Packaging dependencies in the nuget

* Fix onMouseEnter/onMouseLeave callbacks not firing on Pressable (#855)

* add pull yml

* match handleOpenURLNotification event payload with iOS (#755) (#2)

Co-authored-by: Ryan Linton <ryanlntn@gmail.com>

* fix mouse evetns on pressable

* delete extra yml from this branch

* Add macOS tags

* reorder props to have onMouseEnter/onMouseLeave always be before onPress

Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
Co-authored-by: Ryan Linton <ryanlntn@gmail.com>

* Grammar fixes. (#856)

Updates simple grammar issues.

Co-authored-by: Nick Trescases <42704557+ntre@users.noreply.github.com>
Co-authored-by: Anandraj <anandrag@microsoft.com>
Co-authored-by: Saad Najmi <saadnajmi2@gmail.com>
Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
Co-authored-by: Ryan Linton <ryanlntn@gmail.com>
Co-authored-by: Muhammad Hamza Zaman <mh.zaman.4069@gmail.com>

* remove pull yml

Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
Co-authored-by: Ryan Linton <ryanlntn@gmail.com>
Co-authored-by: Nick Trescases <42704557+ntre@users.noreply.github.com>
Co-authored-by: Anandraj <anandrag@microsoft.com>
Co-authored-by: Muhammad Hamza Zaman <mh.zaman.4069@gmail.com>
2022-08-05 11:16:51 -07:00
Saad Najmi 3b1f575937
Ensure we pass `--frozen-lockfile` (#1329) 2022-08-05 09:14:54 -07:00
Christoph Purrer 0f665ba655
Remove TextInput setting insertionPointColor (#1321) 2022-08-05 09:45:41 -04:00
rasaha91 e960741886
Merge pull request #1323 from rasaha91/cherry-pick-ndk-fixes
Cherry pick ndk fixes
2022-08-04 16:36:45 -07:00
Christoph Purrer e6482e0c24
Revert "Alleviate excessive layout jittering when resizing window (#439)" (#1318)
This change reverts https://github.com/microsoft/react-native-macos/issues/459 - but still tries to address the original issues:
- https://github.com/microsoft/react-native-macos/issues/422
- https://github.com/microsoft/react-native-macos/issues/322

This also addresses an issue when programmatically resizing windows where the RCTRootContentView may end up at the wrong size because an in-flight layout gets resolved after the resize on the main thread.
We now keep sync dispatch on the shadow queue for live resizing windows (to prevent tearing) but also dispatch async (as done on iOS) so the latest new size is sure to win.
The block has a check to bail if the size doesn't change, so this isn't a perf drain running the block twice.

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-08-04 08:35:54 -07:00
rasaha91 c83c522236 Merge pull request #1319 from rasaha91/fix-incorrect-version
set version before build
2022-08-02 19:49:04 -07:00
rasaha91 0ed3d385c2 Merge pull request #1315 from rasaha91/hardcode-ndk
Hardcode ndk
2022-08-02 19:42:21 -07:00
Shawn Dempsey 2bcaeb1894
[RN][macos] Enable Hermes for RNTester (#1308)
Summary:
**Context**

On Core RN, Hermes for iOS can be enabled by setting a flag in the Podfile
https://reactnative.dev/docs/hermes#ios

| Since React Native 0.64, Hermes also runs on iOS. To enable Hermes for iOS, edit your ios/Podfile file and make the change illustrated below:
```
   use_react_native!(
     :path => config[:reactNativePath],
     # to enable hermes on iOS, change `false` to `true` and then install pods
     # By default, Hermes is disabled on Old Architecture, and enabled on New Architecture.
     # You can enable/disable it manually by replacing `flags[:hermes_enabled]` with `true` or `false`.
     :hermes_enabled => true
   )
```
In the RNTester Podfile, Hermes is enabled using envvar:
https://github.com/facebook/react-native/blob/main/packages/rn-tester/Podfile#L27
```
  # Hermes is now enabled by default.
  # The following line will only disable Hermes if the USE_HERMES envvar is SET to a value other than 1 (e.g. USE_HERMES=0).
  hermes_enabled = !ENV.has_key?('USE_HERMES') || ENV['USE_HERMES'] == '1'
```
Build command: `USE_HERMES=1 bundle exec pod install`

This will install the Hermes runtime Pod (not build it from scratch) & thus enable the `RCT_USE_HERMES` macro.

https://www.internalfb.com/code/fbsource/[9f57823a75a40d3f8559c8f1b7ae0add8e95d6dc]/xplat/js/react-native-github/packages/rn-tester/RNTester/AppDelegate.mm?lines=10-16

---

The documentation for enabling Hermes on RN Desktop macOS are outdated:
https://microsoft.github.io/react-native-windows/docs/hermes#hermes-on-macos

> Install the npm package yarn add 'hermes-engine-darwin@^0.4.3'

* `hermes-engine-darwin` is no longer required

> Add (or uncomment) the following pod dependencies to your macOS target in your Podfile:
pod 'React-Core/Hermes', :path => '../node_modules/react-native-macos/'
pod 'hermes', :path => '../node_modules/hermes-engine-darwin'
pod 'libevent', :podspec => '../node_modules/react-native-macos/third-party-podspecs/libevent.podspec'

* Setting `USE_HERMES=1` during `pod install= replaces all of this

> Copy
Run pod install
Be sure to set your target's deployment target to at least 10.14 before running pod install

* `USE_HERMES=1 bundle exec pod install --verbose`

---

On RN Desktop, the Hermes flag was [set to false](https://github.com/microsoft/react-native-macos/pull/780) due to M1 build reasons which have since been resolved.
- https://github.com/microsoft/react-native-macos/issues/952
- https://github.com/microsoft/react-native-macos/issues/781

Curiously, the `RNTester-macOS` target AppDelegate was never updated to import & use Hermes when  `RCT_USE_HERMES` was `true`. Only the `RNTester` for mobile had the correct Hermes usage.

**RNTester-macOS:** https://github.com/microsoft/react-native-macos/blob/main/packages/rn-tester/RNTester-macOS/AppDelegate.mm

**RNTester:** https://github.com/microsoft/react-native-macos/blob/main/packages/rn-tester/RNTester/AppDelegate.mm

**Change**

* Remove `pods(:hermes_enabled => true)` in favor of passing `USE_HERMES=1` to `pod install` (This is how it's done on RNTester iOS)
* Copy Hermes support to `RNTester-macOS` AppDelegate

Test Plan: **Install from scratch**

Differential Revision: https://phabricator.intern.facebook.com/D38277077

Co-authored-by: Shawn Dempsey <shawndempsey@fb.com>
2022-08-02 14:42:29 -07:00
rasaha91 4a3b4bf8e1
Merge pull request #1316 from rasaha91/cherry-pick-pool-change
Cherry-pick changes to agent pools from 0.68-stable to main
2022-08-02 11:06:08 -07:00
rasaha91 7ad1816158 Merge pull request #1313 from rasaha91/switch-pool
switch to large pool for faster PR times
2022-08-01 22:34:25 -07:00
Christoph Purrer bea60b79b6
Fix nested Text components not inheriting foreground color from parent (#1283)
This seems to due RN Mac commits that fix text colors for dark mode:
- 8ed55a866a
- 731a535dca

It works on iOS, web .... so it should behave the same on macOS as well

Co-authored-by: Liron Yahdav <lyahdav@fb.com>
2022-07-29 16:52:55 -07:00
Adam Gleitman 2a9e517029
Merge pull request #1310 from amgleitman/office-publish-120-minutes
Increase Office publish timeout to 120 minutes
2022-07-29 15:58:02 -07:00
Adam Gleitman 4096fc3abf Increase Office publish timeout to 120 minutes 2022-07-29 15:24:44 -07:00
msftbot[bot] 39d6b7b8e5
Add `.github/fabricbot.json` (#1225)
Co-authored-by: msftbot[bot] <48340428+msftbot[bot]@users.noreply.github.com>
2022-07-28 22:03:57 -07:00
rasaha91 33b3060fd7
Merge pull request #1302 from rasaha91/cherry-pick-nuget-fixes
Cherry pick nuget fixes
2022-07-28 22:03:10 -07:00
Christoph Purrer 825d334e8b
Fix enableFocusRing also enabled for multiline textFields (#1301) 2022-07-28 09:25:12 -04:00
rasaha91 dfebc17736 Merge pull request #1297 from rasaha91/error-nuget
Escape semi-colon in bash command
2022-07-27 23:52:55 -07:00
rasaha91 8ed7f2934d Merge pull request #1294 from rasaha91/fix-nuget
update paths to binaries
2022-07-27 23:52:31 -07:00
chiuam ea192044d5
Textinput range fix (#1296) 2022-07-27 17:25:59 -04:00
Christoph Purrer bc183b64c0
Single line TextInput fixes (#1284) 2022-07-27 10:17:46 -04:00
Christoph Purrer e9f8381acf
Pass grammarCheck to text input views for Mac (#1293) 2022-07-27 09:21:52 -04:00
Christoph Purrer d69fa5b435
Don't send events when clicking on scrollbars (#1281)
This will ignore "touches" (clicks) on `NSScroller` such that JS does not process them resulting in a press event.

Confirmed clicking scrollbar in rn-tester does not result in a click on the items underneath.

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-07-26 10:16:32 -07:00
Christoph Purrer 6f2f11fc5f
Fix text replacement not working in multiline TextInput (#1286)
This bug was due to some code in multiline TextInput which disabled all text checking types by default.
We now match the system default instead.

Co-authored-by: Liron Yahdav <lyahdav@fb.com>
2022-07-26 10:15:28 -07:00
Christoph Purrer 1c38432e9d
Fix spellCheck and autoCorrect props (#1292)
Summary: This fixes `autoCorrect` to correctly map to `automaticSpellingCorrectionEnabled`, and `spellCheck` to map to `continuousSpellCheckingEnabled`.

Note: automaticTextReplacementEnabled is a different feature than automaticSpellingCorrectionEnabled
https://developer.apple.com/documentation/appkit/nstextview/1449210-automatictextreplacementenabled
https://developer.apple.com/documentation/appkit/nstextview/1449254-isautomaticspellingcorrectionena

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-07-26 10:12:59 -07:00
Christoph Purrer 31634e5017
Fix RCTDevLoadingView never actually closing (#1280)
This fixes a copy/paste mistake where the loading panel is being shown after it fades out instead of being closed. This manifested as app exposé showing a transparent window and these panels showing up in the UI debugger (thus leaking).

Confirmed the loading panels actually now go away and app exposé behaves reasonably now.

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-07-25 15:55:57 -07:00
Christoph Purrer f384479eed
Fix event.locationX/Y to be in view's coordinate space (#1288)
This fixes an issue on macOS where the `locationX`/`Y` properties would incorrectly match `pageX`/`Y` unlike iOS (see lines 218/219 in the same file) and other platforms.

Confirmed `locationX`/`Y` is now correctly reported in the view's coordinate space.

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-07-25 15:53:22 -07:00
chiuam 9639637560
Turn on focus ring for multiline textinput (#1276) 2022-07-22 18:25:04 -04:00
Christoph Purrer b6f1220306
Fix missing autorelease pool in RCTPlatformDisplayLink (#1277)
This fixes leaking `_RCTTimer` instances. The runloop does not push/pop autorelease pools for you with `CFRunLoopPerformBlock`. A similar autorelease pool is setup for the same reason in `RCTMessageThread`.

Confirmed expected number of `_RCTTimer` instances in Xcode memory graph.

Co-authored-by: Scott Kyle <skyle@fb.com>
2022-07-22 14:47:53 -07:00