* Revert "Use execFileSync over execSync when messing with file paths in generate-artifacts.js"
This reverts commit d68d2095e9.
* [RN][macos] Don't try and build Fabric example when USE_CODEGEN_DISCOVERY=1
* use `execFileSync` for secure argument passing
* Fix tag comments
* Don't use template literals as arguments
Co-authored-by: Shawn Dempsey <shawndempsey@fb.com>
Messenger Desktop is a multi-window application (chat, calling, settings, …) and we maintain the various windows with a windowNativeModule which allows JS interaction.
When receiving deep-links from other apps we don’t want to necessary re-open the lastWindow open as the deep-link might contain information about a particular scenario (open login page, start a call). Hence, we need to disable this behavior app wide and use our windowNativeModule to forward the specific window related to the deep link.
- This change has 0 effect on other apps
- We could make this property an ivar, but then we need to manually register RCTLinkingManager.mm ….
- We could append a special url property to deep-links, but I think that would make the ‘API’ harder to use`
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>
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>
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>
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>
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>
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>
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>
* 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>
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>