Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from microsoft:master #1

Merged
merged 5 commits into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ado/ado-test-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -ex

# Script used by the Azure DevOps build agent to cleanup the packager and web socket server
# after the XCode test step has completed
# after the Xcode test step has completed

# kill whatever is occupying port 8081 (packager)
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
Expand Down
4 changes: 4 additions & 0 deletions .ado/apple-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
- template: templates/apple-job-javascript.yml
parameters:
apply_office_patches: $(apply_office_patches)
slice_name: $(slice_name)
xcode_version: $(xcode_version)

- job: AppleRNPR
displayName: Apple React Native PR
Expand Down Expand Up @@ -84,6 +86,8 @@ jobs:
xcode_actions_release: $(xcode_actions_release)
xcode_destination: $(xcode_destination)
apply_office_patches: $(apply_office_patches)
slice_name: $(slice_name)
xcode_version: $(xcode_version)

- job: CliInit
displayName: Verify react-native-macos-init
Expand Down
6 changes: 6 additions & 0 deletions .ado/templates/apple-job-javascript.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
parameters:
apply_office_patches: ''
slice_name: ''
xcode_version: ''

steps:
- template: apple-node-setup.yml

# Task Group: Xcode select proper version
- template: apple-xcode-select.yml
parameters:
slice_name: ${{ parameters.slice_name }}
xcode_version: ${{ parameters.xcode_version }}

- template: apple-droid-node-patching.yml
parameters:
Expand Down
5 changes: 5 additions & 0 deletions .ado/templates/apple-job-react-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ parameters:
xcode_actions_release: ''
xcode_destination: ''
apply_office_patches: ''
slice_name: ''
xcode_version: ''

steps:
# Clean DerivedData
Expand All @@ -18,6 +20,9 @@ steps:

# Task Group: Xcode select proper version
- template: apple-xcode-select.yml
parameters:
slice_name: ${{ parameters.slice_name }}
xcode_version: ${{ parameters.xcode_version }}

- template: apple-droid-node-patching.yml
parameters:
Expand Down
4 changes: 2 additions & 2 deletions .ado/templates/apple-xcode-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:

steps:
- task: Xcode@5
displayName: 'XCode ${{ parameters.xcode_actions }} ${{ parameters.xcode_configuration }} ${{ parameters.xcode_sdk }} ${{ parameters.xcode_scheme }}'
displayName: 'Xcode ${{ parameters.xcode_actions }} ${{ parameters.xcode_configuration }} ${{ parameters.xcode_sdk }} ${{ parameters.xcode_scheme }}'
inputs:
actions: '${{ parameters.xcode_actions }}'
configuration: ${{ parameters.xcode_configuration }}
Expand All @@ -21,7 +21,7 @@ steps:
signingOption: auto
packageApp: false
teamId: '$(XCodeSigningMicrosoftTeamID)'
args: '-destination "${{ parameters.xcode_destination }}" ONLY_ACTIVE_ARCH=NO -verbose -UseModernBuildSystem=NO -derivedDataPath DerivedData ${{ parameters.xcode_extraArgs }}'
args: '-destination "${{ parameters.xcode_destination }}" ONLY_ACTIVE_ARCH=YES -verbose -derivedDataPath DerivedData ${{ parameters.xcode_extraArgs }}'
exportPath: '$(agent.builddirectory)/output/${{ parameters.xcode_sdk }}/${{ parameters.xcode_configuration }}'
useXcpretty: ${{ parameters.xcode_useXcpretty }}
publishJUnitResults: ${{ parameters.xcode_useXcpretty }}
Expand Down
11 changes: 8 additions & 3 deletions .ado/templates/apple-xcode-select.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#
# Task Group: XCode select proper version
# Task Group: Xcode select proper version
#

parameters:
slice_name: ''
xcode_version: ''

