Skip to content
Merged
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
16 changes: 12 additions & 4 deletions example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const path = require('path')
const blacklist = require('metro-config/src/defaults/exclusionList')
const escape = require('escape-string-regexp')
Expand All @@ -13,19 +19,21 @@ module.exports = {
projectRoot: __dirname,
watchFolders: [root],

// We need to make sure that only one version is loaded for peerDependencies
// So we blacklist them at the root, and alias them to the versions in example's node_modules
resolver: {
blockList: blacklist([
// This stops "react-native run-windows" from causing the metro server to crash if its already running
new RegExp(`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`),
// This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip
/.*\.ProjectImports\.zip/,
]),
blacklistRE: blacklist(
modules.map((m) => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)),
),

extraNodeModules: modules.reduce((acc, name) => {
acc[name] = path.join(__dirname, 'node_modules', name)
return acc
}, {}),
},

transformer: {
getTransformOptions: async () => ({
transform: {
Expand Down
5,844 changes: 5,844 additions & 0 deletions example/package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start"
"start": "react-native start",
"windows": "react-native run-windows"
},
"dependencies": {
"react": "17.0.1",
"react-native": "0.64.2"
"react-native": "0.64.2",
"react-native-windows": "^0.64.0-0"
},
"devDependencies": {
"@babel/core": "^7.12.10",
Expand Down
92 changes: 92 additions & 0 deletions example/windows/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
*AppPackages*
*BundleArtifacts*

#OS junk files
[Tt]humbs.db
*.DS_Store

#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.opendb
*.unsuccessfulbuild
ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

#MonoDevelop
*.pidb
*.userprefs

#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*
*.sass-cache

#Project files
[Bb]uild/

#Subversion files
.svn

# Office Temp Files
~$*

# vim Temp Files
*~

#NuGet
packages/
*.nupkg

#ncrunch
*ncrunch*
*crunch*.local.xml

# visual studio database projects
*.dbmdl

#Test files
*.testsettings

#Other files
*.DotSettings
.vs/
*project.lock.json

#Files generated by the VS build
**/Generated Files/**

240 changes: 240 additions & 0 deletions example/windows/DocumentPickerExample.sln

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/windows/DocumentPickerExample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Bundle
9 changes: 9 additions & 0 deletions example/windows/DocumentPickerExample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<react:ReactApplication
x:Class="DocumentPickerExample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:react="using:Microsoft.ReactNative">
<Application.Resources>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
</Application.Resources>
</react:ReactApplication>
63 changes: 63 additions & 0 deletions example/windows/DocumentPickerExample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using Microsoft.ReactNative;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace DocumentPickerExample
{
sealed partial class App : ReactApplication
{
public App()
{
#if BUNDLE
JavaScriptBundleFile = "index.windows";
InstanceSettings.UseWebDebugger = false;
InstanceSettings.UseFastRefresh = false;
#else
JavaScriptBundleFile = "index";
InstanceSettings.UseWebDebugger = true;
InstanceSettings.UseFastRefresh = true;
#endif

#if DEBUG
InstanceSettings.UseDeveloperSupport = true;
#else
InstanceSettings.UseDeveloperSupport = false;
#endif

Microsoft.ReactNative.Managed.AutolinkedNativeModules.RegisterAutolinkedNativeModulePackages(PackageProviders); // Includes any autolinked modules

PackageProviders.Add(new Microsoft.ReactNative.Managed.ReactPackageProvider());
PackageProviders.Add(new ReactNativeDocumentPicker.ReactPackageProvider());
PackageProviders.Add(new ReactPackageProvider());
InitializeComponent();
}

/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
base.OnLaunched(e);
var frame = (Frame)Window.Current.Content;
frame.Navigate(typeof(MainPage), e.Arguments);
}

/// <summary>
/// Invoked when the application is activated by some means other than normal launching.
/// </summary>
protected override void OnActivated(IActivatedEventArgs e)
{
var preActivationContent = Window.Current.Content;
base.OnActivated(e);
if (preActivationContent == null && Window.Current != null)
{
// Display the initial content
var frame = (Frame)Window.Current.Content;
frame.Navigate(typeof(MainPage), null);
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions example/windows/DocumentPickerExample/AutolinkedNativeModules.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// AutolinkedNativeModules.g.cs contents generated by "react-native autolink-windows"

using System.Collections.Generic;

namespace Microsoft.ReactNative.Managed
{
internal static class AutolinkedNativeModules
{
internal static void RegisterAutolinkedNativeModulePackages(IList<IReactPackageProvider> packageProviders)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- AutolinkedNativeModules.g.props contents generated by "react-native autolink-windows" -->
<PropertyGroup>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- AutolinkedNativeModules.g.targets contents generated by "react-native autolink-windows" -->
<ItemGroup>
</ItemGroup>
</Project>
Loading