Skip to content

Commit

Permalink
Merge branch 'upstream/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.circleci/config.yml
#	.flowconfig
#	.flowconfig.android
#	CHANGELOG.md
#	Libraries/AppDelegate/RCTAppDelegate.h
#	React/Fabric/RCTSurfaceTouchHandler.mm
#	ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt
#	ReactAndroid/src/main/jni/CMakeLists.txt
#	ReactCommon/hermes/inspector/chrome/MessageTypes.cpp
#	ReactCommon/hermes/inspector/chrome/MessageTypes.h
#	ReactCommon/hermes/inspector/tools/message_types.txt
#	package.json
#	packages/rn-tester/android/app/build.gradle
#	packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterActivity.java
#	repo-config/package.json
#	scripts/react_native_pods.rb
#	template/_flowconfig
#	template/android/app/build.gradle
#	template/android/app/src/main/java/com/helloworld/MainApplication.java
#	template/android/app/src/main/jni/CMakeLists.txt
#	template/ios/HelloWorld/AppDelegate.mm
#	template/package.json
#	yarn.lock
  • Loading branch information
roryabraham committed Aug 30, 2022
2 parents f204f5d + 9e169da commit 9ae49b1
Show file tree
Hide file tree
Showing 134 changed files with 2,867 additions and 726 deletions.
11 changes: 4 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ references:
# Dependency Anchors
# -------------------------
dependency_versions:
# The Xcode version used on CircleCI OSS tests must be kept in sync with
# the Xcode version used on Sandcastle OSS tests. See _XCODE_VERSION in
# tools/utd/migrated_nbtd_jobs/react_native_oss.td
xcode_version: &xcode_version "13.3.1"
nodelts_image: &nodelts_image "cimg/node:16.14"
nodeprevlts_image: &nodeprevlts_image "cimg/node:14.19"
Expand All @@ -50,10 +47,10 @@ references:
checkout_cache_key: &checkout_cache_key v1-checkout
gems_cache_key: &gems_cache_key v1-gems-{{ checksum "Gemfile.lock" }}
gradle_cache_key: &gradle_cache_key v1-gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "ReactAndroid/gradle.properties" }}
hermes_cache_key: &hermes_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
hermes_windows_cache_key: &hermes_windows_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "tmp/hermes/hermesversion" }}
hermes_tarball_cache_key: &hermes_tarball_cache_key v2-hermes-tarball-{{ checksum "/tmp/hermes/hermesversion" }}
pods_cache_key: &pods_cache_key v7-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }}
hermes_cache_key: &hermes_cache_key v3-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
hermes_windows_cache_key: &hermes_windows_cache_key v3-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "tmp/hermes/hermesversion" }}
hermes_tarball_cache_key: &hermes_tarball_cache_key v3-hermes-tarball-{{ checksum "/tmp/hermes/hermesversion" }}
pods_cache_key: &pods_cache_key v8-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }}
windows_yarn_cache_key: &windows_yarn_cache_key v1-win-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }}
yarn_cache_key: &yarn_cache_key v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}

Expand Down
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ untyped-import
untyped-type-import

[version]
^0.184.0
^0.185.1
2 changes: 1 addition & 1 deletion .flowconfig.android
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ untyped-import
untyped-type-import