steps:
- bash: |
sudo xcode-select --switch '/Applications/Xcode_11.2.1.app'
displayName: 'Switch to XCode 11.2.1'
sudo xcode-select --switch '${{ parameters.xcode_version }}'
displayName: Switch Xcode version ${{ parameters.slice_name }}
failOnStderr: true
4 changes: 3 additions & 1 deletion .ado/variables/mac.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
variables:
VmImage: macOS-10.14
VmImage: macOS-10.15
slice_name: 'Xcode_12_4'
xcode_version: '/Applications/Xcode_12.4.app'
2 changes: 1 addition & 1 deletion Libraries/ART/React-ART.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Pod::Spec.new do |s|
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214)
s.source = source
s.source_files = "**/*.{m}"
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ActionSheetIOS/React-RCTActionSheet.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Pod::Spec.new do |s|
s.documentation_url = "https://reactnative.dev/docs/actionsheetios"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214)
s.source = source
s.source_files = "*.{m}"
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Blob/React-RCTBlob.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Pod::Spec.new do |s|
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214)
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
s.source = source
s.source_files = "*.{m,mm}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ const AccessibilityInfo = {
return Promise.resolve(false);
},

/**
* macOS only
*/
isHighContrastEnabled: function(): Promise<boolean> {
return Promise.resolve(false);
},

/**
* iOS only
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ const AccessibilityInfo = {
});
},

/**
* macOS only
*/
isHighContrastEnabled: function(): Promise<boolean> {
return Promise.resolve(false);
},

/**
* Query whether inverted colors are currently enabled.
*
Expand Down
18 changes: 18 additions & 0 deletions Libraries/Components/AccessibilityInfo/AccessibilityInfo.macos.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const RCTDeviceEventEmitter = require('../../EventEmitter/RCTDeviceEventEmitter'
import NativeAccessibilityManager from './NativeAccessibilityManager';

const CHANGE_EVENT_NAME = {
highContrastChanged: 'highContrastChanged',
invertColorsChanged: 'invertColorsChanged',
reduceMotionChanged: 'reduceMotionChanged',
reduceTransparencyChanged: 'reduceTransparencyChanged',
Expand All @@ -26,6 +27,7 @@ const CHANGE_EVENT_NAME = {

type ChangeEventName = $Keys<{
change: string,
highContrastChanged: string,
invertColorsChanged: string,
reduceMotionChanged: string,
reduceTransparencyChanged: string,
Expand Down Expand Up @@ -58,6 +60,22 @@ const AccessibilityInfo = {
return Promise.resolve(false);
},

/**
* Query whether high contrast is currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when invert color is enabled and `false` otherwise.
*/
isHighContrastEnabled: function(): Promise<boolean> {
return new Promise((resolve, reject) => {
if (NativeAccessibilityManager) {
NativeAccessibilityManager.getCurrentHighContrastState(resolve, reject);
} else {
reject(reject);
}
});
},

