Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 81 additions & 2 deletions packages/sample-app-fabric/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,102 @@
* @format
*/

import React from 'react';
import {SafeAreaView, StatusBar, useColorScheme} from 'react-native';
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/

import React, {useState} from 'react';
import {SafeAreaView, StatusBar, useColorScheme, View, Text, StyleSheet} from 'react-native';
import {NewAppScreen} from '@react-native/new-app-screen';

import {CalendarView} from 'xaml-calendar-view';

type SectionProps = {
title: string;
children?: React.ReactNode;
};

function Section({title, children}: SectionProps): React.JSX.Element {
return (
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>{title}</Text>
{typeof children === 'string' ? (
<Text style={styles.sectionDescription}>{children}</Text>
) : (
children
)}
</View>
);
}

function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';

// Adjust this type if your native event uses a different shape.
// Many RNW components emit strings or numbers; you can swap to Date if you convert it.
const [selectedDate, setSelectedDate] = useState<string | undefined>(undefined);

return (
<SafeAreaView style={{flex: 1}}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor="transparent"
translucent
/>

{/* Your app content below the new screen */}
<View
style={[
styles.content,
{backgroundColor: isDarkMode ? '#000000' : '#FFFFFF'},
]}
>
<Section title="Calendar">
<Text style={styles.sectionDescription}>
Showing a CalendarView here (displayMode=1 for month view).
</Text>

<CalendarView
style={{width: 400, height: 400}}
displayMode="1"
onSelectedDatesChanged={e => {
setSelectedDate(e.nativeEvent.startDate);
}}
/>
</Section>

<Section title="Selected date">
<Text style={styles.sectionDescription}>
{selectedDate ?? '—'}
</Text>
</Section>
</View>
{/* New RN welcome screen */}
<NewAppScreen />
</SafeAreaView>
);
}

const styles = StyleSheet.create({
content: {
paddingHorizontal: 24,
paddingVertical: 16,
},
sectionContainer: {
marginTop: 16,
},
sectionTitle: {
fontSize: 20,
fontWeight: '600',
marginBottom: 6,
},
sectionDescription: {
fontSize: 16,
fontWeight: '400',
},
});

