diff --git a/.ado/Get-ShellScaling.ps1 b/.ado/Get-ShellScaling.ps1 new file mode 100644 index 00000000000..5f1e6bc9b02 --- /dev/null +++ b/.ado/Get-ShellScaling.ps1 @@ -0,0 +1,26 @@ +Add-Type @' + using System; + using System.Runtime.InteropServices; + using System.Drawing; + + public class DPI { + [DllImport("gdi32.dll")] + static extern int GetDeviceCaps(IntPtr hdc, int nIndex); + + public enum DeviceCap { + VERTRES = 10, + DESKTOPVERTRES = 117 + } + + public static float scaling() { + Graphics g = Graphics.FromHwnd(IntPtr.Zero); + IntPtr desktop = g.GetHdc(); + int LogicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.VERTRES); + int PhysicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.DESKTOPVERTRES); + + return (float)PhysicalScreenHeight / (float)LogicalScreenHeight; + } + } +'@ -ReferencedAssemblies 'System.Drawing.dll' + +[Math]::round([DPI]::scaling(), 2) * 100 \ No newline at end of file diff --git a/.ado/SetupLocalDumps.cmd b/.ado/SetupLocalDumps.cmd new file mode 100644 index 00000000000..6afd36134dd --- /dev/null +++ b/.ado/SetupLocalDumps.cmd @@ -0,0 +1,11 @@ +setlocal +set CRASHDUMPS_FOLDER=%BUILD_ARTIFACTSTAGINGDIRECTORY%\ReactUWPTestAppTreeDump\CrashDumps +reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /s +reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\ReactUWPTestApp.exe" /v DumpFolder /t REG_SZ /d %CRASHDUMPS_FOLDER% +reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\ReactUWPTestApp.exe" /v DumpType /t REG_DWORD /d 2 +if not exist %CRASHDUMPS_FOLDER% ( + md %CRASHDUMPS_FOLDER% +) else ( + del %CRASHDUMPS_FOLDER%\* /s /q +) +endlocal \ No newline at end of file diff --git a/.ado/publish.yml b/.ado/publish.yml index 5df81de516a..249427d156a 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -4,11 +4,17 @@ variables: - template: variables/msbuild.yml - template: variables/vs2019.yml +schedules: +- cron: "0 0 * * *" + displayName: Nightly publish build + branches: + include: + - master + trigger: batch: true branches: include: - - master - "*-stable" pr: none diff --git a/.ado/templates/e2e-test-job.yml b/.ado/templates/e2e-test-job.yml index e31b4037136..2dfe9f642a6 100644 --- a/.ado/templates/e2e-test-job.yml +++ b/.ado/templates/e2e-test-job.yml @@ -23,6 +23,12 @@ jobs: - template: prepare-env.yml + - task: CmdLine@2 + displayName: Set LocalDumps + inputs: + script: $(Build.SourcesDirectory)\.ado\SetupLocalDumps.cmd + workingDirectory: $(Build.SourcesDirectory) + - task: NuGetCommand@2 displayName: NuGet restore - ReactUWPTestApp inputs: @@ -34,7 +40,7 @@ jobs: - task: CmdLine@2 displayName: run-windows inputs: - script: react-native run-windows --no-packager --arch ${{ parameters.BuildPlatform }} --release --logging --msbuildprops BaseIntDir=$(BaseIntDir) + script: yarn windows --no-packager --arch ${{ parameters.BuildPlatform }} --release --logging --msbuildprops BaseIntDir=$(BaseIntDir) workingDirectory: packages/E2ETest - task: PublishBuildArtifacts@1 @@ -74,6 +80,11 @@ jobs: targetType: 'inline' script: 'if ((Get-Process React*) -eq $Null) { echo "TestApp is not running"; exit 1}' + - task: CmdLine@2 + displayName: mkdir errorShots + inputs: + script: mkdir $(Build.SourcesDirectory)\packages\E2ETest\errorShots + - task: CmdLine@2 displayName: run e2etest inputs: @@ -87,7 +98,28 @@ jobs: targetFolder: $(Build.StagingDirectory)/ReactUWPTestAppTreeDump contents: TreeDump\** condition: succeededOrFailed() - + + - task: CopyFiles@2 + displayName: Copy tree dump screenshots + inputs: + sourceFolder: $(Build.SourcesDirectory)\packages\E2ETest\errorShots + targetFolder: $(Build.StagingDirectory)/ReactUWPTestAppTreeDump + condition: succeededOrFailed() + + - task: PowerShell@2 + displayName: "MSInfo32" + inputs: + targetType: "inline" + script: "Start-Process msinfo32 -ArgumentList '/report $(Build.StagingDirectory)\\ReactUWPTestAppTreeDump\\msinfo32.txt' -Wait" + condition: failed() + + - task: PowerShell@2 + displayName: "Get-ShellScaling" + inputs: + targetType: "inline" + script: ". $(Build.SourcesDirectory)\\.ado\\Get-ShellScaling.ps1 > $(Build.StagingDirectory)\\ReactUWPTestAppTreeDump\\scaleFactor.txt" + condition: failed() + - task: PublishBuildArtifacts@1 displayName: "Publish Artifact:ReactUWPTestAppTreeDump" inputs: diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index 500e00e3f74..d6a92173390 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -65,7 +65,7 @@ steps: inputs: artifactName: TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} downloadPath: $(System.DefaultWorkingDirectory) - condition: eq('true', ${{ parameters.experimentalNugetDependency }}) + condition: and(succeeded(), eq('true', ${{ parameters.experimentalNugetDependency }})) - task: CmdLine@2 displayName: Init new project @@ -84,14 +84,20 @@ steps: inputs: targetType: inline script: | - Install-Package Microsoft.ReactNative -Source $(System.DefaultWorkingDirectory)/TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} -Destination $(Agent.BuildDirectory)\testcli\windows\packages - condition: eq('true', ${{ parameters.experimentalNugetDependency }}) - - - task: NuGetCommand@2 - displayName: NuGet restore testcli - inputs: - command: restore - restoreSolution: $(Agent.BuildDirectory)\testcli\windows\testcli.sln + Install-Package Microsoft.ReactNative -Source $(System.DefaultWorkingDirectory)/TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} -Destination $(Agent.BuildDirectory)\testcli\localNugets + $xml = [xml](gc $(Agent.BuildDirectory)\testcli\windows\Nuget.Config) + $newSource = $xml.CreateElement("add"); + $keyAttr = $xml.CreateAttribute("key"); + $keyAttr.Value ="PrPublish"; + $valueAttr = $xml.CreateAttribute("value"); + $valueAttr.Value ="$(Agent.BuildDirectory)\testcli\localNugets"; + $newSource.Attributes.Append($keyAttr); + $newSource.Attributes.Append($valueAttr); + $packageSources = $xml.ChildNodes.Item(1).packageSources; + $packageSources.InsertBefore($newSource, $packageSources.FirstChild); + $xml.save("$(Agent.BuildDirectory)\testcli\windows\Nuget.Config"); + + condition: and(succeeded(), eq('true', ${{ parameters.experimentalNugetDependency }})) - template: install-SDK.yml parameters: @@ -114,34 +120,26 @@ steps: -Cleanup:$true condition: and(succeeded(), ${{ parameters.installVsComponents }}) - - task: VSBuild@1 - displayName: VSBuild - testcli + # Work around issue of parameters not getting expanded in conditions properly + - powershell: | + Write-Host "##vso[task.setvariable variable=localConfig]${{ parameters.configuration}}" + + - task: CmdLine@2 + displayName: Build project (Release) inputs: - solution: $(Agent.BuildDirectory)\testcli\windows\testcli.sln - vsVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 - msbuildArchitecture: $(MSBuildArchitecture) # Optional. Options: x86, x64 - platform: ${{ parameters.platform }} # Optional - configuration: ${{ parameters.configuration }} # Optional - clean: false # Optional - maximumCpuCount: false # Optional - restoreNugetPackages: false # Optional - createLogFile: true - logFileVerbosity: detailed - msbuildArgs: - /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) - /p:PlatformToolset=$(MSBuildPlatformToolset) - /p:AppxGeneratePrisForPortableLibrariesEnabled=false - - - task: PublishBuildArtifacts@1 - condition: succeededOrFailed() - timeoutInMinutes: 10 + script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --logging --release + workingDirectory: $(Agent.BuildDirectory)\testcli + condition: and(succeeded(), eq('Release', variables['localConfig'])) + + - task: CmdLine@2 + displayName: Build project (Debug) inputs: - pathtoPublish: $(Agent.BuildDirectory)/testcli/windows/testcli.sln.log - artifactName: Detailed Logs for testcli.sln ${{ parameters.platform }} ${{ parameters.configuration }} ${{ parameters.experimentalNugetDependency }} - publishLocation: 'Container' + script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --logging + workingDirectory: $(Agent.BuildDirectory)\testcli + condition: and(succeeded(), eq('Debug', variables['localConfig'])) - task: CmdLine@2 displayName: Create bundle testcli inputs: - script: react-native bundle --entry-file index.js platform windows --bundle-output test.bundle + script: npx --no-install react-native bundle --entry-file index.js --platform windows --bundle-output test.bundle workingDirectory: $(Agent.BuildDirectory)\testcli diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index b425c0dffbd..c38b149984a 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -11,7 +11,7 @@ variables: - template: variables/msbuild.yml - template: variables/vs2019.yml - name: reactNativeVersion - value: 0.61.5 + value: 0.62.2 jobs: - job: Setup @@ -259,21 +259,21 @@ jobs: - task: CmdLine@2 displayName: run-windows (Debug) inputs: - script: react-native run-windows --no-packager --no-launch --no-deploy --arch $(BuildPlatform) --logging --msbuildprops BaseIntDir=$(BaseIntDir) + script: yarn windows --no-packager --no-launch --no-deploy --arch $(BuildPlatform) --logging --msbuildprops BaseIntDir=$(BaseIntDir) workingDirectory: packages/microsoft-reactnative-sampleapps condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Debug')) - task: CmdLine@2 displayName: run-windows (Release) inputs: - script: react-native run-windows --no-packager --no-launch --no-deploy --arch $(BuildPlatform) --logging --release --msbuildprops BaseIntDir=$(BaseIntDir) + script: yarn windows --no-packager --no-launch --no-deploy --arch $(BuildPlatform) --logging --release --msbuildprops BaseIntDir=$(BaseIntDir) workingDirectory: packages/microsoft-reactnative-sampleapps condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Release')) - task: CmdLine@2 displayName: Create SampleApp bundle inputs: - script: node node_modules/react-native/local-cli/cli.js bundle --entry-file index.windows.js --bundle-output SampleApp.bundle + script: yarn bundle-cpp workingDirectory: packages\microsoft-reactnative-sampleapps condition: succeeded() diff --git a/.gitignore b/.gitignore index 2dfa77403f6..780d8dd9321 100644 --- a/.gitignore +++ b/.gitignore @@ -155,4 +155,5 @@ bld/ # OpenCover *_coverage.xml -tsdoc-metadata.json \ No newline at end of file +tsdoc-metadata.json +*.dmp diff --git a/README.md b/README.md index 58325c7abdb..cbc480fc7b1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

