Skip to content

Commit

Permalink
Merge branch 'main' into text-input-announce-disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
fabOnReact committed Feb 9, 2022
2 parents 666647e + 271b913 commit c263d93
Show file tree
Hide file tree
Showing 45 changed files with 868 additions and 249 deletions.
27 changes: 3 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,6 @@ jobs:
# -------------------------
test_android_rntester:
executor: reactnativeandroid
parameters:
use_hermes:
type: boolean
default: false
steps:
- checkout
- run_yarn
Expand All @@ -605,19 +601,9 @@ jobs:
name: Generate artifacts for Maven
command: ./gradlew :ReactAndroid:installArchives

- when:
condition: << parameters.use_hermes >>
steps:
- run:
name: Build RNTester with Hermes
command: ./gradlew :packages:rn-tester:android:app:assembleHermesDebug
- when:
condition:
not: << parameters.use_hermes >>
steps:
- run:
name: Build RNTester with JSC
command: ./gradlew :packages:rn-tester:android:app:assembleJscDebug
- run:
name: Assemble RNTester
command: ./gradlew :packages:rn-tester:android:app:assembleDebug

# -------------------------
# JOBS: Test iOS Template
Expand Down Expand Up @@ -951,13 +937,6 @@ workflows:
branches:
ignore: gh-pages
- test_android_rntester:
name: test_android_rntester_hermes
use_hermes: true
filters:
branches:
ignore: gh-pages
- test_android_rntester:
name: test_android_rntester_jsc
filters:
branches:
ignore: gh-pages
Expand Down
1 change: 1 addition & 0 deletions BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ rn_xplat_cxx_library2(
"//fbobjc/Libraries/FBQPLMetadataProviders/...",
"//fbobjc/Libraries/FBReactKit/...",
"//fbobjc/Libraries/FBiOSSecurityUtils/...",
"//fbobjc/Libraries/RCTPrerendering/...",
"//fbobjc/VendorLib/react-native-maps:react-native-maps",
"//xplat/js:",
"//xplat/js/react-native-github/React/...",
Expand Down
7 changes: 6 additions & 1 deletion Libraries/Components/Touchable/TouchableOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,12 @@ class TouchableOpacity extends React.Component<Props, State> {

componentDidUpdate(prevProps: Props, prevState: State) {
this.state.pressability.configure(this._createPressabilityConfig());
if (this.props.disabled !== prevProps.disabled) {
if (
this.props.disabled !== prevProps.disabled ||
(flattenStyle(prevProps.style)?.opacity !==
flattenStyle(this.props.style)?.opacity) !==
undefined
) {
this._opacityInactive(250);
}
}
Expand Down
38 changes: 38 additions & 0 deletions Libraries/Core/RawEventEmitter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright (c) Meta Platforms, Inc. and 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
*/

import EventEmitter from '../vendor/emitter/EventEmitter';
import type {IEventEmitter} from '../vendor/emitter/EventEmitter';

export type RawEventEmitterEvent = $ReadOnly<{|
eventName: string,
// We expect, but do not/cannot require, that nativeEvent is an object
// with the properties: key, elementType (string), type (string), tag (numeric),
// and a stateNode of the native element/Fiber the event was emitted to.
nativeEvent: {[string]: mixed},
|}>;

type RawEventDefinitions = {
[eventChannel: string]: [RawEventEmitterEvent],
};

const RawEventEmitter: IEventEmitter<RawEventDefinitions> =
new EventEmitter<RawEventDefinitions>();

// See the React renderer / react repo for how this is used.
// Raw events are emitted here when they are received in JS
// and before any event Plugins process them or before components
// have a chance to respond to them. This allows you to implement
// app-specific perf monitoring, which is unimplemented by default,
// making this entire RawEventEmitter do nothing by default until
// *you* add listeners for your own app.
// Besides perf monitoring and maybe debugging, this RawEventEmitter
// should not be used.
export default RawEventEmitter;
6 changes: 3 additions & 3 deletions Libraries/EventEmitter/NativeEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

'use strict';

import {
type EventSubscription,
type IEventEmitter,
import type {
EventSubscription,
IEventEmitter,
} from '../vendor/emitter/EventEmitter';
import Platform from '../Utilities/Platform';
import RCTDeviceEventEmitter from './RCTDeviceEventEmitter';
Expand Down
3 changes: 2 additions & 1 deletion Libraries/EventEmitter/RCTDeviceEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* @format
*/

import EventEmitter, {type IEventEmitter} from '../vendor/emitter/EventEmitter';
import EventEmitter from '../vendor/emitter/EventEmitter';
import type {IEventEmitter} from '../vendor/emitter/EventEmitter';

// FIXME: use typed events
type RCTDeviceEventDefinitions = $FlowFixMe;
Expand Down
6 changes: 3 additions & 3 deletions Libraries/EventEmitter/__mocks__/NativeEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* @flow strict-local
*/

import {
type EventSubscription,
type IEventEmitter,
import type {
EventSubscription,
IEventEmitter,
} from '../../vendor/emitter/EventEmitter';
import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter';

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Linking/Linking.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @flow strict-local
*/

import {type EventSubscription} from '../vendor/emitter/EventEmitter';
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
import InteractionManager from '../Interaction/InteractionManager';
import Platform from '../Utilities/Platform';
Expand Down
18 changes: 7 additions & 11 deletions Libraries/NativeComponent/StaticViewConfigValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import getNativeComponentAttributes from '../ReactNative/getNativeComponentAttri
import {createViewConfig} from './ViewConfig';
import {isIgnored} from './ViewConfigIgnore';

type Difference =
export type Difference =
| {
type: 'missing',
path: Array<string>,
Expand All @@ -33,7 +33,7 @@ type Difference =
staticValue: mixed,
};

type ValidationResult = ValidResult | InvalidResult;
export type ValidationResult = ValidResult | InvalidResult;
type ValidResult = {
type: 'valid',
};
Expand All @@ -42,19 +42,15 @@ type InvalidResult = {
differences: Array<Difference>,
};

type ViewConfigValidationResult = {
// e.g. require('MyNativeComponent') where MyNativeComponent.js exports a HostComponent
type JSModule = $FlowFixMe;

export function validateStaticViewConfigs(nativeComponent: JSModule): {
componentName: string,
nativeViewConfig?: ?ViewConfig,
staticViewConfig?: ?ViewConfig,
validationResult?: ?ValidationResult,
};

// e.g. require('MyNativeComponent') where MyNativeComponent.js exports a HostComponent
type JSModule = $FlowFixMe;

export function validateStaticViewConfigs(
nativeComponent: JSModule,
): ViewConfigValidationResult {
} {
const nativeViewConfig = getNativeComponentAttributes(
nativeComponent.default || nativeComponent,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Notification = {|
+repeatInterval?: ?string,
+applicationIconBadgeNumber?: ?number,
+isSilent?: ?boolean,
+soundName?: ?string,
|};

export interface Spec extends TurboModule {
Expand Down
16 changes: 12 additions & 4 deletions Libraries/PushNotificationIOS/RCTPushNotificationManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,12 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
if (error != NULL) {
reject(@"-1", @"Error - Push authorization request failed.", error);
} else {
[RCTSharedApplication() registerForRemoteNotifications];
[UNUserNotificationCenter.currentNotificationCenter getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
resolve(RCTPromiseResolveValueForUNNotificationSettings(settings));
}];
dispatch_async(dispatch_get_main_queue(), ^{
[RCTSharedApplication() registerForRemoteNotifications];
[UNUserNotificationCenter.currentNotificationCenter getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
resolve(RCTPromiseResolveValueForUNNotificationSettings(settings));
}];
});
}
}];
}
Expand Down Expand Up @@ -365,6 +367,9 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
}
if (notification.isSilent()) {
notificationDict[@"isSilent"] = @(*notification.isSilent());
if ([notificationDict[@"isSilent"] isEqualToNumber:@(NO)]) {
notificationDict[@"soundName"] = notification.soundName();
}
}
[RCTSharedApplication() presentLocalNotificationNow:[RCTConvert UILocalNotification:notificationDict]];
}
Expand All @@ -386,6 +391,9 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
}
if (notification.isSilent()) {
notificationDict[@"isSilent"] = @(*notification.isSilent());
if ([notificationDict[@"isSilent"] isEqualToNumber:@(NO)]) {
notificationDict[@"soundName"] = notification.soundName();
}
}
[RCTSharedApplication() scheduleLocalNotification:[RCTConvert UILocalNotification:notificationDict]];
}
Expand Down
4 changes: 4 additions & 0 deletions Libraries/ReactPrivate/ReactNativePrivateInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import typeof flattenStyle from '../StyleSheet/flattenStyle';
import {type DangerouslyImpreciseStyleProp} from '../StyleSheet/StyleSheet';
import typeof ReactFiberErrorDialog from '../Core/ReactFiberErrorDialog';
import typeof legacySendAccessibilityEvent from '../Components/AccessibilityInfo/legacySendAccessibilityEvent';
import typeof RawEventEmitter from '../Core/RawEventEmitter';

