Skip to content

Commit d85fa6f

Browse files
chiaramooneyasklar
andauthored
Add MenuBar to Elements Which Can Have Children (#181)
* Fix Bug in MenuBar * Change files * Update Codegen Files * Change files * Address Feedback * Address Feedaback * Fix Format * Change files * Bump Version Co-authored-by: Alexander Sklar <[email protected]>
1 parent ceed6ab commit d85fa6f

File tree

6 files changed

+57
-3
lines changed

6 files changed

+57
-3
lines changed

USAGE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ If you have questions about a scenario you don't see below, please [file an issu
7373
setIsOpen(true); }} />
7474
```
7575

76+
## MenuBar
77+
```jsx
78+
<MenuBar>
79+
<MenuBarItem title="File">
80+
<MenuFlyoutItem text="Help"/>
81+
<MenuFlyoutItem text="Settings"/>
82+
</MenuBarItem>
83+
<MenuBarItem title="View"/>
84+
</MenuBar>
85+
```
86+
7687
## Image
7788

7889
- For Image, note that you should specify its size so that RN reserves space for it, otherwise the image won't show.

package/CHANGELOG.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
{
22
"name": "react-native-xaml",
33
"entries": [
4+
{
5+
"date": "Thu, 10 Feb 2022 17:17:17 GMT",
6+
"tag": "react-native-xaml_v0.0.60",
7+
"version": "0.0.60",
8+
"comments": {
9+
"patch": [
10+
{
11+
"author": "[email protected]",
12+
"package": "react-native-xaml",
13+
"comment": "Fix Bug in MenuBar",
14+
"commit": "cf1ef86e2bd57787ea5de17a49a2d2f84e0470ff"
15+
}
16+
]
17+
}
18+
},
419
{
520
"date": "Thu, 27 Jan 2022 14:11:26 GMT",
621
"tag": "react-native-xaml_v0.0.59",

package/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# Change Log - react-native-xaml
22

3-
This log was last generated on Thu, 27 Jan 2022 14:11:26 GMT and should not be manually modified.
3+
This log was last generated on Thu, 10 Feb 2022 17:17:17 GMT and should not be manually modified.
44

55
<!-- Start content -->
66

7+
## 0.0.60
8+
9+
Thu, 10 Feb 2022 17:17:17 GMT
10+
11+
### Patches
12+
13+
- Fix Bug in MenuBar ([email protected])
14+
715
## 0.0.59
816

917
Thu, 27 Jan 2022 14:11:26 GMT

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-xaml",
33
"title": "React Native Xaml",
4-
"version": "0.0.59",
4+
"version": "0.0.60",
55
"description": "Allows using XAML directly, inside of a React Native Windows app",
66
"main": "lib/index.js",
77
"typings": "lib/index.d.ts",

package/windows/ReactNativeXaml/Codegen/Version.g.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT MODIFY MANUALLY
77
#define VERSION_MAJOR 0
88
#define VERSION_MINOR 0
99
#define VERSION_REVISION 0
10-
#define VERSION_BUILD 59
10+
#define VERSION_BUILD 60

package/windows/ReactNativeXaml/XamlViewManager.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,26 @@ namespace winrt::ReactNativeXaml {
307307
return infoBar.ActionButton(buttonBase);
308308
}
309309
}
310+
if (auto menuBar = e.try_as<MenuBar>()) {
311+
if (auto mbi = child.try_as<MenuBarItem>()) {
312+
return menuBar.Items().InsertAt(index, mbi);
313+
}
314+
}
315+
if (auto muxMenuBar = e.try_as<mux::Controls::MenuBar>()) {
316+
if (auto mbi = child.try_as<mux::Controls::MenuBarItem>()) {
317+
return muxMenuBar.Items().InsertAt(index, mbi);
318+
}
319+
}
320+
if (auto menuBarItem = e.try_as<MenuBarItem>()) {
321+
if (auto mfi = child.try_as<MenuFlyoutItemBase>()) {
322+
return menuBarItem.Items().InsertAt(index,mfi);
323+
}
324+
}
325+
if (auto muxMenuBarItem = e.try_as<mux::Controls::MenuBarItem>()) {
326+
if (auto mfi = child.try_as<MenuFlyoutItemBase>()) {
327+
return muxMenuBarItem.Items().InsertAt(index, mfi);
328+
}
329+
}
310330
//else
311331
{
312332
auto cn = winrt::get_class_name(e);

0 commit comments

Comments
 (0)