React Native for Windows

+

React Native for Windows

Build native Windows apps with React. @@ -18,84 +18,52 @@ ![Hero Image with Logo](./.github/hero2.png) -[React Native](https://reactnative.dev) enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and [React](https://reactjs.org/). The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere. Facebook uses React Native in multiple production apps and will continue investing in React Native. +> See the official [React Native website](https://reactnative.dev/) for an introduction to React Native. + +[React Native](https://reactnative.dev) is a framework developed by Facebook that enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and [React](https://reactjs.org/). The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere. This repository adds support for the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads), which allows you to build apps for [all devices supported by Windows 10](https://developer.microsoft.com/en-us/windows/get-started-windows-10) including PCs, tablets, 2-in-1s, Xbox, Mixed reality devices etc. ## Status and roadmap - -We are in the process of re-implementing react-native-windows in C++, for better performance, and to better align with the shared C++ react-native core as it evolves. Please see the [Roadmap 2019](https://microsoft.github.io/react-native-windows/blog/2019/07/22/roadmap) blog for details on this effort and investment roadmap for the upcoming months. - -Please see the [July 2019 Updates Blog](https://microsoft.github.io/react-native-windows/blog/2019/07/21/updates) for all the latest updates! - -## Quick Links - -- [Getting Started](#getting-started) -- [Getting Help](#getting-help) -- [Documentation](#documentation) -- [Examples](#examples) -- [Extending React Native](#extending-react-native) -- [Opening Issues](#opening-issues) -- [Contributing](#contributing) -- [License](#license) -- [Code of Conduct](#code-of-conduct) - -## Introduction - -See the official [React Native website](https://reactnative.dev/) for an introduction to React Native. +[Check out our blog](https://microsoft.github.io/react-native-windows/blog/) If you'd like to stay up to date on the status of React Native for Windows and check out current and past roadmaps, We will post all new releases, updates and general news about the project there. ## System Requirements -- You can run React Native Windows UWP apps only on Windows 10 devices - - React Native Windows currently supports Windows 10 SDK >= [15063](https://developer.microsoft.com/en-us/windows/downloads/sdk-archive). See [Windows 10 Compatibility](https://microsoft.github.io/react-native-windows/docs/win10-compat) for version support details. -- Download [Visual Studio 2017 Community or Greater](https://www.visualstudio.com/downloads/). (Visual Studio 2015 support has been deprecated.) - - You will need to start Visual Studio after it is installed to do some final setup before it can be used to build or run your React Native Windows application +You can run React Native Windows UWP apps only on Windows 10 devices. -*Note*: Development on React Native Windows itself currently requires Visual Studio 2017 or higher. It is not currently supported with VS Code, but work is ongoing as tracked [here](https://github.com/microsoft/vscode-react-native/issues/1007). - -## Getting Started - -Want to develop a React Native Windows app? Head over to our [Getting Started Guide](https://microsoft.github.io/react-native-windows/docs/getting-started). - -## Getting Help - -- Chat with us on [Reactiflux](https://discord.gg/0ZcbPKXt5bWJVmUY) in #react-native -- If it turns out that you may have found a bug, please [open an issue](#opening-issues) +For a full and detailed list of the system requirements and how to set up your development platform, see our [System Requirements](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies) documentation on our website. ## Documentation +[React Native already has great documentation](https://reactnative.dev/docs/getting-started.html) and we're working to ensure the React Native Windows is part of that documentation story. -[React Native already has great documentation](https://reactnative.dev/docs/getting-started.html), and we're working to ensure the React Native Windows is part of that documentation story. Check out the [React documentation](https://reactjs.org/docs/getting-started.html) for further details about the React API in general. +[React Native for Windows](https://microsoft.github.io/react-native-windows/) has it's own separate documentation site where Windows and Mac specific information, like API docs and blog updates live. -For information on parity status with Android and iOS, including details on implemented and missing components and modules, along with related issues for missing features from partial implementations, go [here](https://microsoft.github.io/react-native-windows/docs/parity-status). +## Get Started +See the [Getting Started Guide](https://microsoft.github.io/react-native-windows/docs/getting-started) on our React Native for Windows website. -## Extending React Native +## Need Help? -- Looking for a component? [JS.coach](https://js.coach/react-native) -- Fellow developers write and publish React Native modules to npm and open source them on GitHub. -- Third party modules may be missing Windows support, so reach out to the project owners directly. -- Making modules helps grow the React Native ecosystem and community. We recommend writing modules for your use cases and sharing them on npm. -- You should almost never need to modify or fork React Native Windows itself (the ReactNative and ReactNative.Shared project/sources) to create custom controls. The extension points should already exist to do just about anything! -- Read the guides on [Native Modules for Windows](https://microsoft.github.io/react-native-windows/docs/native-modules). +Come join us and chat on the [Reactiflux](https://discord.gg/0ZcbPKXt5bWJVmUY) Discord server under in **#react-native** -## Opening Issues +If it turns out that you may have found a bug, we would like to hear about it! -If you encounter a bug with the React Native Windows plugin, we would like to hear about it. Search the [existing issues](https://github.com/microsoft/react-native-windows/issues) and try to make sure your problem doesn’t already exist before opening a new issue. It’s helpful if you include the version of Windows, React Native, React Native Windows plugin, and device family (i.e., mobile, desktop, Xbox, etc.) you’re using. Please include a stack trace and reduced repro case when appropriate, too. +### Logging Issues +Search the [existing issues](https://github.com/microsoft/react-native-windows/issues) and try to make sure your problem doesn’t already exist before opening a new issue. If your issue doesn't exist yet, try to make sure you provide as much information as possible to us so we can help you sooner. It’s helpful if you include information like: -Please use the [appropriate template](https://github.com/microsoft/react-native-windows/issues/new/choose) to file your issues. +- The version of Windows, React Native, React Native Windows plugin, and device family (i.e., mobile, desktop, Xbox, etc.) where you ran into the issue. +- A stack trace and reduced repro case when possible. +- Ensure the [appropriate template](https://github.com/microsoft/react-native-windows/issues/new/choose) is used when filing your issue(s). -The GitHub issues are intended for bug reports and feature requests. For help and questions with using the React Native Windows plugin please make use of the resources listed in the [Getting Help](#getting-help) section. +The GitHub issues are intended for bug reports and feature requests. For help and questions with using the React Native Windows plugin please make use of the resources listed our main README's the [Getting Help](https://github.com/microsoft/react-native-windows#getting-help) section. ## Contributing - -Make sure to install the [system requirements](#system-requirements). If you just want to get started with developing your own app, read [Getting Started with App Development](#getting-started). You only need to interact with `npm` to use for your app development. - -For more information about contributing PRs, see [Contribution Guidelines for react-native-windows](docs/contributing.md) +See [Contributing guidelines](./docs/contributing.md) for how to setup your fork of the repo and start a PR to contribute to React Native for Windows. [Good First Task](https://github.com/microsoft/react-native-windows/labels/Good%20First%20Task) and [help wanted](https://github.com/microsoft/react-native-windows/labels/help%20wanted) are great starting points for PRs. ### Examples -- Using the CLI in the [Getting Started](#getting-started) sections will set you up with a sample React-Native-Windows app that you can begin editing. +- Using the CLI in the [Getting Started](https://microsoft.github.io/react-native-windows/docs/getting-started) guide will set you up with a sample React Native for Windows app that you can begin editing right away. - If you're looking for sample code, just browse the RNTester folder in the GitHub web UI ## License diff --git a/docs/api/react-native-windows.apptheme.md b/docs/api/react-native-windows.apptheme.md index 60807d1aed2..43ffc937963 100644 --- a/docs/api/react-native-windows.apptheme.md +++ b/docs/api/react-native-windows.apptheme.md @@ -7,5 +7,5 @@ Signature: ```typescript -AppTheme: AppThemeModule +AppTheme: AppThemeModule | MissingNativeAppThemeShim ``` diff --git a/docs/e2e-testing.md b/docs/e2e-testing.md index cd4612b2685..83407a939a9 100644 --- a/docs/e2e-testing.md +++ b/docs/e2e-testing.md @@ -18,7 +18,7 @@ E2E test app, test library and test cases are in packages/E2ETest/, and they are # Run E2E test -- Make sure you have installed [dependencies](./GettingStarted.md#dependencies) +- Make sure you have installed [dependencies](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies) ## Procedures to setup and run E2E test diff --git a/package.json b/package.json index bb27e517de6..5974c76d111 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,6 @@ "test": "lerna run test --stream -- --color", "validate-overrides": "lerna run validate-overrides --stream -- --color" }, - "husky": { - "hooks": { - "pre-commit": "yarn format" - } - }, "repository": { "type": "git", "url": "git@github.com:microsoft/react-native-windows.git" @@ -33,7 +28,6 @@ }, "devDependencies": { "beachball": "^1.13.4", - "husky": "^3.0.9", "lerna": "^3.16.1" }, "resolutions": { diff --git a/packages/E2ETest/app/ControlStyleTestPage.tsx b/packages/E2ETest/app/ControlStyleTestPage.tsx index 62686dcf729..9e91fd263ba 100644 --- a/packages/E2ETest/app/ControlStyleTestPage.tsx +++ b/packages/E2ETest/app/ControlStyleTestPage.tsx @@ -3,7 +3,8 @@ * Licensed under the MIT License. */ -import { Switch, CheckBox, TextInput, View, StyleSheet, Button } from 'react-native'; + // Bug:4596 Switch +import { /* Switch, */ CheckBox, TextInput, View, StyleSheet, Button } from 'react-native'; import { DatePicker, Picker } from 'react-native-windows'; import React, { useState } from 'react'; import { SHOWBORDER_ON_CONTROLSTYLE, TREE_DUMP_RESULT } from './Consts'; @@ -56,7 +57,11 @@ export function ControlStyleTestPage() { return ( - + { + /* + // Bug:4596 Switch + + */} { - var previousState = passwordHidden; - setPasswordHidden(!previousState); - } + var previousState = passwordHidden; + setPasswordHidden(!previousState); + }; const onPress = () => { if (userName === 'username' && password === 'password') { @@ -49,29 +62,42 @@ export function LoginTestPage() { }; return ( - { setUserName(text.nativeEvent.text) }} /> + onChange={text => { + setUserName(text.nativeEvent.text); + }} + /> - { setPassword(text.nativeEvent.text) }} /> + placeholderTextColor="rgba(225,225,225,0.7)" + secureTextEntry={passwordHidden} + onChange={text => { + setPassword(text.nativeEvent.text); + }} + /> -