export default App;
3 changes: 2 additions & 1 deletion packages/sample-app-fabric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"@react-native/new-app-screen": "0.82.0-nightly-20250806-5936f29d6",
"react": "^19.1.0",
"react-native": "0.82.0-nightly-20250806-5936f29d6",
"react-native-windows": "^0.0.0-canary.1004"
"react-native-windows": "^0.0.0-canary.1004",
"xaml-calendar-view": "1.0.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand Down
96 changes: 56 additions & 40 deletions packages/sample-app-fabric/windows/SampleAppFabric.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,63 +35,54 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mso", "..\..\..\vnext\Mso\M
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Include", "..\..\..\vnext\include\Include.vcxitems", "{EF074BA1-2D54-4D49-A28E-5E040B47CD2E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XamlCalendarView", "..\..\..\node_modules\xaml-calendar-view\windows\XamlCalendarView\XamlCalendarView.vcxproj", "{3501592F-3196-4EE1-B4AA-FE4A5F29063B}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\..\..\vnext\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9
..\..\..\vnext\Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9
..\..\..\vnext\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9
..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
..\..\..\vnext\include\Include.vcxitems*{ef074ba1-2d54-4d49-a28e-5e040b47cd2e}*SharedItemsImports = 9
..\..\..\vnext\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
..\..\..\vnext\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
..\..\..\vnext\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Debug|ARM64 = Debug|ARM64
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
Release|ARM64 = Release|ARM64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.ActiveCfg = Debug|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Build.0 = Debug|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Deploy.0 = Debug|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x64.ActiveCfg = Debug|x64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x64.Build.0 = Debug|x64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x64.Deploy.0 = Debug|x64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x86.ActiveCfg = Debug|x86
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x86.Build.0 = Debug|x86
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x86.Deploy.0 = Debug|x86
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.ActiveCfg = Debug|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Build.0 = Debug|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Deploy.0 = Debug|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.ActiveCfg = Release|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Build.0 = Release|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Deploy.0 = Release|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x64.ActiveCfg = Release|x64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x64.Build.0 = Release|x64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x64.Deploy.0 = Release|x64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x86.ActiveCfg = Release|x86
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x86.Build.0 = Release|x86
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x86.Deploy.0 = Release|x86
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.ActiveCfg = Release|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Build.0 = Release|ARM64
{7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Deploy.0 = Release|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.ActiveCfg = Debug|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Build.0 = Debug|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Deploy.0 = Debug|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x64.ActiveCfg = Debug|x64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x64.Build.0 = Debug|x64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x64.Deploy.0 = Debug|x64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x86.ActiveCfg = Debug|Win32
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x86.Build.0 = Debug|Win32
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x86.Deploy.0 = Debug|Win32
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.ActiveCfg = Debug|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Build.0 = Debug|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Deploy.0 = Debug|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.ActiveCfg = Release|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Build.0 = Release|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Deploy.0 = Release|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x64.ActiveCfg = Release|x64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x64.Build.0 = Release|x64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x64.Deploy.0 = Release|x64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x86.ActiveCfg = Release|Win32
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x86.Build.0 = Release|Win32
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x86.Deploy.0 = Release|Win32
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.ActiveCfg = Release|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Build.0 = Release|ARM64
{E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Deploy.0 = Release|ARM64
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.ActiveCfg = Debug|ARM64
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.Build.0 = Debug|ARM64
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.ActiveCfg = Debug|x64
Expand All @@ -104,6 +95,20 @@ Global
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.Build.0 = Release|x64
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.ActiveCfg = Release|Win32
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.Build.0 = Release|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.ActiveCfg = Debug|ARM64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.Build.0 = Debug|ARM64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.ActiveCfg = Debug|x64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.Build.0 = Debug|x64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.ActiveCfg = Debug|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Build.0 = Debug|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Deploy.0 = Debug|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.ActiveCfg = Release|ARM64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.Build.0 = Release|ARM64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.ActiveCfg = Release|x64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.Build.0 = Release|x64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.ActiveCfg = Release|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Build.0 = Release|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Deploy.0 = Release|Win32
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.ActiveCfg = Debug|ARM64
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.Build.0 = Debug|ARM64
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.ActiveCfg = Debug|x64
Expand Down Expand Up @@ -140,26 +145,27 @@ Global
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.Build.0 = Release|x64
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.ActiveCfg = Release|Win32
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.Build.0 = Release|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.ActiveCfg = Debug|ARM64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.Build.0 = Debug|ARM64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.ActiveCfg = Debug|x64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.Build.0 = Debug|x64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.ActiveCfg = Debug|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Build.0 = Debug|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Deploy.0 = Debug|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.ActiveCfg = Release|ARM64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.Build.0 = Release|ARM64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.ActiveCfg = Release|x64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.Build.0 = Release|x64
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.ActiveCfg = Release|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Build.0 = Release|Win32
{14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Deploy.0 = Release|Win32
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Debug|ARM64.ActiveCfg = Debug|ARM64
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Debug|ARM64.Build.0 = Debug|ARM64
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Debug|x64.ActiveCfg = Debug|x64
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Debug|x64.Build.0 = Debug|x64
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Debug|x86.ActiveCfg = Debug|Win32
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Debug|x86.Build.0 = Debug|Win32
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Debug|x86.Deploy.0 = Debug|Win32
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Release|ARM64.ActiveCfg = Release|ARM64
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Release|ARM64.Build.0 = Release|ARM64
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Release|x64.ActiveCfg = Release|x64
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Release|x64.Build.0 = Release|x64
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Release|x86.ActiveCfg = Release|Win32
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Release|x86.Build.0 = Release|Win32
{3501592F-3196-4EE1-B4AA-FE4A5F29063B}.Release|x86.Deploy.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
{14B93DC8-FD93-4A6D-81CB-8BC96644501C} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
{C38970C0-5FBF-4D69-90D8-CBAC225AE895} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
{F7D32BD0-2749-483E-9A0D-1635EF7E3136} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
Expand All @@ -168,9 +174,19 @@ Global
{2049DBE9-8D13-42C9-AE4B-413AE38FFFD0} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
{84E05BFA-CBAF-4F0D-BFB6-4CE85742A57E} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
{EF074BA1-2D54-4D49-A28E-5E040B47CD2E} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
{14B93DC8-FD93-4A6D-81CB-8BC96644501C} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D43FAD39-F619-437D-BB40-04A3982ACB6A}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\..\..\vnext\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9
..\..\..\vnext\Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9
..\..\..\vnext\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9
..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
..\..\..\vnext\include\Include.vcxitems*{ef074ba1-2d54-4d49-a28e-5e040b47cd2e}*SharedItemsImports = 9
..\..\..\vnext\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
..\..\..\vnext\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
..\..\..\vnext\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
#include "pch.h"
#include "AutolinkedNativeModules.g.h"

// Includes from xaml-calendar-view
#include <winrt/XamlCalendarView.h>

namespace winrt::Microsoft::ReactNative
{

void RegisterAutolinkedNativeModulePackages(winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::ReactNative::IReactPackageProvider> const& packageProviders)
{
UNREFERENCED_PARAMETER(packageProviders);
// IReactPackageProviders from xaml-calendar-view
packageProviders.Append(winrt::XamlCalendarView::ReactPackageProvider());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- AutolinkedNativeModules.g.targets contents generated by "npx @react-native-community/cli autolink-windows" -->
<ItemGroup>
<!-- Projects from xaml-calendar-view -->
<ProjectReference Include="$(ProjectDir)..\..\..\..\node_modules\xaml-calendar-view\windows\XamlCalendarView\XamlCalendarView.vcxproj">
<Project>{3501592F-3196-4EE1-B4AA-FE4A5F29063B}</Project>
</ProjectReference>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@
"Folly": "[1.0.0, )",
"boost": "[1.83.0, )"
}
},
"xamlcalendarview": {
"type": "Project",
"dependencies": {
"Microsoft.ReactNative": "[1.0.0, )",
"Microsoft.VCRTForwarders.140": "[1.0.2-rc, )",
"Microsoft.WindowsAppSDK": "[1.7.250401001, )",
"boost": "[1.83.0, )"
}
}
},
"native,Version=v0.0/win": {
Expand Down
1 change: 1 addition & 0 deletions packages/xaml-calendar-view/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib-commonjs/
11 changes: 11 additions & 0 deletions packages/xaml-calendar-view/NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="react-native" value="https://pkgs.dev.azure.com/ms/react-native/_packaging/react-native-public/nuget/v3/index.json" />
<add key="Nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>
3 changes: 3 additions & 0 deletions packages/xaml-calendar-view/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:@rnw-scripts/babel-react-native-config'],
};
3 changes: 3 additions & 0 deletions packages/xaml-calendar-view/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
preset: 'react-native',
};
51 changes: 51 additions & 0 deletions packages/xaml-calendar-view/just-task.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
* @format
* @ts-check
*/

const {task, series} = require('just-scripts');
const fs = require('fs');
const glob = require('glob');
const path = require('path');

// Use the shared base configuration
require('@rnw-scripts/just-task');

// The TS build process will strip all the types from the NativeComponent spec file. Which means that the codegen babel will not correctly generate the JS view config for the component.
// So here we manually run babel, overwriting the tsc output, so that we ship the generated code.
task('codegenNativeComponents', () => {
const babel = require('@babel/core');
const matches = glob.sync('src/**/*NativeComponent.ts');

matches.forEach(matchedPath => {
const relativePath = path.relative(
path.resolve(process.cwd(), 'src'),
matchedPath,
);
const code = fs.readFileSync(matchedPath).toString();
const filename = path.resolve(process.cwd(), matchedPath);

const res = babel.transformSync(code, {
ast: false,
filename,
cwd: process.cwd(),
sourceRoot: process.cwd(),
root: process.cwd(),
babelrc: true,
});

const relativeOutputPath = relativePath.replace(/\.ts$/, '.js');

fs.writeFileSync(
path.resolve(process.cwd(), 'lib-commonjs', relativeOutputPath),
res?.code,
);
});
});

task(
'buildWithCodegetNativeComponents',
series('build', 'codegenNativeComponents'),
);
Loading