diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 896bd4c76..e39bc8daf 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -11,7 +11,6 @@ This repository contains React Native samples, components, and templates for Win │ ├── Calculator/ # Calculator sample with C++/WinRT, C#, and Fabric implementations │ ├── NativeModuleSample/ # Native module and component examples │ └── ContinuousIntegration/ # CI/CD pipeline configurations -├── samples-old/ # Legacy samples for older RN versions ├── website/ # Documentation website (Docusaurus) ├── docs/ # Additional documentation └── .github/ # GitHub workflows and templates diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 539533635..69617cf19 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,43 +1,38 @@ version: 2 updates: - package-ecosystem: npm - directory: "/samples/" - schedule: - interval: daily - time: "05:00" - timezone: "America/Los_Angeles" - labels: - - dependencies - versioning-strategy: auto - commit-message: - prefix: 📦 - open-pull-requests-limit: 10 - -- package-ecosystem: nuget - directory: "/samples/" + # Every folder with a package.json: the samples, website, and websitev2. + directories: + - "**/*" + target-branch: "main" + cooldown: + default-days: 8 + ignore: + # Samples move to new React Native for Windows versions through the CI Upgrade workflow. + - dependency-name: "react-native-windows" + - dependency-name: "*" + update-types: + - "version-update:semver-major" + groups: + all-dependencies: + applies-to: version-updates + patterns: + - '*' + security-updates: + applies-to: security-updates + patterns: + - '*' schedule: - interval: daily + interval: weekly time: "05:00" timezone: "America/Los_Angeles" labels: - - dependencies - versioning-strategy: auto + - dependencies + versioning-strategy: lockfile-only commit-message: prefix: 📦 - open-pull-requests-limit: 10 + open-pull-requests-limit: 5 -- package-ecosystem: npm - directory: "/website/" - schedule: - interval: daily - time: "05:00" - timezone: "America/Los_Angeles" - labels: - - dependencies - versioning-strategy: auto - commit-message: - prefix: 📦 - open-pull-requests-limit: 10 - package-ecosystem: "github-actions" directory: "/" groups: diff --git a/.gitignore b/.gitignore index b9ef585e0..107f0267f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,4 @@ website/i18n/* # This is not a mono repo, ignore files from people accidentally running yarn in the wrong places /yarn.lock -/samples/yarn.lock -/samples-old/yarn.lock \ No newline at end of file +/samples/yarn.lock \ No newline at end of file diff --git a/docs/native-modules-advanced.md b/docs/native-modules-advanced.md index 1e9e2ee6f..073e60cf2 100644 --- a/docs/native-modules-advanced.md +++ b/docs/native-modules-advanced.md @@ -11,7 +11,7 @@ title: Native Modules (Advanced) >**This documentation and the underlying platform code is a work in progress.** >**Examples (C# and C++/WinRT):** -> - [Native Module Sample in `microsoft/react-native-windows-samples`](https://github.com/microsoft/react-native-windows-samples/tree/main/samples-old/NativeModuleSample) +> - [Native Module Sample in `microsoft/react-native-windows-samples`](https://github.com/microsoft/react-native-windows-samples/tree/a87d8404c42e189d1553c31e9e62cd3172d16c03/samples-old/NativeModuleSample) ## Writing Native Modules without using Attributes (C#) diff --git a/docs/native-modules-async.md b/docs/native-modules-async.md index 518d7631e..c5427871d 100644 --- a/docs/native-modules-async.md +++ b/docs/native-modules-async.md @@ -15,7 +15,7 @@ A common scenario for [Native Modules](native-modules.md) is to call one or more This document proposes some best patterns to follow when bridging asynchronous methods from JS to native code for React Native Windows. It assumes you've already familiar with the basics of setting up and writing [Native Modules](native-modules.md). -> The complete source for the examples below are provided within the [Native Module Sample in `microsoft/react-native-windows-samples`](https://github.com/microsoft/react-native-windows-samples/tree/main/samples-old/NativeModuleSample). +> The complete source for the examples below are provided within the [Native Module Sample in `microsoft/react-native-windows-samples`](https://github.com/microsoft/react-native-windows-samples/tree/a87d8404c42e189d1553c31e9e62cd3172d16c03/samples-old/NativeModuleSample). ## Writing Native Modules that call Asynchronous Windows APIs @@ -121,7 +121,7 @@ as well as store the status code and update the return statement from `return co But wait, we've only discussed the success path, what happens if `GetHttpResponse` doesn't succeed? We don't handle any exceptions in this example. If an exception is thrown, how do we marshal an error back to JavaScript? That is actually taken care of for you by the framework: any exception in the task will be marshaled to the JavaScript side as a JavaScript exception. -That's it! If you want to see the complete `SimpleHttpModule`, see [`AsyncMethodExamples.cs`](https://github.com/microsoft/react-native-windows-samples/blob/main/samples-old/NativeModuleSample/csharp/windows/NativeModuleSample/AsyncMethodExamples.cs). +That's it! If you want to see the complete `SimpleHttpModule`, see [`AsyncMethodExamples.cs`](https://github.com/microsoft/react-native-windows-samples/blob/a87d8404c42e189d1553c31e9e62cd3172d16c03/samples-old/NativeModuleSample/csharp/windows/NativeModuleSample/AsyncMethodExamples.cs). ### `SimpleHttpModule` in C++/WinRT @@ -262,7 +262,7 @@ We've defined an `AsyncActionCompletedHandler` lambda and set it to be run when > **Important:** This example shows the minimum case, where you don't handle any errors within `GetHttpResponseAsync`, but you're not limited to this. You're free to detect error conditions within your code and call `capturedPromise.Reject()` yourself with (more useful) error messages at any time. However you should *always* include this final handler, to catch any unexpected and unhandled exceptions that may occur, especially when calling Windows APIs. Just be sure that you only call `Reject()` once and that nothing executes afterwards. -That's it! If you want to see the complete `SimpleHttpModule`, see [`AsyncMethodExamples.h`](https://github.com/microsoft/react-native-windows-samples/blob/main/samples-old/NativeModuleSample/cppwinrt/windows/NativeModuleSample/AsyncMethodExamples.h). +That's it! If you want to see the complete `SimpleHttpModule`, see [`AsyncMethodExamples.h`](https://github.com/microsoft/react-native-windows-samples/blob/a87d8404c42e189d1553c31e9e62cd3172d16c03/samples-old/NativeModuleSample/cppwinrt/windows/NativeModuleSample/AsyncMethodExamples.h). ## Executing calls to API on the UI thread diff --git a/docs/native-modules-marshalling-data.md b/docs/native-modules-marshalling-data.md index 7a362228f..dd6181f34 100644 --- a/docs/native-modules-marshalling-data.md +++ b/docs/native-modules-marshalling-data.md @@ -43,7 +43,7 @@ The end-to-end data flow looks something like this: ## Examples -For examples of using data automatically marshaled into both static and dynamic native types, see the `DataMarshalingExamples` module within the [Native Module Sample in `microsoft/react-native-windows-samples`](https://github.com/microsoft/react-native-windows-samples/tree/main/samples-old/NativeModuleSample). Implementations for both C# and C++/WinRT are provided. +For examples of using data automatically marshaled into both static and dynamic native types, see the `DataMarshalingExamples` module within the [Native Module Sample in `microsoft/react-native-windows-samples`](https://github.com/microsoft/react-native-windows-samples/tree/a87d8404c42e189d1553c31e9e62cd3172d16c03/samples-old/NativeModuleSample). Implementations for both C# and C++/WinRT are provided. For further examples of using the dynamic `JSValue` type, see [Using `JSValue`](native-modules-jsvalue.md). diff --git a/docs/native-modules.md b/docs/native-modules.md index e9f0a2244..3eba4134a 100644 --- a/docs/native-modules.md +++ b/docs/native-modules.md @@ -12,7 +12,7 @@ title: Native Modules > **This documentation and the underlying platform code is a work in progress.** > **Examples (C# and C++/WinRT):** > -> - [Native Module Sample in `microsoft/react-native-windows-samples`](https://github.com/microsoft/react-native-windows-samples/tree/main/samples-old/NativeModuleSample) +> - [Native Module Sample in `microsoft/react-native-windows-samples`](https://github.com/microsoft/react-native-windows-samples/tree/a87d8404c42e189d1553c31e9e62cd3172d16c03/samples-old/NativeModuleSample) Sometimes an app needs access to a platform API that React Native doesn't have a corresponding module for yet. Maybe you want to reuse some existing .NET code without having to re-implement it in JavaScript, or write some high performance, multi-threaded code for image processing, a database, or any number of advanced extensions. diff --git a/samples-old/AppServiceDemo/.buckconfig b/samples-old/AppServiceDemo/.buckconfig deleted file mode 100644 index 934256cb2..000000000 --- a/samples-old/AppServiceDemo/.buckconfig +++ /dev/null @@ -1,6 +0,0 @@ - -[android] - target = Google Inc.:Google APIs:23 - -[maven_repositories] - central = https://repo1.maven.org/maven2 diff --git a/samples-old/AppServiceDemo/.editorconfig b/samples-old/AppServiceDemo/.editorconfig deleted file mode 100644 index 7c286132f..000000000 --- a/samples-old/AppServiceDemo/.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -# Windows files -[*.bat] -end_of_line = crlf diff --git a/samples-old/AppServiceDemo/.eslintrc.js b/samples-old/AppServiceDemo/.eslintrc.js deleted file mode 100644 index 40c6dcd05..000000000 --- a/samples-old/AppServiceDemo/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: '@react-native-community', -}; diff --git a/samples-old/AppServiceDemo/.flowconfig b/samples-old/AppServiceDemo/.flowconfig deleted file mode 100644 index 7c3a4c6ae..000000000 --- a/samples-old/AppServiceDemo/.flowconfig +++ /dev/null @@ -1,63 +0,0 @@ -[ignore] -; We fork some components by platform -.*/*[.]android.js - -; Ignore "BUCK" generated dirs -/\.buckd/ - -; Ignore polyfills -node_modules/react-native/Libraries/polyfills/.* - -; Flow doesn't support platforms -.*/Libraries/Utilities/LoadingView.js - -[untyped] -.*/node_modules/@react-native-community/cli/.*/.* - -[include] - -[libs] -node_modules/react-native/interface.js -node_modules/react-native/flow/ - -[options] -emoji=true - -exact_by_default=true - -module.file_ext=.js -module.file_ext=.json -module.file_ext=.ios.js - -munge_underscores=true - -module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' -module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' - -suppress_type=$FlowIssue -suppress_type=$FlowFixMe -suppress_type=$FlowFixMeProps -suppress_type=$FlowFixMeState - -[lints] -sketchy-null-number=warn -sketchy-null-mixed=warn -sketchy-number=warn -untyped-type-import=warn -nonstrict-import=warn -deprecated-type=warn -unsafe-getters-setters=warn -unnecessary-invariant=warn -signature-verification-failure=warn - -[strict] -deprecated-type -nonstrict-import -sketchy-null -unclear-type -unsafe-getters-setters -untyped-import -untyped-type-import - -[version] -^0.149.0 diff --git a/samples-old/AppServiceDemo/.gitattributes b/samples-old/AppServiceDemo/.gitattributes deleted file mode 100644 index 45a3dcb2a..000000000 --- a/samples-old/AppServiceDemo/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# Windows files should use crlf line endings -# https://help.github.com/articles/dealing-with-line-endings/ -*.bat text eol=crlf diff --git a/samples-old/AppServiceDemo/.gitignore b/samples-old/AppServiceDemo/.gitignore deleted file mode 100644 index ad572e632..000000000 --- a/samples-old/AppServiceDemo/.gitignore +++ /dev/null @@ -1,59 +0,0 @@ -# OSX -# -.DS_Store - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml - -# node.js -# -node_modules/ -npm-debug.log -yarn-error.log - -# BUCK -buck-out/ -\.buckd/ -*.keystore -!debug.keystore - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/ - -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots - -# Bundle artifact -*.jsbundle - -# CocoaPods -/ios/Pods/ diff --git a/samples-old/AppServiceDemo/.prettierrc.js b/samples-old/AppServiceDemo/.prettierrc.js deleted file mode 100644 index 84196d95f..000000000 --- a/samples-old/AppServiceDemo/.prettierrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - bracketSpacing: false, - jsxBracketSameLine: true, - singleQuote: true, - trailingComma: 'all', - arrowParens: 'avoid', -}; diff --git a/samples-old/AppServiceDemo/.watchmanconfig b/samples-old/AppServiceDemo/.watchmanconfig deleted file mode 100644 index 9e26dfeeb..000000000 --- a/samples-old/AppServiceDemo/.watchmanconfig +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/samples-old/AppServiceDemo/App.js b/samples-old/AppServiceDemo/App.js deleted file mode 100644 index 8e8f39dbc..000000000 --- a/samples-old/AppServiceDemo/App.js +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * - * @format - * @flow strict-local - */ - - import React, { useState, useEffect } from 'react'; - import type {Node} from 'react'; - import { - SafeAreaView, - ScrollView, - StatusBar, - StyleSheet, - Text, - useColorScheme, - View, - NativeModules, - Button, - TextInput - } from 'react-native'; - - import { - Colors, - DebugInstructions, - Header, - LearnMoreLinks, - ReloadInstructions, - } from 'react-native/Libraries/NewAppScreen'; - - const Section = ({children, title}): Node => { - const isDarkMode = useColorScheme() === 'dark'; - return ( - - - {title} - - - {children} - - - ); - }; - - const App: () => Node = () => { - const isDarkMode = useColorScheme() === 'dark'; - - const backgroundStyle = { - backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, - }; - - useEffect(() => { - async function launchProcess() { - await NativeModules.ReactNativeAppServiceModule.launchFullTrustProcess(); - } - launchProcess(); - }, []); - - const[registryKeyName, setRegistryKeyName] = useState(''); - const[registryKeyValue, setRegistryKeyValue] = useState(''); - - const getRegistryKey = async() => { - var result = await NativeModules.ReactNativeAppServiceModule.getRegistryKey(registryKeyName); - setRegistryKeyValue(result); - } - - return ( - - - -
- - setRegistryKeyName(text)} /> -