/**
* Query whether inverted colors are currently enabled.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export interface Spec extends TurboModule {
onSuccess: (isGrayscaleEnabled: boolean) => void,
onError: (error: Object) => void,
) => void;
// [TODO(macOS ISS#2323203)
+getCurrentHighContrastState: (
onSuccess: (isHighContrastEnabled: boolean) => void,
onError: (error: Object) => void,
) => void;
// ]TODO(macOS ISS#2323203)
+getCurrentInvertColorsState: (
onSuccess: (isInvertColorsEnabled: boolean) => void,
onError: (error: Object) => void,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/FBLazyVector/FBLazyVector.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Pod::Spec.new do |s|
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS ISS#2323203)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS ISS#2323203)
s.source = source
s.source_files = "**/*.{c,h,m,mm,cpp}"
s.header_dir = "FBLazyVector"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Pod::Spec.new do |s|
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS ISS#2323203)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS ISS#2323203)
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
s.source = source
s.source_files = "**/*.{c,h,m,mm,cpp}"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Image/React-RCTImage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Pod::Spec.new do |s|
s.documentation_url = "https://reactnative.dev/docs/image"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214)
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
s.source = source
s.source_files = "*.{m,mm}"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/LinkingIOS/React-RCTLinking.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Pod::Spec.new do |s|
s.documentation_url = "https://reactnative.dev/docs/linking"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214)
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
s.source = source
s.source_files = "*.{m,mm}"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/NativeAnimation/React-RCTAnimation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Pod::Spec.new do |s|
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214)
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
s.source = source
s.source_files = "{Drivers/*,Nodes/*,*}.{m,mm}"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Network/React-RCTNetwork.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Pod::Spec.new do |s|
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214)
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
s.source = source
s.source_files = "*.{m,mm}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Pod::Spec.new do |s|
s.documentation_url = "https://reactnative.dev/docs/pushnotificationios"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214)
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
s.source = source
s.source_files = "*.{m,mm}"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/RCTRequired/RCTRequired.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Pod::Spec.new do |s|
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS ISS#2323203)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS ISS#2323203)
s.source = source
s.source_files = "**/*.{c,h,m,mm,cpp}"
s.header_dir = "RCTRequired"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Settings/React-RCTSettings.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Pod::Spec.new do |s|
s.documentation_url = "https://reactnative.dev/docs/settings"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214)
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
s.source = source
s.source_files = "*.{m,mm}"
Expand Down
50 changes: 49 additions & 1 deletion Libraries/StyleSheet/PlatformColorValueTypes.macos.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,35 @@ export opaque type NativeColorValue = {
light: ?(ColorValue | ProcessedColorValue),
dark: ?(ColorValue | ProcessedColorValue),
},
colorWithSystemEffect?: {
baseColor: ?(ColorValue | ProcessedColorValue),
systemEffect: SystemEffectMacOSPrivate,
},
};

export const PlatformColor = (...names: Array<string>): ColorValue => {
return {semantic: names};
};

export type SystemEffectMacOSPrivate =
| 'none'
| 'pressed'
| 'deepPressed'
| 'disabled'
| 'rollover';

export const ColorWithSystemEffectMacOSPrivate = (
color: ColorValue,
effect: SystemEffectMacOSPrivate,
): ColorValue => {
return {
colorWithSystemEffect: {
baseColor: color,
systemEffect: effect,
},
};
};

export type DynamicColorMacOSTuplePrivate = {
light: ColorValue,
dark: ColorValue,
Expand Down Expand Up @@ -54,8 +77,20 @@ export const normalizeColorObject = (
},
};
return dynamicColor;
} else if (
'colorWithSystemEffect' in color &&
color.colorWithSystemEffect != null
) {
const processColor = require('./processColor');
const colorWithSystemEffect = color.colorWithSystemEffect;
const colorObject: NativeColorValue = {
colorWithSystemEffect: {
baseColor: processColor(colorWithSystemEffect.baseColor),
systemEffect: colorWithSystemEffect.systemEffect,
},
};
return colorObject;
}

return null;
};

Expand All @@ -72,6 +107,19 @@ export const processColorObject = (
},
};
return dynamicColor;
} else if (
'colorWithSystemEffect' in color &&
color.colorWithSystemEffect != null
) {
const processColor = require('./processColor');
const colorWithSystemEffect = color.colorWithSystemEffect;
const colorObject: NativeColorValue = {
colorWithSystemEffect: {
baseColor: processColor(colorWithSystemEffect.baseColor),
systemEffect: colorWithSystemEffect.systemEffect,
},
};
return colorObject;
}
return color;
};
Expand Down
16 changes: 16 additions & 0 deletions Libraries/StyleSheet/PlatformColorValueTypesMacOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,20 @@ export const DynamicColorMacOS = (
): ColorValue => {
throw new Error('DynamicColorMacOS is not available on this platform.');
};

export type SystemEffectMacOS =
| 'none'
| 'pressed'
| 'deepPressed'
| 'disabled'
| 'rollover';

export const ColorWithSystemEffectMacOS = (
color: ColorValue,
effect: SystemEffectMacOS,
): ColorValue => {
throw new Error(
'ColorWithSystemEffectMacOS is not available on this platform.',
);
};
// ]TODO(macOS ISS#2323203)
Loading