Skip to content

Commit

Permalink
Adds shouldConstrainToRootBounds prop to Flyout (microsoft#8414)
Browse files Browse the repository at this point in the history
* Adds shouldConstrainToRootBounds prop to Flyout

Adds the ability to set the `FlyoutBase::ShouldConstrainToRootBounds`
property in the `FlyoutViewManager`.

Co-authored-by: Liron Yahdav <[email protected]>

* Change files

Co-authored-by: Liron Yahdav <[email protected]>
  • Loading branch information
2 people authored and chrisglein committed Sep 22, 2021
1 parent a683c2f commit 032901d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Adds shouldConstrainToRootBounds prop to Flyout",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
5 changes: 5 additions & 0 deletions vnext/Microsoft.ReactNative/Views/FlyoutViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ void FlyoutShadowNode::updateProperties(winrt::Microsoft::ReactNative::JSValueOb
if (m_isFlyoutShowOptionsSupported) {
m_showOptions.ShowMode(showMode);
}
} else if (propertyName == "shouldConstrainToRootBounds") {
if (propertyValue.Type() == React::JSValueType::Boolean) {
m_flyout.ShouldConstrainToRootBounds(propertyValue.AsBoolean());
}
}
}

Expand Down Expand Up @@ -478,6 +482,7 @@ void FlyoutViewManager::GetNativeProps(const winrt::Microsoft::ReactNative::IJSV
React::WriteProperty(writer, L"verticalOffset", L"number");
React::WriteProperty(writer, L"isOverlayEnabled", L"boolean");
React::WriteProperty(writer, L"showMode", L"string");
React::WriteProperty(writer, L"shouldConstrainToRootBounds", L"boolean");
}

void FlyoutViewManager::GetExportedCustomDirectEventTypeConstants(
Expand Down
1 change: 1 addition & 0 deletions vnext/src/Libraries/Components/Flyout/FlyoutProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type ShowMode =
export interface IFlyoutProps extends ViewProps {
horizontalOffset?: number;
isLightDismissEnabled?: boolean;
shouldConstrainToRootBounds?: boolean;

/**
* Specifies whether the area outside the flyout is darkened
Expand Down

0 comments on commit 032901d

Please sign in to comment.