// flowlint unsafe-getters-setters:off
module.exports = {
Expand Down Expand Up @@ -62,4 +63,7 @@ module.exports = {
get legacySendAccessibilityEvent(): legacySendAccessibilityEvent {
return require('../Components/AccessibilityInfo/legacySendAccessibilityEvent');
},
get RawEventEmitter(): RawEventEmitter {
return require('../Core/RawEventEmitter').default;
},
};
2 changes: 1 addition & 1 deletion Libraries/Utilities/verifyComponentAttributeEquivalence.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function verifyComponentAttributeEquivalence(

// Return the different key-value pairs of the right object, by iterating through the keys in the left object
// Note it won't return a difference where a key is missing in the left but exists the right.
export function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object {
function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object {
const differentKeys = {};

function compare(leftItem: any, rightItem: any, key: string) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/vendor/emitter/_EmitterSubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import type EventEmitter from './EventEmitter';
import _EventSubscription from './_EventSubscription';
import type EventSubscriptionVendor from './_EventSubscriptionVendor';
import {type EventSubscription} from './EventSubscription';
import type {EventSubscription} from './EventSubscription';

/**
* EmitterSubscription represents a subscription with listener and context data.
Expand Down
2 changes: 1 addition & 1 deletion Libraries/vendor/emitter/_EventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const invariant = require('invariant');

import EmitterSubscription from './_EmitterSubscription';
import {type EventSubscription} from './EventSubscription';
import type {EventSubscription} from './EventSubscription';
import EventSubscriptionVendor from './_EventSubscriptionVendor';

const sparseFilterPredicate = () => true;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/vendor/emitter/_EventSubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

import {type EventSubscription} from './EventSubscription';
import type {EventSubscription} from './EventSubscription';
import type EventSubscriptionVendor from './_EventSubscriptionVendor';

/**
Expand Down
46 changes: 29 additions & 17 deletions React/Views/RCTView.m
Original file line number Diff line number Diff line change
Expand Up @@ -706,33 +706,45 @@ - (RCTCornerRadii)cornerRadii
};
}

- (RCTBorderColors)borderColors
- (RCTBorderColors)borderColorsWithTraitCollection:(UITraitCollection *)traitCollection
{
const BOOL isRTL = _reactLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;

UIColor *directionAwareBorderLeftColor = nil;
UIColor *directionAwareBorderRightColor = nil;

if ([[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) {
UIColor *borderStartColor = _borderStartColor ?: _borderLeftColor;
UIColor *borderEndColor = _borderEndColor ?: _borderRightColor;

UIColor *directionAwareBorderLeftColor = isRTL ? borderEndColor : borderStartColor;
UIColor *directionAwareBorderRightColor = isRTL ? borderStartColor : borderEndColor;

return (RCTBorderColors){
(_borderTopColor ?: _borderColor).CGColor,
(directionAwareBorderLeftColor ?: _borderColor).CGColor,
(_borderBottomColor ?: _borderColor).CGColor,
(directionAwareBorderRightColor ?: _borderColor).CGColor,
};
directionAwareBorderLeftColor = isRTL ? borderEndColor : borderStartColor;
directionAwareBorderRightColor = isRTL ? borderStartColor : borderEndColor;
} else {
directionAwareBorderLeftColor = (isRTL ? _borderEndColor : _borderStartColor) ?: _borderLeftColor;
directionAwareBorderRightColor = (isRTL ? _borderStartColor : _borderEndColor) ?: _borderRightColor;
}

UIColor *directionAwareBorderLeftColor = isRTL ? _borderEndColor : _borderStartColor;
UIColor *directionAwareBorderRightColor = isRTL ? _borderStartColor : _borderEndColor;
UIColor *borderColor = _borderColor;
UIColor *borderTopColor = _borderTopColor;
UIColor *borderBottomColor = _borderBottomColor;

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, *)) {
borderColor = [borderColor resolvedColorWithTraitCollection:self.traitCollection];
borderTopColor = [borderTopColor resolvedColorWithTraitCollection:self.traitCollection];
directionAwareBorderLeftColor =
[directionAwareBorderLeftColor resolvedColorWithTraitCollection:self.traitCollection];
borderBottomColor = [borderBottomColor resolvedColorWithTraitCollection:self.traitCollection];
directionAwareBorderRightColor =
[directionAwareBorderRightColor resolvedColorWithTraitCollection:self.traitCollection];
}
#endif

return (RCTBorderColors){
(_borderTopColor ?: _borderColor).CGColor,
(directionAwareBorderLeftColor ?: _borderLeftColor ?: _borderColor).CGColor,
(_borderBottomColor ?: _borderColor).CGColor,
(directionAwareBorderRightColor ?: _borderRightColor ?: _borderColor).CGColor,
(borderTopColor ?: borderColor).CGColor,
(directionAwareBorderLeftColor ?: borderColor).CGColor,
(borderBottomColor ?: borderColor).CGColor,
(directionAwareBorderRightColor ?: borderColor).CGColor,
};
}

Expand All @@ -758,7 +770,7 @@ - (void)displayLayer:(CALayer *)layer

const RCTCornerRadii cornerRadii = [self cornerRadii];
const UIEdgeInsets borderInsets = [self bordersAsInsets];
const RCTBorderColors borderColors = [self borderColors];
const RCTBorderColors borderColors = [self borderColorsWithTraitCollection:self.traitCollection];

BOOL useIOSBorderRendering = RCTCornerRadiiAreEqual(cornerRadii) && RCTBorderInsetsAreEqual(borderInsets) &&
RCTBorderColorsAreEqual(borderColors) && _borderStyle == RCTBorderStyleSolid &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.devsupport.DevSupportManagerFactory;
import com.facebook.react.devsupport.ReactInstanceDevHelper;
import com.facebook.react.devsupport.RedBoxHandler;
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
import com.facebook.react.modules.appearance.AppearanceModule;
import com.facebook.react.modules.appregistry.AppRegistry;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import com.facebook.react.common.SurfaceDelegateFactory;
import com.facebook.react.devsupport.DefaultDevSupportManagerFactory;
import com.facebook.react.devsupport.DevSupportManagerFactory;
import com.facebook.react.devsupport.RedBoxHandler;
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
import com.facebook.react.jscexecutor.JSCExecutor;
import com.facebook.react.jscexecutor.JSCExecutorFactory;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.facebook.react.common.SurfaceDelegate;
import com.facebook.react.common.SurfaceDelegateFactory;
import com.facebook.react.devsupport.DevSupportManagerFactory;
import com.facebook.react.devsupport.RedBoxHandler;
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
import com.facebook.react.uimanager.UIImplementationProvider;
import java.util.List;

Expand Down
Loading

0 comments on commit c263d93

Please sign in to comment.