[version]
^0.184.0
^0.185.1
1 change: 1 addition & 0 deletions BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ REACT_PUBLIC_HEADERS = {
"React/RCTBridgeMethod.h": RCTBASE_PATH + "RCTBridgeMethod.h",
"React/RCTBridgeModule.h": RCTBASE_PATH + "RCTBridgeModule.h",
"React/RCTBridgeModuleDecorator.h": RCTBASE_PATH + "RCTBridgeModuleDecorator.h",
"React/RCTBundleManager.h": RCTBASE_PATH + "RCTBundleManager.h",
"React/RCTBundleURLProvider.h": RCTBASE_PATH + "RCTBundleURLProvider.h",
"React/RCTComponent.h": RCTVIEWS_PATH + "RCTComponent.h",
"React/RCTComponentData.h": RCTVIEWS_PATH + "RCTComponentData.h",
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## v0.69.5

### Changed

- Bump react-native-codegen to 0.69.2 ([df3d52bfbf](https://github.com/facebook/react-native/commit/df3d52bfbf4254cd16e1dc0ca0af2743cd7e11c1) by [@dmitryrykun](https://github.com/dmitryrykun))

#### Android specific

- Replaced reactnativeutilsjni with reactnativejni in the build process to reduce size ([54a4fcbfdc](https://github.com/facebook/react-native/commit/54a4fcbfdcc8111b3010b2c31ed3c1d48632ce4c) by [@SparshaSaha](https://github.com/SparshaSaha))

### Fixed

- Codegen should ignore `.d.ts` files ([0f0d52067c](https://github.com/facebook/react-native/commit/0f0d52067cb89fdb39a99021f0745282ce087fc2) by [@tido64](https://github.com/tido64))

## v0.69.4

### Changed
Expand Down
16 changes: 4 additions & 12 deletions Libraries/Animated/useAnimatedProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
useMemo,
useReducer,
useRef,
useState,
} from 'react';

type ReducedProps<TProps> = {
Expand All @@ -31,8 +30,6 @@ type ReducedProps<TProps> = {
};
type CallbackRef<T> = T => mixed;

let animatedComponentNextId = 1;

export default function useAnimatedProps<TProps: {...}, TInstance>(
props: TProps,
): [ReducedProps<TProps>, CallbackRef<TInstance | null>] {
Expand Down Expand Up @@ -141,16 +138,11 @@ function useAnimatedPropsLifecycle(node: AnimatedProps): void {
const prevNodeRef = useRef<?AnimatedProps>(null);
const isUnmountingRef = useRef<boolean>(false);

const [animatedComponentId] = useState(
() => `${animatedComponentNextId++}:animatedComponent`,
);

useLayoutEffect(() => {
NativeAnimatedHelper.API.setWaitingForIdentifier(animatedComponentId);
});

useEffect(() => {
NativeAnimatedHelper.API.unsetWaitingForIdentifier(animatedComponentId);
// It is ok for multiple components to call `flushQueue` because it noops
// if the queue is empty. When multiple animated components are mounted at
// the same time. Only first component flushes the queue and the others will noop.
NativeAnimatedHelper.API.flushQueue();
});

useLayoutEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/AppDelegate/RCTAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
///
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
- (BOOL)concurrentRootEnabled;

@end
Expand Down
208 changes: 208 additions & 0 deletions Libraries/Components/AccessibilityInfo/AccessibilityInfo.flow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
/**
* 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 type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
import type {ElementRef} from 'react';

// Events that are only supported on Android.
type AccessibilityEventDefinitionsAndroid = {
accessibilityServiceChanged: [boolean],
};

// Events that are only supported on iOS.
type AccessibilityEventDefinitionsIOS = {
announcementFinished: [{announcement: string, success: boolean}],
boldTextChanged: [boolean],
grayscaleChanged: [boolean],
invertColorsChanged: [boolean],
reduceTransparencyChanged: [boolean],
};

type AccessibilityEventDefinitions = {
...AccessibilityEventDefinitionsAndroid,
...AccessibilityEventDefinitionsIOS,
change: [boolean], // screenReaderChanged
reduceMotionChanged: [boolean],
screenReaderChanged: [boolean],
};

type AccessibilityEventTypes = 'click' | 'focus';
/**
* Sometimes it's useful to know whether or not the device has a screen reader
* that is currently active. The `AccessibilityInfo` API is designed for this
* purpose. You can use it to query the current state of the screen reader as
* well as to register to be notified when the state of the screen reader
* changes.
*
* See https://reactnative.dev/docs/accessibilityinfo
*/
export type AccessibilityInfoType = {
/**
* Query whether bold text is currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when bold text is enabled and `false` otherwise.
*
* See https://reactnative.dev/docs/accessibilityinfo#isBoldTextEnabled
*/
isBoldTextEnabled: () => Promise<boolean>,

/**
* Query whether grayscale is currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when grayscale is enabled and `false` otherwise.
*
* See https://reactnative.dev/docs/accessibilityinfo#isGrayscaleEnabled
*/
isGrayscaleEnabled: () => Promise<boolean>,

/**
* Query whether inverted colors are currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when invert color is enabled and `false` otherwise.
*
* See https://reactnative.dev/docs/accessibilityinfo#isInvertColorsEnabled
*/
isInvertColorsEnabled: () => Promise<boolean>,

/**
* Query whether reduced motion is currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when a reduce motion is enabled and `false` otherwise.
*
* See https://reactnative.dev/docs/accessibilityinfo#isReduceMotionEnabled
*/
isReduceMotionEnabled: () => Promise<boolean>,

/**
* Query whether reduce motion and prefer cross-fade transitions settings are currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when prefer cross-fade transitions is enabled and `false` otherwise.
*
* See https://reactnative.dev/docs/accessibilityinfo#prefersCrossFadeTransitions
*/
prefersCrossFadeTransitions: () => Promise<boolean>,

/**
* Query whether reduced transparency is currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when a reduce transparency is enabled and `false` otherwise.
*
* See https://reactnative.dev/docs/accessibilityinfo#isReduceTransparencyEnabled
*/
isReduceTransparencyEnabled: () => Promise<boolean>,

/**
* Query whether a screen reader is currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when a screen reader is enabled and `false` otherwise.
*
* See https://reactnative.dev/docs/accessibilityinfo#isScreenReaderEnabled
*/
isScreenReaderEnabled: () => Promise<boolean>,

/**
* Query whether Accessibility Service is currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when any service is enabled and `false` otherwise.
*
* @platform android
*
* See https://reactnative.dev/docs/accessibilityinfo/#isaccessibilityserviceenabled-android
*/
isAccessibilityServiceEnabled: () => Promise<boolean>,

/**
* Add an event handler. Supported events:
*
* - `reduceMotionChanged`: Fires when the state of the reduce motion toggle changes.
* The argument to the event handler is a boolean. The boolean is `true` when a reduce
* motion is enabled (or when "Transition Animation Scale" in "Developer options" is
* "Animation off") and `false` otherwise.
* - `screenReaderChanged`: Fires when the state of the screen reader changes. The argument
* to the event handler is a boolean. The boolean is `true` when a screen
* reader is enabled and `false` otherwise.
*
* These events are only supported on iOS:
*
* - `boldTextChanged`: iOS-only event. Fires when the state of the bold text toggle changes.
* The argument to the event handler is a boolean. The boolean is `true` when a bold text
* is enabled and `false` otherwise.
* - `grayscaleChanged`: iOS-only event. Fires when the state of the gray scale toggle changes.
* The argument to the event handler is a boolean. The boolean is `true` when a gray scale
* is enabled and `false` otherwise.
* - `invertColorsChanged`: iOS-only event. Fires when the state of the invert colors toggle
* changes. The argument to the event handler is a boolean. The boolean is `true` when a invert
* colors is enabled and `false` otherwise.
* - `reduceTransparencyChanged`: iOS-only event. Fires when the state of the reduce transparency
* toggle changes. The argument to the event handler is a boolean. The boolean is `true`
* when a reduce transparency is enabled and `false` otherwise.
* - `announcementFinished`: iOS-only event. Fires when the screen reader has
* finished making an announcement. The argument to the event handler is a
* dictionary with these keys:
* - `announcement`: The string announced by the screen reader.
* - `success`: A boolean indicating whether the announcement was
* successfully made.
*
* See https://reactnative.dev/docs/accessibilityinfo#addeventlistener
*/
addEventListener<K: $Keys<AccessibilityEventDefinitions>>(
eventName: K,
handler: (...$ElementType<AccessibilityEventDefinitions, K>) => void,
): EventSubscription,

/**
* Set accessibility focus to a React component.
*
* See https://reactnative.dev/docs/accessibilityinfo#setaccessibilityfocus
*/
setAccessibilityFocus: (reactTag: number) => void,

/**
* Send a named accessibility event to a HostComponent.
*/
sendAccessibilityEvent: (
handle: ElementRef<HostComponent<mixed>>,
eventType: AccessibilityEventTypes,
) => void,

/**
* Post a string to be announced by the screen reader.
*
* See https://reactnative.dev/docs/accessibilityinfo#announceforaccessibility
*/
announceForAccessibility: (announcement: string) => void,

/**
* Post a string to be announced by the screen reader.
* - `announcement`: The string announced by the screen reader.
* - `options`: An object that configures the reading options.
* - `queue`: The announcement will be queued behind existing announcements. iOS only.
*/
announceForAccessibilityWithOptions: (
announcement: string,
options: {queue?: boolean},
) => void,

/**
* Get the recommended timeout for changes to the UI needed by this user.
*
* See https://reactnative.dev/docs/accessibilityinfo#getrecommendedtimeoutmillis
*/
getRecommendedTimeoutMillis: (originalTimeout: number) => Promise<number>,
};
32 changes: 31 additions & 1 deletion Libraries/Components/AccessibilityInfo/AccessibilityInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import NativeAccessibilityInfoAndroid from './NativeAccessibilityInfo';
import NativeAccessibilityManagerIOS from './NativeAccessibilityManager';
import legacySendAccessibilityEvent from './legacySendAccessibilityEvent';
import type {ElementRef} from 'react';
import type {AccessibilityInfoType} from './AccessibilityInfo.flow';

// Events that are only supported on Android.
type AccessibilityEventDefinitionsAndroid = {
Expand Down Expand Up @@ -73,7 +74,7 @@ const EventNames: Map<
*
* See https://reactnative.dev/docs/accessibilityinfo
*/
const AccessibilityInfo = {
const AccessibilityInfo: AccessibilityInfoType = {
/**
* Query whether bold text is currently enabled.
*
Expand Down Expand Up @@ -178,6 +179,34 @@ const AccessibilityInfo = {
});
},

/**
* Query whether reduce motion and prefer cross-fade transitions settings are currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when prefer cross-fade transitions is enabled and `false` otherwise.
*
* See https://reactnative.dev/docs/accessibilityinfo#prefersCrossFadeTransitions
*/
prefersCrossFadeTransitions(): Promise<boolean> {
return new Promise((resolve, reject) => {
if (Platform.OS === 'android') {
return Promise.resolve(false);
} else {
if (
NativeAccessibilityManagerIOS?.getCurrentPrefersCrossFadeTransitionsState !=
null
) {
NativeAccessibilityManagerIOS.getCurrentPrefersCrossFadeTransitionsState(
resolve,
reject,
);
} else {
reject(null);
}
}
});
},

/**
* Query whether reduced transparency is currently enabled.
*
Expand Down Expand Up @@ -295,6 +324,7 @@ const AccessibilityInfo = {
*/
addEventListener<K: $Keys<AccessibilityEventDefinitions>>(
eventName: K,
// $FlowIssue[incompatible-type] - Flow bug with unions and generics (T128099423)
handler: (...$ElementType<AccessibilityEventDefinitions, K>) => void,
): EventSubscription {
const deviceEventName = EventNames.get(eventName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export interface Spec extends TurboModule {
onSuccess: (isReduceMotionEnabled: boolean) => void,
onError: (error: Object) => void,
) => void;
+getCurrentPrefersCrossFadeTransitionsState?: (
onSuccess: (prefersCrossFadeTransitions: boolean) => void,
onError: (error: Object) => void,
) => void;
+getCurrentReduceTransparencyState: (
onSuccess: (isReduceTransparencyEnabled: boolean) => void,
onError: (error: Object) => void,
Expand Down
Loading

0 comments on commit 9ae49b1

Please sign in to comment.