From cd4603af7e673040973315eee4f72c1ef657b6c5 Mon Sep 17 00:00:00 2001 From: Alexander Sklar Date: Tue, 17 May 2022 23:06:47 -0700 Subject: [PATCH 01/10] Fix event setup codepath --- .clang-format | 92 +++++++++++++++++++ .../windows/ReactNativeXaml/XamlMetadata.cpp | 21 ++--- 2 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..630befaf --- /dev/null +++ b/.clang-format @@ -0,0 +1,92 @@ +--- +AccessModifierOffset: -1 +AlignAfterOpenBracket: AlwaysBreak +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: true +AlignOperands: false +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, TEST_CLASS, TEST_CLASS_EX ] +IncludeBlocks: Preserve +IncludeCategories: + - Regex: 'pch.h' + Priority: -1 + - Regex: '.*\.g\..*' + Priority: 1 + - Regex: '^<.*\.h(pp)?>' + Priority: 2 + - Regex: '^<.*' + Priority: 3 + - Regex: '.*' + Priority: 4 +IndentCaseLabels: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Right +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 8 +UseTab: Never +... diff --git a/package/windows/ReactNativeXaml/XamlMetadata.cpp b/package/windows/ReactNativeXaml/XamlMetadata.cpp index cc1d5d7b..b94e5380 100644 --- a/package/windows/ReactNativeXaml/XamlMetadata.cpp +++ b/package/windows/ReactNativeXaml/XamlMetadata.cpp @@ -29,23 +29,22 @@ using namespace winrt::Microsoft::ReactNative; #define MAKE_GET_DP(type, prop) IsType, []() { return type::prop(); } -void XamlMetadata::SetupEventDispatcher(const IReactContext& reactContext) { - m_reactContext = reactContext; - std::once_flag inited; - std::call_once(inited, [ctx = reactContext, this]() { - ExecuteJsi(ctx, [shared = shared_from_this()](facebook::jsi::Runtime& rt) { - - auto obj = rt.global().createFromHostObject(rt, std::make_shared()); - rt.global().setProperty(rt, jsi::PropNameID::forAscii(rt, "xaml"), obj); +void XamlMetadata::SetupEventDispatcher(const IReactContext &reactContext) { + if (!m_reactContext) { + m_reactContext = reactContext; + } + + if (!m_callFunctionReturnFlushedQueue.has_value() && m_reactContext.JSRuntime()) { + ExecuteJsi(m_reactContext, [shared = shared_from_this()](facebook::jsi::Runtime &rt) { auto batchedBridge = rt.global().getProperty(rt, "__fbBatchedBridge"); if (!batchedBridge.isUndefined() && batchedBridge.isObject()) { if (auto vm = shared.get()) { - vm->m_callFunctionReturnFlushedQueue = batchedBridge.asObject(rt).getPropertyAsFunction( - rt, "callFunctionReturnFlushedQueue"); + vm->m_callFunctionReturnFlushedQueue = + batchedBridge.asObject(rt).getPropertyAsFunction(rt, "callFunctionReturnFlushedQueue"); } } }); - }); + } } FrameworkElement Wrap(const winrt::Windows::Foundation::IInspectable& d) { From 632fccbf9546037de5945de90080efaf5097e0b7 Mon Sep 17 00:00:00 2001 From: Alexander Sklar Date: Tue, 17 May 2022 23:16:50 -0700 Subject: [PATCH 02/10] Change files --- ...t-native-xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json diff --git a/change/react-native-xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json b/change/react-native-xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json new file mode 100644 index 00000000..f91c0a18 --- /dev/null +++ b/change/react-native-xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Fix event setup codepath", + "packageName": "react-native-xaml", + "email": "asklar@microsoft.com", + "dependentChangeType": "patch" +} From ddd7d201853fd680ade47b87d686ff1194bf376e Mon Sep 17 00:00:00 2001 From: Alexander Sklar Date: Tue, 17 May 2022 23:23:32 -0700 Subject: [PATCH 03/10] > --- CONTRIBUTING.md | 4 +++- ...xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json | 7 ------- package.json | 2 +- package/CHANGELOG.json | 15 +++++++++++++++ package/CHANGELOG.md | 10 +++++++++- package/package.json | 2 +- .../windows/ReactNativeXaml/Codegen/Version.g.h | 2 +- 7 files changed, 30 insertions(+), 12 deletions(-) delete mode 100644 change/react-native-xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5ad3b39c..44b55775 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,9 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope 5. For all other changes: run `yarn build` in src folder so that related files are generated 6. Run from Visual Studio to see output. 7. Once changes are ready, run `yarn change` at the root of the repository to create a patch (it will ask for a description of the change). The version scheme we use is [SemVer](https://semver.org/) -8. Open a pull request and address review feedback. +8. Update the package version by running `yarn bump` +9. Open a pull request and address review feedback. +10. After the PR is merged, manually trigger a publish from GitHub to publish to npm. ## Technical details: You can find more details to setting up in the [Technical Guide](TechnicalGuide.md). \ No newline at end of file diff --git a/change/react-native-xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json b/change/react-native-xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json deleted file mode 100644 index f91c0a18..00000000 --- a/change/react-native-xaml-cce8c2e3-5172-48b1-a27f-19dec1b3e077.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "patch", - "comment": "Fix event setup codepath", - "packageName": "react-native-xaml", - "email": "asklar@microsoft.com", - "dependentChangeType": "patch" -} diff --git a/package.json b/package.json index 04648a00..edb09f49 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "build": "tsc --project package", "change": "beachball change", - "bump": "beachball bump && pushd package && yarn codegen && popd" + "bump": "beachball bump && nuget restore example\\windows && pushd package && yarn codegen && popd" }, "repository": { "type": "git", diff --git a/package/CHANGELOG.json b/package/CHANGELOG.json index 5bba0ae9..3c0a2390 100644 --- a/package/CHANGELOG.json +++ b/package/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "react-native-xaml", "entries": [ + { + "date": "Wed, 18 May 2022 06:19:44 GMT", + "tag": "react-native-xaml_v0.0.64", + "version": "0.0.64", + "comments": { + "patch": [ + { + "author": "asklar@microsoft.com", + "package": "react-native-xaml", + "comment": "Fix event setup codepath", + "commit": "632fccbf9546037de5945de90080efaf5097e0b7" + } + ] + } + }, { "date": "Wed, 13 Apr 2022 21:16:52 GMT", "tag": "react-native-xaml_v0.0.63", diff --git a/package/CHANGELOG.md b/package/CHANGELOG.md index dba81572..2af18672 100644 --- a/package/CHANGELOG.md +++ b/package/CHANGELOG.md @@ -1,9 +1,17 @@ # Change Log - react-native-xaml -This log was last generated on Wed, 13 Apr 2022 21:16:52 GMT and should not be manually modified. +This log was last generated on Wed, 18 May 2022 06:19:44 GMT and should not be manually modified. +## 0.0.64 + +Wed, 18 May 2022 06:19:44 GMT + +### Patches + +- Fix event setup codepath (asklar@microsoft.com) + ## 0.0.63 Wed, 13 Apr 2022 21:16:52 GMT diff --git a/package/package.json b/package/package.json index 7917c065..cd1a6c6e 100644 --- a/package/package.json +++ b/package/package.json @@ -1,7 +1,7 @@ { "name": "react-native-xaml", "title": "React Native Xaml", - "version": "0.0.63", + "version": "0.0.64", "description": "Allows using XAML directly, inside of a React Native Windows app", "main": "lib/index.js", "typings": "lib/index.d.ts", diff --git a/package/windows/ReactNativeXaml/Codegen/Version.g.h b/package/windows/ReactNativeXaml/Codegen/Version.g.h index 062fbf36..9d1b49d1 100644 --- a/package/windows/ReactNativeXaml/Codegen/Version.g.h +++ b/package/windows/ReactNativeXaml/Codegen/Version.g.h @@ -7,4 +7,4 @@ THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT MODIFY MANUALLY #define VERSION_MAJOR 0 #define VERSION_MINOR 0 #define VERSION_REVISION 0 -#define VERSION_BUILD 63 +#define VERSION_BUILD 64 From b3f5fb1e2bd7d5e01846d61fe4e3d080280da001 Mon Sep 17 00:00:00 2001 From: Alexander Sklar Date: Tue, 14 Jun 2022 12:57:58 -0700 Subject: [PATCH 04/10] > --- package/windows/ReactNativeXaml/XamlMetadata.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/windows/ReactNativeXaml/XamlMetadata.cpp b/package/windows/ReactNativeXaml/XamlMetadata.cpp index b94e5380..b352d37c 100644 --- a/package/windows/ReactNativeXaml/XamlMetadata.cpp +++ b/package/windows/ReactNativeXaml/XamlMetadata.cpp @@ -34,11 +34,11 @@ void XamlMetadata::SetupEventDispatcher(const IReactContext &reactContext) { m_reactContext = reactContext; } - if (!m_callFunctionReturnFlushedQueue.has_value() && m_reactContext.JSRuntime()) { + if (!m_callFunctionReturnFlushedQueue.has_value()) { ExecuteJsi(m_reactContext, [shared = shared_from_this()](facebook::jsi::Runtime &rt) { - auto batchedBridge = rt.global().getProperty(rt, "__fbBatchedBridge"); - if (!batchedBridge.isUndefined() && batchedBridge.isObject()) { - if (auto vm = shared.get()) { + if (auto vm = shared.get(); vm && !vm->m_callFunctionReturnFlushedQueue.has_value()) { + auto batchedBridge = rt.global().getProperty(rt, "__fbBatchedBridge"); + if (!batchedBridge.isUndefined() && batchedBridge.isObject()) { vm->m_callFunctionReturnFlushedQueue = batchedBridge.asObject(rt).getPropertyAsFunction(rt, "callFunctionReturnFlushedQueue"); } From 1909d2f38bb680efaaccc99eeb9d9daff402c79b Mon Sep 17 00:00:00 2001 From: "Jon Thysell (JAUNTY)" Date: Fri, 28 Jul 2023 12:23:30 -0700 Subject: [PATCH 05/10] update from main --- .clang-format | 2 +- .github/policies/resourceManagement.yml | 252 + .github/workflows/SetUpAppForNuget.ps1 | 10 +- .github/workflows/main.yml | 239 +- .github/workflows/pr.yml | 93 + .github/workflows/publish.yml | 36 +- .github/workflows/template-buildexample.yml | 37 + .../workflows/template-buildnpmpackage.yml | 33 + .github/workflows/template-buildrnx.yml | 53 + .github/workflows/template-runcodegen.yml | 43 + .github/workflows/template-testcli.yml | 61 + CONTRIBUTING.md | 52 +- LICENSE | 2 +- SECURITY.md | 41 + USAGE.md | 61 +- codegen/Properties/launchSettings.json | 2 +- directory.build.props | 8 + example/App.tsx | 14 +- example/metro.config.js | 8 +- example/package.json | 21 +- example/windows/ExperimentalFeatures.props | 38 +- example/windows/NuGet.Config | 13 + .../RuntimeComponent1.vcxproj | 5 +- example/windows/example.sln | 54 +- example/windows/example/App.cpp | 30 +- example/windows/example/App.h | 5 +- .../example/AutolinkedNativeModules.g.targets | 2 +- example/windows/example/MainPage.cpp | 2 +- example/windows/example/MainPage.idl | 4 +- example/windows/example/Package.appxmanifest | 2 +- example/windows/example/PropertySheet.props | 6 +- .../windows/example/ReactPackageProvider.cpp | 2 +- example/windows/example/example.vcxproj | 43 +- .../windows/example/example.vcxproj.filters | 4 +- .../windows/example/example_TemporaryKey.pfx | Bin 2536 -> 2622 bytes example/windows/example/pch.h | 15 +- examplenuget/App.tsx | 9 +- examplenuget/metro.config.js | 8 +- examplenuget/package.json | 19 +- .../windows/ExperimentalFeatures.props | 37 +- examplenuget/windows/NuGet.Config | 1 - examplenuget/windows/examplenuget.sln | 40 +- examplenuget/windows/examplenuget/App.cpp | 9 +- examplenuget/windows/examplenuget/App.h | 4 +- .../AutolinkedNativeModules.g.targets | 2 +- .../windows/examplenuget/MainPage.cpp | 2 +- .../windows/examplenuget/MainPage.idl | 4 +- .../windows/examplenuget/PropertySheet.props | 6 +- .../examplenuget/ReactPackageProvider.cpp | 2 +- .../windows/examplenuget/examplenuget.vcxproj | 61 +- .../examplenuget/examplenuget.vcxproj.filters | 2 +- .../examplenuget_TemporaryKey.pfx | Bin 2520 -> 2528 bytes examplenuget/windows/examplenuget/pch.h | 15 +- examplenuget/yarn.lock | 100 +- package/CHANGELOG.json | 168 +- package/CHANGELOG.md | 88 +- package/Codegen/Codegen.csproj | 2 +- package/Codegen/Program.cs | 22 +- .../Codegen/Properties/launchSettings.json | 2 +- package/Codegen/TSTypes.cs | 293 +- package/Codegen/TSTypes.tt | 71 +- package/Codegen/TypeCreator.cs | 18 +- package/Codegen/TypeCreator.tt | 2 +- package/Codegen/TypeEvents.cs | 68 +- package/Codegen/TypeEvents.tt | 4 +- package/Codegen/Windows.UI.Xaml.json | 1 + package/LICENSE | 2 +- package/README.md | 4 +- package/package.json | 18 +- package/src/Enums.ts | 8 +- package/src/Props.ts | 13 + package/src/Types.tsx | 1776 ++-- package/windows/ExperimentalFeatures.props | 7 +- .../ReactNativeXaml/Codegen/TypeCreator.g.cpp | 3 +- .../ReactNativeXaml/Codegen/TypeEvents.g.h | 7 +- .../Codegen/TypeProperties.g.h | 114 +- .../ReactNativeXaml/Codegen/Version.g.h | 2 +- .../ReactNativeXaml/ReactNativeXaml.vcxproj | 83 +- package/windows/ReactNativeXaml/Serialize.cpp | 5 +- .../windows/ReactNativeXaml/XamlMetadata.cpp | 64 +- .../windows/ReactNativeXaml/XamlMetadata.h | 117 +- .../ReactNativeXaml/XamlViewManager.cpp | 109 +- .../windows/ReactNativeXaml/packages.config | 2 +- yarn.lock | 7912 +++++++++-------- 84 files changed, 6839 insertions(+), 5760 deletions(-) create mode 100644 .github/policies/resourceManagement.yml create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/template-buildexample.yml create mode 100644 .github/workflows/template-buildnpmpackage.yml create mode 100644 .github/workflows/template-buildrnx.yml create mode 100644 .github/workflows/template-runcodegen.yml create mode 100644 .github/workflows/template-testcli.yml create mode 100644 SECURITY.md create mode 100644 directory.build.props create mode 100644 example/windows/NuGet.Config diff --git a/.clang-format b/.clang-format index 630befaf..0b70fd83 100644 --- a/.clang-format +++ b/.clang-format @@ -89,4 +89,4 @@ SpacesInSquareBrackets: false Standard: Cpp11 TabWidth: 8 UseTab: Never -... +... \ No newline at end of file diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml new file mode 100644 index 00000000..9ceb29a2 --- /dev/null +++ b/.github/policies/resourceManagement.yml @@ -0,0 +1,252 @@ +id: +name: GitOps.PullRequestIssueManagement +description: GitOps.PullRequestIssueManagement primitive +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: 'Needs: Author Feedback' + - hasLabel: + label: Status no recent activity + - noActivitySince: + days: 3 + actions: + - closeIssue + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: 'Needs: Author Feedback' + - noActivitySince: + days: 4 + - isNotLabeledWith: + label: Status no recent activity + actions: + - addLabel: + label: Status no recent activity + - addReply: + reply: This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**. + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: duplicate + - noActivitySince: + days: 1 + actions: + - addReply: + reply: This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes. + - closeIssue + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isPullRequest + - isOpen + - hasLabel: + label: Needs Author Feedback + - hasLabel: + label: Status no recent activity + - noActivitySince: + days: 7 + actions: + - closeIssue + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isPullRequest + - isOpen + - hasLabel: + label: 'Needs: Author Feedback' + - noActivitySince: + days: 7 + - isNotLabeledWith: + label: Status no recent activity + actions: + - addLabel: + label: Status no recent activity + - addReply: + reply: This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **7 days**. It will be closed if no further activity occurs **within 7 days of this comment**. + eventResponderTasks: + - if: + - payloadType: Issues + - isAction: + action: Opened + then: + - addLabel: + label: 'Needs: Triage :mag:' + description: + - if: + - payloadType: Issue_Comment + - isAction: + action: Created + - isActivitySender: + issueAuthor: True + - hasLabel: + label: 'Needs: Author Feedback' + - isOpen + then: + - addLabel: + label: 'Needs: Attention :wave:' + - removeLabel: + label: 'Needs: Author Feedback' + description: + - if: + - payloadType: Issues + - not: + isAction: + action: Closed + - hasLabel: + label: Status no recent activity + then: + - removeLabel: + label: Status no recent activity + description: + - if: + - payloadType: Issue_Comment + - hasLabel: + label: Status no recent activity + then: + - removeLabel: + label: Status no recent activity + description: + - if: + - payloadType: Pull_Request + then: + - inPrLabel: + label: 'Status: In PR' + description: + - if: + - payloadType: Pull_Request + - isAction: + action: Opened + then: + - addCodeFlowLink + description: + - if: + - payloadType: Pull_Request_Review + - isAction: + action: Submitted + - isReviewState: + reviewState: Changes_requested + then: + - addLabel: + label: 'Needs: Author Feedback' + description: + - if: + - payloadType: Pull_Request + - isActivitySender: + issueAuthor: True + - not: + isAction: + action: Closed + - hasLabel: + label: 'Needs: Author Feedback' + then: + - removeLabel: + label: 'Needs: Author Feedback' + description: + - if: + - payloadType: Issue_Comment + - isActivitySender: + issueAuthor: True + - hasLabel: + label: 'Needs: Author Feedback' + then: + - removeLabel: + label: 'Needs: Author Feedback' + description: + - if: + - payloadType: Pull_Request_Review + - isActivitySender: + issueAuthor: True + - hasLabel: + label: 'Needs: Author Feedback' + then: + - removeLabel: + label: 'Needs: Author Feedback' + description: + - if: + - payloadType: Pull_Request + - not: + isAction: + action: Closed + - hasLabel: + label: Status no recent activity + then: + - removeLabel: + label: Status no recent activity + description: + - if: + - payloadType: Issue_Comment + - hasLabel: + label: Status no recent activity + then: + - removeLabel: + label: Status no recent activity + description: + - if: + - payloadType: Pull_Request_Review + - hasLabel: + label: Status no recent activity + then: + - removeLabel: + label: Status no recent activity + description: + - if: + - payloadType: Pull_Request + - hasLabel: + label: auto merge + then: + - enableAutoMerge: + mergeMethod: Squash + description: + - if: + - payloadType: Pull_Request + - labelRemoved: + label: auto merge + then: + - disableAutoMerge + description: + - if: + - payloadType: Issues + - labelAdded: + label: 'Needs: Environment Info' + then: + - addReply: + reply: >- + This issue lacks the environment info requested in the bug template. Please edit your issue report to add this information. + + + 1. `npx react-native --version`: + + 2. `npx react-native run-windows --info`: + - addLabel: + label: 'Needs: Author Feedback' + - removeLabel: + label: 'Needs: Triage :mag:' + description: +onFailure: +onSuccess: diff --git a/.github/workflows/SetUpAppForNuget.ps1 b/.github/workflows/SetUpAppForNuget.ps1 index 1fd94c6e..cac6c96b 100644 --- a/.github/workflows/SetUpAppForNuget.ps1 +++ b/.github/workflows/SetUpAppForNuget.ps1 @@ -3,16 +3,18 @@ param ( [switch] $UseNuGet, [Version] - $WinUIVersion = "2.6.0" + $WinUIVersion = "2.7.0" ) $AppName = Split-Path $PWD -Leaf Write-Host App name = $AppName $ns = "http://schemas.microsoft.com/developer/msbuild/2003" -[xml]$packagesConfig = Get-Content .\windows\$AppName\packages.config -($packagesConfig.packages.package | Where-Object id -EQ 'Microsoft.UI.Xaml').version = $WinUIVersion.ToString() -$packagesConfig.Save("$PWD\windows\$AppName\packages.config") +if (Test-Path .\windows\$AppName\packages.config) { + [xml]$packagesConfig = Get-Content .\windows\$AppName\packages.config + ($packagesConfig.packages.package | Where-Object id -EQ 'Microsoft.UI.Xaml').version = $WinUIVersion.ToString() + $packagesConfig.Save("$PWD\windows\$AppName\packages.config") +} [xml]$EF = Get-Content .\windows\ExperimentalFeatures.props $node = $EF.Project.PropertyGroup.WinUI2xVersion diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7d951559..18f0c022 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,182 +1,71 @@ -# This is a basic workflow to help you get started with Actions - name: CI -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch on: + schedule: + - cron: '0 15 * * 2' # Tuesday 3PM UTC (8AM PST) push: branches: [ main ] - pull_request: - branches: [ main ] + workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - codegen: - runs-on: windows-2019 - steps: - - name: setup git - run: | - git config --global core.autocrlf false - git config --global core.filemode false - - - uses: actions/checkout@v2 - - - uses: nuget/setup-nuget@v1 - - - name: NuGet restore - run: nuget restore example\windows\example.sln - - - name: run CodeGen - run: dotnet run -verbose -winmd ..\..\example\windows\packages\Microsoft.UI.Xaml.2.6.0\lib\uap10.0\Microsoft.UI.Xaml.winmd - working-directory: package\Codegen - - - name: verify no changes from CodeGen - shell: powershell - run: | - $changed = git status --porcelain=v1 - $changed - if ($changed -ne $null) { throw "CodeGen detected changes" } - - examplenuget: - runs-on: windows-2019 - steps: - - uses: actions/checkout@v2 - - name: yarn install - run: yarn install - - - name: build TS - run: yarn build - - - name: build ExampleNuget - run: yarn windows --no-launch --no-deploy --no-packager --logging - working-directory: examplenuget - - - name: Upload appx - uses: actions/upload-artifact@v2 - with: - name: ExampleNuget appx - path: exampleNuget\windows\AppPackages\exampleNuget\exampleNuget_1.0.0.0_Win32_Debug_Test - if-no-files-found: error - - - testcli: - runs-on: windows-2019 - steps: - - uses: actions/checkout@v2 - - name: yarn install - run: yarn install - - - name: build TS - run: yarn build - - - name: yarn link - run: yarn link - working-directory: package - - - name: create 0.64 app - run: npx react-native init testrnx --template react-native@^0.64 - - - name: add Windows - run: npx react-native-windows-init --overwrite - working-directory: testrnx - - - name: link react-native-xaml - run: yarn link react-native-xaml - working-directory: testrnx - - - name: add react-native-xaml - run: yarn add react-native-xaml - working-directory: testrnx - - - name: autolink - run: npx react-native autolink-windows --logging - working-directory: testrnx - - - name: update WinUI package version - run: ..\.github\workflows\SetUpAppForNuget.ps1 - working-directory: testrnx - - - name: build app - run: npx react-native run-windows --no-launch --no-deploy --no-packager --logging - working-directory: testrnx - - - testcliNuGet: - runs-on: windows-2019 - steps: - - uses: actions/checkout@v2 - - name: yarn install - run: yarn install - - - name: build TS - run: yarn build - - - name: yarn link - run: yarn link - working-directory: package - - - name: create 0.64 app - run: npx react-native init testrnx --template react-native@^0.64 - - - name: add Windows - run: npx react-native-windows-init --overwrite --experimentalNuGetDependency true - working-directory: testrnx - - - name: link react-native-xaml - run: yarn link react-native-xaml - working-directory: testrnx - - - name: add react-native-xaml - run: yarn add react-native-xaml - working-directory: testrnx - - - name: autolink - run: npx react-native autolink-windows --logging - working-directory: testrnx - - - name: update WinUI package version and mark for NuGet package consumption - run: ..\.github\workflows\SetUpAppForNuget.ps1 -UseNuGet - working-directory: testrnx - - - name: build app - run: npx react-native run-windows --no-launch --no-deploy --no-packager --logging - working-directory: testrnx - - package: - runs-on: windows-2019 - steps: - - uses: actions/checkout@v2 - - - name: setup-msbuild - uses: microsoft/setup-msbuild@v1 - - - name: yarn install - run: yarn install - - - name: build TS - run: yarn build - - - name: npm pack - run: npm pack - working-directory: package - - - name: Upload npm package - uses: actions/upload-artifact@v2 - with: - name: npm package - path: package\*.tgz - if-no-files-found: error - - - name: build Release x64 - run: msbuild /restore /p:RestorePackagesConfig=true package\windows\ReactNativeXaml.sln /p:configuration=Release /p:platform=x64 - - - name: Validate size - shell: powershell - run: | - $size = (gci package\windows\x64\Release\ReactNativeXaml\ReactNativeXaml.dll).Length - $size - if ($size -gt 1.5MB) { - throw "DLL is bigger than 1.5MB" - } - + call-runcodegen: + name: Run CodeGen + uses: ./.github/workflows/template-runcodegen.yml + with: + vmImage: windows-2022 + + call-buildexample: + name: Build Example + strategy: + fail-fast: false + matrix: + exampleName: ['example', 'examplenuget'] # build both examples + uses: ./.github/workflows/template-buildexample.yml + with: + vmImage: windows-2022 + exampleName: ${{ matrix.exampleName }} + + call-testcli: + name: Test CLI + strategy: + fail-fast: false + matrix: + rnwVersion: ['^0.71'] # test supported versions + useRnwNuGet: [false, true] # test building with both RNW source and RNW NuGet + uses: ./.github/workflows/template-testcli.yml + with: + vmImage: windows-2022 + rnwVersion: ${{ matrix.rnwVersion }} + useRnwNuGet: ${{ matrix.useRnwNuGet }} + + call-testcli-old: + name: Test CLI (Old) + strategy: + fail-fast: false + matrix: + rnwVersion: ['^0.67', '^0.68', '^0.69', '^0.70'] # test supported versions + useRnwNuGet: [false, true] # test building with both RNW source and RNW NuGet + uses: ./.github/workflows/template-testcli.yml + with: + vmImage: windows-2019 + rnwVersion: ${{ matrix.rnwVersion }} + useRnwNuGet: ${{ matrix.useRnwNuGet }} + + call-buildnpmpackage: + name: Build NPM Package + uses: ./.github/workflows/template-buildnpmpackage.yml + with: + vmImage: windows-2022 + + call-buildrnx: + name: Build RNX + strategy: + fail-fast: false + matrix: + configuration: ['Debug', 'Release'] + platform: ['x64'] + uses: ./.github/workflows/template-buildrnx.yml + with: + vmImage: windows-2022 + configuration: ${{ matrix.configuration }} + platform: ${{ matrix.platform }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..1643fcf4 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,93 @@ +name: PR + +on: + pull_request: + branches: [ main ] + +jobs: + setupcheck: + name: Setup Check + runs-on: windows-2022 + steps: + - uses: actions/checkout@v3 + + - name: yarn install + run: yarn install + + - name: beachball check + run: npx beachball check --verbose --changehint "::error::Run `yarn change` from root of repo to generate a change file." + + call-runcodegen: + name: Run CodeGen + needs: setupcheck + uses: ./.github/workflows/template-runcodegen.yml + with: + vmImage: windows-2022 + + call-buildexample: + name: Build Example + needs: setupcheck + strategy: + fail-fast: true + matrix: + exampleName: ['example', 'examplenuget'] # build both examples + uses: ./.github/workflows/template-buildexample.yml + with: + vmImage: windows-2022 + exampleName: ${{ matrix.exampleName }} + + call-testcli: + name: Test CLI + needs: setupcheck + strategy: + fail-fast: true + matrix: + rnwVersion: ['^0.71'] # test key versions + useRnwNuGet: [false, true] # test building with both RNW source and RNW NuGet + uses: ./.github/workflows/template-testcli.yml + with: + vmImage: windows-2022 + rnwVersion: ${{ matrix.rnwVersion }} + useRnwNuGet: ${{ matrix.useRnwNuGet }} + + call-testcli-old: + name: Test CLI (Old) + needs: setupcheck + strategy: + fail-fast: true + matrix: + rnwVersion: ['^0.67', '^0.69'] # test key versions (min, partners) + useRnwNuGet: [false, true] # test building with both RNW source and RNW NuGet + uses: ./.github/workflows/template-testcli.yml + with: + vmImage: windows-2019 + rnwVersion: ${{ matrix.rnwVersion }} + useRnwNuGet: ${{ matrix.useRnwNuGet }} + + call-buildnpmpackage: + name: Build NPM Package + needs: setupcheck + uses: ./.github/workflows/template-buildnpmpackage.yml + with: + vmImage: windows-2022 + + call-buildrnx: + name: Build RNX + needs: setupcheck + strategy: + fail-fast: true + matrix: + configuration: ['Release'] + platform: ['x64'] + uses: ./.github/workflows/template-buildrnx.yml + with: + vmImage: windows-2022 + configuration: ${{ matrix.configuration }} + platform: ${{ matrix.platform }} + + prcheck: + name: Successful PR Check + runs-on: ubuntu-latest + needs: [setupcheck, call-runcodegen, call-testcli, call-testcli-old, call-buildnpmpackage, call-buildrnx] + steps: + - uses: actions/checkout@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3fdd1564..047e1432 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - name: Publish on: @@ -9,34 +6,19 @@ on: workflow_dispatch: jobs: - run-codegen: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - uses: nuget/setup-nuget@v1 - - name: setup-msbuild - uses: microsoft/setup-msbuild@v1 - - - name: NuGet restore - run: nuget restore example\windows\example.sln - - - name: run CodeGen - run: dotnet run -verbose -winmd ..\..\example\windows\packages\Microsoft.UI.Xaml.2.6.0\lib\uap10.0\Microsoft.UI.Xaml.winmd - working-directory: package\Codegen - - - name: verify no changes from CodeGen - shell: powershell - run: | - $changed = git status --porcelain=v1 - if ($changed -ne $null) { throw "CodeGen detected changes" } + call-runcodegen: + name: Run CodeGen + uses: ./.github/workflows/template-runcodegen.yml + with: + vmImage: windows-2022 publish-npm: runs-on: ubuntu-latest - needs: run-codegen + needs: call-runcodegen steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Use Node.js uses: actions/setup-node@v1 with: @@ -56,7 +38,7 @@ jobs: working-directory: package - name: upload npm logs - uses: actions/upload-artifact@v2.3.1 + uses: actions/upload-artifact@v3 with: name: npm-logs path: /home/runner/.npm/_logs diff --git a/.github/workflows/template-buildexample.yml b/.github/workflows/template-buildexample.yml new file mode 100644 index 00000000..6ebc5661 --- /dev/null +++ b/.github/workflows/template-buildexample.yml @@ -0,0 +1,37 @@ +name: Build Example + +on: + workflow_call: + inputs: + vmImage: + required: false + default: 'windows-latest' + type: string + exampleName: + required: false + default: 'example' + type: string + +jobs: + build-example: + name: Build ${{ inputs.exampleName }} + runs-on: ${{ inputs.vmImage }} + steps: + - uses: actions/checkout@v3 + + - name: yarn install + run: yarn install + + - name: build TS + run: yarn build + + - name: yarn windows + run: yarn windows --no-launch --no-deploy --no-packager --logging + working-directory: ${{ inputs.exampleName }} + + - name: Upload appx + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.exampleName }} appx + path: ${{ inputs.exampleName }}\windows\AppPackages\${{ inputs.exampleName }}\${{ inputs.exampleName }}_1.0.0.0_x64_Debug_Test + if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/template-buildnpmpackage.yml b/.github/workflows/template-buildnpmpackage.yml new file mode 100644 index 00000000..fad8a09a --- /dev/null +++ b/.github/workflows/template-buildnpmpackage.yml @@ -0,0 +1,33 @@ +name: Build NPM Package + +on: + workflow_call: + inputs: + vmImage: + required: false + default: 'windows-latest' + type: string + +jobs: + package: + name: Build NPM Package + runs-on: ${{ inputs.vmImage }} + steps: + - uses: actions/checkout@v3 + + - name: yarn install + run: yarn install + + - name: build TS + run: yarn build + + - name: npm pack + run: npm pack + working-directory: package + + - name: Upload npm package + uses: actions/upload-artifact@v3 + with: + name: RNX npm package + path: package\*.tgz + if-no-files-found: error diff --git a/.github/workflows/template-buildrnx.yml b/.github/workflows/template-buildrnx.yml new file mode 100644 index 00000000..c9850fb4 --- /dev/null +++ b/.github/workflows/template-buildrnx.yml @@ -0,0 +1,53 @@ +name: Build RNX + +on: + workflow_call: + inputs: + vmImage: + required: false + default: 'windows-latest' + type: string + configuration: + required: false + default: 'Debug' + type: string + platform: + required: false + default: 'x64' + type: string + +jobs: + package: + name: Build RNX ${{ inputs.configuration }} ${{ inputs.platform }} + runs-on: ${{ inputs.vmImage }} + steps: + - uses: actions/checkout@v3 + + - name: setup-msbuild + uses: microsoft/setup-msbuild@v1 + + - name: yarn install + run: yarn install + + - name: build TS + run: yarn build + + - name: build ReactNativeXaml.sln + run: msbuild /restore /p:RestorePackagesConfig=true package\windows\ReactNativeXaml.sln /p:configuration=${{ inputs.configuration }} /p:platform=${{ inputs.platform }} + + - name: Upload build output + uses: actions/upload-artifact@v3 + with: + name: RNX ${{ inputs.configuration }} ${{ inputs.platform }} Build Output + path: package\windows\${{ inputs.platform }}\${{ inputs.configuration }}\ReactNativeXaml\*.* + if-no-files-found: error + + - if: ${{ inputs.configuration == 'Release' && inputs.platform == 'x64' }} + name: Validate size (Release x64 only) + shell: powershell + run: | + $size = (gci package\windows\x64\Release\ReactNativeXaml\ReactNativeXaml.dll).Length + $size + if ($size -gt 1.5MB) { + throw "DLL is bigger than 1.5MB" + } diff --git a/.github/workflows/template-runcodegen.yml b/.github/workflows/template-runcodegen.yml new file mode 100644 index 00000000..10f97312 --- /dev/null +++ b/.github/workflows/template-runcodegen.yml @@ -0,0 +1,43 @@ +name: Run CodeGen + +on: + workflow_call: + inputs: + vmImage: + required: false + default: 'windows-latest' + type: string + +jobs: + codegen: + name: Run CodeGen + runs-on: ${{ inputs.vmImage }} + steps: + - name: setup git + run: | + git config --global core.autocrlf false + git config --global core.filemode false + + - uses: actions/checkout@v3 + + - name: yarn install + run: yarn install + + - uses: nuget/setup-nuget@v1 + + - name: NuGet restore + run: nuget restore example\windows\example.sln + + - name: run CodeGen + run: dotnet run -verbose -winmd $env:USERPROFILE\.nuget\packages\microsoft.ui.xaml\2.7.0\lib\uap10.0\Microsoft.UI.Xaml.winmd + working-directory: package\Codegen + + - name: build TS + run: yarn build + + - name: verify no changes from CodeGen + shell: powershell + run: | + $changed = git status --porcelain=v1 package/ + $changed + if ($changed -ne $null) { throw "CodeGen detected changes" } \ No newline at end of file diff --git a/.github/workflows/template-testcli.yml b/.github/workflows/template-testcli.yml new file mode 100644 index 00000000..79a8e4e4 --- /dev/null +++ b/.github/workflows/template-testcli.yml @@ -0,0 +1,61 @@ +name: Test CLI + +on: + workflow_call: + inputs: + vmImage: + required: false + default: 'windows-latest' + type: string + rnwVersion: + required: false + default: 'latest' + type: string + useRnwNuGet: + required: false + default: false + type: boolean + +jobs: + testcli: + name: New RNW@${{ inputs.rnwVersion }} App from ${{ inputs.useRnwNuGet && 'NuGet' || 'Source' }} + runs-on: ${{ inputs.vmImage }} + steps: + - uses: actions/checkout@v3 + + - name: yarn install + run: yarn install + + - name: build TS + run: yarn build + + - name: yarn link + run: yarn link + working-directory: package + + - name: create react-native@${{ inputs.rnwVersion }} app + run: npx react-native init testrnx --template react-native@${{ inputs.rnwVersion }} + + - name: add Windows (RNW via ${{ inputs.useRnwNuGet && 'NuGet' || 'Source' }}) + run: npx react-native-windows-init --overwrite ${{ inputs.useRnwNuGet && '--experimentalNuGetDependency true' || '' }} + working-directory: testrnx + + - name: link react-native-xaml + run: yarn link react-native-xaml + working-directory: testrnx + + - name: add react-native-xaml + run: yarn add react-native-xaml + working-directory: testrnx + + - name: autolink + run: npx react-native autolink-windows --logging + working-directory: testrnx + + - name: update WinUI package version + run: ..\.github\workflows\SetUpAppForNuget.ps1 ${{ inputs.useRnwNuGet && '-UseNuGet' || '' }} + working-directory: testrnx + + - name: build app + run: npx react-native run-windows --no-launch --no-deploy --no-packager --logging + working-directory: testrnx diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 44b55775..5a81b7a3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,16 +4,46 @@ When contributing to this repository, please first discuss the change you wish t This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. ## Pull Request Process + +### Initial setup 1. Fork repository and create your feature branch out of main. -2. Open [Codegen project](./package/Codegen/Codegen.csproj) in Visual Studio. -3. Build project (this will restore NuGet packages). Once completed, you are ready to run the project, see output, and make your desired changes. -4. If you make changes in a .tt file, all you need to do is save the file and that will generate corresponding files that reflect your change. -5. For all other changes: run `yarn build` in src folder so that related files are generated -6. Run from Visual Studio to see output. -7. Once changes are ready, run `yarn change` at the root of the repository to create a patch (it will ask for a description of the change). The version scheme we use is [SemVer](https://semver.org/) -8. Update the package version by running `yarn bump` -9. Open a pull request and address review feedback. -10. After the PR is merged, manually trigger a publish from GitHub to publish to npm. - -## Technical details: +2. Run `yarn` in the repo root to install NPM dependencies. +3. Open the [example solution](./example/windows/example.sln) in Visual Studio. +4. In the Solution Explorer, right-click on `Solution 'example'` and select `Restore NuGet Packages`. + +### Build and run Codegen +1. In the Solution Explorer, right-click on the `Codegen` project and select `Set as Startup Project`. +2. Build the Codegen project (`Build > Build Godegen`). Once completed, you are ready to run the project, see output, and make your desired changes. +3. Run the Codegen project (`Debug > Start Debugging`). + +### Make and verify your Codegen changes + +If you make changes to the Codegen project, be sure to build and re-run the Codegen. + +1. If you make changes in a .tt file in Visual Studio, all you need to do is save the file and that will generate corresponding .cs file that reflects your change. +2. Run the Codegen steps above in Visual Studio to verify your changes to the +[output files](./package/windows/ReactNativeXaml/Codegen/). + +### Make and verify your ReactNativeXaml changes + +If you make changes to the ReactNativeXaml project, or to the Codegen output files (above), make sure that the ReactNativeXaml project still builds. + +1. Make sure the example.sln is loaded in Visual Studio, see [Intial setup](#initial-setup) +2. Set the Solution Configuration to `Debug` or `Release`. +3. Set the Solution Platforms to `x86` or `x64` (not `AnyCPU`). +4. Run `Build > Build Solution`. + +### Make and verify your TS changes + +If you make changes to the [package TypeScript files](./package/src/), be sure to build them. + +1. Run `yarn build` from the repo root. + +### Prepare and submit a PR +1. Once changes are ready, run `yarn change` at the root of the repository to create a patch (it will ask for a description of the change). The version scheme we use is [SemVer](https://semver.org/) +2. Update the package version by running `yarn bump` +3. Open a pull request and address review feedback. +4. After the PR is merged, manually trigger a publish from GitHub to publish to npm. + +## Technical details You can find more details to setting up in the [Technical Guide](TechnicalGuide.md). \ No newline at end of file diff --git a/LICENSE b/LICENSE index d6d4ee52..22aed37e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Alexander Sklar +Copyright (c) Microsoft Corporation. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..869fdfe2 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + + diff --git a/USAGE.md b/USAGE.md index 0c4ec536..0c0543f9 100644 --- a/USAGE.md +++ b/USAGE.md @@ -73,6 +73,22 @@ If you have questions about a scenario you don't see below, please [file an issu setIsOpen(true); }} /> ``` +Menus can contain cascading items: +```jsx + + + + + + + + + + + + +``` + ## MenuBar ```jsx @@ -136,7 +152,7 @@ Note that only react-native-xaml components will respect the `gridRow`/`gridColu ## NavigationView ```jsx - const [text, setText] = React.useState('initial text'); +const [text, setText] = React.useState('initial text'); setText('text #1')} priority={NavigationViewPriority.MenuItem}> @@ -208,7 +224,7 @@ const [showState, setShowState] = useState(ContentDialogState.Hidden); ## SplitView ```jsx - const [isOpen, setIsOpen] = useState(false); +const [isOpen, setIsOpen] = useState(false); // ... -