-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expose AutomationOption Setter for ChildSite #15622
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
base: main
Are you sure you want to change the base?
Changes from all commits
0a8a100
3541a3a
0457d40
e4cd88b
a1563b6
9783b81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "prerelease", | ||
| "comment": "Expose AutomationOption Setter for ChildSite", | ||
| "packageName": "react-native-windows", | ||
| "email": "66076509+vineethkuttan@users.noreply.github.com", | ||
| "dependentChangeType": "patch" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| #include <Fabric/AbiComponentDescriptor.h> | ||
| #include <react/renderer/componentregistry/ComponentDescriptorProvider.h> | ||
| #include <react/renderer/core/ReactPrimitives.h> | ||
| #include <optional> | ||
| #include "winrt/Microsoft.ReactNative.Composition.Experimental.h" | ||
| #include "winrt/Microsoft.ReactNative.Composition.h" | ||
| #include "winrt/Microsoft.ReactNative.h" | ||
|
|
@@ -46,6 +47,8 @@ struct ReactCompositionViewComponentBuilder | |
| public: // Composition::IReactCompositionViewComponentBuilder | ||
| void SetViewComponentViewInitializer(const ViewComponentViewInitializer &initializer) noexcept; | ||
| void SetContentIslandComponentViewInitializer(const ComponentIslandComponentViewInitializer &initializer) noexcept; | ||
| void SetContentIslandChildSiteAutomationOption( | ||
| winrt::Microsoft::UI::Content::ContentAutomationOptions automationOption) noexcept; | ||
| void SetPortalComponentViewInitializer(const PortalComponentViewInitializer &initializer) noexcept; | ||
| void SetCreateVisualHandler(CreateVisualDelegate impl) noexcept; | ||
| void SetViewFeatures(ComponentViewFeatures viewFeatures) noexcept; | ||
|
|
@@ -81,6 +84,8 @@ struct ReactCompositionViewComponentBuilder | |
| const winrt::Microsoft::ReactNative::Composition::Experimental::IVisualToMountChildrenIntoDelegate & | ||
| VisualToMountChildrenIntoHandler() const noexcept; | ||
| const CreateAutomationPeerDelegate &CreateAutomationPeerHandler() const noexcept; | ||
| std::optional<winrt::Microsoft::UI::Content::ContentAutomationOptions> ContentIslandChildSiteAutomationOption() | ||
| const noexcept; | ||
|
|
||
| private: | ||
| void InitializeComponentView(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept; | ||
|
|
@@ -114,6 +119,7 @@ struct ReactCompositionViewComponentBuilder | |
| m_visualToMountChildrenIntoHandler; | ||
| UpdateLayoutMetricsDelegate m_updateLayoutMetricsHandler; | ||
| bool m_xamlSupport{false}; | ||
| std::optional<winrt::Microsoft::UI::Content::ContentAutomationOptions> m_contentIslandChildSiteAutomationOption; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this an
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes Sundaram. Since it is enum class , it will have default value which is None. So added optional to differentiate that case from not being set at all. Or I may need to set the default value as frameworkbased in the contructor. |
||
| }; | ||
|
|
||
| } // namespace winrt::Microsoft::ReactNative::Composition | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can
m_builderever benullptrwithin the lifetime of this object? If yes, then won't every usage of this member variable be starting with aif (m_builder)check? That would be unperformant, ugly and noisy, yes?std::optional::operator boolautomatically does whathas_value()does. Excerpt fromstd::optional:operator*returns the value within.Even better is to use
std::optional::or_valuewhich gives the value if there's a value else defaults to whatever you pass it.Shorter, cleaner and clearer to read, no? As a bonus since you initialize the variable in one statement, it can be qualified
constnow.Moral: It helps to read the documentation and many things are perhaps already done for you. You just have to use them, for that you've to know them.