Conversation
| { | ||
| key: 'WinRT', | ||
| component: WinRTExamplePage, | ||
| icon: '\uEF15', | ||
| type: 'Layout', | ||
| }, |
There was a problem hiding this comment.
FYI when you have to merge this later, look for:
icon -> textIcon
| key: 'WinRT', | ||
| component: WinRTExamplePage, | ||
| icon: '\uEF15', | ||
| type: 'Layout', |
There was a problem hiding this comment.
| type: 'Layout', | |
| type: 'System', |
| const ToastNotification = Notifications.ToastNotification; | ||
|
|
||
| export function showNotification(notification) { | ||
| var type = ToastTemplateType.toastText01; |
There was a problem hiding this comment.
| var type = ToastTemplateType.toastText01; | |
| let type = ToastTemplateType.toastText01; |
I'm surprised we don't have lint rules setup about var. As a default in our JS, we should always prefer let. It's scoped in a way that is much more sensible.
| if (typeof value === 'string') { | ||
| fillXmlElements(xml, xmlElements, [value]); | ||
| } else if (Array.isArray(value)) { | ||
| fillXmlElements(xml, xmlElements, value); | ||
| } else if (typeof value === 'object') { | ||
| fillXmlElements(xml, xmlElements, [value]); | ||
| } |
There was a problem hiding this comment.
Looks like case 1 and 3 are the same. Is this still correct?
| if (typeof value === 'string') { | |
| fillXmlElements(xml, xmlElements, [value]); | |
| } else if (Array.isArray(value)) { | |
| fillXmlElements(xml, xmlElements, value); | |
| } else if (typeof value === 'object') { | |
| fillXmlElements(xml, xmlElements, [value]); | |
| } | |
| if (Array.isArray(value)) { | |
| fillXmlElements(xml, xmlElements, value); | |
| } else { | |
| fillXmlElements(xml, xmlElements, [value]); | |
| } |
Or do you get types other than string/object in there? (like numeric literals or something)
There was a problem hiding this comment.
If your goal is "if it's an array, leave it; otherwise, place in an array" there might be other options. Like:
[...value]
Does that do the right thing? It definitely spreads a source array into a new array. But for a single item... I think still the same thing? Hmmm... except strings are iterable so that'll break apart the string. Anyway, might be some syntactic magic here.
| for (var arrValue of arr) { | ||
| var node = xmlElements[i++]; |
There was a problem hiding this comment.
What's happening here? Are arr and xmlElements ensured to be the same length? Why are we enumerating over arr but indexing into xmlElements?
| documentation={[ | ||
| { | ||
| label: 'WinRT Source Code', | ||
| url: 'https://github.com/asklar/react-native-winrt', |
There was a problem hiding this comment.
| url: 'https://github.com/asklar/react-native-winrt', | |
| url: 'https://github.com/microsoft/react-native-winrt', |
| flexWrap: 'wrap', | ||
| alignItems: 'center', | ||
| }}> | ||
| <Pressable |
There was a problem hiding this comment.
Any reason this doesn't just use a Button instead of a custom Pressable? It looks... button-y. And the point of the sample isn't any exact visual style, so it should be simple first.
Description
Add an example page using react-native-winrt, one of the community modules that we support.
Note: currently WIP, adding more API examples.
Why
Showcase community modules available in React Native Windows.
What
Add example page showcasing various APIs used in the react-native-winrt example application.
Screenshots