Skip to content

Commit

Permalink
Merge pull request #36 from asklar/enumConst
Browse files Browse the repository at this point in the history
Use ints for XAML Enums
  • Loading branch information
asklar committed Mar 8, 2021
2 parents d2be58e + eab5c5b commit 9054dcb
Show file tree
Hide file tree
Showing 19 changed files with 1,863 additions and 2,424 deletions.
5 changes: 4 additions & 1 deletion example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ NativeXamlControl,
MenuFlyoutItem,
TextBox,
// BlankUserControl,
ClickMode,
} from 'react-native-xaml'; // Would be from 'react-native-xaml' outside of this repo;

const Section = ({children, title}): Node => {
Expand Down Expand Up @@ -84,7 +85,9 @@ const App: () => Node = () => {
}}>
{/* <BlankUserControl onHappened={(arg) => alert(JSON.stringify(arg.nativeEvent)) } /> */}
<Button content={{ string: `Last selected option = ${option} ${count}` }} foreground="red"
onClick={(a) => { alert(JSON.stringify(a.nativeEvent)); setCount(count + 1); setIsOpen(true); }} />
onClick={(a) => { alert(JSON.stringify(a.nativeEvent)); setCount(count + 1); setIsOpen(true); }}
clickMode={ClickMode.Release}
/>
{/*<StackPanel orientation="horizontal">*/}
{/* <HyperlinkButton content={{ string: "Click me!" }} onClick={(args) => {*/}
{/* alert(`clicked! Native event args: ${JSON.stringify(args.nativeEvent)}`);*/}
Expand Down
8 changes: 4 additions & 4 deletions package/Codegen/Codegen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
</ItemGroup>

<ItemGroup>
<Compile Update="EnumConverters.cs">
<Compile Update="TSEnums.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>EnumConverters.tt</DependentUpon>
<DependentUpon>TSEnums.tt</DependentUpon>
</Compile>
<Compile Update="TSProps.cs">
<DesignTime>True</DesignTime>
Expand Down Expand Up @@ -48,9 +48,9 @@
</ItemGroup>

<ItemGroup>
<None Update="EnumConverters.tt">
<None Update="TSEnums.tt">
<Generator>TextTemplatingFilePreprocessor</Generator>
<LastGenOutput>EnumConverters.cs</LastGenOutput>
<LastGenOutput>TSEnums.cs</LastGenOutput>
</None>
<None Update="TSProps.tt">
<Generator>TextTemplatingFilePreprocessor</Generator>
Expand Down
40 changes: 0 additions & 40 deletions package/Codegen/EnumConverters.tt

This file was deleted.

4 changes: 2 additions & 2 deletions package/Codegen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ private void DumpTypes()
var propertiesGen = new TypeProperties(properties).TransformText();
UpdateFile(Path.Join(generatedDirPath, "TypeProperties.g.h"), propertiesGen);

var enumConvertersGen = new EnumConverters().TransformText();
UpdateFile(Path.Join(generatedDirPath, "EnumConverters.g.cpp"), enumConvertersGen);
var tsEnumsGen = new TSEnums().TransformText();
UpdateFile(Path.Join(packageSrcPath, "Enums.ts"), tsEnumsGen);

var eventsGen = new TypeEvents(events).TransformText();
UpdateFile(Path.Join(generatedDirPath, "TypeEvents.g.h"), eventsGen);
Expand Down

0 comments on commit 9054dcb

Please sign in to comment.