Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7834106
Add support for React Native BackHandler API on Windows (#4623)
DrewHiggins Apr 17, 2020
18d54be
applying package updates ***NO_CI***
rnbot Apr 18, 2020
52bf969
Fix include paths (#4634)
kmelmon Apr 18, 2020
6dae6e7
applying package updates ***NO_CI***
rnbot Apr 19, 2020
97a2fda
Remove break for 4122 and reenable DManip test (#4636)
asklar Apr 19, 2020
8a730a1
Bump io-ts from 2.2.0 to 2.2.1 (#4644)
dependabot-preview[bot] Apr 20, 2020
854fd9d
Bump @types/lodash from 4.14.149 to 4.14.150 (#4642)
dependabot-preview[bot] Apr 20, 2020
5c98e23
Release bundle builds should have --dev false flag (#4603)
acoates-ms Apr 21, 2020
a34e216
react-native-windows-init should support npm tags for --version param…
acoates-ms Apr 21, 2020
21dea64
Implemented C++ TurboModule compile time spec validation (#4656)
vmoroz Apr 21, 2020
94f2b3f
Bump beachball from 1.29.1 to 1.30.2 (#4658)
dependabot-preview[bot] Apr 21, 2020
c779043
Opening the devmenu should attempt to connect to dev tools (#4660)
acoates-ms Apr 21, 2020
3eece7f
applying package updates ***NO_CI***
rnbot Apr 22, 2020
16a4ede
Handle syntax errors in RedBox (#4666)
asklar Apr 22, 2020
2fad67b
Hitting 'r' in the packager should reload the instance (#4665)
acoates-ms Apr 22, 2020
b35cc97
Microsoft.ReactNative Nuget only contains debug bits (#4674)
acoates-ms Apr 22, 2020
dcccb2c
Create initial codegen for creating TurboModuleSpec's from JS Spec fi…
acoates-ms Apr 22, 2020
509b9e5
Implement String ViewManager Command IDs (#4667)
NickGerleman Apr 22, 2020
a57ded1
applying package updates ***NO_CI***
rnbot Apr 23, 2020
cf58dd6
Add DevMode in bug template (#4685)
asklar Apr 23, 2020
b797774
Fixup direction == 'rtl' (#4683)
kmelmon Apr 23, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ assignees: ''
If you are using latest version:
1. `react-native -v`:
2. `react-native run-windows --info`:
3. `reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"`

Otherwise if `--info` doesn't exist:
1. `react-native -v`:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "prerelease",
"comment": "remove AccessibilityStates",
"comment": "fix RTL",
"packageName": "react-native-windows",
"email": "kmelmon@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-04-17T00:40:26.842Z"
"date": "2020-04-22T23:22:32.344Z"
}
2 changes: 1 addition & 1 deletion packages/E2ETest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"prompt-sync": "^4.2.0",
"react": "16.9.0",
"react-native": "0.62.2",
"react-native-windows": "0.0.0-master.42",
"react-native-windows": "0.0.0-master.46",
"rnpm-plugin-windows": "^0.6.1"
},
"devDependencies": {
Expand Down
5 changes: 1 addition & 4 deletions packages/E2ETest/wdio/test/DirectManipulation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ describe('DirectManipulationTest', () => {
result.includes('width=50'),
'measureLayout response has correct width'
);
// https://github.com/microsoft/react-native-windows/issues/4122
// Un-comment this when bug 4122 is fixed
// E2ETEST_OVERRIDE_4122
// assert.ok(result.includes('x=20;'), 'measureLayout response x=20');
assert.ok(result.includes('x=20;'), 'measureLayout response x=20');
});
});
6 changes: 0 additions & 6 deletions packages/E2ETest/windows/ReactUWPTestApp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
base.OnLaunched(e);
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
ApplicationView.GetForCurrentView().TryResizeView(new Size(800, 600));
#if !E2ETEST_OVERRIDE_4122
#error [E2ETest] - There is a bug in Yoga with v142/VS2019 that makes the masters for this app different in Release|x64 than in other platforms.
#error However we want to test what people will be shipping. As a result, the tree dump output won't match the masters (which have the bug).
#error You can disable this warning by defining the constant E2ETEST_OVERRIDE_4122 in the project properties page under "Define Constants"
#error For more information see https://github.com/microsoft/react-native-windows/issues/4122
#endif
if (DisplayInformation.GetForCurrentView().ResolutionScale != ResolutionScale.Scale100Percent)
{
throw new Exception("A bug requires this app to run at 100% for accurate results - See https://github.com/microsoft/react-native-windows/issues/4619");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;E2ETEST_OVERRIDE_4122</DefineConstants>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
Expand Down Expand Up @@ -174,11 +174,9 @@
<VisualStudioVersion>16.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.props" />
<PropertyGroup>
<BundleCommand>
echo WorkingDir %CD%
npx --no-install yarn run bundle
</BundleCommand>
<BundleEntryFile>dist/app/index.js</BundleEntryFile>
</PropertyGroup>
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version>
<Version>6.2.10</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
32 changes: 32 additions & 0 deletions packages/microsoft-reactnative-sampleapps/NativeMyModule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* @flow
* @format
*/

'use strict';

import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
// Exported methods.
+getConstants: () => {|
const1: boolean,
const2: number,
const3: string,
|};
+voidFunc: () => void;
+getBool: (arg: boolean) => boolean;
+getNumber: (arg: number) => number;
+getString: (arg: string) => string;
+getArray: (arg: Array<any>) => Array<any>;
+getObject: (arg: Object) => Object;
+getValue: (x: number, y: string, z: Object) => Object;
+getValueWithCallback: (callback: (value: string) => void) => void;
+getValueWithPromise: (error: boolean) => Promise<string>;
}

export default (TurboModuleRegistry.getEnforcing<Spec>('MyModule'): Spec);
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

/**
* This file is auto-generated from a NativeModule spec file in js.
*/

#pragma once

#include "NativeModules.h"
#include <tuple>

namespace SampleLibraryCpp {

/*
* This is a C++ Spec class that should be used with MakeTurboModuleProvider to register native modules
* in a way that also verifies at compile time that the native module matches the interface required
* by the TurboModule JS spec.
*/
struct MyModuleSpec : winrt::Microsoft::ReactNative::TurboModuleSpec {
static constexpr auto methods = std::tuple{
Method<void() noexcept>{0, L"voidFunc"},
SyncMethod<bool(bool) noexcept>{1, L"getBool"},
SyncMethod<double(double) noexcept>{2, L"getNumber"},
SyncMethod<std::string(std::string) noexcept>{3, L"getString"},
SyncMethod<JSValueArray(JSValueArray) noexcept>{4, L"getArray"},
SyncMethod<JSValueObject(JSValueObject) noexcept>{5, L"getObject"},
SyncMethod<JSValueObject(double,std::string,JSValueObject) noexcept>{6, L"getValue"},
Method<void(Callback<JSValue>) noexcept>{7, L"getValueWithCallback"},
Method<void(bool,Promise<JSValue>) noexcept>{8, L"getValueWithPromise"},
};

template <class TModule>
static constexpr void ValidateModule() noexcept {
constexpr auto methodCheckResults = CheckMethods<TModule, MyModuleSpec>();

REACT_SHOW_METHOD_SPEC_ERRORS(
0,
"voidFunc",
" REACT_METHOD(voidFunc) void voidFunc() noexcept { /* implementation */ }}",
" REACT_METHOD(voidFunc) static void voidFunc() noexcept { /* implementation */ }}");
REACT_SHOW_METHOD_SPEC_ERRORS(
1,
"getBool",
" REACT_SYNC_METHOD(getBool) bool getBool(bool arg) noexcept { /* implementation */ }}",
" REACT_SYNC_METHOD(getBool) static bool getBool(bool arg) noexcept { /* implementation */ }}");
REACT_SHOW_METHOD_SPEC_ERRORS(
2,
"getNumber",
" REACT_SYNC_METHOD(getNumber) double getNumber(double arg) noexcept { /* implementation */ }}",
" REACT_SYNC_METHOD(getNumber) static double getNumber(double arg) noexcept { /* implementation */ }}");
REACT_SHOW_METHOD_SPEC_ERRORS(
3,
"getString",
" REACT_SYNC_METHOD(getString) std::string getString(std::string arg) noexcept { /* implementation */ }}",
" REACT_SYNC_METHOD(getString) static std::string getString(std::string arg) noexcept { /* implementation */ }}");
REACT_SHOW_METHOD_SPEC_ERRORS(
4,
"getArray",
" REACT_SYNC_METHOD(getArray) React::JSValueArray getArray(React::JSValueArray && arg) noexcept { /* implementation */ }}",
" REACT_SYNC_METHOD(getArray) static React::JSValueArray getArray(React::JSValueArray && arg) noexcept { /* implementation */ }}");
REACT_SHOW_METHOD_SPEC_ERRORS(
5,
"getObject",
" REACT_SYNC_METHOD(getObject) React::JSValueObject getObject(React::JSValueObject && arg) noexcept { /* implementation */ }}",
" REACT_SYNC_METHOD(getObject) static React::JSValueObject getObject(React::JSValueObject && arg) noexcept { /* implementation */ }}");
REACT_SHOW_METHOD_SPEC_ERRORS(
6,
"getValue",
" REACT_SYNC_METHOD(getValue) React::JSValueObject getValue(double x, std::string y, React::JSValueObject && z) noexcept { /* implementation */ }}",
" REACT_SYNC_METHOD(getValue) static React::JSValueObject getValue(double x, std::string y, React::JSValueObject && z) noexcept { /* implementation */ }}");
REACT_SHOW_METHOD_SPEC_ERRORS(
7,
"getValueWithCallback",
" REACT_METHOD(getValueWithCallback) void getValueWithCallback(std::function<void(React::JSValue const &)> const & callback) noexcept { /* implementation */ }}",
" REACT_METHOD(getValueWithCallback) static void getValueWithCallback(std::function<void(React::JSValue const &)> const & callback) noexcept { /* implementation */ }}");
REACT_SHOW_METHOD_SPEC_ERRORS(
8,
"getValueWithPromise",
" REACT_METHOD(getValueWithPromise) void getValueWithPromise(bool error, React::ReactPromise<React::JSValue> &&result) noexcept { /* implementation */ }}",
" REACT_METHOD(getValueWithPromise) static void getValueWithPromise(bool error, React::ReactPromise<React::JSValue> &&result) noexcept { /* implementation */ }}");
}
};

} // namespace SampleLibraryCpp
4 changes: 4 additions & 0 deletions packages/microsoft-reactnative-sampleapps/index.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { NativeModules, NativeEventEmitter } from 'react-native';

import {MyComp} from './myComp';

import {default as MyModule} from './NativeMyModule';

// Creating event emitters
const SampleModuleCSEmitter = new NativeEventEmitter(NativeModules.SampleModuleCS);
const SampleModuleCppEmitter = new NativeEventEmitter(NativeModules.SampleModuleCpp);
Expand Down Expand Up @@ -278,6 +280,8 @@ class SampleApp extends Component {
This app consumes custom Native Modules and View Managers.
</Text>

<Button onPress={() => { MyModule.voidFunc(); }} title="Call MyModule tests"/>

<Button onPress={() => { this.onPressSampleModuleCS(); }} title="Call SampleModuleCS!" disabled={NativeModules.SampleModuleCS == null} />
<Button onPress={() => { this.onPressSampleModuleCpp(); }} title="Call SampleModuleCpp!" disabled={NativeModules.SampleModuleCpp == null} />

Expand Down
10 changes: 9 additions & 1 deletion packages/microsoft-reactnative-sampleapps/just-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
const {
task,
series,
parallel,
option,
argv,
tscTask,
eslintTask,
} = require('just-scripts');
const fs = require('fs');
const path = require('path');
const {execSync} = require('child_process');

option('production');
option('clean');
Expand All @@ -36,6 +38,12 @@ task('ts', () => {
});
});

task('codegen', () => {
execSync(
'npx react-native-windows-codegen --file NativeMyModule.js --namespace SampleLibraryCpp',
);
});

function ensureDirectoryExists(filePath) {
const dir = path.dirname(filePath);
if (!fs.existsSync(dir)) {
Expand All @@ -49,6 +57,6 @@ task('prepareBundle', () => {
ensureDirectoryExists('windows/SampleAppCPP/Bundle');
});

task('build', series('ts'));
task('build', parallel('ts', 'codegen'));
task('lint', series('eslint'));
task('lint:fix', series('eslint:fix'));
3 changes: 2 additions & 1 deletion packages/microsoft-reactnative-sampleapps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"react": "16.9.0",
"react-native": "0.62.2",
"react-native-windows": "0.0.0-master.42",
"react-native-windows": "0.0.0-master.46",
"rnpm-plugin-windows": "^0.6.1"
},
"devDependencies": {
Expand All @@ -26,6 +26,7 @@
"@types/react-native": "^0.62.2",
"just-scripts": "^0.36.1",
"metro-react-native-babel-preset": "^0.56.0",
"react-native-windows-codegen": "0.0.2",
"react-test-renderer": "16.9.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<PropertyGroup>
<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
</PropertyGroup>
<Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
Expand Down Expand Up @@ -198,11 +197,7 @@
<Import Project="..\packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets')" />
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<PropertyGroup>
<BundleCommand>
npx --no-install yarn run bundle-cpp
</BundleCommand>
</PropertyGroup>
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.props" />
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.Cpp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,9 @@
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '16.0' ">
<VisualStudioVersion>16.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup>
<BundleCommand>
npx --no-install yarn run bundle-cs
</BundleCommand>
</PropertyGroup>
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.props" />
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,18 @@ void CustomUserControlViewManagerCpp::UpdateProperties(
}

// IViewManagerWithCommands
IMapView<hstring, int64_t> CustomUserControlViewManagerCpp::Commands() noexcept {
auto commands = winrt::single_threaded_map<hstring, int64_t>();
commands.Insert(L"CustomCommand", 0);
IVectorView<hstring> CustomUserControlViewManagerCpp::Commands() noexcept {
auto commands = winrt::single_threaded_vector<hstring>();
commands.Append(L"CustomCommand");
return commands.GetView();
}

void CustomUserControlViewManagerCpp::DispatchCommand(
FrameworkElement const &view,
int64_t commandId,
winrt::hstring const &commandId,
IJSValueReader const &commandArgsReader) noexcept {
if (auto control = view.try_as<winrt::SampleLibraryCpp::CustomUserControlCpp>()) {
if (commandId == 0) {
if (commandId == L"CustomCommand") {
std::string arg = std::to_string(winrt::unbox_value<int64_t>(view.Tag()));
arg.append(", \"");
arg.append(winrt::to_string(commandArgsReader.GetString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ struct CustomUserControlViewManagerCpp
winrt::Microsoft::ReactNative::IJSValueReader const &propertyMapReader) noexcept;

// IViewManagerWithCommands
winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, int64_t> Commands() noexcept;
winrt::Windows::Foundation::Collections::IVectorView<winrt::hstring> Commands() noexcept;

void DispatchCommand(
winrt::Windows::UI::Xaml::FrameworkElement const &view,
int64_t commandId,
winrt::hstring const &commandId,
winrt::Microsoft::ReactNative::IJSValueReader const &commandArgsReader) noexcept;

// IViewManagerWithExportedEventTypeConstants
Expand Down
Loading