From afac01c952bad1b0aec6b15fe041bf1e6e14f2c8 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Mon, 10 Aug 2020 19:54:27 -0700 Subject: [PATCH 01/12] Progress --- packages/E2ETest/package.json | 2 +- .../package.json | 2 +- packages/playground/package.json | 2 +- packages/react-native-win32/.flowconfig | 2 +- packages/react-native-win32/overrides.json | 78 ++++---- packages/react-native-win32/package.json | 6 +- .../Libraries/StyleSheet/StyleSheet.win32.js | 10 + .../react-native-win32/src/index.win32.js | 32 ++-- vnext/.flowconfig | 2 +- .../IntegrationTests/AsyncStorageTest.js | 5 +- .../RNTester/js/components/RNTesterTheme.js | 2 +- .../js/examples/CheckBox/CheckBoxExample.js | 148 --------------- .../examples/Layout/LayoutAnimationExample.js | 177 ++++++++++++++++-- .../PlatformColor/PlatformColorExample.js | 137 ++++++-------- .../js/examples/Pressable/PressableExample.js | 56 +++--- .../TurboModule/SampleTurboModuleExample.js | 5 + .../RNTester/js/examples/View/ViewExample.js | 49 ++++- .../js/examples/XHR/XHRExampleDownload.js | 8 +- .../RNTester/js/utils/RNTesterList.android.js | 4 - vnext/codegen/NativeSampleTurboModuleSpec.g.h | 16 +- vnext/overrides.json | 124 ++++++------ vnext/package.json | 6 +- .../Libraries/Components/Button.windows.js | 2 +- .../Components/Picker/Picker.windows.js | 2 +- .../RefreshControl/RefreshControl.windows.js | 2 +- .../Touchable/TouchableHighlight.windows.js | 2 +- .../js/examples/View/ViewExample.windows.js | 49 ++++- vnext/src/index.windows.js | 32 ++-- yarn.lock | 128 +++++++++++-- 29 files changed, 634 insertions(+), 456 deletions(-) delete mode 100644 vnext/ReactCopies/RNTester/js/examples/CheckBox/CheckBoxExample.js diff --git a/packages/E2ETest/package.json b/packages/E2ETest/package.json index 706d7c3cb58..32755e65b0f 100644 --- a/packages/E2ETest/package.json +++ b/packages/E2ETest/package.json @@ -24,7 +24,7 @@ "dependencies": { "prompt-sync": "^4.2.0", "react": "16.13.1", - "react-native": "0.0.0-4a48b021d", + "react-native": "0.0.0-2c473e1a3", "react-native-windows": "0.0.0-canary.136" }, "devDependencies": { diff --git a/packages/microsoft-reactnative-sampleapps/package.json b/packages/microsoft-reactnative-sampleapps/package.json index 6592367be65..ba96d0b96c0 100644 --- a/packages/microsoft-reactnative-sampleapps/package.json +++ b/packages/microsoft-reactnative-sampleapps/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "react": "16.13.1", - "react-native": "0.0.0-4a48b021d", + "react-native": "0.0.0-2c473e1a3", "react-native-windows": "0.0.0-canary.136" }, "devDependencies": { diff --git a/packages/playground/package.json b/packages/playground/package.json index d43d8e0fd48..74b36852cc4 100644 --- a/packages/playground/package.json +++ b/packages/playground/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "react": "16.13.1", - "react-native": "0.0.0-4a48b021d", + "react-native": "0.0.0-2c473e1a3", "react-native-windows": "0.0.0-canary.136" }, "devDependencies": { diff --git a/packages/react-native-win32/.flowconfig b/packages/react-native-win32/.flowconfig index 869b94d18c2..42f0f24db70 100644 --- a/packages/react-native-win32/.flowconfig +++ b/packages/react-native-win32/.flowconfig @@ -127,4 +127,4 @@ untyped-import untyped-type-import [version] -^0.122.0 +^0.123.0 diff --git a/packages/react-native-win32/overrides.json b/packages/react-native-win32/overrides.json index 00d57c56622..385ede3b6d0 100644 --- a/packages/react-native-win32/overrides.json +++ b/packages/react-native-win32/overrides.json @@ -8,22 +8,22 @@ "type": "derived", "file": ".flowconfig", "baseFile": ".flowconfig", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "a01a99335388562d23fb0c43a98b6b2bb780835c" + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "3210a076de8ff5c698de48d8af444b2677270ca6" }, { "type": "derived", "file": "src/index.win32.js", "baseFile": "index.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "7fa1b7cdc28ea57c2b1cf6085a1b1c53a530b30f", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "27967b6f36e9bc2bc3f4ac79c1320b7152d93f83", "issue": "LEGACY_FIXME" }, { "type": "patch", "file": "src/Libraries/Alert/Alert.win32.js", "baseFile": "Libraries/Alert/Alert.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "b4867752830f6953516c5898a7e2fc0dc796dcfa", "issue": "LEGACY_FIXME" }, @@ -31,7 +31,7 @@ "type": "derived", "file": "src/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js", "baseFile": "Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "611e89285ac812456b381568052cf575c955575a", "issue": "LEGACY_FIXME" }, @@ -39,7 +39,7 @@ "type": "patch", "file": "src/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.win32.js", "baseFile": "Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "b3e2c37d96de6f00066495267f7c32d6e9d3f840", "issue": "LEGACY_FIXME" }, @@ -63,7 +63,7 @@ "type": "copy", "file": "src/Libraries/Components/DatePicker/DatePickerIOS.win32.js", "baseFile": "Libraries/Components/DatePicker/DatePickerIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "218895e2a5f3d7614a2cb577da187800857850ea", "issue": 4378 }, @@ -71,7 +71,7 @@ "type": "copy", "file": "src/Libraries/Components/DatePickerAndroid/DatePickerAndroid.win32.js", "baseFile": "Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "09d82215c57ca5873a53523a63006daebf07ffbc", "issue": 4378 }, @@ -79,7 +79,7 @@ "type": "copy", "file": "src/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js", "baseFile": "Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a", "issue": 4378 }, @@ -91,7 +91,7 @@ "type": "copy", "file": "src/Libraries/Components/MaskedView/MaskedViewIOS.win32.js", "baseFile": "Libraries/Components/MaskedView/MaskedViewIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "0b409391c852a1001cee74a84414a13c4fe88f8b", "issue": 4378 }, @@ -103,7 +103,7 @@ "type": "copy", "file": "src/Libraries/Components/Picker/PickerAndroid.js", "baseFile": "Libraries/Components/Picker/PickerAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a", "issue": 4378 }, @@ -111,7 +111,7 @@ "type": "copy", "file": "src/Libraries/Components/Picker/PickerIOS.js", "baseFile": "Libraries/Components/Picker/PickerIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "0c6bf0751e053672123cbad30d67851ba0007af6", "issue": 4378 }, @@ -119,7 +119,7 @@ "type": "copy", "file": "src/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js", "baseFile": "Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a", "issue": 4378 }, @@ -127,14 +127,14 @@ "type": "derived", "file": "src/Libraries/Components/ProgressViewIOS/ProgressViewIOS.win32.js", "baseFile": "Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "f0b35fdee6b1c9e7bfe860a9e0aefc00337ea7fd" }, { "type": "patch", "file": "src/Libraries/Components/SafeAreaView/SafeAreaView.win32.js", "baseFile": "Libraries/Components/SafeAreaView/SafeAreaView.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "59dabb86baedb0088e110f8cdeb914fa3271dfd9", "issue": "LEGACY_FIXME" }, @@ -142,7 +142,7 @@ "type": "copy", "file": "src/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.js", "baseFile": "Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "37cea8b532ea4e4335120c6f8b2d3d3548e31b18", "issue": 4378 }, @@ -174,7 +174,7 @@ "type": "patch", "file": "src/Libraries/Components/TextInput/TextInputState.win32.js", "baseFile": "Libraries/Components/TextInput/TextInputState.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "e982deb23d7ad5312ab0c09508a6d58c152b5be7", "issue": "LEGACY_FIXME" }, @@ -182,7 +182,7 @@ "type": "copy", "file": "src/Libraries/Components/ToastAndroid/ToastAndroid.win32.js", "baseFile": "Libraries/Components/ToastAndroid/ToastAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "614b7e88c38f5820656c79d64239bfb74ca308c0", "issue": 4378 }, @@ -214,7 +214,7 @@ "type": "patch", "file": "src/Libraries/Components/View/ReactNativeViewAttributes.win32.js", "baseFile": "Libraries/Components/View/ReactNativeViewAttributes.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "0825b0257e19cfef2d626f19d219256a01c54b67", "issue": "LEGACY_FIXME" }, @@ -222,7 +222,7 @@ "type": "patch", "file": "src/Libraries/Components/View/ReactNativeViewViewConfig.win32.js", "baseFile": "Libraries/Components/View/ReactNativeViewViewConfig.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "8d5d480284b4cdaf7d8d86935967370d455b7b68", "issue": "LEGACY_FIXME" }, @@ -242,7 +242,7 @@ "type": "patch", "file": "src/Libraries/core/ReactNativeVersionCheck.win32.js", "baseFile": "Libraries/core/ReactNativeVersionCheck.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "599ad6d6c8485cd453cd926cdf89f06640d439f6", "issue": 5170 }, @@ -250,7 +250,7 @@ "type": "derived", "file": "src/Libraries/Image/Image.win32.js", "baseFile": "Libraries/Image/Image.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "26acff268b815c7b3c5da0d6c9c009073b202ea8", "issue": 4320 }, @@ -262,7 +262,7 @@ "type": "derived", "file": "src/Libraries/Image/NativeImageLoaderWin32.js", "baseFile": "Libraries/Image/NativeImageLoaderIOS.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "6161ce89a0b45b24e8df69aa108af22a7b591483", "issue": 4320 }, @@ -306,7 +306,7 @@ "type": "patch", "file": "src/Libraries/Inspector/Inspector.win32.js", "baseFile": "Libraries/Inspector/Inspector.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "60aa482532caac00745f8ae8611a36c756fb5b75", "issue": "LEGACY_FIXME" }, @@ -314,7 +314,7 @@ "type": "patch", "file": "src/Libraries/Inspector/InspectorOverlay.win32.js", "baseFile": "Libraries/Inspector/InspectorOverlay.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "31687eefb91682d95abba47f8288f7c42158706e", "issue": "LEGACY_FIXME" }, @@ -322,7 +322,7 @@ "type": "derived", "file": "src/Libraries/Network/RCTNetworking.win32.js", "baseFile": "Libraries/Network/RCTNetworking.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "9ba4db01878648ef181dfd51debd821a837f56b3", "issue": 4318 }, @@ -342,7 +342,7 @@ "type": "derived", "file": "src/Libraries/Settings/Settings.win32.js", "baseFile": "Libraries/Settings/Settings.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "00604dd0ab624b3f5b80d460f48dbc3ac7ee905d", "issue": "LEGACY_FIXME" }, @@ -362,15 +362,15 @@ "type": "patch", "file": "src/Libraries/StyleSheet/StyleSheet.win32.js", "baseFile": "Libraries/StyleSheet/StyleSheet.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "073367bc043b5e7e9db6ec046da088e750d3693c", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "95ed8a2da162e168c7d740640a9d6c0fdb282c84", "issue": "LEGACY_FIXME" }, { "type": "patch", "file": "src/Libraries/StyleSheet/StyleSheetValidation.win32.js", "baseFile": "Libraries/StyleSheet/StyleSheetValidation.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "5fe7febd1eb5374745fe612030806512e9161796", "issue": 5269 }, @@ -378,7 +378,7 @@ "type": "derived", "file": "src/Libraries/Utilities/BackHandler.win32.ts", "baseFile": "Libraries/Utilities/BackHandler.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "b1633b6bb5e3dc842011b09f778626c39bf6b654", "issue": "LEGACY_FIXME" }, @@ -386,7 +386,7 @@ "type": "derived", "file": "src/Libraries/Utilities/DeviceInfo.win32.js", "baseFile": "Libraries/Utilities/DeviceInfo.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "19aa984db7404750d8b86ad1359057dfe8912b24", "issue": "LEGACY_FIXME" }, @@ -394,7 +394,7 @@ "type": "derived", "file": "src/Libraries/Utilities/Dimensions.win32.js", "baseFile": "Libraries/Utilities/Dimensions.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "6a61022dbe92a0683a82669ace739fc7ca110c7d", "issue": "LEGACY_FIXME" }, @@ -402,7 +402,7 @@ "type": "derived", "file": "src/Libraries/Utilities/NativePlatformConstantsWin.js", "baseFile": "Libraries/Utilities/NativePlatformConstantsIOS.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "168fe4a9608c0b151237122eea94d78f7b0093e5", "issue": "LEGACY_FIXME" }, @@ -410,7 +410,7 @@ "type": "derived", "file": "src/Libraries/Utilities/Platform.win32.js", "baseFile": "Libraries/Utilities/Platform.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "bcaebbe089a41de46724b00e69fcdba7e6b1ed7f", "issue": "LEGACY_FIXME" }, @@ -426,7 +426,7 @@ "type": "patch", "file": "src/RNTester/js/components/ListExampleShared.win32.js", "baseFile": "RNTester/js/components/ListExampleShared.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "d7be07e3fd8d9c1df8e23d5674ce3eb067d00865", "issue": "LEGACY_FIXME" }, @@ -434,7 +434,7 @@ "type": "patch", "file": "src/RNTester/js/components/RNTesterExampleFilter.win32.js", "baseFile": "RNTester/js/components/RNTesterExampleFilter.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "8a8182f7c36e8184b7bbfe1445263ceca622b2c1", "issue": "LEGACY_FIXME" }, @@ -446,7 +446,7 @@ "type": "derived", "file": "src/RNTester/js/RNTesterApp.win32.js", "baseFile": "RNTester/js/RNTesterApp.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "34d2517461704840a508ce1856bc3a364fb3fc7e", "issue": 4586 }, diff --git a/packages/react-native-win32/package.json b/packages/react-native-win32/package.json index 5448098fc81..a9d6f7ab761 100644 --- a/packages/react-native-win32/package.json +++ b/packages/react-native-win32/package.json @@ -61,17 +61,17 @@ "@types/react-native": "^0.62.10", "babel-eslint": "10.0.1", "eslint": "6.7.0", - "flow-bin": "^0.122.0", + "flow-bin": "^0.123.0", "jscodeshift": "^0.7.0", "just-scripts": "^0.36.1", "react": "16.13.1", - "react-native": "0.0.0-4a48b021d", + "react-native": "0.0.0-2c473e1a3", "react-native-platform-override": "^0.2.1", "typescript": "^3.8.3" }, "peerDependencies": { "react": "16.13.1", - "react-native": "0.0.0-4a48b021d" + "react-native": "0.0.0-2c473e1a3" }, "beachball": { "defaultNpmTag": "canary", diff --git a/packages/react-native-win32/src/Libraries/StyleSheet/StyleSheet.win32.js b/packages/react-native-win32/src/Libraries/StyleSheet/StyleSheet.win32.js index 8299bd88d5d..9de22471f9d 100644 --- a/packages/react-native-win32/src/Libraries/StyleSheet/StyleSheet.win32.js +++ b/packages/react-native-win32/src/Libraries/StyleSheet/StyleSheet.win32.js @@ -18,6 +18,7 @@ const Platform = require('../Utilities/Platform'); // [Win32] const flatten = require('./flattenStyle'); import type { + ____ColorValue_Internal, ____Styles_Internal, ____DangerouslyImpreciseStyle_Internal, ____DangerouslyImpreciseStyleProp_Internal, @@ -29,6 +30,15 @@ import type { ____ImageStyleProp_Internal, } from './StyleSheetTypes'; +/** + * This type should be used as the type for anything that is a color. It is + * most useful when using DynamicColorIOS which can be a string or a dynamic + * color object. + * + * type props = {backgroundColor: ColorValue}; + */ +export type ColorValue = ____ColorValue_Internal; + /** * This type should be used as the type for a prop that is passed through * to a 's `style` prop. This ensures call sites of the component diff --git a/packages/react-native-win32/src/index.win32.js b/packages/react-native-win32/src/index.win32.js index 1c9ce6c99f6..0af29a47ba7 100644 --- a/packages/react-native-win32/src/index.win32.js +++ b/packages/react-native-win32/src/index.win32.js @@ -13,7 +13,6 @@ import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo'; import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator'; import typeof Button from './Libraries/Components/Button'; -import typeof CheckBox from './Libraries/Components/CheckBox/CheckBox'; import typeof DatePickerIOS from './Libraries/Components/DatePicker/DatePickerIOS'; import typeof DrawerLayoutAndroid from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid'; import typeof FlatList from './Libraries/Lists/FlatList'; @@ -96,8 +95,7 @@ import typeof Platform from './Libraries/Utilities/Platform'; import typeof processColor from './Libraries/StyleSheet/processColor'; import typeof {PlatformColor} from './Libraries/StyleSheet/PlatformColorValueTypes'; import typeof {DynamicColorIOS} from './Libraries/StyleSheet/PlatformColorValueTypesIOS'; -import typeof {ColorAndroid} from './Libraries/StyleSheet/PlatformColorValueTypesAndroid'; -import typeof RootTagContext from './Libraries/ReactNative/RootTagContext'; +import typeof {RootTagContext} from './Libraries/ReactNative/RootTag'; import typeof DeprecatedColorPropType from './Libraries/DeprecatedPropTypes/DeprecatedColorPropType'; import typeof DeprecatedEdgeInsetsPropType from './Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType'; import typeof DeprecatedPointPropType from './Libraries/DeprecatedPropTypes/DeprecatedPointPropType'; @@ -124,15 +122,6 @@ module.exports = { get Button(): Button { return require('./Libraries/Components/Button'); }, - get CheckBox(): CheckBox { - warnOnce( - 'checkBox-moved', - 'CheckBox has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/checkbox' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-checkbox', - ); - return require('./Libraries/Components/CheckBox/CheckBox'); - }, get DatePickerIOS(): DatePickerIOS { warnOnce( 'DatePickerIOS-merged', @@ -476,17 +465,13 @@ module.exports = { return require('./Libraries/StyleSheet/PlatformColorValueTypesIOS') .DynamicColorIOS; }, - get ColorAndroid(): ColorAndroid { - return require('./Libraries/StyleSheet/PlatformColorValueTypesAndroid') - .ColorAndroid; - }, get requireNativeComponent(): ( uiViewClassName: string, ) => HostComponent { return require('./Libraries/ReactNative/requireNativeComponent'); }, get unstable_RootTagContext(): RootTagContext { - return require('./Libraries/ReactNative/RootTagContext'); + return require('./Libraries/ReactNative/RootTag').RootTagContext; }, get unstable_enableLogBox(): () => void { return () => @@ -681,4 +666,17 @@ if (__DEV__) { ); }, }); + + // $FlowFixMe This is intentional: Flow will error when attempting to access CheckBox. + Object.defineProperty(module.exports, 'CheckBox', { + configurable: true, + get() { + invariant( + false, + 'CheckBox has been removed from React Native. ' + + "It can now be installed and imported from '@react-native-community/checkbox' instead of 'react-native'. " + + 'See https://github.com/react-native-community/react-native-checkbox', + ); + }, + }); } diff --git a/vnext/.flowconfig b/vnext/.flowconfig index dd962e993de..a3c11493049 100644 --- a/vnext/.flowconfig +++ b/vnext/.flowconfig @@ -138,4 +138,4 @@ untyped-import untyped-type-import [version] -^0.122.0 +^0.123.0 diff --git a/vnext/ReactCopies/IntegrationTests/AsyncStorageTest.js b/vnext/ReactCopies/IntegrationTests/AsyncStorageTest.js index e33cedfdd82..12d9f3d620f 100644 --- a/vnext/ReactCopies/IntegrationTests/AsyncStorageTest.js +++ b/vnext/ReactCopies/IntegrationTests/AsyncStorageTest.js @@ -152,7 +152,10 @@ function testMerge() { } function testOptimizedMultiGet() { - let batch = [[KEY_1, VAL_1], [KEY_2, VAL_2]]; + let batch = [ + [KEY_1, VAL_1], + [KEY_2, VAL_2], + ]; let keys = batch.map(([key, value]) => key); AsyncStorage.multiSet(batch, err1 => { // yes, twice on purpose diff --git a/vnext/ReactCopies/RNTester/js/components/RNTesterTheme.js b/vnext/ReactCopies/RNTester/js/components/RNTesterTheme.js index 7bc14ea3ebd..5a1244ef362 100644 --- a/vnext/ReactCopies/RNTester/js/components/RNTesterTheme.js +++ b/vnext/ReactCopies/RNTester/js/components/RNTesterTheme.js @@ -12,7 +12,7 @@ import * as React from 'react'; import {Appearance} from 'react-native'; -import type {ColorValue} from '../../../Libraries/StyleSheet/StyleSheetTypes'; +import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; export type RNTesterTheme = { LabelColor: ColorValue, diff --git a/vnext/ReactCopies/RNTester/js/examples/CheckBox/CheckBoxExample.js b/vnext/ReactCopies/RNTester/js/examples/CheckBox/CheckBoxExample.js deleted file mode 100644 index c9e795f638d..00000000000 --- a/vnext/ReactCopies/RNTester/js/examples/CheckBox/CheckBoxExample.js +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const React = require('react'); -const {CheckBox, Text, View, StyleSheet} = require('react-native'); - -type BasicState = {| - trueCheckBoxIsOn: boolean, - falseCheckBoxIsOn: boolean, -|}; - -type BasicProps = $ReadOnly<{||}>; -class BasicCheckBoxExample extends React.Component { - state = { - trueCheckBoxIsOn: true, - falseCheckBoxIsOn: false, - }; - - render() { - return ( - - this.setState({falseCheckBoxIsOn: value})} - style={styles.checkbox} - value={this.state.falseCheckBoxIsOn} - tintColors={{false: 'red'}} - /> - this.setState({trueCheckBoxIsOn: value})} - value={this.state.trueCheckBoxIsOn} - tintColors={{true: 'green'}} - /> - - ); - } -} - -type DisabledProps = $ReadOnly<{||}>; -class DisabledCheckBoxExample extends React.Component { - render() { - return ( - - - - - ); - } -} - -type EventProps = $ReadOnly<{||}>; -type EventState = {| - eventCheckBoxIsOn: boolean, - eventCheckBoxRegressionIsOn: boolean, -|}; - -class EventCheckBoxExample extends React.Component { - state = { - eventCheckBoxIsOn: false, - eventCheckBoxRegressionIsOn: true, - }; - - render() { - return ( - - - this.setState({eventCheckBoxIsOn: value})} - style={styles.checkbox} - value={this.state.eventCheckBoxIsOn} - /> - this.setState({eventCheckBoxIsOn: value})} - style={styles.checkbox} - value={this.state.eventCheckBoxIsOn} - /> - {this.state.eventCheckBoxIsOn ? 'On' : 'Off'} - - - - this.setState({eventCheckBoxRegressionIsOn: value}) - } - style={styles.checkbox} - value={this.state.eventCheckBoxRegressionIsOn} - /> - - this.setState({eventCheckBoxRegressionIsOn: value}) - } - style={styles.checkbox} - value={this.state.eventCheckBoxRegressionIsOn} - /> - {this.state.eventCheckBoxRegressionIsOn ? 'On' : 'Off'} - - - ); - } -} - -const styles = StyleSheet.create({ - container: { - flexDirection: 'row', - justifyContent: 'space-around', - }, - checkbox: { - marginBottom: 10, - }, -}); - -exports.title = ''; -exports.displayName = 'CheckBoxExample'; -exports.description = 'Native boolean input'; -exports.examples = [ - { - title: - 'CheckBoxes can be set to true or false, and the color of both states can be specified.', - render(): React.Element { - return ; - }, - }, - { - title: 'CheckBoxes can be disabled', - render(): React.Element { - return ; - }, - }, - { - title: 'Change events can be detected', - render(): React.Element { - return ; - }, - }, - { - title: 'CheckBoxes are controlled components', - render(): React.Element { - return ; - }, - }, -]; diff --git a/vnext/ReactCopies/RNTester/js/examples/Layout/LayoutAnimationExample.js b/vnext/ReactCopies/RNTester/js/examples/Layout/LayoutAnimationExample.js index 4a0eac9fc58..62c88324645 100644 --- a/vnext/ReactCopies/RNTester/js/examples/Layout/LayoutAnimationExample.js +++ b/vnext/ReactCopies/RNTester/js/examples/Layout/LayoutAnimationExample.js @@ -19,49 +19,184 @@ const { TouchableOpacity, } = require('react-native'); -class AddRemoveExample extends React.Component<{...}, $FlowFixMeState> { +type ExampleViewSpec = {| + key: number, +|}; + +type AddRemoveExampleState = {| + views: Array, + nextKey: number, +|}; + +function shuffleArray(array: Array) { + var currentIndex: number = array.length, + temporaryValue: ExampleViewSpec, + randomIndex: number; + + // While there remain elements to shuffle... + while (currentIndex !== 0) { + // Pick a remaining element... + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + + // And swap it with the current element. + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } + + return array; +} + +class AddRemoveExample extends React.Component<{...}, AddRemoveExampleState> { state = { views: [], + nextKey: 1, }; - UNSAFE_componentWillUpdate() { - LayoutAnimation.easeInEaseOut(args => - console.log('AddRemoveExample completed', args), + configureNextAnimation() { + LayoutAnimation.configureNext( + { + duration: 1000, + create: {type: 'easeInEaseOut', property: 'opacity'}, + update: {type: 'easeInEaseOut', property: 'opacity'}, + delete: {type: 'easeInEaseOut', property: 'opacity'}, + }, + args => console.log('AddRemoveExample completed', args), ); } + _onPressAddViewAnimated = () => { + this.configureNextAnimation(); + this._onPressAddView(); + }; + + _onPressRemoveViewAnimated = () => { + this.configureNextAnimation(); + this._onPressRemoveView(); + }; + + _onPressReorderViewsAnimated = () => { + this.configureNextAnimation(); + this._onPressReorderViews(); + }; + _onPressAddView = () => { - this.setState(state => ({views: [...state.views, {}]})); + this.setState(state => ({ + views: [...state.views, {key: state.nextKey}], + nextKey: state.nextKey + 1, + })); }; _onPressRemoveView = () => { this.setState(state => ({views: state.views.slice(0, -1)})); }; + _onPressReorderViews = () => { + this.setState(state => ({views: shuffleArray(state.views)})); + }; + render() { - const views = this.state.views.map((view, i) => ( - - {i} + const views = this.state.views.map(({key}) => ( + console.log('Box onLayout')}> + {key} )); return ( - + Add view - + Remove view + + + Reorder Views + + + + + Add view (no animation) + + + + + Remove view (no animation) + + + + + Reorder Views (no animation) + + {views} ); } } +type ReparentingExampleState = {| + hasBorder: boolean, +|}; + +class ReparentingExample extends React.Component< + {...}, + ReparentingExampleState, +> { + state = { + hasBorder: false, + }; + + _onPressToggleAnimated = () => { + LayoutAnimation.configureNext( + { + duration: 300, + create: {type: 'easeInEaseOut', property: 'opacity', duration: 1000}, + update: {type: 'easeInEaseOut', property: 'opacity'}, + delete: {type: 'easeInEaseOut', property: 'opacity', duration: 1000}, + }, + args => console.log('ReparentingExample completed', args), + ); + this._onPressToggle(); + }; + + _onPressToggle = () => { + this.setState(state => ({hasBorder: !state.hasBorder})); + }; + + render() { + const parentStyle = this.state.hasBorder + ? {borderWidth: 5, borderColor: 'red'} + : {}; + + return ( + + + + Toggle + + + + + Toggle (no animation) + + + + + + + ); + } +} + const GreenSquare = () => ( Green square @@ -74,7 +209,11 @@ const BlueSquare = () => ( ); -class CrossFadeExample extends React.Component<{...}, $FlowFixMeState> { +type CrossFadeExampleState = {| + toggled: boolean, +|}; + +class CrossFadeExample extends React.Component<{...}, CrossFadeExampleState> { state = { toggled: false, }; @@ -102,7 +241,15 @@ class CrossFadeExample extends React.Component<{...}, $FlowFixMeState> { } } -class LayoutUpdateExample extends React.Component<{...}, $FlowFixMeState> { +type LayoutUpdateExampleState = {| + width: number, + height: number, +|}; + +class LayoutUpdateExample extends React.Component< + {...}, + LayoutUpdateExampleState, +> { state = { width: 200, height: 100, @@ -206,6 +353,12 @@ exports.examples = [ return ; }, }, + { + title: 'Animate Reparenting Update', + render(): React.Element { + return ; + }, + }, { title: 'Cross fade views', render(): React.Element { diff --git a/vnext/ReactCopies/RNTester/js/examples/PlatformColor/PlatformColorExample.js b/vnext/ReactCopies/RNTester/js/examples/PlatformColor/PlatformColorExample.js index 8417ff6d2d8..5cb831c0627 100644 --- a/vnext/ReactCopies/RNTester/js/examples/PlatformColor/PlatformColorExample.js +++ b/vnext/ReactCopies/RNTester/js/examples/PlatformColor/PlatformColorExample.js @@ -13,14 +13,7 @@ const React = require('react'); const ReactNative = require('react-native'); import Platform from '../../../../Libraries/Utilities/Platform'; -const { - ColorAndroid, - DynamicColorIOS, - PlatformColor, - StyleSheet, - Text, - View, -} = ReactNative; +const {DynamicColorIOS, PlatformColor, StyleSheet, Text, View} = ReactNative; function PlatformColorsExample() { function createTable() { @@ -29,94 +22,94 @@ function PlatformColorsExample() { colors = [ // https://developer.apple.com/documentation/uikit/uicolor/ui_element_colors // Label Colors - {label: 'labelColor', color: PlatformColor('labelColor')}, + {label: 'label', color: PlatformColor('label')}, { - label: 'secondaryLabelColor', - color: PlatformColor('secondaryLabelColor'), + label: 'secondaryLabel', + color: PlatformColor('secondaryLabel'), }, { - label: 'tertiaryLabelColor', - color: PlatformColor('tertiaryLabelColor'), + label: 'tertiaryLabel', + color: PlatformColor('tertiaryLabel'), }, { - label: 'quaternaryLabelColor', - color: PlatformColor('quaternaryLabelColor'), + label: 'quaternaryLabel', + color: PlatformColor('quaternaryLabel'), }, // Fill Colors - {label: 'systemFillColor', color: PlatformColor('systemFillColor')}, + {label: 'systemFill', color: PlatformColor('systemFill')}, { - label: 'secondarySystemFillColor', - color: PlatformColor('secondarySystemFillColor'), + label: 'secondarySystemFill', + color: PlatformColor('secondarySystemFill'), }, { - label: 'tertiarySystemFillColor', - color: PlatformColor('tertiarySystemFillColor'), + label: 'tertiarySystemFill', + color: PlatformColor('tertiarySystemFill'), }, { - label: 'quaternarySystemFillColor', - color: PlatformColor('quaternarySystemFillColor'), + label: 'quaternarySystemFill', + color: PlatformColor('quaternarySystemFill'), }, // Text Colors { - label: 'placeholderTextColor', - color: PlatformColor('placeholderTextColor'), + label: 'placeholderText', + color: PlatformColor('placeholderText'), }, // Standard Content Background Colors { - label: 'systemBackgroundColor', - color: PlatformColor('systemBackgroundColor'), + label: 'systemBackground', + color: PlatformColor('systemBackground'), }, { - label: 'secondarySystemBackgroundColor', - color: PlatformColor('secondarySystemBackgroundColor'), + label: 'secondarySystemBackground', + color: PlatformColor('secondarySystemBackground'), }, { - label: 'tertiarySystemBackgroundColor', - color: PlatformColor('tertiarySystemBackgroundColor'), + label: 'tertiarySystemBackground', + color: PlatformColor('tertiarySystemBackground'), }, // Grouped Content Background Colors { - label: 'systemGroupedBackgroundColor', - color: PlatformColor('systemGroupedBackgroundColor'), + label: 'systemGroupedBackground', + color: PlatformColor('systemGroupedBackground'), }, { - label: 'secondarySystemGroupedBackgroundColor', - color: PlatformColor('secondarySystemGroupedBackgroundColor'), + label: 'secondarySystemGroupedBackground', + color: PlatformColor('secondarySystemGroupedBackground'), }, { - label: 'tertiarySystemGroupedBackgroundColor', - color: PlatformColor('tertiarySystemGroupedBackgroundColor'), + label: 'tertiarySystemGroupedBackground', + color: PlatformColor('tertiarySystemGroupedBackground'), }, // Separator Colors - {label: 'separatorColor', color: PlatformColor('separatorColor')}, + {label: 'separator', color: PlatformColor('separator')}, { - label: 'opaqueSeparatorColor', - color: PlatformColor('opaqueSeparatorColor'), + label: 'opaqueSeparator', + color: PlatformColor('opaqueSeparator'), }, // Link Color - {label: 'linkColor', color: PlatformColor('linkColor')}, + {label: 'link', color: PlatformColor('link')}, // Nonadaptable Colors - {label: 'darkTextColor', color: PlatformColor('darkTextColor')}, - {label: 'lightTextColor', color: PlatformColor('lightTextColor')}, + {label: 'darkText', color: PlatformColor('darkText')}, + {label: 'lightText', color: PlatformColor('lightText')}, // https://developer.apple.com/documentation/uikit/uicolor/standard_colors // Adaptable Colors - {label: 'systemBlueColor', color: PlatformColor('systemBlueColor')}, - {label: 'systemBrownColor', color: PlatformColor('systemBrownColor')}, - {label: 'systemGreenColor', color: PlatformColor('systemGreenColor')}, - {label: 'systemIndigoColor', color: PlatformColor('systemIndigoColor')}, - {label: 'systemOrangeColor', color: PlatformColor('systemOrangeColor')}, - {label: 'systemPinkColor', color: PlatformColor('systemPinkColor')}, - {label: 'systemPurpleColor', color: PlatformColor('systemPurpleColor')}, - {label: 'systemRedColor', color: PlatformColor('systemRedColor')}, - {label: 'systemTealColor', color: PlatformColor('systemTealColor')}, - {label: 'systemYellowColor', color: PlatformColor('systemYellowColor')}, + {label: 'systemBlue', color: PlatformColor('systemBlue')}, + {label: 'systemBrown', color: PlatformColor('systemBrown')}, + {label: 'systemGreen', color: PlatformColor('systemGreen')}, + {label: 'systemIndigo', color: PlatformColor('systemIndigo')}, + {label: 'systemOrange', color: PlatformColor('systemOrange')}, + {label: 'systemPink', color: PlatformColor('systemPink')}, + {label: 'systemPurple', color: PlatformColor('systemPurple')}, + {label: 'systemRed', color: PlatformColor('systemRed')}, + {label: 'systemTeal', color: PlatformColor('systemTeal')}, + {label: 'systemYellow', color: PlatformColor('systemYellow')}, // Adaptable Gray Colors - {label: 'systemGrayColor', color: PlatformColor('systemGrayColor')}, - {label: 'systemGray2Color', color: PlatformColor('systemGray2Color')}, - {label: 'systemGray3Color', color: PlatformColor('systemGray3Color')}, - {label: 'systemGray4Color', color: PlatformColor('systemGray4Color')}, - {label: 'systemGray5Color', color: PlatformColor('systemGray5Color')}, - {label: 'systemGray6Color', color: PlatformColor('systemGray6Color')}, + {label: 'systemGray', color: PlatformColor('systemGray')}, + {label: 'systemGray2', color: PlatformColor('systemGray2')}, + {label: 'systemGray3', color: PlatformColor('systemGray3')}, + {label: 'systemGray4', color: PlatformColor('systemGray4')}, + {label: 'systemGray5', color: PlatformColor('systemGray5')}, + {label: 'systemGray6', color: PlatformColor('systemGray6')}, ]; } else if (Platform.OS === 'android') { colors = [ @@ -263,24 +256,6 @@ function DynamicColorsExample() { ); } -function AndroidColorsExample() { - return Platform.OS === 'android' ? ( - - - ColorAndroid('?attr/colorAccent') - - - - ) : ( - Not applicable on this platform - ); -} - function VariantColorsExample() { return ( @@ -288,7 +263,7 @@ function VariantColorsExample() { {Platform.OS === 'ios' ? "DynamicColorIOS({light: 'red', dark: 'blue'})" - : "ColorAndroid('?attr/colorAccent')"} + : "PlatformColor('?attr/colorAccent')"} @@ -340,12 +315,6 @@ exports.examples = [ return ; }, }, - { - title: 'Android Colors', - render(): React.Element { - return ; - }, - }, { title: 'Variant Colors', render(): React.Element { diff --git a/vnext/ReactCopies/RNTester/js/examples/Pressable/PressableExample.js b/vnext/ReactCopies/RNTester/js/examples/Pressable/PressableExample.js index 1dadac6b1c4..e57f6320098 100644 --- a/vnext/ReactCopies/RNTester/js/examples/Pressable/PressableExample.js +++ b/vnext/ReactCopies/RNTester/js/examples/Pressable/PressableExample.js @@ -378,7 +378,7 @@ exports.examples = [ }, { title: 'Pressable with custom Ripple', - description: ("Pressable can specify ripple's radius and borderless params": string), + description: ("Pressable can specify ripple's radius, color and borderless params": string), platform: 'android', render: function(): React.Node { const nativeFeedbackButton = { @@ -386,32 +386,42 @@ exports.examples = [ margin: 10, }; return ( - - - - - radius 30 - - - + + + + + + radius 30 + + + - - - - radius 150 - - - + + + + radius 150 + + + + + + + + radius 70, with border + + + + - + - radius 70, with border + with border, default color and radius diff --git a/vnext/ReactCopies/RNTester/js/examples/TurboModule/SampleTurboModuleExample.js b/vnext/ReactCopies/RNTester/js/examples/TurboModule/SampleTurboModuleExample.js index eae564aa3a2..4eaa82444ad 100644 --- a/vnext/ReactCopies/RNTester/js/examples/TurboModule/SampleTurboModuleExample.js +++ b/vnext/ReactCopies/RNTester/js/examples/TurboModule/SampleTurboModuleExample.js @@ -11,6 +11,7 @@ 'use strict'; import NativeSampleTurboModule from '../../../../Libraries/TurboModule/samples/NativeSampleTurboModule'; +import type {RootTag} from '../../../../Libraries/ReactNative/RootTag'; import { StyleSheet, Text, @@ -18,6 +19,7 @@ import { FlatList, Platform, TouchableOpacity, + unstable_RootTagContext, } from 'react-native'; import * as React from 'react'; @@ -33,6 +35,8 @@ type State = {| |}; class SampleTurboModuleExample extends React.Component<{||}, State> { + static contextType: React$Context = unstable_RootTagContext; + state: State = { testResults: {}, }; @@ -64,6 +68,7 @@ class SampleTurboModuleExample extends React.Component<{||}, State> { ]), getObject: () => NativeSampleTurboModule.getObject({a: 1, b: 'foo', c: null}), + getRootTag: () => NativeSampleTurboModule.getRootTag(this.context), getValue: () => NativeSampleTurboModule.getValue(5, 'test', {a: 1, b: 'foo'}), }; diff --git a/vnext/ReactCopies/RNTester/js/examples/View/ViewExample.js b/vnext/ReactCopies/RNTester/js/examples/View/ViewExample.js index 06b27412120..7f89797ed51 100644 --- a/vnext/ReactCopies/RNTester/js/examples/View/ViewExample.js +++ b/vnext/ReactCopies/RNTester/js/examples/View/ViewExample.js @@ -148,12 +148,53 @@ exports.examples = [ }, }, { - title: 'Circle with Border Radius', + title: 'Rounded Borders', render(): React.Node { return ( - + + + + + + ); }, }, diff --git a/vnext/ReactCopies/RNTester/js/examples/XHR/XHRExampleDownload.js b/vnext/ReactCopies/RNTester/js/examples/XHR/XHRExampleDownload.js index 41c414c108c..f203a7d9a1d 100644 --- a/vnext/ReactCopies/RNTester/js/examples/XHR/XHRExampleDownload.js +++ b/vnext/ReactCopies/RNTester/js/examples/XHR/XHRExampleDownload.js @@ -112,13 +112,9 @@ class XHRExampleDownload extends React.Component<{...}, Object> { return; } if (xhr.status === 200) { - let responseType = `Response is a string, ${ - xhr.response.length - } characters long.`; + let responseType = `Response is a string, ${xhr.response.length} characters long.`; if (xhr.response instanceof ArrayBuffer) { - responseType = `Response is an ArrayBuffer, ${ - xhr.response.byteLength - } bytes long.`; + responseType = `Response is an ArrayBuffer, ${xhr.response.byteLength} bytes long.`; } Alert.alert('Download complete!', responseType); } else if (xhr.status !== 0) { diff --git a/vnext/ReactCopies/RNTester/js/utils/RNTesterList.android.js b/vnext/ReactCopies/RNTester/js/utils/RNTesterList.android.js index 1de9d42a00c..66962af5154 100644 --- a/vnext/ReactCopies/RNTester/js/utils/RNTesterList.android.js +++ b/vnext/ReactCopies/RNTester/js/utils/RNTesterList.android.js @@ -21,10 +21,6 @@ const ComponentExamples: Array = [ key: 'ButtonExample', module: require('../examples/Button/ButtonExample'), }, - { - key: 'CheckBoxExample', - module: require('../examples/CheckBox/CheckBoxExample'), - }, { key: 'FlatListExample', module: require('../examples/FlatList/FlatListExample'), diff --git a/vnext/codegen/NativeSampleTurboModuleSpec.g.h b/vnext/codegen/NativeSampleTurboModuleSpec.g.h index 8261d7e220f..e85b7ba2635 100644 --- a/vnext/codegen/NativeSampleTurboModuleSpec.g.h +++ b/vnext/codegen/NativeSampleTurboModuleSpec.g.h @@ -21,9 +21,10 @@ struct SampleTurboModuleSpec : winrt::Microsoft::ReactNative::TurboModuleSpec { SyncMethod{3, L"getString"}, SyncMethod{4, L"getArray"}, SyncMethod{5, L"getObject"}, - SyncMethod{6, L"getValue"}, - Method) noexcept>{7, L"getValueWithCallback"}, - Method) noexcept>{8, L"getValueWithPromise"}, + SyncMethod{6, L"getRootTag"}, + SyncMethod{7, L"getValue"}, + Method) noexcept>{8, L"getValueWithCallback"}, + Method) noexcept>{9, L"getValueWithPromise"}, }; template @@ -62,16 +63,21 @@ struct SampleTurboModuleSpec : winrt::Microsoft::ReactNative::TurboModuleSpec { " REACT_SYNC_METHOD(getObject) static React::JSValueObject getObject(React::JSValueObject && arg) noexcept { /* implementation */ }}\n"); REACT_SHOW_METHOD_SPEC_ERRORS( 6, + "getRootTag", + " REACT_SYNC_METHOD(getRootTag) React::JSValueObject getRootTag(React::JSValueObject && arg) noexcept { /* implementation */ }}\n" + " REACT_SYNC_METHOD(getRootTag) static React::JSValueObject getRootTag(React::JSValueObject && arg) noexcept { /* implementation */ }}\n"); + REACT_SHOW_METHOD_SPEC_ERRORS( + 7, "getValue", " REACT_SYNC_METHOD(getValue) React::JSValueObject getValue(double x, std::string y, React::JSValueObject && z) noexcept { /* implementation */ }}\n" " REACT_SYNC_METHOD(getValue) static React::JSValueObject getValue(double x, std::string y, React::JSValueObject && z) noexcept { /* implementation */ }}\n"); REACT_SHOW_METHOD_SPEC_ERRORS( - 7, + 8, "getValueWithCallback", " REACT_METHOD(getValueWithCallback) void getValueWithCallback(std::function const & callback) noexcept { /* implementation */ }}\n" " REACT_METHOD(getValueWithCallback) static void getValueWithCallback(std::function const & callback) noexcept { /* implementation */ }}\n"); REACT_SHOW_METHOD_SPEC_ERRORS( - 8, + 9, "getValueWithPromise", " REACT_METHOD(getValueWithPromise) void getValueWithPromise(bool error, React::ReactPromise &&result) noexcept { /* implementation */ }}\n" " REACT_METHOD(getValueWithPromise) static void getValueWithPromise(bool error, React::ReactPromise &&result) noexcept { /* implementation */ }}\n"); diff --git a/vnext/overrides.json b/vnext/overrides.json index c061eec9a62..0545badbd3d 100644 --- a/vnext/overrides.json +++ b/vnext/overrides.json @@ -17,14 +17,14 @@ "type": "derived", "file": ".flowconfig", "baseFile": ".flowconfig", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "a01a99335388562d23fb0c43a98b6b2bb780835c" + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "3210a076de8ff5c698de48d8af444b2677270ca6" }, { "type": "patch", "file": "DeforkingPatches/ReactCommon/turbomodule/samples/SampleTurboCxxModule.cpp", "baseFile": "ReactCommon/turbomodule/samples/SampleTurboCxxModule.cpp", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "b8840ecbf1d0a61d5e13d6f9690722e41cacb7ab", "issue": "LEGACY_FIXME" }, @@ -32,7 +32,7 @@ "type": "patch", "file": "DeforkingPatches/ReactCommon/turbomodule/samples/SampleTurboCxxModule.h", "baseFile": "ReactCommon/turbomodule/samples/SampleTurboCxxModule.h", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "2e4e38798e5504d891342e46da17ef3b073123d8", "issue": "LEGACY_FIXME" }, @@ -48,31 +48,31 @@ "type": "copy", "directory": "ReactCopies/IntegrationTests", "baseDirectory": "IntegrationTests", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "6053056f2ec59cf60e5406d7f3986ef09da6dc22", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "b189414bfc74b1a14e0181a79b92a18e67253491", "issue": 4054 }, { "type": "copy", "directory": "ReactCopies/RNTester/js", "baseDirectory": "RNTester/js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "05fa9a5bffd222591ac5baad502cf6e4d84f40e6", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "cda4f72e616b25b6cc900dfbd3b98d3d98c78ffc", "issue": 4054 }, { "type": "patch", "file": "src/babel-plugin-inline-view-configs/GenerateViewConfigJs.js", "baseFile": "packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "415a69596caa402d0f510fe2a2eb2ca792169cab", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "b5da375a685a44f9dcb99d374f2564d03830776f", "issue": 5430 }, { "type": "patch", "file": "src/babel-plugin-inline-view-configs/index.js", "baseFile": "packages/babel-plugin-inline-view-configs/index.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "02590f3430fb57fcd954357c9dbeeaa8bdc01d06", "issue": 5430 }, @@ -80,7 +80,7 @@ "type": "patch", "file": "src/babel-plugin-inline-view-configs/package.json", "baseFile": "packages/babel-plugin-inline-view-configs/package.json", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "8d37fac510a533c0badffacd9c3aa9c392fd58c6", "issue": 5430 }, @@ -88,8 +88,8 @@ "type": "derived", "file": "src/index.windows.js", "baseFile": "index.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "7fa1b7cdc28ea57c2b1cf6085a1b1c53a530b30f", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "27967b6f36e9bc2bc3f4ac79c1320b7152d93f83", "issue": "LEGACY_FIXME" }, { @@ -108,7 +108,7 @@ "type": "patch", "file": "src/Libraries/Alert/Alert.windows.js", "baseFile": "Libraries/Alert/Alert.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "b4867752830f6953516c5898a7e2fc0dc796dcfa", "issue": "LEGACY_FIXME" }, @@ -124,7 +124,7 @@ "type": "copy", "file": "src/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js", "baseFile": "Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "611e89285ac812456b381568052cf575c955575a", "issue": 4578 }, @@ -132,8 +132,8 @@ "type": "patch", "file": "src/Libraries/Components/Button.windows.js", "baseFile": "Libraries/Components/Button.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "1bb31cc95e6e4b71ff09f024dd102a9717925e51", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "3c1baecf9171422511a08436edd423c5da9cf5c2", "issue": "LEGACY_FIXME" }, { @@ -156,7 +156,7 @@ "type": "derived", "file": "src/Libraries/Components/DatePicker/DatePickerIOS.windows.js", "baseFile": "Libraries/Components/DatePicker/DatePickerIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "218895e2a5f3d7614a2cb577da187800857850ea" }, { @@ -167,14 +167,14 @@ "type": "derived", "file": "src/Libraries/Components/DatePickerAndroid/DatePickerAndroid.windows.js", "baseFile": "Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "09d82215c57ca5873a53523a63006daebf07ffbc" }, { "type": "derived", "file": "src/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.windows.js", "baseFile": "Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a" }, { @@ -205,29 +205,29 @@ "type": "derived", "file": "src/Libraries/Components/MaskedView/MaskedViewIOS.windows.js", "baseFile": "Libraries/Components/MaskedView/MaskedViewIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "0b409391c852a1001cee74a84414a13c4fe88f8b" }, { "type": "patch", "file": "src/Libraries/Components/Picker/Picker.windows.js", "baseFile": "Libraries/Components/Picker/Picker.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "290040ab9124b6bc167a1d01f9b145199bee11c0", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "ebfef6691cf4634daa34c025327f837d292ef44f", "issue": 4611 }, { "type": "derived", "file": "src/Libraries/Components/Picker/PickerAndroid.windows.js", "baseFile": "Libraries/Components/Picker/PickerAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a" }, { "type": "derived", "file": "src/Libraries/Components/Picker/PickerIOS.windows.js", "baseFile": "Libraries/Components/Picker/PickerIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "0c6bf0751e053672123cbad30d67851ba0007af6" }, { @@ -254,29 +254,29 @@ "type": "derived", "file": "src/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.windows.js", "baseFile": "Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a" }, { "type": "derived", "file": "src/Libraries/Components/ProgressViewIOS/ProgressViewIOS.windows.js", "baseFile": "Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "f0b35fdee6b1c9e7bfe860a9e0aefc00337ea7fd" }, { "type": "patch", "file": "src/Libraries/Components/RefreshControl/RefreshControl.windows.js", "baseFile": "Libraries/Components/RefreshControl/RefreshControl.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "61f351ccc7fbfc340adb9b0cab22497d978ba26d", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "0efdf9cc52f5411bbf296f92e30aa44f83668b45", "issue": "LEGACY_FIXME" }, { "type": "derived", "file": "src/Libraries/Components/SafeAreaView/SafeAreaView.windows.js", "baseFile": "Libraries/Components/SafeAreaView/SafeAreaView.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "59dabb86baedb0088e110f8cdeb914fa3271dfd9", "issue": "LEGACY_FIXME" }, @@ -284,7 +284,7 @@ "type": "derived", "file": "src/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.windows.js", "baseFile": "Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "37cea8b532ea4e4335120c6f8b2d3d3548e31b18", "issue": "LEGACY_FIXME" }, @@ -300,7 +300,7 @@ "type": "patch", "file": "src/Libraries/Components/TextInput/TextInputState.windows.js", "baseFile": "Libraries/Components/TextInput/TextInputState.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "e982deb23d7ad5312ab0c09508a6d58c152b5be7", "issue": "LEGACY_FIXME" }, @@ -308,22 +308,22 @@ "type": "derived", "file": "src/Libraries/Components/ToastAndroid/ToastAndroid.windows.js", "baseFile": "Libraries/Components/ToastAndroid/ToastAndroid.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "614b7e88c38f5820656c79d64239bfb74ca308c0" }, { "type": "patch", "file": "src/Libraries/Components/Touchable/TouchableHighlight.windows.js", "baseFile": "Libraries/Components/Touchable/TouchableHighlight.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "b03a273535705ec4a1e979ec0adf06c90b8938e5", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "a41ceb18692f6d3df5fe3e93bd86f5cfa5399d97", "issue": "LEGACY_FIXME" }, { "type": "patch", "file": "src/Libraries/Components/Touchable/TouchableOpacity.windows.js", "baseFile": "Libraries/Components/Touchable/TouchableOpacity.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "e9b3b0a49be45f4030f34f7c91f5a47c01b50582", "issue": "LEGACY_FIXME" }, @@ -331,7 +331,7 @@ "type": "patch", "file": "src/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js", "baseFile": "Libraries/Components/Touchable/TouchableWithoutFeedback.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "8fef33cd9edce5725695ca1e7fd9705916578799", "issue": "LEGACY_FIXME" }, @@ -339,7 +339,7 @@ "type": "patch", "file": "src/Libraries/Components/View/ReactNativeViewViewConfig.windows.js", "baseFile": "Libraries/Components/View/ReactNativeViewViewConfig.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "8d5d480284b4cdaf7d8d86935967370d455b7b68", "issue": "LEGACY_FIXME" }, @@ -347,7 +347,7 @@ "type": "patch", "file": "src/Libraries/Components/View/ViewAccessibility.windows.js", "baseFile": "Libraries/Components/View/ViewAccessibility.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "2d01902a9edd76f728e9044e2ed8a35d44f34424", "issue": "LEGACY_FIXME" }, @@ -355,7 +355,7 @@ "type": "patch", "file": "src/Libraries/Components/View/ViewPropTypes.windows.js", "baseFile": "Libraries/Components/View/ViewPropTypes.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "f768a7dd320d434d9bc9dacef3ee2ca9776e2197", "issue": "LEGACY_FIXME" }, @@ -371,7 +371,7 @@ "type": "patch", "file": "src/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.windows.js", "baseFile": "Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "c6d80f9ea60e5802d2e67ed50a78f2b6840d1162", "issue": "LEGACY_FIXME" }, @@ -379,7 +379,7 @@ "type": "copy", "file": "src/Libraries/Image/Image.windows.js", "baseFile": "Libraries/Image/Image.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "26acff268b815c7b3c5da0d6c9c009073b202ea8", "issue": 4590 }, @@ -387,8 +387,8 @@ "type": "patch", "file": "src/Libraries/Lists/VirtualizedList.windows.js", "baseFile": "Libraries/Lists/VirtualizedList.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "dcb006e1b8717daf7e5a1ba7e860ea12d5b1832d", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "8c4f541731683e194e4ec22c01b6e969fc5f64ae", "issue": "LEGACY_FIXME" }, { @@ -399,7 +399,7 @@ "type": "derived", "file": "src/Libraries/Network/RCTNetworkingWinShared.js", "baseFile": "Libraries/Network/RCTNetworking.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "fa5d7d307e25d22d699a1d2d1eec9c0ac79ba928", "issue": "LEGACY_FIXME" }, @@ -407,7 +407,7 @@ "type": "patch", "file": "src/Libraries/NewAppScreen/components/DebugInstructions.windows.js", "baseFile": "Libraries/NewAppScreen/components/DebugInstructions.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "a9f4db370db2e34a8708abd57bc5a7ab5c44ccf1", "issue": "LEGACY_FIXME" }, @@ -415,7 +415,7 @@ "type": "patch", "file": "src/Libraries/NewAppScreen/components/ReloadInstructions.windows.js", "baseFile": "Libraries/NewAppScreen/components/ReloadInstructions.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "39326801da6c9ce8c350aa8ba971be4a386499bc", "issue": "LEGACY_FIXME" }, @@ -423,7 +423,7 @@ "type": "patch", "file": "src/Libraries/Pressability/Pressability.windows.js", "baseFile": "Libraries/Pressability/Pressability.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "a3e33cfe943788b47933ea2c7a807326c8545492", "issue": 4379 }, @@ -431,7 +431,7 @@ "type": "derived", "file": "src/Libraries/Settings/Settings.windows.js", "baseFile": "Libraries/Settings/Settings.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "00604dd0ab624b3f5b80d460f48dbc3ac7ee905d", "issue": "LEGACY_FIXME" }, @@ -443,7 +443,7 @@ "type": "patch", "file": "src/Libraries/StyleSheet/StyleSheetValidation.windows.js", "baseFile": "Libraries/StyleSheet/StyleSheetValidation.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "5fe7febd1eb5374745fe612030806512e9161796", "issue": 5269 }, @@ -451,7 +451,7 @@ "type": "patch", "file": "src/Libraries/Types/CoreEventTypes.js", "baseFile": "Libraries/Types/CoreEventTypes.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "83b203d547d9bdc57a8f3346ecee6f6e34b25f5d", "issue": "LEGACY_FIXME" }, @@ -459,7 +459,7 @@ "type": "copy", "file": "src/Libraries/Utilities/BackHandler.windows.js", "baseFile": "Libraries/Utilities/BackHandler.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "b1633b6bb5e3dc842011b09f778626c39bf6b654", "issue": 4629 }, @@ -467,14 +467,14 @@ "type": "derived", "file": "src/Libraries/Utilities/NativePlatformConstantsWin.js", "baseFile": "Libraries/Utilities/NativePlatformConstantsIOS.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "168fe4a9608c0b151237122eea94d78f7b0093e5" }, { "type": "derived", "file": "src/Libraries/Utilities/Platform.windows.js", "baseFile": "Libraries/Utilities/Platform.android.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "bcaebbe089a41de46724b00e69fcdba7e6b1ed7f" }, { @@ -485,7 +485,7 @@ "type": "patch", "file": "src/RNTester/js/components/ListExampleShared.windows.js", "baseFile": "RNTester/js/components/ListExampleShared.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "d7be07e3fd8d9c1df8e23d5674ce3eb067d00865", "issue": "LEGACY_FIXME" }, @@ -493,7 +493,7 @@ "type": "patch", "file": "src/RNTester/js/components/RNTesterExampleList.windows.js", "baseFile": "RNTester/js/components/RNTesterExampleList.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "fc507321dc5cb53be93df517ba5c4b1acd0074f4", "issue": "LEGACY_FIXME" }, @@ -509,7 +509,7 @@ "type": "patch", "file": "src/RNTester/js/examples/RTL/RTLExample.windows.js", "baseFile": "RNTester/js/examples/RTL/RTLExample.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "70a65dc896406e7ad971f0a9a770b7ea30f43b9e", "issue": 4678 }, @@ -517,7 +517,7 @@ "type": "patch", "file": "src/RNTester/js/examples/ScrollView/ScrollViewExample.windows.js", "baseFile": "RNTester/js/examples/ScrollView/ScrollViewExample.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "1840fda2dd4591883df92d28c1e1aeabff190f7f", "issue": "LEGACY_FIXME" }, @@ -525,15 +525,15 @@ "type": "patch", "file": "src/RNTester/js/examples/View/ViewExample.windows.js", "baseFile": "RNTester/js/examples/View/ViewExample.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "2883fb236a49da83cb59fb6871a11665779036e0", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "76d4a9914e731bffefefd3b0de90c97a1726e2a9", "issue": "LEGACY_FIXME" }, { "type": "derived", "file": "src/RNTester/js/RNTesterApp.windows.js", "baseFile": "RNTester/js/RNTesterApp.ios.js", - "baseVersion": "0.0.0-4a48b021d", + "baseVersion": "0.0.0-2c473e1a3", "baseHash": "34d2517461704840a508ce1856bc3a364fb3fc7e", "issue": 4586 }, diff --git a/vnext/package.json b/vnext/package.json index 5c99e51df82..c1f0db5b2cc 100644 --- a/vnext/package.json +++ b/vnext/package.json @@ -58,12 +58,12 @@ "@types/react-native": "^0.62.10", "eslint": "6.7.0", "eslint-plugin-prettier": "2.6.2", - "flow-bin": "^0.122.0", + "flow-bin": "^0.123.0", "jscodeshift": "^0.7.0", "just-scripts": "^0.36.1", "prettier": "1.17.0", "react": "16.13.1", - "react-native": "0.0.0-4a48b021d", + "react-native": "0.0.0-2c473e1a3", "react-native-platform-override": "^0.2.1", "react-native-windows-codegen": "0.0.10", "react-refresh": "^0.4.0", @@ -71,7 +71,7 @@ }, "peerDependencies": { "react": "16.13.1", - "react-native": "0.0.0-4a48b021d" + "react-native": "0.0.0-2c473e1a3" }, "beachball": { "defaultNpmTag": "canary", diff --git a/vnext/src/Libraries/Components/Button.windows.js b/vnext/src/Libraries/Components/Button.windows.js index fda4b82c191..95cd9bab0e1 100644 --- a/vnext/src/Libraries/Components/Button.windows.js +++ b/vnext/src/Libraries/Components/Button.windows.js @@ -22,7 +22,7 @@ const View = require('./View/View'); const invariant = require('invariant'); import type {PressEvent} from '../Types/CoreEventTypes'; -import type {ColorValue} from '../StyleSheet/StyleSheetTypes'; +import type {ColorValue} from '../StyleSheet/StyleSheet'; type ButtonProps = $ReadOnly<{| /** diff --git a/vnext/src/Libraries/Components/Picker/Picker.windows.js b/vnext/src/Libraries/Components/Picker/Picker.windows.js index 3ef0268365f..a714acdebf7 100644 --- a/vnext/src/Libraries/Components/Picker/Picker.windows.js +++ b/vnext/src/Libraries/Components/Picker/Picker.windows.js @@ -18,7 +18,7 @@ const React = require('react'); const UnimplementedView = require('../UnimplementedViews/UnimplementedView'); import type {TextStyleProp} from '../../StyleSheet/StyleSheet'; -import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; +import type {ColorValue} from '../../StyleSheet/StyleSheet'; const MODE_DIALOG = 'dialog'; const MODE_DROPDOWN = 'dropdown'; diff --git a/vnext/src/Libraries/Components/RefreshControl/RefreshControl.windows.js b/vnext/src/Libraries/Components/RefreshControl/RefreshControl.windows.js index 7d04ab49c35..79ebe5b54b0 100644 --- a/vnext/src/Libraries/Components/RefreshControl/RefreshControl.windows.js +++ b/vnext/src/Libraries/Components/RefreshControl/RefreshControl.windows.js @@ -13,7 +13,7 @@ const Platform = require('../../Utilities/Platform'); const React = require('react'); -import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; +import type {ColorValue} from '../../StyleSheet/StyleSheet'; import type {ViewProps} from '../View/ViewPropTypes'; import AndroidSwipeRefreshLayoutNativeComponent, { Commands as AndroidSwipeRefreshLayoutCommands, diff --git a/vnext/src/Libraries/Components/Touchable/TouchableHighlight.windows.js b/vnext/src/Libraries/Components/Touchable/TouchableHighlight.windows.js index 407407d5c9e..2588a12cf72 100644 --- a/vnext/src/Libraries/Components/Touchable/TouchableHighlight.windows.js +++ b/vnext/src/Libraries/Components/Touchable/TouchableHighlight.windows.js @@ -15,7 +15,7 @@ import Pressability, { } from '../../Pressability/Pressability'; import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import StyleSheet, {type ViewStyleProp} from '../../StyleSheet/StyleSheet'; -import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; +import type {ColorValue} from '../../StyleSheet/StyleSheet'; import TVTouchable from './TVTouchable'; import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback'; import Platform from '../../Utilities/Platform'; diff --git a/vnext/src/RNTester/js/examples/View/ViewExample.windows.js b/vnext/src/RNTester/js/examples/View/ViewExample.windows.js index d7bb753f5e2..69de6b5933d 100644 --- a/vnext/src/RNTester/js/examples/View/ViewExample.windows.js +++ b/vnext/src/RNTester/js/examples/View/ViewExample.windows.js @@ -148,12 +148,53 @@ exports.examples = [ }, }, { - title: 'Circle with Border Radius', + title: 'Rounded Borders', render(): React.Node { return ( - + + + + + + ); }, }, diff --git a/vnext/src/index.windows.js b/vnext/src/index.windows.js index 529c32dd52d..fcea6c012c5 100644 --- a/vnext/src/index.windows.js +++ b/vnext/src/index.windows.js @@ -13,7 +13,6 @@ import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo'; import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator'; import typeof Button from './Libraries/Components/Button'; -import typeof CheckBox from './Libraries/Components/CheckBox/CheckBox'; import typeof DatePickerIOS from './Libraries/Components/DatePicker/DatePickerIOS'; import typeof DrawerLayoutAndroid from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid'; import typeof FlatList from './Libraries/Lists/FlatList'; @@ -96,8 +95,7 @@ import typeof Platform from './Libraries/Utilities/Platform'; import typeof processColor from './Libraries/StyleSheet/processColor'; import typeof {PlatformColor} from './Libraries/StyleSheet/PlatformColorValueTypes'; import typeof {DynamicColorIOS} from './Libraries/StyleSheet/PlatformColorValueTypesIOS'; -import typeof {ColorAndroid} from './Libraries/StyleSheet/PlatformColorValueTypesAndroid'; -import typeof RootTagContext from './Libraries/ReactNative/RootTagContext'; +import typeof {RootTagContext} from './Libraries/ReactNative/RootTag'; import typeof DeprecatedColorPropType from './Libraries/DeprecatedPropTypes/DeprecatedColorPropType'; import typeof DeprecatedEdgeInsetsPropType from './Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType'; import typeof DeprecatedPointPropType from './Libraries/DeprecatedPropTypes/DeprecatedPointPropType'; @@ -121,15 +119,6 @@ module.exports = { get Button(): Button { return require('./Libraries/Components/Button'); }, - get CheckBox(): CheckBox { - warnOnce( - 'checkBox-moved', - 'CheckBox has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/checkbox' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-checkbox', - ); - return require('./Libraries/Components/CheckBox/CheckBox'); - }, get DatePickerIOS(): DatePickerIOS { warnOnce( 'DatePickerIOS-merged', @@ -473,17 +462,13 @@ module.exports = { return require('./Libraries/StyleSheet/PlatformColorValueTypesIOS') .DynamicColorIOS; }, - get ColorAndroid(): ColorAndroid { - return require('./Libraries/StyleSheet/PlatformColorValueTypesAndroid') - .ColorAndroid; - }, get requireNativeComponent(): ( uiViewClassName: string, ) => HostComponent { return require('./Libraries/ReactNative/requireNativeComponent'); }, get unstable_RootTagContext(): RootTagContext { - return require('./Libraries/ReactNative/RootTagContext'); + return require('./Libraries/ReactNative/RootTag').RootTagContext; }, get unstable_enableLogBox(): () => void { return () => @@ -686,4 +671,17 @@ if (__DEV__) { ); }, }); + + // $FlowFixMe This is intentional: Flow will error when attempting to access CheckBox. + Object.defineProperty(module.exports, 'CheckBox', { + configurable: true, + get() { + invariant( + false, + 'CheckBox has been removed from React Native. ' + + "It can now be installed and imported from '@react-native-community/checkbox' instead of 'react-native'. " + + 'See https://github.com/react-native-community/react-native-checkbox', + ); + }, + }); } diff --git a/yarn.lock b/yarn.lock index 60fa5048049..36f7a57e799 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2624,6 +2624,22 @@ slash "^3.0.0" xmldoc "^1.1.2" +"@react-native-community/cli-platform-android@^4.7.0": + version "4.11.0" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-android/-/cli-platform-android-4.11.0.tgz#0ce9b88ed8b6b0ef962af49d980eb53433c17a84" + integrity sha512-BzqocGjOCjpDW0bM/LUrHMXw4nBvOhDXnHWxaoRp3eeUVsD2oSegoRn52kZo9yhPb9cCPkZJ3b+Web71Ue4j9w== + dependencies: + "@react-native-community/cli-tools" "^4.11.0" + chalk "^3.0.0" + execa "^1.0.0" + fs-extra "^8.1.0" + glob "^7.1.3" + jetifier "^1.6.2" + lodash "^4.17.15" + logkitty "^0.7.1" + slash "^3.0.0" + xmldoc "^1.1.2" + "@react-native-community/cli-platform-ios@^4.2.3": version "4.9.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-4.9.0.tgz#211ca9cd3976fbbb41406c0a846e445cc04c773c" @@ -2637,6 +2653,33 @@ plist "^3.0.1" xcode "^2.0.0" +"@react-native-community/cli-platform-ios@^4.7.0": + version "4.11.0" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-4.11.0.tgz#5870bf5f2b3c01a0aa672a7c1f7f0fe13337c6b5" + integrity sha512-/qkjnhhJ7BGBTNkHSS8a+z8UgWUQbU6YZOTuYxjNywGUzMiTsb/wlm2cWCY1VEAvWtY97c4plAZ5OferPJHaVA== + dependencies: + "@react-native-community/cli-tools" "^4.11.0" + chalk "^3.0.0" + glob "^7.1.3" + js-yaml "^3.13.1" + lodash "^4.17.15" + plist "^3.0.1" + xcode "^2.0.0" + +"@react-native-community/cli-server-api@^4.11.0": + version "4.11.0" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-server-api/-/cli-server-api-4.11.0.tgz#93887ab8496c9d89b53817297974670184be1191" + integrity sha512-vrRaGq7ezsxyyUsFhAboEtA1CHLDa2UpJygOWHip30LaAluM+vopAJbau2NtHVX54vgQzXo438Tx8TXiRacPhA== + dependencies: + "@react-native-community/cli-debugger-ui" "^4.9.0" + "@react-native-community/cli-tools" "^4.11.0" + compression "^1.7.1" + connect "^3.6.5" + errorhandler "^1.5.0" + pretty-format "^25.1.0" + serve-static "^1.13.1" + ws "^1.1.0" + "@react-native-community/cli-server-api@^4.9.0": version "4.9.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli-server-api/-/cli-server-api-4.9.0.tgz#503f50331c6e2cc8c5fcf6b693170e3a3a669d1a" @@ -2651,6 +2694,18 @@ serve-static "^1.13.1" ws "^1.1.0" +"@react-native-community/cli-tools@^4.11.0": + version "4.11.0" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-4.11.0.tgz#a53a51da76468a37f89ef7db808acc1d3c5f9cea" + integrity sha512-o2dh9q/778lIYBJxgIvTXkcxi9bSozjt8lv3tpyVmLZNA/PAPmQ7CafT37jWWwdmaSgP7nWyp4DtuE/gRsrXkA== + dependencies: + chalk "^3.0.0" + lodash "^4.17.15" + mime "^2.4.1" + node-fetch "^2.6.0" + open "^6.2.0" + shell-quote "1.6.1" + "@react-native-community/cli-tools@^4.9.0": version "4.9.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-4.9.0.tgz#d8fd0326cc2fcaeb8c920baf24b68b63c8164fa2" @@ -2713,6 +2768,46 @@ sudo-prompt "^9.0.0" wcwidth "^1.0.1" +"@react-native-community/cli@^4.7.0": + version "4.11.0" + resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-4.11.0.tgz#58faf2e27ab5601bd2d3ec1cd84a213d33a31480" + integrity sha512-pP2jB7294708pX81l6fjCxnBNGefRj8/X1nqGIgiMpHdI1WXfwR6XuegZPMGgxkiCISs7FZybV7TBl1jVxlVpA== + dependencies: + "@hapi/joi" "^15.0.3" + "@react-native-community/cli-debugger-ui" "^4.9.0" + "@react-native-community/cli-server-api" "^4.11.0" + "@react-native-community/cli-tools" "^4.11.0" + "@react-native-community/cli-types" "^4.10.1" + chalk "^3.0.0" + command-exists "^1.2.8" + commander "^2.19.0" + cosmiconfig "^5.1.0" + deepmerge "^3.2.0" + envinfo "^7.1.0" + execa "^1.0.0" + find-up "^4.1.0" + fs-extra "^8.1.0" + glob "^7.1.3" + graceful-fs "^4.1.3" + inquirer "^3.0.6" + leven "^3.1.0" + lodash "^4.17.15" + metro "^0.58.0" + metro-config "^0.58.0" + metro-core "^0.58.0" + metro-react-native-babel-transformer "^0.58.0" + metro-resolver "^0.58.0" + minimist "^1.2.0" + mkdirp "^0.5.1" + node-stream-zip "^1.9.1" + ora "^3.4.0" + pretty-format "^25.2.0" + semver "^6.3.0" + serve-static "^1.13.1" + strip-ansi "^5.2.0" + sudo-prompt "^9.0.0" + wcwidth "^1.0.1" + "@react-native-community/eslint-config@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-1.1.0.tgz#2dacad06dd44d13e778510864473fc6091f080c0" @@ -7047,10 +7142,10 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== -flow-bin@^0.122.0: - version "0.122.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.122.0.tgz#c723a2b33b1a70bd10204704ae1dc776d5d89d79" - integrity sha512-my8N5jgl/A+UVby9E7NDppHdhLgRbWgKbmFZSx2MSYMRh3d9YGnM2MM+wexpUpl0ftY1IM6ZcUwaAhrypLyvlA== +flow-bin@^0.123.0: + version "0.123.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.123.0.tgz#7ba61a0b8775928cf4943ccf78eed2b1b05f7b3a" + integrity sha512-Ylcf8YDIM/KrqtxkPuq+f8O+6sdYA2Nuz5f+sWHlp539DatZz3YMcsO1EiXaf1C11HJgpT/3YGYe7xZ9/UZmvQ== flow-parser@0.*: version "0.113.0" @@ -7653,6 +7748,11 @@ hermes-engine@~0.4.0: resolved "https://registry.yarnpkg.com/hermes-engine/-/hermes-engine-0.4.0.tgz#ea3113d472871ca4791f2d75d9f68b25d82ef92c" integrity sha512-7AO/K64GuVtcpUwUKDxyQXFN45RlqWrMIPMte6AeegMQMBh+MWuMU6ZOw8Jc7FGtsgiRqJRp+UX4+4UrFQXJ/A== +hermes-engine@~0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/hermes-engine/-/hermes-engine-0.5.1.tgz#601115e4b1e0a17d9aa91243b96277de4e926e09" + integrity sha512-hLwqh8dejHayjlpvZY40e1aDCDvyP98cWx/L5DhAjSJLH8g4z9Tp08D7y4+3vErDsncPOdf1bxm+zUWpx0/Fxg== + hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: version "2.8.4" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546" @@ -11570,7 +11670,7 @@ pretty-format@^24.7.0, pretty-format@^24.9.0: ansi-styles "^3.2.0" react-is "^16.8.4" -pretty-format@^25.1.0, pretty-format@^25.2.0: +pretty-format@^25.1.0, pretty-format@^25.2.0, pretty-format@^25.4.0: version "25.5.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.5.0.tgz#7873c1d774f682c34b8d48b6743a2bf2ac55791a" integrity sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ== @@ -11823,29 +11923,29 @@ react-native-tscodegen@0.62.1: nullthrows "1.1.1" typescript "^3.5.3" -react-native@0.0.0-4a48b021d: - version "0.0.0-4a48b021d" - resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.0.0-4a48b021d.tgz#f4d940ff41ee47228251490d1fb04de0f39a221e" - integrity sha512-SK23TSNJ5oQ3JP20G+si0G41xDxLx6T/hwiv8MgWRWolPucVl1isYQ+BJ8a/6n3yWvWBEkE80Dyr+7E1G8oLjA== +react-native@0.0.0-2c473e1a3: + version "0.0.0-2c473e1a3" + resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.0.0-2c473e1a3.tgz#98762f71c89ae2412559ca1a6fda51d24908f64d" + integrity sha512-lQMLaGdK18IIrBRe2QsSWFJWabgSnSXTAfTONxvf2XS62ajmsYUIimDiWTj33g8V7hRssiD6AN+7g8xQFangkA== dependencies: "@babel/runtime" "^7.0.0" - "@react-native-community/cli" "^4.2.4" - "@react-native-community/cli-platform-android" "^4.2.3" - "@react-native-community/cli-platform-ios" "^4.2.3" + "@react-native-community/cli" "^4.7.0" + "@react-native-community/cli-platform-android" "^4.7.0" + "@react-native-community/cli-platform-ios" "^4.7.0" abort-controller "^3.0.0" anser "^1.4.9" base64-js "^1.1.2" event-target-shim "^5.0.1" fbjs "^1.0.0" fbjs-scripts "^1.1.0" - hermes-engine "~0.4.0" + hermes-engine "~0.5.0" invariant "^2.2.4" jsc-android "^245459.0.0" metro-babel-register "0.59.0" metro-react-native-babel-transformer "0.59.0" metro-source-map "0.59.0" nullthrows "^1.1.1" - pretty-format "^24.9.0" + pretty-format "^25.4.0" promise "^8.0.3" prop-types "^15.7.2" react-devtools-core "^4.6.0" From e36e7c73f86361ee568f8660ed03ecf3d14d12bb Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 00:46:48 -0700 Subject: [PATCH 02/12] Merge vnext --- .../ReactCommon/yoga/yoga/Yoga.cpp | 17 ++- vnext/overrides.json | 20 +-- .../Components/TextInput/TextInput.windows.js | 65 +++++---- .../PlatformColorExample.windows.js | 137 +++++++----------- .../RNTester/js/utils/RNTesterList.windows.ts | 4 - 5 files changed, 114 insertions(+), 129 deletions(-) diff --git a/vnext/DeforkingPatches/ReactCommon/yoga/yoga/Yoga.cpp b/vnext/DeforkingPatches/ReactCommon/yoga/yoga/Yoga.cpp index 290247de7c5..7338f065779 100644 --- a/vnext/DeforkingPatches/ReactCommon/yoga/yoga/Yoga.cpp +++ b/vnext/DeforkingPatches/ReactCommon/yoga/yoga/Yoga.cpp @@ -1663,8 +1663,8 @@ static void YGNodeAbsoluteLayoutChild( static void YGNodeWithMeasureFuncSetMeasuredDimensions( const YGNodeRef node, - const float availableWidth, - const float availableHeight, + float availableWidth, + float availableHeight, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, const float ownerWidth, @@ -1677,6 +1677,13 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( node->hasMeasureFunc(), "Expected node to have custom measure function"); + if (widthMeasureMode == YGMeasureModeUndefined) { + availableWidth = YGUndefined; + } + if (heightMeasureMode == YGMeasureModeUndefined) { + availableHeight = YGUndefined; + } + const float paddingAndBorderAxisRow = YGNodePaddingAndBorderForAxis(node, YGFlexDirectionRow, ownerWidth); const float paddingAndBorderAxisColumn = @@ -3814,8 +3821,10 @@ bool YGLayoutNodeInternal( if (needToVisitNode) { // Invalidate the cached results. layout->nextCachedMeasurementsIndex = 0; - layout->cachedLayout.widthMeasureMode = (YGMeasureMode)-1; - layout->cachedLayout.heightMeasureMode = (YGMeasureMode)-1; + layout->cachedLayout.availableWidth = -1; + layout->cachedLayout.availableHeight = -1; + layout->cachedLayout.widthMeasureMode = YGMeasureModeUndefined; + layout->cachedLayout.heightMeasureMode = YGMeasureModeUndefined; layout->cachedLayout.computedWidth = -1; layout->cachedLayout.computedHeight = -1; } diff --git a/vnext/overrides.json b/vnext/overrides.json index 0545badbd3d..089e61eafb9 100644 --- a/vnext/overrides.json +++ b/vnext/overrides.json @@ -40,8 +40,8 @@ "type": "patch", "file": "DeforkingPatches/ReactCommon/yoga/yoga/Yoga.cpp", "baseFile": "ReactCommon/yoga/yoga/Yoga.cpp", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "8d6ec976334a009920300bd700cb04adf11e0f03", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "baf6b8bf6893f2929abc8614ddecf4095191231b", "issue": 3994 }, { @@ -238,8 +238,8 @@ "type": "derived", "file": "src/Libraries/Components/Picker/PickerWindows.tsx", "baseFile": "Libraries/Components/Picker/PickerIOS.ios.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "f15d5ab6c73a202608d66eb90f41497cb1fc6dc4", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "1a94e2e99474b15141d1c67c1211ac1dc2c2a62d", "issue": 4611 }, { @@ -292,8 +292,8 @@ "type": "patch", "file": "src/Libraries/Components/TextInput/TextInput.windows.js", "baseFile": "Libraries/Components/TextInput/TextInput.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "a50310f6dee460f7d1a53e0f1a21dbac9cf02094", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "9d9e65ecd506387e98d0ef5a58321c568a95ad41", "issue": "LEGACY_FIXME" }, { @@ -501,8 +501,8 @@ "type": "derived", "file": "src/RNTester/js/examples/PlatformColor/PlatformColorExample.windows.js", "baseFile": "RNTester/js/examples/PlatformColor/PlatformColorExample.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "f1c2babe02e11d237dbab875b8a7cd63fce048b6", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "a63038b104bcf3caa0984d994bf3916ef1aa38ee", "issue": 4055 }, { @@ -541,8 +541,8 @@ "type": "derived", "file": "src/RNTester/js/utils/RNTesterList.windows.ts", "baseFile": "RNTester/js/utils/RNTesterList.android.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "65c3876bdbc2755cd568b2779ed962fa7a4edf6a", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "20a6f5c42266beb017dccc7f22d45bde02907d89", "issue": "LEGACY_FIXME" }, { diff --git a/vnext/src/Libraries/Components/TextInput/TextInput.windows.js b/vnext/src/Libraries/Components/TextInput/TextInput.windows.js index 33114f05f84..25cda364089 100644 --- a/vnext/src/Libraries/Components/TextInput/TextInput.windows.js +++ b/vnext/src/Libraries/Components/TextInput/TextInput.windows.js @@ -13,7 +13,6 @@ const DeprecatedTextInputPropTypes = require('../../DeprecatedPropTypes/DeprecatedTextInputPropTypes'); const Platform = require('../../Utilities/Platform'); const React = require('react'); -const ReactNative = require('../../Renderer/shims/ReactNative'); const StyleSheet = require('../../StyleSheet/StyleSheet'); const Text = require('../../Text/Text'); const TextAncestor = require('../../Text/TextAncestor'); @@ -29,11 +28,12 @@ const nullthrows = require('nullthrows'); const setAndForwardRef = require('../../Utilities/setAndForwardRef'); import type {TextStyleProp, ViewStyleProp} from '../../StyleSheet/StyleSheet'; -import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; +import type {ColorValue} from '../../StyleSheet/StyleSheet'; import type {ViewProps} from '../View/ViewPropTypes'; import type {SyntheticEvent, ScrollEvent} from '../../Types/CoreEventTypes'; import type {PressEvent} from '../../Types/CoreEventTypes'; import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; +import type {TextInputNativeCommands} from './TextInputNativeCommands'; const {useEffect, useRef, useState} = React; @@ -41,9 +41,12 @@ type ReactRefSetter = {current: null | T, ...} | ((ref: null | T) => mixed); let AndroidTextInput; let AndroidTextInputCommands; -let RCTMultilineTextInputView; let RCTSinglelineTextInputView; -let RCTTextInput; // [Windows] +let RCTSinglelineTextInputNativeCommands; +let RCTMultilineTextInputView; +let RCTMultilineTextInputNativeCommands; +let WindowsTextInput; // [Windows] +let WindowsTextInputCommands; // [Windows] // [Windows if (Platform.OS === 'android') { @@ -51,14 +54,20 @@ if (Platform.OS === 'android') { AndroidTextInputCommands = require('./AndroidTextInputNativeComponent') .Commands; } else if (Platform.OS === 'ios') { - RCTMultilineTextInputView = require('./RCTMultilineTextInputNativeComponent') - .default; RCTSinglelineTextInputView = require('./RCTSingelineTextInputNativeComponent') .default; + RCTSinglelineTextInputNativeCommands = require('./RCTSingelineTextInputNativeComponent') + .Commands; + RCTMultilineTextInputView = require('./RCTMultilineTextInputNativeComponent') + .default; + RCTMultilineTextInputNativeCommands = require('./RCTMultilineTextInputNativeComponent') + .Commands; } // [Windows else if (Platform.OS === 'windows') { - RCTTextInput = requireNativeComponent('RCTTextInput'); + const nativeComponent = requireNativeComponent('RCTTextInput'); + WindowsTextInput = nativeComponent; + WindowsTextInputCommands = nativeComponent.Commands; } // Windows] @@ -856,6 +865,21 @@ function InternalTextInput(props: Props): React.Node { selection = null; } + let viewCommands: TextInputNativeCommands>; + if (AndroidTextInputCommands) { + viewCommands = AndroidTextInputCommands; + } + // [Windows + else if (WindowsTextInputCommands) { + viewCommands = WindowsTextInputCommands; + } + // Windows] + else { + viewCommands = props.multiline + ? RCTMultilineTextInputNativeCommands + : RCTSinglelineTextInputNativeCommands; + } + const text = typeof props.value === 'string' ? props.value @@ -888,16 +912,14 @@ function InternalTextInput(props: Props): React.Node { return; } - if (AndroidTextInputCommands && inputRef.current != null) { - AndroidTextInputCommands.setTextAndSelection( + if (inputRef.current != null) { + viewCommands.setTextAndSelection( inputRef.current, mostRecentEventCount, text, selection?.start ?? -1, selection?.end ?? -1, ); - } else if (inputRef.current != null) { - inputRef.current.setNativeProps(nativeUpdate); } }, [ mostRecentEventCount, @@ -908,6 +930,7 @@ function InternalTextInput(props: Props): React.Node { selection, lastNativeSelection, text, + viewCommands, ]); useEffect(() => { @@ -932,16 +955,14 @@ function InternalTextInput(props: Props): React.Node { }, [inputRef]); function clear(): void { - if (AndroidTextInputCommands && inputRef.current != null) { - AndroidTextInputCommands.setTextAndSelection( + if (inputRef.current != null) { + viewCommands.setTextAndSelection( inputRef.current, mostRecentEventCount, '', 0, 0, ); - } else if (inputRef.current != null) { - inputRef.current.setNativeProps({text: ''}); } } @@ -996,17 +1017,6 @@ function InternalTextInput(props: Props): React.Node { }; const _onChange = (event: ChangeEvent) => { - if (AndroidTextInputCommands && inputRef.current != null) { - // Do nothing - } else if (inputRef.current != null) { - // Make sure to fire the mostRecentEventCount first so it is already set on - // native when the text value is set. - // This is now only relevant on iOS until we migrate to ViewCommands everywhere - inputRef.current.setNativeProps({ - mostRecentEventCount: event.nativeEvent.eventCount, - }); - } - const text = event.nativeEvent.text; props.onChange && props.onChange(event); props.onChangeText && props.onChangeText(text); @@ -1084,6 +1094,7 @@ function InternalTextInput(props: Props): React.Node { ref={_setNativeRef} {...props} dataDetectorTypes={props.dataDetectorTypes} + mostRecentEventCount={mostRecentEventCount} onBlur={_onBlur} onChange={_onChange} onContentSizeChange={props.onContentSizeChange} @@ -1136,7 +1147,7 @@ function InternalTextInput(props: Props): React.Node { } // [Windows else if (Platform.OS === 'windows') { textInput = ( - - - ColorAndroid('?attr/colorAccent') - - - - ) : ( - Not applicable on this platform - ); -} - function VariantColorsExample() { return ( @@ -318,7 +293,7 @@ function VariantColorsExample() { {Platform.select({ ios: "DynamicColorIOS({light: 'red', dark: 'blue'})", - android: "ColorAndroid('?attr/colorAccent')", + android: "PlatformColor('?attr/colorAccent')", default: 'Unexpected Platform.OS: ' + Platform.OS, })} @@ -329,7 +304,7 @@ function VariantColorsExample() { Platform.OS === 'ios' ? DynamicColorIOS({light: 'red', dark: 'blue'}) : Platform.OS === 'android' - ? ColorAndroid('?attr/colorAccent') + ? PlatformColor('?attr/colorAccent') : 'red', }} /> @@ -374,12 +349,6 @@ exports.examples = [ return ; }, }, - { - title: 'Android Colors', - render(): React.Element { - return ; - }, - }, { title: 'Variant Colors', render(): React.Element { diff --git a/vnext/src/RNTester/js/utils/RNTesterList.windows.ts b/vnext/src/RNTester/js/utils/RNTesterList.windows.ts index d6f81af632f..47d8cbad4d8 100644 --- a/vnext/src/RNTester/js/utils/RNTesterList.windows.ts +++ b/vnext/src/RNTester/js/utils/RNTesterList.windows.ts @@ -35,10 +35,6 @@ const ComponentExamples: Array = [ key: 'ButtonExample', module: require('react-native/RNTester/js/examples/Button/ButtonExample'), }, - { - key: 'CheckBoxExample', - module: require('react-native/RNTester/js/examples/CheckBox/CheckBoxExample'), - }, { key: 'CustomViewExample', module: require('./../examples-win/CustomView/CustomViewExample'), From cece364d6a442640efca08328e44b5a403cf095d Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 00:53:52 -0700 Subject: [PATCH 03/12] Remove checkbox from vnext Fixes #4694 --- packages/playground/windows/playground.sln | 1 - .../Base/CoreUIManagers.cpp | 2 - .../Microsoft.ReactNative.vcxproj | 2 - .../Microsoft.ReactNative.vcxproj.filters | 6 - .../Views/CheckboxViewManager.cpp | 148 ------------ .../Views/CheckboxViewManager.h | 35 --- vnext/overrides.json | 12 - .../CheckBox/CheckBox.windesktop.js | 9 - .../Components/CheckBox/CheckBox.windows.js | 228 ------------------ .../Components/CheckBox/CheckBoxProps.ts | 21 -- 10 files changed, 464 deletions(-) delete mode 100644 vnext/Microsoft.ReactNative/Views/CheckboxViewManager.cpp delete mode 100644 vnext/Microsoft.ReactNative/Views/CheckboxViewManager.h delete mode 100644 vnext/src/Libraries/Components/CheckBox/CheckBox.windesktop.js delete mode 100644 vnext/src/Libraries/Components/CheckBox/CheckBox.windows.js delete mode 100644 vnext/src/Libraries/Components/CheckBox/CheckBoxProps.ts diff --git a/packages/playground/windows/playground.sln b/packages/playground/windows/playground.sln index bcf96e029d1..96fad1d1a65 100644 --- a/packages/playground/windows/playground.sln +++ b/packages/playground/windows/playground.sln @@ -42,7 +42,6 @@ Global ..\..\..\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\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 - ..\..\..\vnext\JSI\Shared\JSI.Shared.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 diff --git a/vnext/Microsoft.ReactNative/Base/CoreUIManagers.cpp b/vnext/Microsoft.ReactNative/Base/CoreUIManagers.cpp index 0b9e496ee5c..d51e713f214 100644 --- a/vnext/Microsoft.ReactNative/Base/CoreUIManagers.cpp +++ b/vnext/Microsoft.ReactNative/Base/CoreUIManagers.cpp @@ -10,7 +10,6 @@ // Standard View Managers #include -#include #include #include #include @@ -41,7 +40,6 @@ void AddStandardViewManagers( std::vector> &viewManagers, std::shared_ptr const &instance) noexcept { viewManagers.push_back(std::make_unique(instance)); - viewManagers.push_back(std::make_unique(instance)); viewManagers.push_back(std::make_unique(instance)); viewManagers.push_back(std::make_unique(instance)); viewManagers.push_back(std::make_unique(instance)); diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj index 50b317de1a5..d5b40a29437 100644 --- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj @@ -303,7 +303,6 @@ - @@ -490,7 +489,6 @@ - diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters index 82d62a14daa..f9949f312d2 100644 --- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters @@ -209,9 +209,6 @@ Views - - Views - Views @@ -566,9 +563,6 @@ Views - - Views - Views diff --git a/vnext/Microsoft.ReactNative/Views/CheckboxViewManager.cpp b/vnext/Microsoft.ReactNative/Views/CheckboxViewManager.cpp deleted file mode 100644 index 930f6224c44..00000000000 --- a/vnext/Microsoft.ReactNative/Views/CheckboxViewManager.cpp +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" - -#include -#include "CheckboxViewManager.h" - -#include -#include -#include - -#include -#include - -namespace winrt { -using ToggleButton = xaml::Controls::Primitives::ToggleButton; -} - -namespace react::uwp { - -class CheckBoxShadowNode : public ShadowNodeBase { - using Super = ShadowNodeBase; - - public: - CheckBoxShadowNode() = default; - void createView() override; - void updateProperties(const folly::dynamic &&props) override; - - void RegisterChangedEvents(); - void UnregisterChangedEvents(); - - private: - static void OnCheckedChanged(IReactInstance &instance, int64_t tag, bool newValue); - - xaml::Controls::CheckBox::Checked_revoker m_checkBoxCheckedRevoker{}; - xaml::Controls::CheckBox::Unchecked_revoker m_checkBoxUncheckedRevoker{}; -}; - -void CheckBoxShadowNode::createView() { - Super::createView(); - - RegisterChangedEvents(); -} - -void CheckBoxShadowNode::RegisterChangedEvents() { - auto checkbox = GetView().as(); - auto wkinstance = GetViewManager()->GetReactInstance(); - - m_checkBoxCheckedRevoker = checkbox.Checked(winrt::auto_revoke, [=](auto &&, auto &&) { - auto instance = wkinstance.lock(); - if (!m_updating && instance != nullptr) - OnCheckedChanged(*instance, m_tag, true); - }); - m_checkBoxUncheckedRevoker = checkbox.Unchecked(winrt::auto_revoke, [=](auto &&, auto &&) { - auto instance = wkinstance.lock(); - if (!m_updating && instance != nullptr) - OnCheckedChanged(*instance, m_tag, false); - }); -} - -void CheckBoxShadowNode::UnregisterChangedEvents() { - m_checkBoxCheckedRevoker.revoke(); - m_checkBoxUncheckedRevoker.revoke(); -} - -void CheckBoxShadowNode::updateProperties(const folly::dynamic &&props) { - m_updating = true; - Super::updateProperties(std::move(props)); - m_updating = false; -} - -/*static*/ void CheckBoxShadowNode::OnCheckedChanged(IReactInstance &instance, int64_t tag, bool newValue) { - folly::dynamic eventData = folly::dynamic::object("target", tag)("value", newValue); - instance.DispatchEvent(tag, "topChange", std::move(eventData)); -} - -CheckBoxViewManager::CheckBoxViewManager(const std::shared_ptr &reactInstance) : Super(reactInstance) {} - -const char *CheckBoxViewManager::GetName() const { - return "AndroidCheckBox"; -} - -folly::dynamic CheckBoxViewManager::GetNativeProps() const { - auto props = Super::GetNativeProps(); - - props.update(folly::dynamic::object("on", "boolean")("enabled", "boolean")); - - return props; -} - -facebook::react::ShadowNode *CheckBoxViewManager::createShadow() const { - return new CheckBoxShadowNode(); -} - -XamlView CheckBoxViewManager::CreateViewCore(int64_t /*tag*/) { - auto checkbox = xaml::Controls::CheckBox(); - return checkbox; -} - -bool CheckBoxViewManager::UpdateProperty( - ShadowNodeBase *nodeToUpdate, - const std::string &propertyName, - const folly::dynamic &propertyValue) { - auto checkbox = nodeToUpdate->GetView().as(); - if (checkbox == nullptr) - return true; - - if (propertyName == "enabled") { - if (propertyValue.isBool()) - checkbox.IsEnabled(propertyValue.asBool()); - else if (propertyValue.isNull()) - checkbox.ClearValue(xaml::Controls::Control::IsEnabledProperty()); - } else if (propertyName == "on") { - if (propertyValue.isBool()) - checkbox.IsChecked(propertyValue.asBool()); - else if (propertyValue.isNull()) - checkbox.ClearValue(winrt::ToggleButton::IsCheckedProperty()); - } else { - return Super::UpdateProperty(nodeToUpdate, propertyName, propertyValue); - } - return true; -} - -void CheckBoxViewManager::DispatchCommand( - const XamlView &viewToUpdate, - const std::string &commandId, - const folly::dynamic &commandArgs) { - if (commandId == "setNativeValue") { - auto value = commandArgs[0].asBool(); - - if (auto instance = GetReactInstance().lock()) { - auto shadow = static_cast( - instance->NativeUIManager()->getHost()->FindShadowNodeForTag(GetTag(viewToUpdate))); - // we unregister the changed events and then restore them so that we don't fire an - // onChange event to JS when JS itself is updating the value of the checkbox - shadow->UnregisterChangedEvents(); - viewToUpdate.as().IsChecked(value); - shadow->RegisterChangedEvents(); - } - - viewToUpdate.as().IsChecked(value); - } else { - Super::DispatchCommand(viewToUpdate, commandId, commandArgs); - } -} - -} // namespace react::uwp diff --git a/vnext/Microsoft.ReactNative/Views/CheckboxViewManager.h b/vnext/Microsoft.ReactNative/Views/CheckboxViewManager.h deleted file mode 100644 index fb445e28edf..00000000000 --- a/vnext/Microsoft.ReactNative/Views/CheckboxViewManager.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#pragma once - -#include - -namespace react::uwp { - -class CheckBoxViewManager : public ControlViewManager { - using Super = ControlViewManager; - - public: - CheckBoxViewManager(const std::shared_ptr &reactInstance); - - const char *GetName() const override; - folly::dynamic GetNativeProps() const override; - - facebook::react::ShadowNode *createShadow() const override; - - protected: - bool UpdateProperty( - ShadowNodeBase *nodeToUpdate, - const std::string &propertyName, - const folly::dynamic &propertyValue) override; - - void DispatchCommand(const XamlView &viewToUpdate, const std::string &commandId, const folly::dynamic &commandArgs) - override; - - XamlView CreateViewCore(int64_t tag) override; - - friend class CheckBoxShadowNode; -}; - -} // namespace react::uwp diff --git a/vnext/overrides.json b/vnext/overrides.json index 089e61eafb9..2639f6de242 100644 --- a/vnext/overrides.json +++ b/vnext/overrides.json @@ -136,18 +136,6 @@ "baseHash": "3c1baecf9171422511a08436edd423c5da9cf5c2", "issue": "LEGACY_FIXME" }, - { - "type": "copy", - "file": "src/Libraries/Components/CheckBox/CheckBox.windows.js", - "baseFile": "Libraries/Components/CheckBox/CheckBox.android.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "278d7049749ba8b5f3840f21ef6b3d528183829f", - "issue": 4694 - }, - { - "type": "platform", - "file": "src/Libraries/Components/CheckBox/CheckBoxProps.ts" - }, { "type": "platform", "file": "src/Libraries/Components/DatePicker/DatePicker.tsx" diff --git a/vnext/src/Libraries/Components/CheckBox/CheckBox.windesktop.js b/vnext/src/Libraries/Components/CheckBox/CheckBox.windesktop.js deleted file mode 100644 index 101a12e9f7c..00000000000 --- a/vnext/src/Libraries/Components/CheckBox/CheckBox.windesktop.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * @format - */ - -'use strict'; - -module.exports = require('../UnimplementedViews/UnimplementedView'); diff --git a/vnext/src/Libraries/Components/CheckBox/CheckBox.windows.js b/vnext/src/Libraries/Components/CheckBox/CheckBox.windows.js deleted file mode 100644 index aed9cd9eb38..00000000000 --- a/vnext/src/Libraries/Components/CheckBox/CheckBox.windows.js +++ /dev/null @@ -1,228 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -const React = require('react'); -const StyleSheet = require('../../StyleSheet/StyleSheet'); -const invariant = require('invariant'); -const processColor = require('../../StyleSheet/processColor'); - -const nullthrows = require('nullthrows'); -const setAndForwardRef = require('../../Utilities/setAndForwardRef'); - -import AndroidCheckBoxNativeComponent, { - Commands as AndroidCheckBoxCommands, -} from './AndroidCheckBoxNativeComponent'; - -import type {ViewProps} from '../View/ViewPropTypes'; -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; -import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; - -type CheckBoxEvent = SyntheticEvent< - $ReadOnly<{| - target: number, - value: boolean, - |}>, ->; - -type CommonProps = $ReadOnly<{| - ...ViewProps, - - /** - * Used in case the props change removes the component. - */ - onChange?: ?(event: CheckBoxEvent) => mixed, - - /** - * Invoked with the new value when the value changes. - */ - onValueChange?: ?(value: boolean) => mixed, - - /** - * Used to locate this view in end-to-end tests. - */ - testID?: ?string, -|}>; - -type Props = $ReadOnly<{| - ...CommonProps, - - /** - * The value of the checkbox. If true the checkbox will be turned on. - * Default value is false. - */ - value?: ?boolean, - - /** - * If true the user won't be able to toggle the checkbox. - * Default value is false. - */ - disabled?: ?boolean, - - /** - * Used to get the ref for the native checkbox - */ - forwardedRef?: ?React.Ref, - - /** - * Controls the colors the checkbox has in checked and unchecked states. - */ - tintColors?: {|true?: ?ColorValue, false?: ?ColorValue|}, -|}>; - -/** - * Renders a boolean input (Android only). - * - * This is a controlled component that requires an `onValueChange` callback that - * updates the `value` prop in order for the component to reflect user actions. - * If the `value` prop is not updated, the component will continue to render - * the supplied `value` prop instead of the expected result of any user actions. - * - * ``` - * import React from 'react'; - * import { AppRegistry, StyleSheet, Text, View, CheckBox } from 'react-native'; - * - * export default class App extends React.Component { - * constructor(props) { - * super(props); - * this.state = { - * checked: false - * } - * } - * - * toggle() { - * this.setState(({checked}) => { - * return { - * checked: !checked - * }; - * }); - * } - * - * render() { - * const {checked} = this.state; - * return ( - * - * Checked - * - * - * ); - * } - * } - * - * const styles = StyleSheet.create({ - * container: { - * flex: 1, - * flexDirection: 'row', - * alignItems: 'center', - * justifyContent: 'center', - * }, - * }); - * - * // skip this line if using Create React Native App - * AppRegistry.registerComponent('App', () => App); - * ``` - * - * @keyword checkbox - * @keyword toggle - */ -class CheckBox extends React.Component { - _nativeRef: ?React.ElementRef = null; - _setNativeRef = setAndForwardRef({ - getForwardedRef: () => this.props.forwardedRef, - setLocalRef: ref => { - this._nativeRef = ref; - }, - }); - - _onChange = (event: CheckBoxEvent) => { - const value = this.props.value ?? false; - AndroidCheckBoxCommands.setNativeValue(nullthrows(this._nativeRef), value); - // Change the props after the native props are set in case the props - // change removes the component - this.props.onChange && this.props.onChange(event); - this.props.onValueChange && - this.props.onValueChange(event.nativeEvent.value); - }; - - _getTintColors(tintColors) { - if (tintColors) { - const processedTextColorTrue = processColor(tintColors.true); - invariant( - processedTextColorTrue == null || - typeof processedTextColorTrue === 'number', - 'Unexpected color given for tintColors.true', - ); - const processedTextColorFalse = processColor(tintColors.true); - invariant( - processedTextColorFalse == null || - typeof processedTextColorFalse === 'number', - 'Unexpected color given for tintColors.false', - ); - return { - true: processedTextColorTrue, - false: processedTextColorFalse, - }; - } else { - return undefined; - } - } - - render() { - const { - disabled: _, - value: __, - tintColors, - style, - forwardedRef, - ...props - } = this.props; - const disabled = this.props.disabled ?? false; - const value = this.props.value ?? false; - - const nativeProps = { - ...props, - onStartShouldSetResponder: () => true, - onResponderTerminationRequest: () => false, - enabled: !disabled, - on: value, - tintColors: this._getTintColors(tintColors), - style: [styles.rctCheckBox, style], - }; - return ( - - ); - } -} - -const styles = StyleSheet.create({ - rctCheckBox: { - height: 32, - width: 32, - }, -}); - -type CheckBoxType = React.AbstractComponent< - Props, - React.ElementRef, ->; - -const CheckBoxWithRef = React.forwardRef< - Props, - React.ElementRef, ->(function CheckBoxWithRef(props, ref) { - return ; -}); - -module.exports = (CheckBoxWithRef: CheckBoxType); diff --git a/vnext/src/Libraries/Components/CheckBox/CheckBoxProps.ts b/vnext/src/Libraries/Components/CheckBox/CheckBoxProps.ts deleted file mode 100644 index 40c29674d51..00000000000 --- a/vnext/src/Libraries/Components/CheckBox/CheckBoxProps.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * @format - */ - -import {ViewProps} from 'react-native'; - -export interface ICheckBoxProps extends ViewProps { - value?: boolean; - disabled?: boolean; - onChange?: (event: ICheckBoxChangeEvent) => void; - onValueChange?: (value: boolean) => void; - defaultChecked?: boolean; -} - -export interface ICheckBoxChangeEvent { - nativeEvent: { - value: boolean; - }; -} From bcfc87d52811604f92482501b2884e91e4a35d4b Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 00:58:52 -0700 Subject: [PATCH 04/12] Fixup PlatformColor Imports --- .../src/Libraries/StyleSheet/PlatformColorValueTypesWin32.js | 2 +- .../Libraries/StyleSheet/PlatformColorValueTypes.windesktop.js | 2 +- .../src/Libraries/StyleSheet/PlatformColorValueTypes.windows.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-native-win32/src/Libraries/StyleSheet/PlatformColorValueTypesWin32.js b/packages/react-native-win32/src/Libraries/StyleSheet/PlatformColorValueTypesWin32.js index 276eea32a3d..20cbe7a531d 100644 --- a/packages/react-native-win32/src/Libraries/StyleSheet/PlatformColorValueTypesWin32.js +++ b/packages/react-native-win32/src/Libraries/StyleSheet/PlatformColorValueTypesWin32.js @@ -10,7 +10,7 @@ 'use strict'; -import type {ColorValue} from './StyleSheetTypes'; +import type {ColorValue} from './StyleSheet'; import type {GradientColorValueWin32} from './PlatformColorValueTypes'; import {ColorGradientWin32Private} from './PlatformColorValueTypes'; diff --git a/vnext/src/Libraries/StyleSheet/PlatformColorValueTypes.windesktop.js b/vnext/src/Libraries/StyleSheet/PlatformColorValueTypes.windesktop.js index 69c016c68e2..b9e7d9c9936 100644 --- a/vnext/src/Libraries/StyleSheet/PlatformColorValueTypes.windesktop.js +++ b/vnext/src/Libraries/StyleSheet/PlatformColorValueTypes.windesktop.js @@ -10,7 +10,7 @@ 'use strict'; -import type {ColorValue} from './StyleSheetTypes'; +import type {ColorValue} from './StyleSheet'; import type {ProcessedColorValue} from './processColor'; export opaque type NativeColorValue = { diff --git a/vnext/src/Libraries/StyleSheet/PlatformColorValueTypes.windows.js b/vnext/src/Libraries/StyleSheet/PlatformColorValueTypes.windows.js index 69c016c68e2..b9e7d9c9936 100644 --- a/vnext/src/Libraries/StyleSheet/PlatformColorValueTypes.windows.js +++ b/vnext/src/Libraries/StyleSheet/PlatformColorValueTypes.windows.js @@ -10,7 +10,7 @@ 'use strict'; -import type {ColorValue} from './StyleSheetTypes'; +import type {ColorValue} from './StyleSheet'; import type {ProcessedColorValue} from './processColor'; export opaque type NativeColorValue = { From 20eefb1144a03aeb88172742a70e62b508fbcbe7 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 04:23:56 -0700 Subject: [PATCH 05/12] ViewManager Commands for Windows Textbox And lint:fix --- .../E2ETest/wdio/test/VisitAllPages.spec.ts | 1 + .../Views/TextInputViewManager.cpp | 130 ++++-- .../Views/ViewManagerBase.h | 2 +- vnext/overrides.json | 8 + .../Components/TextInput/TextInput.windows.js | 8 +- .../TextInput/TextInputExample.windows.js | 425 ++++++++++++++++++ .../RNTester/js/utils/RNTesterList.windows.ts | 4 + 7 files changed, 532 insertions(+), 46 deletions(-) create mode 100644 vnext/src/RNTester/js/examples/TextInput/TextInputExample.windows.js diff --git a/packages/E2ETest/wdio/test/VisitAllPages.spec.ts b/packages/E2ETest/wdio/test/VisitAllPages.spec.ts index a3f4b097bdc..262e4406a79 100644 --- a/packages/E2ETest/wdio/test/VisitAllPages.spec.ts +++ b/packages/E2ETest/wdio/test/VisitAllPages.spec.ts @@ -29,6 +29,7 @@ let pages = [ // '', '', '', + '', ' and onPress', '', '', diff --git a/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp b/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp index 892ca953aa1..a2886bf7eb5 100644 --- a/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp +++ b/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp @@ -15,6 +15,7 @@ #include #include +#include #ifdef USE_WINUI3 namespace winrt::Microsoft::UI::Xaml::Controls { @@ -31,20 +32,9 @@ using namespace xaml::Shapes; namespace react::uwp { struct Selection { - int start = -1; - int end = -1; - bool isValid(); + int64_t start = -1; + int64_t end = -1; }; - -bool Selection::isValid() { - if (start < 0) - return false; - if (end < 0) - return false; - if (start > end) - return false; - return true; -} } // namespace react::uwp // Such code is better to move to a seperate parser layer @@ -54,13 +44,13 @@ struct json_type_traits { react::uwp::Selection selection; for (auto &item : json.items()) { if (item.first == "start") { - auto start = item.second.asDouble(); - if (start == static_cast(start)) - selection.start = static_cast(start); + auto start = item.second.asInt(); + if (start == start) + selection.start = start; } else if (item.first == "end") { - auto end = item.second.asDouble(); - if (end == static_cast(end)) - selection.end = static_cast(end); + auto end = item.second.asInt(); + if (end == end) + selection.end = end; } } return selection; @@ -103,6 +93,25 @@ class TextInputShadowNode : public ShadowNodeBase { void createView() override; void updateProperties(const folly::dynamic &&props) override; + void dispatchCommand(const std::string &commandId, const folly::dynamic &commandArgs) override; + + void removeAllChildren() override { + // NYI #5689 + YellowBox("Nested elements in TextInput are currently unsupported on Windows"); + } + void AddView(ShadowNode & /*child*/, int64_t /*index*/) override { + // NYI #5689 + YellowBox("Nested elements in TextInput are currently unsupported on Windows"); + } + void RemoveChildAt(int64_t /*indexToRemove*/) override { + // NYI #5689 + YellowBox("Nested elements in TextInput are currently unsupported on Windows"); + } + void ReplaceChild(const XamlView & /*oldChildView*/, const XamlView & /*newChildView*/) override { + // NYI #5689 + YellowBox("Nested elements in TextInput are currently unsupported on Windows"); + } + bool ImplementsPadding() override { return true; } @@ -112,6 +121,8 @@ class TextInputShadowNode : public ShadowNodeBase { void registerEvents(); void HideCaretIfNeeded(); void setPasswordBoxPlaceholderForeground(xaml::Controls::PasswordBox passwordBox, folly::dynamic color); + void SetText(const folly::dynamic &text); + void SetSelection(int64_t start, int64_t end); winrt::Shape FindCaret(xaml::DependencyObject element); bool m_shouldClearTextOnFocus = false; @@ -544,9 +555,7 @@ void TextInputShadowNode::updateProperties(const folly::dynamic &&props) { } else if (propertyName == "selection") { if (propertyValue.isObject()) { auto selection = json_type_traits::parseJson(propertyValue); - - if (selection.isValid()) - textBox.Select(selection.start, selection.end - selection.start); + SetSelection(selection.start, selection.end); } } else if (propertyName == "spellCheck") { if (propertyValue.isBool()) @@ -554,16 +563,7 @@ void TextInputShadowNode::updateProperties(const folly::dynamic &&props) { else if (propertyValue.isNull()) textBox.ClearValue(xaml::Controls::TextBox::IsSpellCheckEnabledProperty()); } else if (propertyName == "text") { - if (m_mostRecentEventCount == m_nativeEventCount) { - if (propertyValue.isString()) { - auto oldValue = textBox.Text(); - auto newValue = asHstring(propertyValue); - if (oldValue != newValue) { - textBox.Text(newValue); - } - } else if (propertyValue.isNull()) - textBox.ClearValue(xaml::Controls::TextBox::TextProperty()); - } + SetText(propertyValue); } else if (propertyName == "autoCapitalize") { if (textBox.try_as()) { if (propertyValue.isString()) { @@ -579,16 +579,7 @@ void TextInputShadowNode::updateProperties(const folly::dynamic &&props) { } } else { // Applicable properties for PasswordBox if (propertyName == "text" && !m_isTextBox) { - if (m_mostRecentEventCount == m_nativeEventCount) { - if (propertyValue.isString()) { - auto oldValue = passwordBox.Password(); - auto newValue = asHstring(propertyValue); - if (oldValue != newValue) { - passwordBox.Password(newValue); - } - } else if (propertyValue.isNull()) - passwordBox.ClearValue(xaml::Controls::PasswordBox::PasswordProperty()); - } + SetText(propertyValue); } } } @@ -598,6 +589,61 @@ void TextInputShadowNode::updateProperties(const folly::dynamic &&props) { m_updating = false; } +void TextInputShadowNode::SetText(const folly::dynamic &text) { + auto textBox = this->GetView().try_as(); + auto passwordBox = this->GetView().try_as(); + + if (m_mostRecentEventCount == m_nativeEventCount) { + if (textBox) { + if (text.isString()) { + auto oldValue = textBox.Text(); + auto newValue = asHstring(text); + if (oldValue != newValue) { + textBox.Text(newValue); + } + } else if (text.isNull()) + textBox.ClearValue(xaml::Controls::TextBox::TextProperty()); + } else { + if (text.isString()) { + auto oldValue = passwordBox.Password(); + auto newValue = asHstring(text); + if (oldValue != newValue) { + passwordBox.Password(newValue); + } + } else if (text.isNull()) + passwordBox.ClearValue(xaml::Controls::PasswordBox::PasswordProperty()); + } + } +} + +void TextInputShadowNode::SetSelection(int64_t start, int64_t end) { + if (start < 0 || end < 0 || start > end) { + return; + } + + if (auto textBox = this->GetView().try_as()) { + textBox.Select(static_cast(start), static_cast(end - start)); + } +} + +void TextInputShadowNode::dispatchCommand(const std::string &commandId, const folly::dynamic &commandArgs) { + if (commandId == "focus") { + if (auto reactInstance = GetViewManager()->GetReactInstance().lock()) { + reactInstance->NativeUIManager()->focus(m_tag); + } + } else if (commandId == "blur") { + if (auto reactInstance = GetViewManager()->GetReactInstance().lock()) { + reactInstance->NativeUIManager()->blur(m_tag); + } + } else if (commandId == "setTextAndSelection") { + m_mostRecentEventCount = static_cast(commandArgs[0].asInt()); + SetText(commandArgs[1]); + SetSelection(commandArgs[2].asInt(), commandArgs[3].asInt()); + } else { + Super::dispatchCommand(commandId, commandArgs); + } +} + TextInputViewManager::TextInputViewManager(const std::shared_ptr &reactInstance) : Super(reactInstance) {} diff --git a/vnext/Microsoft.ReactNative/Views/ViewManagerBase.h b/vnext/Microsoft.ReactNative/Views/ViewManagerBase.h index e6f682a40d3..1a476e0749c 100644 --- a/vnext/Microsoft.ReactNative/Views/ViewManagerBase.h +++ b/vnext/Microsoft.ReactNative/Views/ViewManagerBase.h @@ -62,7 +62,7 @@ class REACTWINDOWS_EXPORT ViewManagerBase : public facebook::react::IViewManager virtual void UpdateProperties(ShadowNodeBase *nodeToUpdate, const folly::dynamic &reactDiffMap); virtual void - DispatchCommand(const XamlView &viewToUpdatee, const std::string &commandId, const folly::dynamic &commandArgs); + DispatchCommand(const XamlView &viewToUpdate, const std::string &commandId, const folly::dynamic &commandArgs); // Yoga Layout virtual void SetLayoutProps( diff --git a/vnext/overrides.json b/vnext/overrides.json index 2639f6de242..608ad4adbf8 100644 --- a/vnext/overrides.json +++ b/vnext/overrides.json @@ -509,6 +509,14 @@ "baseHash": "1840fda2dd4591883df92d28c1e1aeabff190f7f", "issue": "LEGACY_FIXME" }, + { + "type": "patch", + "file": "src/RNTester/js/examples/TextInput/TextInputExample.windows.js", + "baseFile": "RNTester/js/examples/TextInput/TextInputExample.android.js", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "1755bffd6ae353838f1779007dc4a512b8dddcdc", + "issue": 5688 + }, { "type": "patch", "file": "src/RNTester/js/examples/View/ViewExample.windows.js", diff --git a/vnext/src/Libraries/Components/TextInput/TextInput.windows.js b/vnext/src/Libraries/Components/TextInput/TextInput.windows.js index 25cda364089..1daca974454 100644 --- a/vnext/src/Libraries/Components/TextInput/TextInput.windows.js +++ b/vnext/src/Libraries/Components/TextInput/TextInput.windows.js @@ -21,6 +21,7 @@ const TouchableWithoutFeedback = require('../Touchable/TouchableWithoutFeedback' // [Windows const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); +import codegenNativeCommands from '../../Utilities/codegenNativeCommands'; // Windows] const invariant = require('invariant'); @@ -65,9 +66,10 @@ if (Platform.OS === 'android') { } // [Windows else if (Platform.OS === 'windows') { - const nativeComponent = requireNativeComponent('RCTTextInput'); - WindowsTextInput = nativeComponent; - WindowsTextInputCommands = nativeComponent.Commands; + WindowsTextInput = requireNativeComponent('RCTTextInput'); + WindowsTextInputCommands = codegenNativeCommands< + TextInputNativeCommands>, + >({supportedCommands: ['focus', 'blur', 'setTextAndSelection']}); } // Windows] diff --git a/vnext/src/RNTester/js/examples/TextInput/TextInputExample.windows.js b/vnext/src/RNTester/js/examples/TextInput/TextInputExample.windows.js new file mode 100644 index 00000000000..461e36f24fd --- /dev/null +++ b/vnext/src/RNTester/js/examples/TextInput/TextInputExample.windows.js @@ -0,0 +1,425 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow + */ + +'use strict'; + +const React = require('react'); + +const { + Text, + TextInput, + View, + StyleSheet, + Slider, + Switch, +} = require('react-native'); + +const TextInputSharedExamples = require('./TextInputSharedExamples.js'); + +import type {RNTesterExampleModuleItem} from '../../types/RNTesterTypes'; + +class ToggleDefaultPaddingExample extends React.Component< + $FlowFixMeProps, + $FlowFixMeState, +> { + constructor(props) { + super(props); + this.state = {hasPadding: false}; + } + render() { + return ( + + + this.setState({hasPadding: !this.state.hasPadding})}> + Toggle padding + + + ); + } +} + +class AutogrowingTextInputExample extends React.Component<{...}> { + constructor(props) { + super(props); + + /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found + * when making Flow check .android.js files. */ + this.state = { + width: 100, + multiline: true, + text: '', + contentSize: { + width: 0, + height: 0, + }, + }; + } + + UNSAFE_componentWillReceiveProps(props) { + /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found + * when making Flow check .android.js files. */ + this.setState({ + /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found + * when making Flow check .android.js files. */ + multiline: props.multiline, + }); + } + + render() { + /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found + * when making Flow check .android.js files. */ + const {style, multiline, ...props} = this.props; + return ( + + Width: + =0.78.0 site=react_native_android_fb) This issue was + * found when making Flow check .android.js files. */ + onValueChange={value => this.setState({width: value})} + /> + Multiline: + =0.78.0 site=react_native_android_fb) This issue was + * found when making Flow check .android.js files. */ + value={this.state.multiline} + /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was + * found when making Flow check .android.js files. */ + onValueChange={value => this.setState({multiline: value})} + /> + TextInput: + {/* $FlowFixMe(>=0.122.0 site=react_native_android_fb) This comment + * suppresses an error found when Flow v0.122.0 was deployed. To see + * the error, delete this comment and run Flow. */} + =0.78.0 site=react_native_android_fb) This issue was + * found when making Flow check .android.js files. */ + multiline={this.state.multiline} + /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was + * found when making Flow check .android.js files. */ + style={[style, {width: this.state.width + '%'}]} + /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was + * found when making Flow check .android.js files. */ + onChangeText={value => this.setState({text: value})} + onContentSizeChange={event => + /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was + * found when making Flow check .android.js files. */ + this.setState({contentSize: event.nativeEvent.contentSize}) + } + {...props} + /> + Plain text value representation: + {/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was + * found when making Flow check .android.js files. */} + {this.state.text} + {/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was + * found when making Flow check .android.js files. */} + Content Size: {JSON.stringify(this.state.contentSize)} + + ); + } +} + +const styles = StyleSheet.create({ + multiline: { + height: 60, + fontSize: 16, + }, + singleLine: { + fontSize: 16, + }, + singleLineWithHeightTextInput: { + height: 30, + }, +}); + +exports.title = ''; +exports.description = 'Single and multi-line text inputs.'; +exports.examples = ([ + ...TextInputSharedExamples, + { + title: 'Colors and text inputs', + render: function(): React.Node { + return ( + + + + + + + + + + Darker backgroundColor + + + + + ); + }, + }, + { + title: 'Text input, themes and heights', + render: function(): React.Node { + return ( + + ); + }, + }, + { + title: 'letterSpacing', + render: function(): React.Node { + return ( + + + + + + + ); + }, + }, + { + title: 'Passwords', + render: function(): React.Node { + return ( + + + + + ); + }, + }, + { + title: 'Editable', + render: function(): React.Node { + return ( + + ); + }, + }, + { + title: 'Multiline', + render: function(): React.Node { + return ( + + + + + + multiline with children, aligned bottom-right + + + + ); + }, + }, + { + title: 'Fixed number of lines', + platform: 'android', + render: function(): React.Node { + return ( + + + + + ); + }, + }, + { + title: 'Auto-expanding', + render: function(): React.Node { + return ( + + + {/*generic generic generic [Windows]*/} + + small small small small small small + + regular regular + + huge huge huge huge huge + + {/*generic generic generic [Windows]*/} + + + ); + }, + }, + { + title: 'Return key', + render: function(): React.Node { + const returnKeyTypes = [ + 'none', + 'go', + 'search', + 'send', + 'done', + 'previous', + 'next', + ]; + const returnKeyLabels = ['Compile', 'React Native']; + const examples = returnKeyTypes.map(type => { + return ( + + ); + }); + const types = returnKeyLabels.map(type => { + return ( + + ); + }); + return ( + + {examples} + {types} + + ); + }, + }, + { + title: 'Inline Images', + render: function(): React.Node { + return ( + + + + + + ); + }, + }, + { + title: 'Toggle Default Padding', + render: function(): React.Node { + return ; + }, + }, +]: Array); diff --git a/vnext/src/RNTester/js/utils/RNTesterList.windows.ts b/vnext/src/RNTester/js/utils/RNTesterList.windows.ts index 47d8cbad4d8..508b7ce85fd 100644 --- a/vnext/src/RNTester/js/utils/RNTesterList.windows.ts +++ b/vnext/src/RNTester/js/utils/RNTesterList.windows.ts @@ -107,6 +107,10 @@ const ComponentExamples: Array = [ key: 'TextExample', module: require('./../examples-win/Text/TextExample'), }, + { + key: 'TextInputExample', + module: require('react-native/RNTester/js/examples/TextInput/TextInputExample'), + }, { key: 'TouchableExample', module: require('react-native/RNTester/js/examples/Touchable/TouchableExample'), From c7249ef0329bfe5f1a8af9e3bf49d19b11298ef8 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 04:25:29 -0700 Subject: [PATCH 06/12] Upgrade react-native-win32 overrides --- packages/react-native-win32/overrides.json | 16 ++++------------ .../Components/CheckBox/CheckBox.win32.js | 12 ------------ 2 files changed, 4 insertions(+), 24 deletions(-) delete mode 100644 packages/react-native-win32/src/Libraries/Components/CheckBox/CheckBox.win32.js diff --git a/packages/react-native-win32/overrides.json b/packages/react-native-win32/overrides.json index 385ede3b6d0..9bad97f10ca 100644 --- a/packages/react-native-win32/overrides.json +++ b/packages/react-native-win32/overrides.json @@ -51,14 +51,6 @@ "type": "platform", "file": "src/Libraries/Components/Button/ButtonWin32.tsx" }, - { - "type": "derived", - "file": "src/Libraries/Components/CheckBox/CheckBox.win32.js", - "baseFile": "Libraries/Components/CheckBox/CheckBox.android.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "278d7049749ba8b5f3840f21ef6b3d528183829f", - "issue": "LEGACY_FIXME" - }, { "type": "copy", "file": "src/Libraries/Components/DatePicker/DatePickerIOS.win32.js", @@ -166,8 +158,8 @@ "type": "derived", "file": "src/Libraries/Components/TextInput/TextInput.win32.tsx", "baseFile": "Libraries/Components/TextInput/TextInput.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "a50310f6dee460f7d1a53e0f1a21dbac9cf02094", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "9d9e65ecd506387e98d0ef5a58321c568a95ad41", "issue": "LEGACY_FIXME" }, { @@ -454,8 +446,8 @@ "type": "derived", "file": "src/RNTester/js/utils/RNTesterList.win32.js", "baseFile": "RNTester/js/utils/RNTesterList.android.js", - "baseVersion": "0.0.0-4a48b021d", - "baseHash": "65c3876bdbc2755cd568b2779ed962fa7a4edf6a", + "baseVersion": "0.0.0-2c473e1a3", + "baseHash": "20a6f5c42266beb017dccc7f22d45bde02907d89", "issue": "LEGACY_FIXME" }, { diff --git a/packages/react-native-win32/src/Libraries/Components/CheckBox/CheckBox.win32.js b/packages/react-native-win32/src/Libraries/Components/CheckBox/CheckBox.win32.js deleted file mode 100644 index d5fd5cf83f7..00000000000 --- a/packages/react-native-win32/src/Libraries/Components/CheckBox/CheckBox.win32.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -module.exports = require('../UnimplementedViews/UnimplementedView'); From dcab848bd8d46cbfa88e1bc889e92973377aa56f Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 04:28:07 -0700 Subject: [PATCH 07/12] Change files --- ...t-native-win32-2020-08-11-04-28-07-integrate-4-22.json | 8 ++++++++ ...native-windows-2020-08-11-04-28-07-integrate-4-22.json | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 change/@office-iss-react-native-win32-2020-08-11-04-28-07-integrate-4-22.json create mode 100644 change/react-native-windows-2020-08-11-04-28-07-integrate-4-22.json diff --git a/change/@office-iss-react-native-win32-2020-08-11-04-28-07-integrate-4-22.json b/change/@office-iss-react-native-win32-2020-08-11-04-28-07-integrate-4-22.json new file mode 100644 index 00000000000..b089213673c --- /dev/null +++ b/change/@office-iss-react-native-win32-2020-08-11-04-28-07-integrate-4-22.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "Integrate 4/22 Nightly Build", + "packageName": "@office-iss/react-native-win32", + "email": "ngerlem@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-08-11T11:28:00.447Z" +} diff --git a/change/react-native-windows-2020-08-11-04-28-07-integrate-4-22.json b/change/react-native-windows-2020-08-11-04-28-07-integrate-4-22.json new file mode 100644 index 00000000000..c970a5411d2 --- /dev/null +++ b/change/react-native-windows-2020-08-11-04-28-07-integrate-4-22.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "Integrate 4/22 Nightly Build", + "packageName": "react-native-windows", + "email": "ngerlem@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-08-11T11:28:07.228Z" +} From 7409211975a46959db70ae4a3326da7ce3f20b65 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 04:37:10 -0700 Subject: [PATCH 08/12] Lint react-native-win32 --- .../src/Libraries/StyleSheet/PlatformColorValueTypes.win32.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-win32/src/Libraries/StyleSheet/PlatformColorValueTypes.win32.js b/packages/react-native-win32/src/Libraries/StyleSheet/PlatformColorValueTypes.win32.js index 997b7273e57..74f109a5ea3 100644 --- a/packages/react-native-win32/src/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +++ b/packages/react-native-win32/src/Libraries/StyleSheet/PlatformColorValueTypes.win32.js @@ -10,7 +10,7 @@ 'use strict'; -import type {ColorValue} from './StyleSheetTypes'; +import type {ColorValue} from './StyleSheet'; import type {ProcessedColorValue} from './processColor'; type GradientColorStop = {| From bf0af12d6e3a80b043a402f21b0e46f5e8e1df58 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 05:04:52 -0700 Subject: [PATCH 09/12] Fix integrate-rn bug with dependency syncing added late PR --- .../@rnw-scripts/integrate-rn/package.json | 2 ++ .../integrate-rn/src/integrateRN.ts | 30 +++++++++++++------ packages/react-native-win32/package.json | 10 +++---- vnext/package.json | 10 +++---- yarn.lock | 11 ++----- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/packages/@rnw-scripts/integrate-rn/package.json b/packages/@rnw-scripts/integrate-rn/package.json index 601c3b8e6ca..f61c163f74e 100644 --- a/packages/@rnw-scripts/integrate-rn/package.json +++ b/packages/@rnw-scripts/integrate-rn/package.json @@ -15,6 +15,7 @@ "dependencies": { "@rnw-scripts/find-repo-root": "^0.0.4", "@rnw-scripts/package-utils": "^0.0.1", + "async": "^3.2.0", "lodash": "^4.17.15", "ora": "^4.0.3", "react-native-platform-override": "^0.2.1", @@ -25,6 +26,7 @@ "@rnw-scripts/eslint-config": "0.0.2", "@rnw-scripts/just-task": "0.0.2", "@rnw-scripts/ts-config": "0.1.0", + "@types/async": "^3.2.3", "@types/lodash": "^4.14.157", "@types/ora": "^3.2.0", "@types/semver": "^7.3.1", diff --git a/packages/@rnw-scripts/integrate-rn/src/integrateRN.ts b/packages/@rnw-scripts/integrate-rn/src/integrateRN.ts index 7c0b2067596..401856f639a 100644 --- a/packages/@rnw-scripts/integrate-rn/src/integrateRN.ts +++ b/packages/@rnw-scripts/integrate-rn/src/integrateRN.ts @@ -6,6 +6,7 @@ */ import * as _ from 'lodash'; +import * as async from 'async'; import * as fs from 'fs'; import * as ora from 'ora'; import * as path from 'path'; @@ -15,6 +16,7 @@ import * as yargs from 'yargs'; import { enumerateLocalPackages, findPackage, + NpmPackage, WritableNpmPackage, } from '@rnw-scripts/package-utils'; @@ -60,14 +62,19 @@ import findRepoRoot from '@rnw-scripts/find-repo-root'; * Enumerate packages for out-of-tree platforms */ async function enumeratePlatformPackages(): Promise { - return await enumerateLocalPackages(async pkg => { - try { - await fs.promises.access(path.join(pkg.path, 'overrides.json')); - return true; - } catch { - return false; - } - }); + return await enumerateLocalPackages(isOutOfTreePlatform); +} + +/** + * Does the NPM package correspond to an out-of-tree platform? + */ +async function isOutOfTreePlatform(pkg: NpmPackage): Promise { + try { + await fs.promises.access(path.join(pkg.path, 'overrides.json')); + return true; + } catch { + return false; + } } /** @@ -75,8 +82,13 @@ async function enumeratePlatformPackages(): Promise { * version of React Native */ async function updatePackages(newVersion: string) { + // Be careful to share package objects since writing to one may invalidate + // copies const localPackages = await enumerateLocalPackages(); - const platformPackages = await enumeratePlatformPackages(); + const platformPackages = await async.filter( + localPackages, + isOutOfTreePlatform, + ); if (platformPackages.length === 0) { throw new Error( diff --git a/packages/react-native-win32/package.json b/packages/react-native-win32/package.json index eb61a4bc2c3..8302091d2f1 100644 --- a/packages/react-native-win32/package.json +++ b/packages/react-native-win32/package.json @@ -21,9 +21,9 @@ }, "dependencies": { "@babel/runtime": "^7.0.0", - "@react-native-community/cli": "^4.2.4", - "@react-native-community/cli-platform-android": "^4.2.3", - "@react-native-community/cli-platform-ios": "^4.2.3", + "@react-native-community/cli": "^4.7.0", + "@react-native-community/cli-platform-android": "^4.7.0", + "@react-native-community/cli-platform-ios": "^4.7.0", "abort-controller": "^3.0.0", "anser": "^1.4.9", "art": "^0.10.0", @@ -31,14 +31,14 @@ "event-target-shim": "^5.0.1", "fbjs": "^1.0.0", "fbjs-scripts": "^1.1.0", - "hermes-engine": "~0.4.0", + "hermes-engine": "~0.5.0", "invariant": "^2.2.4", "jsc-android": "^245459.0.0", "metro-babel-register": "0.59.0", "metro-react-native-babel-transformer": "0.59.0", "metro-source-map": "0.59.0", "nullthrows": "^1.1.1", - "pretty-format": "^24.9.0", + "pretty-format": "^25.4.0", "promise": "^8.0.3", "prop-types": "^15.7.2", "react-clone-referenced-element": "^1.0.1", diff --git a/vnext/package.json b/vnext/package.json index ce90a7ff168..8addda6150c 100644 --- a/vnext/package.json +++ b/vnext/package.json @@ -22,9 +22,9 @@ }, "dependencies": { "@babel/runtime": "^7.0.0", - "@react-native-community/cli": "^4.2.4", - "@react-native-community/cli-platform-android": "^4.2.3", - "@react-native-community/cli-platform-ios": "^4.2.3", + "@react-native-community/cli": "^4.7.0", + "@react-native-community/cli-platform-android": "^4.7.0", + "@react-native-community/cli-platform-ios": "^4.7.0", "@react-native-windows/cli": "0.0.0-canary.2", "abort-controller": "^3.0.0", "anser": "^1.4.9", @@ -32,14 +32,14 @@ "event-target-shim": "^5.0.1", "fbjs": "^1.0.0", "fbjs-scripts": "^1.1.0", - "hermes-engine": "~0.4.0", + "hermes-engine": "~0.5.0", "invariant": "^2.2.4", "jsc-android": "^245459.0.0", "metro-babel-register": "0.59.0", "metro-react-native-babel-transformer": "0.59.0", "metro-source-map": "0.59.0", "nullthrows": "^1.1.1", - "pretty-format": "^24.9.0", + "pretty-format": "^25.4.0", "promise": "^8.0.3", "prop-types": "^15.7.2", "react-devtools-core": "^4.6.0", diff --git a/yarn.lock b/yarn.lock index 7f2f6f3949e..424f61b5d9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2608,7 +2608,7 @@ dependencies: serve-static "^1.13.1" -"@react-native-community/cli-platform-android@^4.2.3", "@react-native-community/cli-platform-android@^4.7.0": +"@react-native-community/cli-platform-android@^4.7.0": version "4.11.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-android/-/cli-platform-android-4.11.0.tgz#0ce9b88ed8b6b0ef962af49d980eb53433c17a84" integrity sha512-BzqocGjOCjpDW0bM/LUrHMXw4nBvOhDXnHWxaoRp3eeUVsD2oSegoRn52kZo9yhPb9cCPkZJ3b+Web71Ue4j9w== @@ -2624,7 +2624,7 @@ slash "^3.0.0" xmldoc "^1.1.2" -"@react-native-community/cli-platform-ios@^4.2.3", "@react-native-community/cli-platform-ios@^4.7.0": +"@react-native-community/cli-platform-ios@^4.7.0": version "4.11.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-4.11.0.tgz#5870bf5f2b3c01a0aa672a7c1f7f0fe13337c6b5" integrity sha512-/qkjnhhJ7BGBTNkHSS8a+z8UgWUQbU6YZOTuYxjNywGUzMiTsb/wlm2cWCY1VEAvWtY97c4plAZ5OferPJHaVA== @@ -2668,7 +2668,7 @@ resolved "https://registry.yarnpkg.com/@react-native-community/cli-types/-/cli-types-4.10.1.tgz#d68a2dcd1649d3b3774823c64e5e9ce55bfbe1c9" integrity sha512-ael2f1onoPF3vF7YqHGWy7NnafzGu+yp88BbFbP0ydoCP2xGSUzmZVw0zakPTC040Id+JQ9WeFczujMkDy6jYQ== -"@react-native-community/cli@^4.2.4", "@react-native-community/cli@^4.7.0": +"@react-native-community/cli@^4.7.0": version "4.11.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-4.11.0.tgz#58faf2e27ab5601bd2d3ec1cd84a213d33a31480" integrity sha512-pP2jB7294708pX81l6fjCxnBNGefRj8/X1nqGIgiMpHdI1WXfwR6XuegZPMGgxkiCISs7FZybV7TBl1jVxlVpA== @@ -7643,11 +7643,6 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" -hermes-engine@~0.4.0: - version "0.4.3" - resolved "https://registry.yarnpkg.com/hermes-engine/-/hermes-engine-0.4.3.tgz#1754932f989daddd149172600f01e69cb8f27298" - integrity sha512-qkk85ezG+w70C3tQ4iDs22B8talvByGeJQ1VIb2KG5+rMZWVizRq6r+NYptOC/HWAFxkdYb6F3OPca7RxvjYew== - hermes-engine@~0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/hermes-engine/-/hermes-engine-0.5.1.tgz#601115e4b1e0a17d9aa91243b96277de4e926e09" From 966c4bfe1f33704001a4bd962f9e38085dd1ae0c Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 05:05:02 -0700 Subject: [PATCH 10/12] Change files --- ...s-integrate-rn-2020-08-11-05-05-02-integrate-4-22.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 change/@rnw-scripts-integrate-rn-2020-08-11-05-05-02-integrate-4-22.json diff --git a/change/@rnw-scripts-integrate-rn-2020-08-11-05-05-02-integrate-4-22.json b/change/@rnw-scripts-integrate-rn-2020-08-11-05-05-02-integrate-4-22.json new file mode 100644 index 00000000000..bc0d8685f5b --- /dev/null +++ b/change/@rnw-scripts-integrate-rn-2020-08-11-05-05-02-integrate-4-22.json @@ -0,0 +1,8 @@ +{ + "type": "patch", + "comment": "Fix integrate-rn bug with dependency syncing added late PR", + "packageName": "@rnw-scripts/integrate-rn", + "email": "ngerlem@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-08-11T12:05:02.815Z" +} From b9568b0ba054d2b0eb7cf6bfad12bdc96f8321cf Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 11 Aug 2020 05:30:14 -0700 Subject: [PATCH 11/12] More checkbox removal --- .../E2ETest/wdio/test/VisitAllPages.spec.ts | 1 - packages/playground/Samples/control.tsx | 19 ---- packages/playground/Samples/index.tsx | 27 ++---- packages/playground/Samples/view.tsx | 16 ++-- .../Utils/ResourceBrushUtils.cpp | 34 ------- .../Utils/StandardControlResourceKeyNames.h | 92 ------------------- .../Flyout/FlyoutExample.windows.tsx | 14 +-- .../Keyboard/KeyboardFocusExample.windows.tsx | 11 --- .../LegacyTests/ControlStyleTestPage.tsx | 4 - 9 files changed, 21 insertions(+), 197 deletions(-) diff --git a/packages/E2ETest/wdio/test/VisitAllPages.spec.ts b/packages/E2ETest/wdio/test/VisitAllPages.spec.ts index 262e4406a79..a05a184ea8e 100644 --- a/packages/E2ETest/wdio/test/VisitAllPages.spec.ts +++ b/packages/E2ETest/wdio/test/VisitAllPages.spec.ts @@ -10,7 +10,6 @@ let pages = [ /* TODO: Disabling most of the test for now due to instability, tracked by #5661 '