Skip to content
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

[Fabric] Implement onDismiss for Modal and remove titlebar #14126

Merged
merged 11 commits into from
Dec 4, 2024

Conversation

TatianaKapos
Copy link
Contributor

@TatianaKapos TatianaKapos commented Nov 19, 2024

Description

Implements onDismiss for Modal and removed the titlebar (Both Flyout/Popup/Modal don't have their own titlebar so by default Modal shouldn't have one either but it's easy to add it back in if needed! My guess is that the titlebar should be a windows-specific property).

This also means you no longer get the visual indicator that Modal needs to be dealt with before closing but Flyout/Popup also don't give a visual indicator.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Why

Resolves #13762

What

onDismiss doesn't work if you just implement the native-side because the Fabric-UI Manager destroys the Modal before the event can be fired. This PR enables the JavaScript portion of onDismiss for Modal that upstream implemented (see facebook/react-native#42601)

Screenshots

Playground-composition_bAJKM2a6ik

Testing

tested locally

Changelog

yes

Implements onDismiss for Modal and removes titlebar

Microsoft Reviewers: Open in CodeFlow

@TatianaKapos TatianaKapos requested a review from a team as a code owner November 19, 2024 22:01
@microsoft-github-policy-service microsoft-github-policy-service bot added Area: Component Views Area: Fabric Support Facebook Fabric Area: Modal New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric labels Nov 19, 2024
@@ -95,7 +100,7 @@ void WindowsModalHostComponentView::EnsureModalCreated() {
m_hwnd = CreateWindow(
c_modalWindowClassName,
L"React-Native Modal",
WS_OVERLAPPEDWINDOW,
(WS_POPUP),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it this that causes the titlebar to disappear?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! And another line for adjusting the size for the titlebar but just added them behind m_showTitleBar!

@jonthysell
Copy link
Contributor

jonthysell commented Nov 22, 2024

We should probably (at least) have an internal m_showTitleBar member bool, maybe default to false (if that's the default behavior we want), and use that variable to control whether or not there's a title bar. Then maybe you could have whatever new title bar property you create (to lets users change it) be in a future PR.

@TatianaKapos TatianaKapos merged commit d7b4b48 into microsoft:main Dec 4, 2024
59 checks passed
@TatianaKapos TatianaKapos deleted the tk-modal3 branch December 4, 2024 00:54
acoates-ms pushed a commit to acoates-ms/react-native-windows that referenced this pull request Dec 6, 2024
…#14126)

* add onDismiss event

* remove title bar

* Change files

* fix lint and snapshots

* add option for titlebar

* upgrade override
acoates-ms pushed a commit to acoates-ms/react-native-windows that referenced this pull request Dec 6, 2024
…#14126)

* add onDismiss event

* remove title bar

* Change files

* fix lint and snapshots

* add option for titlebar

* upgrade override
acoates-ms pushed a commit to acoates-ms/react-native-windows that referenced this pull request Dec 6, 2024
…#14126)

* add onDismiss event

* remove title bar

* Change files

* fix lint and snapshots

* add option for titlebar

* upgrade override
acoates-ms added a commit that referenced this pull request Dec 9, 2024
* [Fabric] Fix Modal position, disable input to parent hwnd, and add onShow event (#14109)

* default to Modal opening in middle of app

* add onShow event

* Change files

* disable input to parent hwnd

* fix changefile

* Implement cursor property (#14141)

* Implement cursor property

* Change files

* Disable failing UT (#14153)

* Disable failing UT

* Change files

* [Fabric] Implement onDismiss for Modal and remove titlebar (#14126)

* add onDismiss event

* remove title bar

* Change files

* fix lint and snapshots

* add option for titlebar

* upgrade override

* fix change files

* Core didn't have most values of cursor yet

* Fix overrides

---------

Co-authored-by: Tatiana Kapos <[email protected]>
acoates-ms added a commit that referenced this pull request Dec 9, 2024
* [Fabric] Fix Modal position, disable input to parent hwnd, and add onShow event (#14109)

* default to Modal opening in middle of app

* add onShow event

* Change files

* disable input to parent hwnd

* fix changefile

* Implement cursor property (#14141)

* Implement cursor property

* Change files

* [Fabric] Implement onDismiss for Modal and remove titlebar (#14126)

* add onDismiss event

* remove title bar

* Change files

* fix lint and snapshots

* add option for titlebar

* upgrade override

* fix change files

* Update overrides

---------

Co-authored-by: Tatiana Kapos <[email protected]>
acoates-ms added a commit that referenced this pull request Dec 9, 2024
* Fix issue with prop cloning with custom native props (#14061)

* Fix issue with prop cloning with custom native props

* format

* prettier

* Change files

---------

Co-authored-by: React-Native-Windows Bot <[email protected]>

* Export MS.RN.Color ctor in Office dll (#14082)

* Export MS.RN.Color ctor in Office dll

* Change files

* Implement TxScreenToClient and TxClientToScreen

* format

---------

Co-authored-by: React-Native-Windows Bot <[email protected]>

* TextInput caret becomes visible on non-focused TextInputs on resize (#14091)

* TextInput caret becomes visible on non-focused TextInputs on resize

* Change files

---------

Co-authored-by: React-Native-Windows Bot <[email protected]>

* [Fabric] Introducing autocapitalize prop in TextInput - Take 2 (#13343)

* New implementation of autocapitalize!

* Change files

* Fixed bug for sentences scenario

* Just keep characters mode for now

* Revert "Just keep characters mode for now"

This reverts commit 60ca1ce.

* Re-apply changes minus packages.json.lock

* The original js file was deleted, re-applying changes

* Fixed snapshot and lint errors

* Fix override mismatch, added comments

* Remove stale test check

* Minor changes

* Update obsolete snapshot

* Add very basic box-shadow support (#14028)

* Add very basic box-shadow support

* Change files

* Focus should notify island host when tab loop wraps to give host oportunity to take focus (#14026)

* Focus should notify island host when tab loop wraps to give host oportunity to take focus

* Change files

* Default scroll to bring a component into view should have padding around the viewport (#14018)

* Default scroll to bring a component into view should have padding around the viewport

* Change files

* Update focus visuals to use cornerRadius and inner/outer strokes (#14008)

* Update focus visuals to use cornerRadius and inner/outer strokes.

* Change files

* Format

* lint fix

* Scale focus border for scaleFactor

* Fix Text running flattenStyle multiple times (#14041)

* integrate rn #45340 and #45345

* Change files

* remove dead windows code

* Fixing text components not rendering a border with Paper (#14054)

## Description
Text components rendered in Paper need to have check if the style they are rendering contains border style props. This bug occurs when the passed in style is an array. From what I can tell, this bug has existed for a long time, possibly forever.

[4 Years Ago](946ba7f) This PR fixed borders not rendering for text, but did not address text components with an array of styles.
[3 Years Ago](ee4d83d#diff-5beb08e50a61de475cd20c6e68588ac3a5cd687a971883167fe75fc97a0dbdea) This PR changes naming, but not the logic.

This PR switches the style that is checked for border props from the one that is passed in to the one that is flattened.

This is the type of JSX that is broken. The text does not render a border.
```tsx
<Text style={[{ borderColor: "red", borderWidth: 3 }]}>{"hello world"}</Text>
```

### Type of Change
- Bug fix (non-breaking change which fixes an issue)

### Why
This reenables borders for Paper text components.

### What
Swapped a variable in text.window.js that is used to check for border style props.

## Screenshots
Add any relevant screen captures here from before or after your changes. 

## Testing
Local tests.

## Changelog
Fixing text components not rendering a border with Paper

---------

Co-authored-by: Sam Walker <[email protected]>
Co-authored-by: Jon Thysell <[email protected]>

* [Fabric] Get Modal to host RN components in new hwnd (#13500)

* save state

* add example

* build but blank page still :(

* clean up comments

* visuals show up in new hwnd!

* clean up code

* better naming and unfork Modal examples

* testing save state

* Make the RN island a Modal member var

* Failed attempt at skipping root view in CEH, leaving it for learning purposes

* you can click on UI!

* clean up code

* Change files

* save state

* remove hardcoded rootTag

* add width/height to example

* add test

* revert simple.tsx

* remove test

* update snapshot

* feedback part 1: make Modal a RootComponentView

* feedback part2: simplify MountChildren

* fix deleting modal

* feedback round2

* remove comment

* remove imports

* feedback part 3

* fix overrides

* add simple layout - still has issues with padding/flex

* feedback part4

* lint

* update overrides

* Change files

* feedback

---------

Co-authored-by: Daniel Ayala <[email protected]>

* Support accessibilityState 'checked' (#13962)

* Implement accessibilityState checked

* Change files

* Add Testing

* Format and Update Snapshots

* Adjust Guardrails

* Merge

* Format

* Format

* Lint

* Change files

* Fix Merge Error

* Fix focus visuals being obscured by adjacent views (#14093)

* Fix focus visuals being obscured by adjacent views

* Change files

* update snapshots

* Fix uimplemented view

* review feedback

---------

Co-authored-by: React-Native-Windows Bot <[email protected]>

* [Fabric] Fix Modal position, disable input to parent hwnd, and add onShow event (#14109)

* default to Modal opening in middle of app

* add onShow event

* Change files

* disable input to parent hwnd

* fix changefile

* Implement cursor property (#14141)

* Implement cursor property

* Change files

* Disable failing UT (#14153)

* Disable failing UT

* Change files

* [Fabric] Implement onDismiss for Modal and remove titlebar (#14126)

* add onDismiss event

* remove title bar

* Change files

* fix lint and snapshots

* add option for titlebar

* upgrade override

* Views with keyUpEvents/keyDownEvents set on them should form a stacking context (#14090)

* Key and mouse events require a stacking context

* Change files

* We dont need a stacking context to bubble JS events - but we do to modify the native handling of the events

* fix

* Fix change files

* build fix

* fixes

* fix

* format

---------

Co-authored-by: React-Native-Windows Bot <[email protected]>
Co-authored-by: Daniel Ayala <[email protected]>
Co-authored-by: Tatiana Kapos <[email protected]>
Co-authored-by: Sam Walker <[email protected]>
Co-authored-by: Sam Walker <[email protected]>
Co-authored-by: Jon Thysell <[email protected]>
Co-authored-by: Chiara Mooney <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Component Views Area: Fabric Support Facebook Fabric Area: Modal New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Implement onDismiss property for Modal in Fabric
2 participants