Коммит
7c90d023ef
|
@ -329,7 +329,7 @@ jobs:
|
|||
- run:
|
||||
name: "Run Tests: JavaScript Tests"
|
||||
command: node ./scripts/run-ci-javascript-tests.js --maxWorkers 2
|
||||
# [macOS] Github#949 Disable this failing test
|
||||
# TODO(macOS GH#949): Disable this failing test
|
||||
# - run_e2e:
|
||||
# platform: js
|
||||
|
||||
|
@ -388,8 +388,6 @@ jobs:
|
|||
steps:
|
||||
- brew_install:
|
||||
package: watchman
|
||||
- brew_install:
|
||||
package: node@16
|
||||
- run:
|
||||
name: "Brew: Tap wix/brew"
|
||||
command: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
|
||||
|
@ -576,41 +574,39 @@ jobs:
|
|||
steps:
|
||||
- checkout
|
||||
- run_yarn
|
||||
- attach_workspace:
|
||||
at: .
|
||||
|
||||
- run:
|
||||
name: Setup the Android Template
|
||||
name: Create Android template project
|
||||
command: |
|
||||
REPO_ROOT=$(pwd)
|
||||
PACKAGE=$(cat build/react-native-package-version)
|
||||
PATH_TO_PACKAGE="$REPO_ROOT/build/$PACKAGE"
|
||||
cd template
|
||||
# We replace the "react-native" dependency version with file:.. so we use it from source.
|
||||
sed -i 's/\"react-native\"\:.*/\"react-native\"\: \"file\:\.\.\"/g' package.json
|
||||
npm add $PATH_TO_PACKAGE
|
||||
npm install
|
||||
# react-native-community/cli is needed as the Android template is referencing a .gradle file inside it.
|
||||
npm i @react-native-community/cli
|
||||
|
||||
- run:
|
||||
name: Bundle the latest version of ReactAndroid
|
||||
command: ./gradlew :ReactAndroid:publishReleasePublicationToNpmRepository
|
||||
|
||||
- run:
|
||||
name: Build the template application
|
||||
command: cd template/android/ && ./gradlew assembleDebug
|
||||
|
||||
# -------------------------
|
||||
# JOBS: Test Docker
|
||||
# JOBS: Test Android RNTester
|
||||
# -------------------------
|
||||
test_docker:
|
||||
machine: true
|
||||
test_android_rntester:
|
||||
executor: reactnativeandroid
|
||||
steps:
|
||||
- checkout
|
||||
- run_yarn
|
||||
|
||||
- run:
|
||||
name: Build Docker container for Android RNTester App
|
||||
command: |
|
||||
source ~/.bashrc
|
||||
nvm i node
|
||||
npm i -g yarn
|
||||
echo y | npx envinfo@latest
|
||||
yarn run docker-setup-android
|
||||
yarn run docker-build-android
|
||||
name: Generate artifacts for Maven
|
||||
command: ./gradlew :ReactAndroid:installArchives
|
||||
|
||||
- run:
|
||||
name: Assemble RNTester
|
||||
command: ./gradlew :packages:rn-tester:android:app:assembleDebug
|
||||
|
||||
# -------------------------
|
||||
# JOBS: Test iOS Template
|
||||
|
@ -645,6 +641,40 @@ jobs:
|
|||
-scheme $PROJECT_NAME \
|
||||
-sdk iphonesimulator
|
||||
|
||||
# -------------------------
|
||||
# JOBS: Test iOS RNTester
|
||||
# -------------------------
|
||||
test_ios_rntester:
|
||||
executor: reactnativeios
|
||||
parameters:
|
||||
use_hermes:
|
||||
type: boolean
|
||||
default: false
|
||||
steps:
|
||||
- checkout
|
||||
- run_yarn
|
||||
|
||||
- when:
|
||||
condition: << parameters.use_hermes >>
|
||||
steps:
|
||||
- run:
|
||||
name: Set USE_HERMES=1
|
||||
command: echo "export USE_HERMES=1" >> $BASH_ENV
|
||||
|
||||
- run:
|
||||
name: Install CocoaPods dependencies
|
||||
command: |
|
||||
rm -rf packages/rn-tester/Pods
|
||||
cd packages/rn-tester && bundle exec pod install
|
||||
|
||||
- run:
|
||||
name: Build RNTester
|
||||
command: |
|
||||
xcodebuild build \
|
||||
-workspace packages/rn-tester/RNTesterPods.xcworkspace \
|
||||
-scheme RNTester \
|
||||
-sdk iphonesimulator
|
||||
|
||||
# -------------------------
|
||||
# JOBS: Windows
|
||||
# -------------------------
|
||||
|
@ -890,11 +920,6 @@ workflows:
|
|||
- build_npm_package:
|
||||
# Build a release package on every untagged commit, but do not publish to npm.
|
||||
publish_npm_args: --dry-run
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- main
|
||||
- /^pull\/.*$/
|
||||
- test_js:
|
||||
run_disabled_tests: false
|
||||
filters:
|
||||
|
@ -904,19 +929,34 @@ workflows:
|
|||
run_disabled_tests: false
|
||||
filters:
|
||||
branches:
|
||||
# [macOS] disable this test which is redundant to Azure Devops test and it requires a CCI plan with resource-class:large.
|
||||
ignore: /.*/
|
||||
ignore: gh-pages
|
||||
- test_android_template:
|
||||
requires:
|
||||
- build_npm_package
|
||||
filters:
|
||||
branches:
|
||||
# [macOS] disable this test which is redundant to Azure Devops test and it requires a CCI plan with resource-class:large.
|
||||
ignore: /.*/
|
||||
ignore: gh-pages
|
||||
- test_android_rntester:
|
||||
filters:
|
||||
branches:
|
||||
ignore: gh-pages
|
||||
- test_ios_template:
|
||||
requires:
|
||||
- build_npm_package
|
||||
filters:
|
||||
branches:
|
||||
ignore: gh-pages
|
||||
- test_ios_rntester:
|
||||
name: test_ios_rntester_hermes
|
||||
use_hermes: true
|
||||
filters:
|
||||
branches:
|
||||
ignore: gh-pages
|
||||
- test_ios_rntester:
|
||||
name: test_ios_rntester_jsc
|
||||
filters:
|
||||
branches:
|
||||
ignore: gh-pages
|
||||
- test_ios:
|
||||
name: test_ios_unit_jsc
|
||||
run_unit_tests: true
|
||||
|
@ -941,25 +981,16 @@ workflows:
|
|||
# use_hermes: true
|
||||
# use_frameworks: true
|
||||
# run_unit_tests: true
|
||||
# [macOS] Github#949 Disable this failing test
|
||||
# - test_js:
|
||||
# name: test_js_prev_lts
|
||||
# executor: nodeprevlts
|
||||
# filters:
|
||||
# branches:
|
||||
# ignore: gh-pages
|
||||
- test_docker:
|
||||
- test_js:
|
||||
name: test_js_prev_lts
|
||||
executor: nodeprevlts
|
||||
filters:
|
||||
branches:
|
||||
# [macOS] disable this test which is redundant to Azure Devops test and in the fork it fails because of Microsoft's V8 upgrade to Android
|
||||
ignore: /.*/
|
||||
ignore: gh-pages
|
||||
- test_windows:
|
||||
filters:
|
||||
branches:
|
||||
# [macOS disable this test which requires a CCI plan.
|
||||
# ignore: gh-pages
|
||||
ignore: /.*/
|
||||
# macOS]
|
||||
ignore: gh-pages
|
||||
run_disabled_tests: false
|
||||
|
||||
# This workflow should only be triggered by release script
|
||||
|
@ -1009,11 +1040,10 @@ workflows:
|
|||
|
||||
# Gather coverage
|
||||
- js_coverage:
|
||||
# [macOS disable this test, it fails in the fork due to not being set up for coveralls
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
# macOS]
|
||||
ignore: gh-pages
|
||||
|
||||
nightly:
|
||||
unless: << pipeline.parameters.run_package_release_workflow_only >>
|
||||
triggers:
|
||||
|
@ -1021,13 +1051,13 @@ workflows:
|
|||
cron: "0 20 * * *"
|
||||
filters:
|
||||
branches:
|
||||
# [macOS disable this release. We never want to release anything from this fork via CCI.
|
||||
# [TODO(macOS GH#774): disable this release. We never want to release anything from this fork via CCI.
|
||||
ignore: /.*/
|
||||
# only:
|
||||
# - main
|
||||
# macOS]
|
||||
# ]TODO(macOS GH#774)
|
||||
jobs:
|
||||
- nightly_job
|
||||
|
||||
- build_npm_package:
|
||||
publish_npm_args: --nightly
|
||||
publish_npm_args: --nightly
|
|
@ -78,4 +78,4 @@ untyped-import
|
|||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.170.0
|
||||
^0.171.0
|
||||
|
|
|
@ -81,4 +81,4 @@ untyped-import
|
|||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.170.0
|
||||
^0.171.0
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
[ignore]
|
||||
; [macOS]
|
||||
; We fork some components by platform
|
||||
; We fork some components by platform [macOS]
|
||||
.*/*[.]ios.js
|
||||
.*/*[.]android.js
|
||||
|
||||
|
@ -13,7 +12,7 @@
|
|||
; Ignore "BUCK" generated dirs
|
||||
<PROJECT_ROOT>/\.buckd/
|
||||
|
||||
; [macOS Ignore metro.config.js
|
||||
; [macOS] Ignore metro.config.js
|
||||
<PROJECT_ROOT>/metro.config.js
|
||||
|
||||
; Flow doesn't support platforms
|
||||
|
@ -39,8 +38,11 @@ emoji=true
|
|||
|
||||
exact_by_default=true
|
||||
|
||||
format.bracket_spacing=false
|
||||
|
||||
module.file_ext=.js
|
||||
module.file_ext=.json
|
||||
; [macOS]
|
||||
module.file_ext=.macos.js
|
||||
|
||||
munge_underscores=true
|
||||
|
@ -55,19 +57,16 @@ suppress_type=$FlowFixMeProps
|
|||
suppress_type=$FlowFixMeState
|
||||
suppress_type=$FlowFixMeEmpty
|
||||
|
||||
experimental.abstract_locations=true
|
||||
|
||||
[lints]
|
||||
sketchy-null-number=warn
|
||||
sketchy-null-mixed=warn
|
||||
sketchy-number=warn
|
||||
untyped-type-import=warn
|
||||
nonstrict-import=warn
|
||||
deprecated-type=warn
|
||||
deprecated-type=error
|
||||
unsafe-getters-setters=warn
|
||||
unnecessary-invariant=warn
|
||||
signature-verification-failure=warn
|
||||
deprecated-utility=error
|
||||
|
||||
[strict]
|
||||
deprecated-type
|
||||
|
@ -79,4 +78,4 @@ untyped-import
|
|||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.170.0
|
||||
^0.171.0
|
||||
|
|
2
BUCK
2
BUCK
|
@ -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/...",
|
||||
|
@ -723,7 +724,6 @@ rn_library(
|
|||
"//xplat/js:node_modules__abort_19controller",
|
||||
"//xplat/js:node_modules__anser",
|
||||
"//xplat/js:node_modules__base64_19js",
|
||||
"//xplat/js:node_modules__deprecated_19react_19native_19prop_19types",
|
||||
"//xplat/js:node_modules__event_19target_19shim",
|
||||
"//xplat/js:node_modules__invariant",
|
||||
"//xplat/js:node_modules__nullthrows",
|
||||
|
|
|
@ -90,6 +90,18 @@ const API = {
|
|||
NativeAnimatedModule.createAnimatedNode(tag, config),
|
||||
);
|
||||
},
|
||||
updateAnimatedNodeConfig: function (
|
||||
tag: number,
|
||||
config: AnimatedNodeConfig,
|
||||
): void {
|
||||
invariant(NativeAnimatedModule, 'Native animated module is not available');
|
||||
if (typeof NativeAnimatedModule.updateAnimatedNodeConfig === 'function') {
|
||||
API.queueOperation(() =>
|
||||
// $FlowIgnore[not-a-function] - checked above
|
||||
NativeAnimatedModule.updateAnimatedNodeConfig(tag, config),
|
||||
);
|
||||
}
|
||||
},
|
||||
startListeningToAnimatedNodeValue: function (tag: number) {
|
||||
invariant(NativeAnimatedModule, 'Native animated module is not available');
|
||||
API.queueOperation(() =>
|
||||
|
|
|
@ -29,6 +29,7 @@ export interface Spec extends TurboModule {
|
|||
+startOperationBatch: () => void;
|
||||
+finishOperationBatch: () => void;
|
||||
+createAnimatedNode: (tag: number, config: AnimatedNodeConfig) => void;
|
||||
+updateAnimatedNodeConfig?: (tag: number, config: AnimatedNodeConfig) => void;
|
||||
+getValue: (tag: number, saveValueCallback: SaveValueCallback) => void;
|
||||
+startListeningToAnimatedNodeValue: (tag: number) => void;
|
||||
+stopListeningToAnimatedNodeValue: (tag: number) => void;
|
||||
|
|
|
@ -29,6 +29,7 @@ export interface Spec extends TurboModule {
|
|||
+startOperationBatch: () => void;
|
||||
+finishOperationBatch: () => void;
|
||||
+createAnimatedNode: (tag: number, config: AnimatedNodeConfig) => void;
|
||||
+updateAnimatedNodeConfig?: (tag: number, config: AnimatedNodeConfig) => void;
|
||||
+getValue: (tag: number, saveValueCallback: SaveValueCallback) => void;
|
||||
+startListeningToAnimatedNodeValue: (tag: number) => void;
|
||||
+stopListeningToAnimatedNodeValue: (tag: number) => void;
|
||||
|
|
|
@ -14,6 +14,7 @@ import AnimatedValue from './AnimatedValue';
|
|||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
import normalizeColor from '../../StyleSheet/normalizeColor';
|
||||
import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
|
@ -91,6 +92,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|||
g: AnimatedValue;
|
||||
b: AnimatedValue;
|
||||
a: AnimatedValue;
|
||||
nativeColor: Object;
|
||||
_listeners: {
|
||||
[key: string]: {
|
||||
r: string,
|
||||
|
@ -105,8 +107,16 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|||
constructor(valueIn?: ?(RgbaValue | RgbaAnimatedValue | ColorValue)) {
|
||||
super();
|
||||
let value: RgbaValue | RgbaAnimatedValue | ColorValue =
|
||||
valueIn || defaultColor;
|
||||
valueIn ?? defaultColor;
|
||||
this.setValue(value);
|
||||
this._listeners = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Directly set the value. This will stop any animations running on the value
|
||||
* and update all the bound properties.
|
||||
*/
|
||||
setValue(value: RgbaValue | RgbaAnimatedValue | ColorValue): void {
|
||||
if (isRgbaAnimatedValue(value)) {
|
||||
// $FlowIgnore[incompatible-cast] - Type is verified above
|
||||
const rgbaAnimatedValue: RgbaAnimatedValue = (value: RgbaAnimatedValue);
|
||||
|
@ -118,29 +128,60 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|||
// Handle potential parsable string color or platform color object
|
||||
if (!isRgbaValue(value)) {
|
||||
// $FlowIgnore[incompatible-cast] - Type is verified via conditionals
|
||||
value = processColor((value: ColorValue)) || {r: 0, g: 0, b: 0, a: 1.0};
|
||||
// TODO: support platform color
|
||||
value = processColor((value: ColorValue)) ?? defaultColor;
|
||||
}
|
||||
|
||||
// $FlowIgnore[incompatible-cast] - Type is verified via conditionals
|
||||
const rgbaValue: RgbaValue = (value: RgbaValue);
|
||||
this.r = new AnimatedValue(rgbaValue.r);
|
||||
this.g = new AnimatedValue(rgbaValue.g);
|
||||
this.b = new AnimatedValue(rgbaValue.b);
|
||||
this.a = new AnimatedValue(rgbaValue.a);
|
||||
}
|
||||
this._listeners = {};
|
||||
}
|
||||
if (!isRgbaValue(value)) {
|
||||
// We are using a platform color
|
||||
this.nativeColor = value;
|
||||
value = defaultColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Directly set the value. This will stop any animations running on the value
|
||||
* and update all the bound properties.
|
||||
*/
|
||||
setValue(value: {r: number, g: number, b: number, a: number, ...}): void {
|
||||
this.r.setValue(value.r);
|
||||
this.g.setValue(value.g);
|
||||
this.b.setValue(value.b);
|
||||
this.a.setValue(value.a);
|
||||
if (isRgbaValue(value)) {
|
||||
// $FlowIgnore[incompatible-cast] - Type is verified via conditionals
|
||||
const rgbaValue: RgbaValue = (value: RgbaValue);
|
||||
|
||||
if (this.r) {
|
||||
this.r.setValue(rgbaValue.r);
|
||||
} else {
|
||||
this.r = new AnimatedValue(rgbaValue.r);
|
||||
}
|
||||
|
||||
if (this.g) {
|
||||
this.g.setValue(rgbaValue.g);
|
||||
} else {
|
||||
this.g = new AnimatedValue(rgbaValue.g);
|
||||
}
|
||||
|
||||
if (this.b) {
|
||||
this.b.setValue(rgbaValue.b);
|
||||
} else {
|
||||
this.b = new AnimatedValue(rgbaValue.b);
|
||||
}
|
||||
|
||||
if (this.a) {
|
||||
this.a.setValue(rgbaValue.a);
|
||||
} else {
|
||||
this.a = new AnimatedValue(rgbaValue.a);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.nativeColor) {
|
||||
if (!this.__isNative) {
|
||||
this.__makeNative();
|
||||
}
|
||||
|
||||
const nativeTag = this.__getNativeTag();
|
||||
NativeAnimatedHelper.API.setWaitingForIdentifier(nativeTag.toString());
|
||||
NativeAnimatedHelper.API.updateAnimatedNodeConfig(
|
||||
nativeTag,
|
||||
this.__getNativeConfig(),
|
||||
);
|
||||
NativeAnimatedHelper.API.unsetWaitingForIdentifier(
|
||||
nativeTag.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,7 +189,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|||
* via `setValue`, an animation, or `Animated.event`. Useful for compensating
|
||||
* things like the start of a pan gesture.
|
||||
*/
|
||||
setOffset(offset: {r: number, g: number, b: number, a: number, ...}): void {
|
||||
setOffset(offset: RgbaValue): void {
|
||||
this.r.setOffset(offset.r);
|
||||
this.g.setOffset(offset.g);
|
||||
this.b.setOffset(offset.b);
|
||||
|
@ -280,6 +321,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|||
g: this.g.__getNativeTag(),
|
||||
b: this.b.__getNativeTag(),
|
||||
a: this.a.__getNativeTag(),
|
||||
nativeColor: this.nativeColor,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,14 +23,14 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
|||
|
||||
type ExtrapolateType = 'extend' | 'identity' | 'clamp';
|
||||
|
||||
export type InterpolationConfigType = {
|
||||
export type InterpolationConfigType = $ReadOnly<{
|
||||
inputRange: $ReadOnlyArray<number>,
|
||||
outputRange: $ReadOnlyArray<number> | $ReadOnlyArray<string>,
|
||||
easing?: (input: number) => number,
|
||||
extrapolate?: ExtrapolateType,
|
||||
extrapolateLeft?: ExtrapolateType,
|
||||
extrapolateRight?: ExtrapolateType,
|
||||
};
|
||||
}>;
|
||||
|
||||
const linear = (t: number) => t;
|
||||
|
||||
|
|
|
@ -130,12 +130,12 @@ class AnimatedNode {
|
|||
if (data.tag !== this.__getNativeTag()) {
|
||||
return;
|
||||
}
|
||||
this._onAnimatedValueUpdateReceived(data.value);
|
||||
this.__onAnimatedValueUpdateReceived(data.value);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
_onAnimatedValueUpdateReceived(value: number) {
|
||||
__onAnimatedValueUpdateReceived(value: number) {
|
||||
this.__callListeners(value);
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ class AnimatedValue extends AnimatedWithChildren {
|
|||
}
|
||||
}
|
||||
|
||||
_onAnimatedValueUpdateReceived(value: number): void {
|
||||
__onAnimatedValueUpdateReceived(value: number): void {
|
||||
this._updateValue(value, false /*flush*/);
|
||||
}
|
||||
|
||||
|
|
|
@ -370,20 +370,6 @@ type IOSProps = $ReadOnly<{|
|
|||
| 'never'
|
||||
| 'always'
|
||||
),
|
||||
/**
|
||||
* Experimental: specifies how much to adjust the content view by when using
|
||||
* the keyboard to scroll. This value adjusts the content's horizontal offset.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
horizontalLineScroll?: number, // [macOS]
|
||||
/**
|
||||
* Experimental: specifies how much to adjust the content view by when using
|
||||
* the keyboard to scroll. This value adjusts the content's vertical offset.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
verticalLineScroll?: number, // [macOS]
|
||||
|}>;
|
||||
|
||||
type AndroidProps = $ReadOnly<{|
|
||||
|
@ -500,7 +486,7 @@ export type Props = $ReadOnly<{|
|
|||
*/
|
||||
invertStickyHeaders?: ?boolean,
|
||||
/**
|
||||
* Reverses the direction of scroll. Uses native inversion on macOS and scale transforms of -1 elsewhere
|
||||
* Reverses the direction of scroll. Uses native inversion on macOS and scale transforms of -1 elsewhere // [macOS]
|
||||
*/
|
||||
inverted?: ?boolean, // [macOS]
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType';
|
||||
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
|
||||
import {ConditionallyIgnoredEventHandlers} from '../../NativeComponent/ViewConfigIgnore';
|
||||
import Platform from '../../Utilities/Platform';
|
||||
|
||||
const RCTScrollViewViewConfig =
|
||||
|
@ -138,6 +139,18 @@ const RCTScrollViewViewConfig =
|
|||
snapToOffsets: true,
|
||||
snapToStart: true,
|
||||
zoomScale: true,
|
||||
...ConditionallyIgnoredEventHandlers({
|
||||
onScrollBeginDrag: true,
|
||||
onMomentumScrollEnd: true,
|
||||
onScrollEndDrag: true,
|
||||
onMomentumScrollBegin: true,
|
||||
onScrollToTop: true,
|
||||
onScroll: true,
|
||||
// [macOS
|
||||
onInvertedDidChange: true,
|
||||
onPreferredScrollerStyleDidChange: true,
|
||||
// macOS]
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -235,7 +235,6 @@ const Slider = (
|
|||
}
|
||||
: null;
|
||||
|
||||
const onChangeEvent = onValueChangeEvent;
|
||||
const onSlidingCompleteEvent = onSlidingComplete
|
||||
? (event: Event) => {
|
||||
onSlidingComplete(event.nativeEvent.value);
|
||||
|
@ -257,7 +256,6 @@ const Slider = (
|
|||
disabled={disabled}
|
||||
maximumValue={maximumValue}
|
||||
minimumValue={minimumValue}
|
||||
onChange={onChangeEvent}
|
||||
onResponderTerminationRequest={() => false}
|
||||
onSlidingComplete={onSlidingCompleteEvent}
|
||||
onStartShouldSetResponder={() => true}
|
||||
|
|
|
@ -47,7 +47,6 @@ type NativeProps = $ReadOnly<{|
|
|||
value?: WithDefault<Double, 0>,
|
||||
|
||||
// Events
|
||||
onChange?: ?BubblingEventHandler<Event>,
|
||||
onValueChange?: ?BubblingEventHandler<Event>,
|
||||
onSlidingComplete?: ?DirectEventHandler<Event>,
|
||||
|}>;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import {ConditionallyIgnoredEventHandlers} from '../../NativeComponent/ViewConfigIgnore';
|
||||
|
||||
type PartialViewConfigWithoutName = $Rest<
|
||||
PartialViewConfig,
|
||||
|
@ -130,7 +131,6 @@ const RCTTextInputViewConfig = {
|
|||
blurOnSubmit: true,
|
||||
mostRecentEventCount: true,
|
||||
scrollEnabled: true,
|
||||
hideVerticalScrollIndicator: true,
|
||||
selectionColor: {process: require('../../StyleSheet/processColor')},
|
||||
contextMenuHidden: true,
|
||||
secureTextEntry: true,
|
||||
|
@ -142,13 +142,35 @@ const RCTTextInputViewConfig = {
|
|||
autoCapitalize: true,
|
||||
keyboardAppearance: true,
|
||||
passwordRules: true,
|
||||
grammarCheck: true, // [macOS]
|
||||
spellCheck: true,
|
||||
selectTextOnFocus: true,
|
||||
text: true,
|
||||
clearTextOnFocus: true,
|
||||
showSoftInputOnFocus: true,
|
||||
autoFocus: true,
|
||||
// [macOS
|
||||
clearTextOnSubmit: true,
|
||||
grammarCheck: true,
|
||||
hideVerticalScrollIndicator: true,
|
||||
pastedTypes: true,
|
||||
submitKeyEvents: true,
|
||||
tooltip: true,
|
||||
// macOS]
|
||||
...ConditionallyIgnoredEventHandlers({
|
||||
onChange: true,
|
||||
onSelectionChange: true,
|
||||
onContentSizeChange: true,
|
||||
onScroll: true,
|
||||
onChangeSync: true,
|
||||
onKeyPressSync: true,
|
||||
onTextInput: true,
|
||||
// [macOS
|
||||
onPaste: true,
|
||||
onAutoCorrectChange: true,
|
||||
onSpellCheckChange: true,
|
||||
onGrammarCheckChange: true,
|
||||
// macOS]
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -327,21 +327,6 @@ type IOSProps = $ReadOnly<{|
|
|||
*/
|
||||
scrollEnabled?: ?boolean,
|
||||
|
||||
// [macOS
|
||||
/**
|
||||
* If `true`, hide vertical scrollbar on the underlying multiline scrollview
|
||||
* The default value is `false`.
|
||||
* @platform macos
|
||||
*/
|
||||
hideVerticalScrollIndicator?: ?boolean,
|
||||
|
||||
/**
|
||||
* If `false`, disables grammar-check.
|
||||
* @platform macos
|
||||
*/
|
||||
grammarCheck?: ?boolean,
|
||||
// macOS]
|
||||
|
||||
/**
|
||||
* If `false`, disables spell-check style (i.e. red underlines).
|
||||
* The default value is inherited from `autoCorrect`.
|
||||
|
@ -370,10 +355,26 @@ export type SubmitKeyEvent = $ReadOnly<{|
|
|||
type MacOSProps = $ReadOnly<{|
|
||||
/**
|
||||
* If `true`, clears the text field synchronously before `onSubmitEditing` is emitted.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
clearTextOnSubmit?: ?boolean,
|
||||
|
||||
/**
|
||||
* If `false`, disables grammar-check.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
grammarCheck?: ?boolean,
|
||||
|
||||
/**
|
||||
* If `true`, hide vertical scrollbar on the underlying multiline scrollview
|
||||
* The default value is `false`.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
hideVerticalScrollIndicator?: ?boolean,
|
||||
|
||||
/**
|
||||
* Fired when a supported element is pasted
|
||||
*
|
||||
|
@ -381,6 +382,36 @@ type MacOSProps = $ReadOnly<{|
|
|||
*/
|
||||
onPaste?: (event: PasteEvent) => void,
|
||||
|
||||
/**
|
||||
* Callback that is called when the text input's autoCorrect setting changes.
|
||||
* This will be called with
|
||||
* `{ nativeEvent: { enabled } }`.
|
||||
* Does only work with 'multiline={true}'.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
onAutoCorrectChange?: ?(e: SettingChangeEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Callback that is called when the text input's spellCheck setting changes.
|
||||
* This will be called with
|
||||
* `{ nativeEvent: { enabled } }`.
|
||||
* Does only work with 'multiline={true}'.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
onSpellCheckChange?: ?(e: SettingChangeEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Callback that is called when the text input's grammarCheck setting changes.
|
||||
* This will be called with
|
||||
* `{ nativeEvent: { enabled } }`.
|
||||
* Does only work with 'multiline={true}'.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
onGrammarCheckChange?: ?(e: SettingChangeEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Enables Paste support for certain types of pasted types
|
||||
*
|
||||
|
@ -399,6 +430,13 @@ type MacOSProps = $ReadOnly<{|
|
|||
* @platform macos
|
||||
*/
|
||||
submitKeyEvents?: ?$ReadOnlyArray<SubmitKeyEvent>,
|
||||
|
||||
/**
|
||||
* Specifies the tooltip.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
tooltip?: ?string,
|
||||
|}>;
|
||||
// macOS]
|
||||
|
||||
|
@ -717,38 +755,6 @@ export type Props = $ReadOnly<{|
|
|||
*/
|
||||
onChangeText?: ?(text: string) => mixed,
|
||||
|
||||
// [macOS
|
||||
/**
|
||||
* Callback that is called when the text input's autoCorrect setting changes.
|
||||
* This will be called with
|
||||
* `{ nativeEvent: { enabled } }`.
|
||||
* Does only work with 'multiline={true}'.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
onAutoCorrectChange?: ?(e: SettingChangeEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Callback that is called when the text input's spellCheck setting changes.
|
||||
* This will be called with
|
||||
* `{ nativeEvent: { enabled } }`.
|
||||
* Does only work with 'multiline={true}'.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
onSpellCheckChange?: ?(e: SettingChangeEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Callback that is called when the text input's grammarCheck setting changes.
|
||||
* This will be called with
|
||||
* `{ nativeEvent: { enabled } }`.
|
||||
* Does only work with 'multiline={true}'.
|
||||
*
|
||||
* @platform macos
|
||||
*/
|
||||
onGrammarCheckChange?: ?(e: SettingChangeEvent) => mixed,
|
||||
// macOS]
|
||||
|
||||
/**
|
||||
* DANGER: this API is not stable and will change in the future.
|
||||
*
|
||||
|
@ -921,12 +927,6 @@ export type Props = $ReadOnly<{|
|
|||
*/
|
||||
style?: ?TextStyleProp,
|
||||
|
||||
// [macOS
|
||||
/*
|
||||
* Specifies the tooltip.
|
||||
*/
|
||||
tooltip?: ?string, // macOS ]
|
||||
|
||||
/**
|
||||
* The value to show for the text input. `TextInput` is a controlled
|
||||
* component, which means the native value will be forced to match this
|
||||
|
@ -1499,9 +1499,6 @@ const ExportedForwardRef: React.AbstractComponent<
|
|||
);
|
||||
});
|
||||
|
||||
ExportedForwardRef.propTypes =
|
||||
require('deprecated-react-native-prop-types').TextInputPropTypes;
|
||||
|
||||
// $FlowFixMe[prop-missing]
|
||||
ExportedForwardRef.State = {
|
||||
currentlyFocusedInput: TextInputState.currentlyFocusedInput,
|
||||
|
|
|
@ -308,7 +308,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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ exports[`<Slider /> should render as expected 1`] = `
|
|||
enabled={true}
|
||||
maximumValue={1}
|
||||
minimumValue={0}
|
||||
onChange={null}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onSlidingComplete={null}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
|
@ -27,7 +26,6 @@ exports[`<Slider /> should set disabled as false 1`] = `
|
|||
enabled={true}
|
||||
maximumValue={1}
|
||||
minimumValue={0}
|
||||
onChange={null}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onSlidingComplete={null}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
|
@ -53,7 +51,6 @@ exports[`<Slider /> should set disabled as false 2`] = `
|
|||
enabled={true}
|
||||
maximumValue={1}
|
||||
minimumValue={0}
|
||||
onChange={null}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onSlidingComplete={null}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
|
@ -79,7 +76,6 @@ exports[`<Slider /> should set disabled as true 1`] = `
|
|||
enabled={false}
|
||||
maximumValue={1}
|
||||
minimumValue={0}
|
||||
onChange={null}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onSlidingComplete={null}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
|
@ -105,7 +101,6 @@ exports[`<Slider /> should set disabled as true 2`] = `
|
|||
enabled={false}
|
||||
maximumValue={1}
|
||||
minimumValue={0}
|
||||
onChange={null}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onSlidingComplete={null}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
|
|
|
@ -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;
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
* @flow strict-local
|
||||
*/
|
||||
|
||||
import {
|
||||
type EventSubscription,
|
||||
type IEventEmitter,
|
||||
import type {
|
||||
EventSubscription,
|
||||
IEventEmitter,
|
||||
} from '../../vendor/emitter/EventEmitter';
|
||||
import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter';
|
||||
|
||||
|
|
|
@ -306,12 +306,6 @@ Image.queryCache = queryCache;
|
|||
* comment and run Flow. */
|
||||
Image.resolveAssetSource = resolveAssetSource;
|
||||
|
||||
/**
|
||||
* Switch to `deprecated-react-native-prop-types` for compatibility with future
|
||||
* releases. This is deprecated and will be removed in the future.
|
||||
*/
|
||||
Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
base: {
|
||||
overflow: 'hidden',
|
||||
|
|
|
@ -235,12 +235,6 @@ Image.queryCache = queryCache;
|
|||
* delete this comment and run Flow. */
|
||||
Image.resolveAssetSource = resolveAssetSource;
|
||||
|
||||
/**
|
||||
* Switch to `deprecated-react-native-prop-types` for compatibility with future
|
||||
* releases. This is deprecated and will be removed in the future.
|
||||
*/
|
||||
Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
base: {
|
||||
overflow: 'hidden',
|
||||
|
|
|
@ -12,6 +12,7 @@ import type {ResolvedAssetSource} from './AssetSourceResolver';
|
|||
import type {ImageProps} from './ImageProps';
|
||||
import type {ViewProps} from '../Components/View/ViewPropTypes';
|
||||
import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
|
||||
import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore';
|
||||
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
||||
import type {
|
||||
ColorValue,
|
||||
|
@ -125,6 +126,14 @@ const ImageViewViewConfig =
|
|||
tintColor: {
|
||||
process: require('../StyleSheet/processColor'),
|
||||
},
|
||||
...ConditionallyIgnoredEventHandlers({
|
||||
onLoadStart: true,
|
||||
onLoad: true,
|
||||
onLoadEnd: true,
|
||||
onProgress: true,
|
||||
onError: true,
|
||||
onPartialLoad: true,
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -440,7 +440,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
scrollToEnd(params?: ?{animated?: ?boolean, ...}) {
|
||||
const animated = params ? params.animated : true;
|
||||
const veryLast = this.props.getItemCount(this.props.data) - 1;
|
||||
const frame = this._getFrameMetricsApprox(veryLast);
|
||||
const frame = this.__getFrameMetricsApprox(veryLast);
|
||||
const offset = Math.max(
|
||||
0,
|
||||
frame.offset +
|
||||
|
@ -514,7 +514,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
});
|
||||
return;
|
||||
}
|
||||
const frame = this._getFrameMetricsApprox(index);
|
||||
const frame = this.__getFrameMetricsApprox(index);
|
||||
const offset =
|
||||
Math.max(
|
||||
0,
|
||||
|
@ -595,7 +595,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
|
||||
// [macOS
|
||||
ensureItemAtIndexIsVisible(rowIndex: number) {
|
||||
const frame = this._getFrameMetricsApprox(rowIndex);
|
||||
const frame = this.__getFrameMetricsApprox(rowIndex);
|
||||
const visTop = this._scrollMetrics.offset;
|
||||
const visLen = this._scrollMetrics.visibleLength;
|
||||
const visEnd = visTop + visLen;
|
||||
|
@ -1044,8 +1044,8 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
// See if there are any sticky headers in the virtualized space that we need to render.
|
||||
for (let ii = firstAfterInitial - 1; ii > lastInitialIndex; ii--) {
|
||||
if (stickyIndicesFromProps.has(ii + stickyOffset)) {
|
||||
const initBlock = this._getFrameMetricsApprox(lastInitialIndex);
|
||||
const stickyBlock = this._getFrameMetricsApprox(ii);
|
||||
const initBlock = this.__getFrameMetricsApprox(lastInitialIndex);
|
||||
const stickyBlock = this.__getFrameMetricsApprox(ii);
|
||||
const leadSpace =
|
||||
stickyBlock.offset -
|
||||
initBlock.offset -
|
||||
|
@ -1062,7 +1062,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
inversionStyle,
|
||||
);
|
||||
const trailSpace =
|
||||
this._getFrameMetricsApprox(first).offset -
|
||||
this.__getFrameMetricsApprox(first).offset -
|
||||
(stickyBlock.offset + stickyBlock.length);
|
||||
cells.push(
|
||||
<View key="$sticky_trail" style={{[spacerKey]: trailSpace}} />,
|
||||
|
@ -1073,9 +1073,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
}
|
||||
}
|
||||
if (!insertedStickySpacer) {
|
||||
const initBlock = this._getFrameMetricsApprox(lastInitialIndex);
|
||||
const initBlock = this.__getFrameMetricsApprox(lastInitialIndex);
|
||||
const firstSpace =
|
||||
this._getFrameMetricsApprox(first).offset -
|
||||
this.__getFrameMetricsApprox(first).offset -
|
||||
(initBlock.offset + initBlock.length);
|
||||
cells.push(
|
||||
<View key="$lead_spacer" style={{[spacerKey]: firstSpace}} />,
|
||||
|
@ -1099,14 +1099,14 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
this._hasWarned.keys = true;
|
||||
}
|
||||
if (!isVirtualizationDisabled && last < itemCount - 1) {
|
||||
const lastFrame = this._getFrameMetricsApprox(last);
|
||||
const lastFrame = this.__getFrameMetricsApprox(last);
|
||||
// Without getItemLayout, we limit our tail spacer to the _highestMeasuredFrameIndex to
|
||||
// prevent the user for hyperscrolling into un-measured area because otherwise content will
|
||||
// likely jump around as it renders in above the viewport.
|
||||
const end = this.props.getItemLayout
|
||||
? itemCount - 1
|
||||
: Math.min(itemCount - 1, this._highestMeasuredFrameIndex);
|
||||
const endFrame = this._getFrameMetricsApprox(end);
|
||||
const endFrame = this.__getFrameMetricsApprox(end);
|
||||
const tailSpacerLength =
|
||||
endFrame.offset +
|
||||
endFrame.length -
|
||||
|
@ -1629,7 +1629,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
const framesInLayout = [];
|
||||
const itemCount = this.props.getItemCount(this.props.data);
|
||||
for (let ii = 0; ii < itemCount; ii++) {
|
||||
const frame = this._getFrameMetricsApprox(ii);
|
||||
const frame = this.__getFrameMetricsApprox(ii);
|
||||
/* $FlowFixMe[prop-missing] (>=0.68.0 site=react_native_fb) This comment
|
||||
* suppresses an error found when Flow v0.68 was deployed. To see the
|
||||
* error delete this comment and run Flow. */
|
||||
|
@ -1637,8 +1637,8 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
framesInLayout.push(frame);
|
||||
}
|
||||
}
|
||||
const windowTop = this._getFrameMetricsApprox(this.state.first).offset;
|
||||
const frameLast = this._getFrameMetricsApprox(this.state.last);
|
||||
const windowTop = this.__getFrameMetricsApprox(this.state.first).offset;
|
||||
const frameLast = this.__getFrameMetricsApprox(this.state.last);
|
||||
const windowLen = frameLast.offset + frameLast.length - windowTop;
|
||||
const visTop = this._scrollMetrics.offset;
|
||||
const visLen = this._scrollMetrics.visibleLength;
|
||||
|
@ -1852,7 +1852,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
// Mark as high priority if we're close to the start of the first item
|
||||
// But only if there are items before the first rendered item
|
||||
if (first > 0) {
|
||||
const distTop = offset - this._getFrameMetricsApprox(first).offset;
|
||||
const distTop = offset - this.__getFrameMetricsApprox(first).offset;
|
||||
hiPri =
|
||||
hiPri || distTop < 0 || (velocity < -2 && distTop < scrollingThreshold);
|
||||
}
|
||||
|
@ -1860,7 +1860,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
// But only if there are items after the last rendered item
|
||||
if (last < itemCount - 1) {
|
||||
const distBottom =
|
||||
this._getFrameMetricsApprox(last).offset - (offset + visibleLength);
|
||||
this.__getFrameMetricsApprox(last).offset - (offset + visibleLength);
|
||||
hiPri =
|
||||
hiPri ||
|
||||
distBottom < 0 ||
|
||||
|
@ -1962,7 +1962,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
maxToRenderPerBatchOrDefault(this.props.maxToRenderPerBatch),
|
||||
windowSizeOrDefault(this.props.windowSize),
|
||||
state,
|
||||
this._getFrameMetricsApprox,
|
||||
this.__getFrameMetricsApprox,
|
||||
this._scrollMetrics,
|
||||
);
|
||||
}
|
||||
|
@ -2025,13 +2025,11 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
return {index, item, key: this._keyExtractor(item, index), isViewable};
|
||||
};
|
||||
|
||||
_getFrameMetricsApprox = (
|
||||
index: number,
|
||||
): {
|
||||
__getFrameMetricsApprox: (index: number) => {
|
||||
length: number,
|
||||
offset: number,
|
||||
...
|
||||
} => {
|
||||
} = index => {
|
||||
const frame = this._getFrameMetrics(index);
|
||||
if (frame && frame.index === index) {
|
||||
// check for invalid frames due to row re-ordering
|
||||
|
|
|
@ -171,8 +171,7 @@ class VirtualizedSectionList<
|
|||
return;
|
||||
}
|
||||
if (params.itemIndex > 0 && this.props.stickySectionHeadersEnabled) {
|
||||
// $FlowFixMe[prop-missing] Cannot access private property
|
||||
const frame = this._listRef._getFrameMetricsApprox(
|
||||
const frame = this._listRef.__getFrameMetricsApprox(
|
||||
index - params.itemIndex,
|
||||
);
|
||||
viewOffset += frame.length;
|
||||
|
|
|
@ -96,6 +96,14 @@ RCT_EXPORT_METHOD(createAnimatedNode:(double)tag
|
|||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(updateAnimatedNodeConfig:(double)tag
|
||||
config:(NSDictionary<NSString *, id> *)config)
|
||||
{
|
||||
[self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) {
|
||||
[nodesManager updateAnimatedNodeConfig:[NSNumber numberWithDouble:tag] config:config];
|
||||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(connectAnimatedNodes:(double)parentTag
|
||||
childTag:(double)childTag)
|
||||
{
|
||||
|
|
|
@ -64,6 +64,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (void)extractAnimatedNodeOffset:(NSNumber *)nodeTag;
|
||||
|
||||
- (void)updateAnimatedNodeConfig:(NSNumber *)tag
|
||||
config:(NSDictionary<NSString *, id> *)config;
|
||||
|
||||
// drivers
|
||||
|
||||
- (void)startAnimatingNode:(NSNumber *)animationId
|
||||
|
|
|
@ -261,6 +261,12 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
|||
saveCallback(@[@(valueNode.value)]);
|
||||
}
|
||||
|
||||
- (void)updateAnimatedNodeConfig:(NSNumber *)tag
|
||||
config:(NSDictionary<NSString *, id> *)config
|
||||
{
|
||||
// TODO (T111179606): Support platform colors for color animations
|
||||
}
|
||||
|
||||
#pragma mark -- Drivers
|
||||
|
||||
- (void)startAnimatingNode:(NSNumber *)animationId
|
||||
|
|
|
@ -102,6 +102,14 @@ RCT_EXPORT_METHOD(createAnimatedNode:(double)tag
|
|||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(updateAnimatedNodeConfig:(double)tag
|
||||
config:(NSDictionary<NSString *, id> *)config)
|
||||
{
|
||||
[self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) {
|
||||
[nodesManager updateAnimatedNodeConfig:[NSNumber numberWithDouble:tag] config:config];
|
||||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(connectAnimatedNodes:(double)parentTag
|
||||
childTag:(double)childTag)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
import {Platform} from 'react-native';
|
||||
import type {PartialViewConfig} from '../Renderer/shims/ReactNativeTypes';
|
||||
import ReactNativeStyleAttributes from '../Components/View/ReactNativeStyleAttributes';
|
||||
import {DynamicallyInjectedByGestureHandler} from './ViewConfigIgnore';
|
||||
import {
|
||||
DynamicallyInjectedByGestureHandler,
|
||||
ConditionallyIgnoredEventHandlers,
|
||||
} from './ViewConfigIgnore';
|
||||
|
||||
type PartialViewConfigWithoutName = $Rest<
|
||||
PartialViewConfig,
|
||||
|
@ -35,13 +38,13 @@ const PlatformBaseViewConfig: PartialViewConfigWithoutName =
|
|||
registrationName: 'onAccessibilityAction',
|
||||
},
|
||||
topPointerEnter: {
|
||||
registrationName: 'pointerenter',
|
||||
registrationName: 'onPointerEnter',
|
||||
},
|
||||
topPointerLeave: {
|
||||
registrationName: 'pointerleave',
|
||||
registrationName: 'onPointerLeave',
|
||||
},
|
||||
topPointerMove: {
|
||||
registrationName: 'pointermove',
|
||||
registrationName: 'onPointerMove',
|
||||
},
|
||||
onGestureHandlerEvent: DynamicallyInjectedByGestureHandler({
|
||||
registrationName: 'onGestureHandlerEvent',
|
||||
|
@ -216,9 +219,31 @@ const PlatformBaseViewConfig: PartialViewConfigWithoutName =
|
|||
position: true,
|
||||
onLayout: true,
|
||||
|
||||
pointerenter: true,
|
||||
pointerleave: true,
|
||||
pointermove: true,
|
||||
// Pointer events
|
||||
onPointerEnter: true,
|
||||
onPointerLeave: true,
|
||||
onPointerMove: true,
|
||||
|
||||
// PanResponder handlers
|
||||
onMoveShouldSetResponder: true,
|
||||
onMoveShouldSetResponderCapture: true,
|
||||
onStartShouldSetResponder: true,
|
||||
onStartShouldSetResponderCapture: true,
|
||||
onResponderGrant: true,
|
||||
onResponderReject: true,
|
||||
onResponderStart: true,
|
||||
onResponderEnd: true,
|
||||
onResponderRelease: true,
|
||||
onResponderMove: true,
|
||||
onResponderTerminate: true,
|
||||
onResponderTerminationRequest: true,
|
||||
onShouldBlockNativeResponder: true,
|
||||
|
||||
// Touch events
|
||||
onTouchStart: true,
|
||||
onTouchMove: true,
|
||||
onTouchEnd: true,
|
||||
onTouchCancel: true,
|
||||
|
||||
style: ReactNativeStyleAttributes,
|
||||
},
|
||||
|
@ -351,6 +376,7 @@ const PlatformBaseViewConfig: PartialViewConfigWithoutName =
|
|||
}),
|
||||
// macOS]
|
||||
},
|
||||
// $FlowFixMe: Flow doesn't like these nested spreads // [macOS]
|
||||
validAttributes: {
|
||||
// View Props
|
||||
accessible: true,
|
||||
|
@ -361,8 +387,7 @@ const PlatformBaseViewConfig: PartialViewConfigWithoutName =
|
|||
accessibilityViewIsModal: true,
|
||||
accessibilityElementsHidden: true,
|
||||
accessibilityIgnoresInvertColors: true,
|
||||
apple_fontSmoothing: true, // TODO(OSS Candidate ISS#2710739)
|
||||
testID: true,
|
||||
apple_fontSmoothing: true, // [macOS]
|
||||
backgroundColor: {process: require('../StyleSheet/processColor')},
|
||||
backfaceVisibility: true,
|
||||
opacity: true,
|
||||
|
@ -477,6 +502,7 @@ const PlatformBaseViewConfig: PartialViewConfigWithoutName =
|
|||
style: ReactNativeStyleAttributes,
|
||||
|
||||
// [macOS
|
||||
// $FlowFixMe: Flow doesn't like these nested spreads
|
||||
...(Platform.OS === 'macos' && {
|
||||
acceptsFirstMouse: true,
|
||||
accessibilityTraits: true,
|
||||
|
@ -484,22 +510,57 @@ const PlatformBaseViewConfig: PartialViewConfigWithoutName =
|
|||
draggedTypes: true,
|
||||
enableFocusRing: true,
|
||||
nextKeyViewTag: true,
|
||||
onBlur: true,
|
||||
onClick: true,
|
||||
onDoubleClick: true,
|
||||
onDragEnter: true,
|
||||
onDragLeave: true,
|
||||
onDrop: true,
|
||||
onFocus: true,
|
||||
onKeyDown: true,
|
||||
onKeyUp: true,
|
||||
onMouseEnter: true,
|
||||
onMouseLeave: true,
|
||||
tooltip: true,
|
||||
validKeysDown: true,
|
||||
validKeysUp: true,
|
||||
}),
|
||||
// macOS]
|
||||
// $FlowFixMe: Flow doesn't like these nested spreads // [macOS]
|
||||
...ConditionallyIgnoredEventHandlers({
|
||||
onLayout: true,
|
||||
onMagicTap: true,
|
||||
onAccessibilityAction: true,
|
||||
onAccessibilityEscape: true,
|
||||
onAccessibilityTap: true,
|
||||
|
||||
// PanResponder handlers
|
||||
onMoveShouldSetResponder: true,
|
||||
onMoveShouldSetResponderCapture: true,
|
||||
onStartShouldSetResponder: true,
|
||||
onStartShouldSetResponderCapture: true,
|
||||
onResponderGrant: true,
|
||||
onResponderReject: true,
|
||||
onResponderStart: true,
|
||||
onResponderEnd: true,
|
||||
onResponderRelease: true,
|
||||
onResponderMove: true,
|
||||
onResponderTerminate: true,
|
||||
onResponderTerminationRequest: true,
|
||||
onShouldBlockNativeResponder: true,
|
||||
|
||||
// Touch events
|
||||
onTouchStart: true,
|
||||
onTouchMove: true,
|
||||
onTouchEnd: true,
|
||||
onTouchCancel: true,
|
||||
|
||||
// [macOS
|
||||
// $FlowFixMe: Flow doesn't like these nested spreads
|
||||
...(Platform.OS === 'macos' && {
|
||||
onBlur: true,
|
||||
onClick: true,
|
||||
onDoubleClick: true,
|
||||
onDragEnter: true,
|
||||
onDragLeave: true,
|
||||
onDrop: true,
|
||||
onFocus: true,
|
||||
onKeyDown: true,
|
||||
onKeyUp: true,
|
||||
onMouseEnter: true,
|
||||
onMouseLeave: true,
|
||||
}),
|
||||
// macOS]
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -9,13 +9,9 @@
|
|||
*/
|
||||
|
||||
import {type ViewConfig} from '../Renderer/shims/ReactNativeTypes';
|
||||
// $FlowFixMe[nonstrict-import]
|
||||
import getNativeComponentAttributes from '../ReactNative/getNativeComponentAttributes';
|
||||
// $FlowFixMe[nonstrict-import]
|
||||
import {createViewConfig} from './ViewConfig';
|
||||
import {isIgnored} from './ViewConfigIgnore';
|
||||
|
||||
type Difference =
|
||||
export type Difference =
|
||||
| {
|
||||
type: 'missing',
|
||||
path: Array<string>,
|
||||
|
@ -33,7 +29,7 @@ type Difference =
|
|||
staticValue: mixed,
|
||||
};
|
||||
|
||||
type ValidationResult = ValidResult | InvalidResult;
|
||||
export type ValidationResult = ValidResult | InvalidResult;
|
||||
type ValidResult = {
|
||||
type: 'valid',
|
||||
};
|
||||
|
@ -42,41 +38,6 @@ type InvalidResult = {
|
|||
differences: Array<Difference>,
|
||||
};
|
||||
|
||||
type ViewConfigValidationResult = {
|
||||
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,
|
||||
);
|
||||
|
||||
const generatedPartialViewConfig = nativeComponent.__INTERNAL_VIEW_CONFIG;
|
||||
const staticViewConfig: ?ViewConfig =
|
||||
generatedPartialViewConfig && createViewConfig(generatedPartialViewConfig);
|
||||
|
||||
const componentName: string = nativeComponent.default || nativeComponent;
|
||||
const validationResult: ?ValidationResult =
|
||||
nativeViewConfig &&
|
||||
staticViewConfig &&
|
||||
validate(componentName, nativeViewConfig, staticViewConfig);
|
||||
|
||||
return {
|
||||
componentName,
|
||||
nativeViewConfig,
|
||||
staticViewConfig,
|
||||
validationResult,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* During the migration from native view configs to static view configs, this is
|
||||
* used to validate that the two are equivalent.
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
* @format
|
||||
*/
|
||||
|
||||
import Platform from '../Utilities/Platform';
|
||||
|
||||
const ignoredViewConfigProps = new WeakSet<{...}>();
|
||||
|
||||
/**
|
||||
|
@ -19,6 +21,30 @@ export function DynamicallyInjectedByGestureHandler<T: {...}>(object: T): T {
|
|||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* On iOS, ViewManager event declarations generate {eventName}: true entries
|
||||
* in ViewConfig valueAttributes. These entries aren't generated for Android.
|
||||
* This annotation allows Static ViewConfigs to insert these entries into
|
||||
* iOS but not Android.
|
||||
*
|
||||
* In the future, we want to remove this platform-inconsistency.
|
||||
* This annotation also allows us to safely test this removal by setting
|
||||
* global.RN$ViewConfigEventValidAttributesDisabled = true server-side.
|
||||
*
|
||||
* TODO(T110872225): Remove this logic, after achieving platform-consistency
|
||||
*/
|
||||
export function ConditionallyIgnoredEventHandlers<T: {[name: string]: true}>(
|
||||
value: T,
|
||||
): T | void {
|
||||
if (
|
||||
(Platform.OS === 'ios' || Platform.OS === 'macos') &&
|
||||
!(global.RN$ViewConfigEventValidAttributesDisabled === true)
|
||||
) {
|
||||
return value;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function isIgnored(value: mixed): boolean {
|
||||
if (typeof value === 'object' && value != null) {
|
||||
return ignoredViewConfigProps.has(value);
|
||||
|
|
|
@ -29,6 +29,7 @@ type Notification = {|
|
|||
+repeatInterval?: ?string,
|
||||
+applicationIconBadgeNumber?: ?number,
|
||||
+isSilent?: ?boolean,
|
||||
+soundName?: ?string,
|
||||
|};
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
|
|
|
@ -407,10 +407,12 @@ RCT_EXPORT_METHOD(requestPermissions:(JS::NativePushNotificationManagerIOS::Spec
|
|||
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));
|
||||
}];
|
||||
});
|
||||
}
|
||||
}];
|
||||
#else // [macOS
|
||||
|
@ -486,6 +488,9 @@ RCT_EXPORT_METHOD(presentLocalNotification:(JS::NativePushNotificationManagerIOS
|
|||
}
|
||||
if (notification.isSilent()) {
|
||||
notificationDict[@"isSilent"] = @(*notification.isSilent());
|
||||
if ([notificationDict[@"isSilent"] isEqualToNumber:@(NO)]) {
|
||||
notificationDict[@"soundName"] = notification.soundName();
|
||||
}
|
||||
}
|
||||
[RCTSharedApplication() presentLocalNotificationNow:[RCTConvert UILocalNotification:notificationDict]];
|
||||
}
|
||||
|
@ -514,6 +519,9 @@ RCT_EXPORT_METHOD(scheduleLocalNotification:(JS::NativePushNotificationManagerIO
|
|||
}
|
||||
if (notification.isSilent()) {
|
||||
notificationDict[@"isSilent"] = @(*notification.isSilent());
|
||||
if ([notificationDict[@"isSilent"] isEqualToNumber:@(NO)]) {
|
||||
notificationDict[@"soundName"] = notification.soundName();
|
||||
}
|
||||
}
|
||||
[RCTSharedApplication() scheduleLocalNotification:[RCTConvert UILocalNotification:notificationDict]];
|
||||
}
|
||||
|
|
|
@ -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 = {
|
||||
|
@ -62,4 +63,7 @@ module.exports = {
|
|||
get legacySendAccessibilityEvent(): legacySendAccessibilityEvent {
|
||||
return require('../Components/AccessibilityInfo/legacySendAccessibilityEvent');
|
||||
},
|
||||
get RawEventEmitter(): RawEventEmitter {
|
||||
return require('../Core/RawEventEmitter').default;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1 +1 @@
|
|||
51947a14bb24bd151f76f6fc0acdbbc404de13f7
|
||||
a3bde7974c48cfa749b18531700f895c86cbad91
|
|
@ -7,7 +7,7 @@
|
|||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<10efd73d5435b5750183622476c68681>>
|
||||
* @generated SignedSource<<5cd13a68c6b2a6d7a0ea84aff011af30>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
@ -3888,7 +3888,34 @@ function dispatchEvent(target, topLevelType, nativeEvent) {
|
|||
}
|
||||
|
||||
batchedUpdates(function() {
|
||||
// Heritage plugin event system
|
||||
// Emit event to the RawEventEmitter. This is an unused-by-default EventEmitter
|
||||
// that can be used to instrument event performance monitoring (primarily - could be useful
|
||||
// for other things too).
|
||||
//
|
||||
// NOTE: this merely emits events into the EventEmitter below.
|
||||
// If *you* do not add listeners to the `RawEventEmitter`,
|
||||
// then all of these emitted events will just blackhole and are no-ops.
|
||||
// It is available (although not officially supported... yet) if you want to collect
|
||||
// perf data on event latency in your application, and could also be useful for debugging
|
||||
// low-level events issues.
|
||||
//
|
||||
// If you do not have any event perf monitoring and are extremely concerned about event perf,
|
||||
// it is safe to disable these "emit" statements; it will prevent checking the size of
|
||||
// an empty array twice and prevent two no-ops. Practically the overhead is so low that
|
||||
// we don't think it's worth thinking about in prod; your perf issues probably lie elsewhere.
|
||||
//
|
||||
// We emit two events here: one for listeners to this specific event,
|
||||
// and one for the catchall listener '*', for any listeners that want
|
||||
// to be notified for all events.
|
||||
// Note that extracted events are *not* emitted,
|
||||
// only events that have a 1:1 mapping with a native event, at least for now.
|
||||
var event = {
|
||||
eventName: topLevelType,
|
||||
nativeEvent: nativeEvent
|
||||
};
|
||||
ReactNativePrivateInterface.RawEventEmitter.emit(topLevelType, event);
|
||||
ReactNativePrivateInterface.RawEventEmitter.emit("*", event); // Heritage plugin event system
|
||||
|
||||
runExtractedPluginEventsInBatch(
|
||||
topLevelType,
|
||||
targetFiber,
|
||||
|
@ -4040,12 +4067,17 @@ function injectInternals(internals) {
|
|||
}
|
||||
|
||||
try {
|
||||
rendererID = hook.inject(
|
||||
Object.assign({}, internals, {
|
||||
if (enableSchedulingProfiler) {
|
||||
// Conditionally inject these hooks only if Timeline profiler is supported by this build.
|
||||
// This gives DevTools a way to feature detect that isn't tied to version number
|
||||
// (since profiling and timeline are controlled by different feature flags).
|
||||
internals = Object.assign({}, internals, {
|
||||
getLaneLabelMap: getLaneLabelMap,
|
||||
injectProfilingHooks: injectProfilingHooks
|
||||
})
|
||||
); // We have successfully injected, so now it is safe to set up hooks.
|
||||
});
|
||||
}
|
||||
|
||||
rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks.
|
||||
|
||||
injectedHook = hook;
|
||||
} catch (err) {
|
||||
|
@ -4179,16 +4211,18 @@ function injectProfilingHooks(profilingHooks) {
|
|||
}
|
||||
|
||||
function getLaneLabelMap() {
|
||||
var map = new Map();
|
||||
var lane = 1;
|
||||
{
|
||||
var map = new Map();
|
||||
var lane = 1;
|
||||
|
||||
for (var index = 0; index < TotalLanes; index++) {
|
||||
var label = getLabelForLane(lane);
|
||||
map.set(lane, label);
|
||||
lane *= 2;
|
||||
for (var index = 0; index < TotalLanes; index++) {
|
||||
var label = getLabelForLane(lane);
|
||||
map.set(lane, label);
|
||||
lane *= 2;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
function markCommitStarted(lanes) {
|
||||
|
@ -6941,7 +6975,7 @@ function popProvider(context, providerFiber) {
|
|||
context._currentValue2 = currentValue;
|
||||
}
|
||||
}
|
||||
function scheduleWorkOnParentPath(parent, renderLanes) {
|
||||
function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) {
|
||||
// Update the child lanes of all the ancestors, including the alternates.
|
||||
var node = parent;
|
||||
|
||||
|
@ -6959,14 +6993,23 @@ function scheduleWorkOnParentPath(parent, renderLanes) {
|
|||
!isSubsetOfLanes(alternate.childLanes, renderLanes)
|
||||
) {
|
||||
alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes);
|
||||
} else {
|
||||
// Neither alternate was updated, which means the rest of the
|
||||
// ancestor path already has sufficient priority.
|
||||
}
|
||||
|
||||
if (node === propagationRoot) {
|
||||
break;
|
||||
}
|
||||
|
||||
node = node.return;
|
||||
}
|
||||
|
||||
{
|
||||
if (node !== propagationRoot) {
|
||||
error(
|
||||
"Expected to find the propagation root when scheduling context work. " +
|
||||
"This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
function propagateContextChange(workInProgress, context, renderLanes) {
|
||||
{
|
||||
|
@ -7031,7 +7074,11 @@ function propagateContextChange_eager(workInProgress, context, renderLanes) {
|
|||
alternate.lanes = mergeLanes(alternate.lanes, renderLanes);
|
||||
}
|
||||
|
||||
scheduleWorkOnParentPath(fiber.return, renderLanes); // Mark the updated lanes on the list, too.
|
||||
scheduleContextWorkOnParentPath(
|
||||
fiber.return,
|
||||
renderLanes,
|
||||
workInProgress
|
||||
); // Mark the updated lanes on the list, too.
|
||||
|
||||
list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the
|
||||
// dependency list.
|
||||
|
@ -8906,7 +8953,7 @@ function popTreeContext(workInProgress) {
|
|||
}
|
||||
}
|
||||
|
||||
var isHydrating = false;
|
||||
var isHydrating = false; // Hydration errors that were thrown inside this boundary
|
||||
|
||||
function enterHydrationState(fiber) {
|
||||
{
|
||||
|
@ -13866,7 +13913,7 @@ function throwException(
|
|||
// over and traverse parent path again, this time treating the exception
|
||||
// as an error.
|
||||
|
||||
renderDidError();
|
||||
renderDidError(value);
|
||||
value = createCapturedValue(value, sourceFiber);
|
||||
var workInProgress = returnFiber;
|
||||
|
||||
|
@ -16912,7 +16959,7 @@ function updateSuspenseFallbackChildren(
|
|||
return fallbackChildFragment;
|
||||
}
|
||||
|
||||
function scheduleWorkOnFiber(fiber, renderLanes) {
|
||||
function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) {
|
||||
fiber.lanes = mergeLanes(fiber.lanes, renderLanes);
|
||||
var alternate = fiber.alternate;
|
||||
|
||||
|
@ -16920,7 +16967,7 @@ function scheduleWorkOnFiber(fiber, renderLanes) {
|
|||
alternate.lanes = mergeLanes(alternate.lanes, renderLanes);
|
||||
}
|
||||
|
||||
scheduleWorkOnParentPath(fiber.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot);
|
||||
}
|
||||
|
||||
function propagateSuspenseContextChange(
|
||||
|
@ -16938,7 +16985,7 @@ function propagateSuspenseContextChange(
|
|||
var state = node.memoizedState;
|
||||
|
||||
if (state !== null) {
|
||||
scheduleWorkOnFiber(node, renderLanes);
|
||||
scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress);
|
||||
}
|
||||
} else if (node.tag === SuspenseListComponent) {
|
||||
// If the tail is hidden there might not be an Suspense boundaries
|
||||
|
@ -16946,7 +16993,7 @@ function propagateSuspenseContextChange(
|
|||
// list itself.
|
||||
// We don't have to traverse to the children of the list since
|
||||
// the list will propagate the change when it rerenders.
|
||||
scheduleWorkOnFiber(node, renderLanes);
|
||||
scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress);
|
||||
} else if (node.child !== null) {
|
||||
node.child.return = node;
|
||||
node = node.child;
|
||||
|
@ -18238,6 +18285,16 @@ function safelyDetachRef(current, nearestMountedAncestor) {
|
|||
reportUncaughtErrorInDEV(error);
|
||||
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
||||
}
|
||||
|
||||
{
|
||||
if (typeof retVal === "function") {
|
||||
error(
|
||||
"Unexpected return value from a callback ref in %s. " +
|
||||
"A callback ref should not return a function.",
|
||||
getComponentNameFromFiber(current)
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ref.current = null;
|
||||
}
|
||||
|
@ -18946,6 +19003,16 @@ function commitAttachRef(finishedWork) {
|
|||
} else {
|
||||
retVal = ref(instanceToUse);
|
||||
}
|
||||
|
||||
{
|
||||
if (typeof retVal === "function") {
|
||||
error(
|
||||
"Unexpected return value from a callback ref in %s. " +
|
||||
"A callback ref should not return a function.",
|
||||
getComponentNameFromFiber(finishedWork)
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
{
|
||||
if (!ref.hasOwnProperty("current")) {
|
||||
|
@ -20070,9 +20137,12 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an
|
|||
|
||||
var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event).
|
||||
|
||||
var workInProgressRootRenderPhaseUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render.
|
||||
var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase.
|
||||
|
||||
var workInProgressRootPingedLanes = NoLanes; // The most recent time we committed a fallback. This lets us ensure a train
|
||||
var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI.
|
||||
// We will log them once the tree commits.
|
||||
|
||||
var workInProgressRootRecoverableErrors = null; // The most recent time we committed a fallback. This lets us ensure a train
|
||||
// model where we don't commit new loading states in too quick succession.
|
||||
|
||||
var globalMostRecentFallbackTime = 0;
|
||||
|
@ -20220,11 +20290,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
|
|||
// function), but there are some internal React features that use this as
|
||||
// an implementation detail, like selective hydration.
|
||||
warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase
|
||||
|
||||
workInProgressRootRenderPhaseUpdatedLanes = mergeLanes(
|
||||
workInProgressRootRenderPhaseUpdatedLanes,
|
||||
lane
|
||||
);
|
||||
} else {
|
||||
// This is a normal update, scheduled from outside the render phase. For
|
||||
// example, during an input event.
|
||||
|
@ -20601,30 +20666,34 @@ function recoverFromConcurrentError(root, errorRetryLanes) {
|
|||
}
|
||||
}
|
||||
|
||||
var exitStatus;
|
||||
var MAX_ERROR_RETRY_ATTEMPTS = 50;
|
||||
var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
|
||||
var exitStatus = renderRootSync(root, errorRetryLanes);
|
||||
|
||||
for (var i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) {
|
||||
exitStatus = renderRootSync(root, errorRetryLanes);
|
||||
|
||||
if (
|
||||
exitStatus === RootErrored &&
|
||||
workInProgressRootRenderPhaseUpdatedLanes !== NoLanes
|
||||
) {
|
||||
// There was a render phase update during this render. Some internal React
|
||||
// implementation details may use this as a trick to schedule another
|
||||
// render pass. To protect against an inifinite loop, eventually
|
||||
// we'll give up.
|
||||
continue;
|
||||
if (exitStatus !== RootErrored) {
|
||||
// Successfully finished rendering on retry
|
||||
if (errorsFromFirstAttempt !== null) {
|
||||
// The errors from the failed first attempt have been recovered. Add
|
||||
// them to the collection of recoverable errors. We'll log them in the
|
||||
// commit phase.
|
||||
queueRecoverableErrors(errorsFromFirstAttempt);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
executionContext = prevExecutionContext;
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
function queueRecoverableErrors(errors) {
|
||||
if (workInProgressRootConcurrentErrors === null) {
|
||||
workInProgressRootRecoverableErrors = errors;
|
||||
} else {
|
||||
workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply(
|
||||
null,
|
||||
errors
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function finishConcurrentRender(root, exitStatus, lanes) {
|
||||
switch (exitStatus) {
|
||||
case RootIncomplete:
|
||||
|
@ -20638,7 +20707,7 @@ function finishConcurrentRender(root, exitStatus, lanes) {
|
|||
case RootErrored: {
|
||||
// We should have already attempted to retry this tree. If we reached
|
||||
// this point, it errored again. Commit it.
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -20678,14 +20747,14 @@ function finishConcurrentRender(root, exitStatus, lanes) {
|
|||
// immediately, wait for more data to arrive.
|
||||
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
msUntilTimeout
|
||||
);
|
||||
break;
|
||||
}
|
||||
} // The work expired. Commit immediately.
|
||||
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -20716,20 +20785,20 @@ function finishConcurrentRender(root, exitStatus, lanes) {
|
|||
// Instead of committing the fallback immediately, wait for more data
|
||||
// to arrive.
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
_msUntilTimeout
|
||||
);
|
||||
break;
|
||||
}
|
||||
} // Commit the placeholder.
|
||||
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
}
|
||||
|
||||
case RootCompleted: {
|
||||
// The work completed. Ready to commit.
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -20860,7 +20929,7 @@ function performSyncWorkOnRoot(root) {
|
|||
var finishedWork = root.current.alternate;
|
||||
root.finishedWork = finishedWork;
|
||||
root.finishedLanes = lanes;
|
||||
commitRoot(root); // Before exiting, make sure there's a callback scheduled for the next
|
||||
commitRoot(root, workInProgressRootRecoverableErrors); // Before exiting, make sure there's a callback scheduled for the next
|
||||
// pending level.
|
||||
|
||||
ensureRootIsScheduled(root, now());
|
||||
|
@ -20967,8 +21036,9 @@ function prepareFreshStack(root, lanes) {
|
|||
workInProgressRootFatalError = null;
|
||||
workInProgressRootSkippedLanes = NoLanes;
|
||||
workInProgressRootInterleavedUpdatedLanes = NoLanes;
|
||||
workInProgressRootRenderPhaseUpdatedLanes = NoLanes;
|
||||
workInProgressRootPingedLanes = NoLanes;
|
||||
workInProgressRootConcurrentErrors = null;
|
||||
workInProgressRootRecoverableErrors = null;
|
||||
enqueueInterleavedUpdates();
|
||||
|
||||
{
|
||||
|
@ -21121,10 +21191,16 @@ function renderDidSuspendDelayIfPossible() {
|
|||
markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes);
|
||||
}
|
||||
}
|
||||
function renderDidError() {
|
||||
function renderDidError(error) {
|
||||
if (workInProgressRootExitStatus !== RootSuspendedWithDelay) {
|
||||
workInProgressRootExitStatus = RootErrored;
|
||||
}
|
||||
|
||||
if (workInProgressRootConcurrentErrors === null) {
|
||||
workInProgressRootConcurrentErrors = [error];
|
||||
} else {
|
||||
workInProgressRootConcurrentErrors.push(error);
|
||||
}
|
||||
} // Called during render to determine if anything has suspended.
|
||||
// Returns false if we're not sure.
|
||||
|
||||
|
@ -21393,7 +21469,7 @@ function completeUnitOfWork(unitOfWork) {
|
|||
}
|
||||
}
|
||||
|
||||
function commitRoot(root) {
|
||||
function commitRoot(root, recoverableErrors) {
|
||||
// TODO: This no longer makes any sense. We already wrap the mutation and
|
||||
// layout phases. Should be able to remove.
|
||||
var previousUpdateLanePriority = getCurrentUpdatePriority();
|
||||
|
@ -21402,7 +21478,7 @@ function commitRoot(root) {
|
|||
try {
|
||||
ReactCurrentBatchConfig$2.transition = 0;
|
||||
setCurrentUpdatePriority(DiscreteEventPriority);
|
||||
commitRootImpl(root, previousUpdateLanePriority);
|
||||
commitRootImpl(root, recoverableErrors, previousUpdateLanePriority);
|
||||
} finally {
|
||||
ReactCurrentBatchConfig$2.transition = prevTransition;
|
||||
setCurrentUpdatePriority(previousUpdateLanePriority);
|
||||
|
@ -21411,7 +21487,7 @@ function commitRoot(root) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function commitRootImpl(root, renderPriorityLevel) {
|
||||
function commitRootImpl(root, recoverableErrors, renderPriorityLevel) {
|
||||
do {
|
||||
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
|
||||
// means `flushPassiveEffects` will sometimes result in additional
|
||||
|
@ -21616,6 +21692,19 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|||
|
||||
ensureRootIsScheduled(root, now());
|
||||
|
||||
if (recoverableErrors !== null) {
|
||||
// There were errors during this render, but recovered from them without
|
||||
// needing to surface it to the UI. We log them here.
|
||||
for (var i = 0; i < recoverableErrors.length; i++) {
|
||||
var recoverableError = recoverableErrors[i];
|
||||
var onRecoverableError = root.onRecoverableError;
|
||||
|
||||
if (onRecoverableError !== null) {
|
||||
onRecoverableError(recoverableError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasUncaughtError) {
|
||||
hasUncaughtError = false;
|
||||
var error$1 = firstUncaughtError;
|
||||
|
@ -23443,7 +23532,13 @@ function assignFiberPropertiesInDEV(target, source) {
|
|||
return target;
|
||||
}
|
||||
|
||||
function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
||||
function FiberRootNode(
|
||||
containerInfo,
|
||||
tag,
|
||||
hydrate,
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
this.tag = tag;
|
||||
this.containerInfo = containerInfo;
|
||||
this.pendingChildren = null;
|
||||
|
@ -23467,6 +23562,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
|||
this.entangledLanes = NoLanes;
|
||||
this.entanglements = createLaneMap(NoLanes);
|
||||
this.identifierPrefix = identifierPrefix;
|
||||
this.onRecoverableError = onRecoverableError;
|
||||
|
||||
{
|
||||
this.effectDuration = 0;
|
||||
|
@ -23501,10 +23597,20 @@ function createFiberRoot(
|
|||
hydrate,
|
||||
hydrationCallbacks,
|
||||
isStrictMode,
|
||||
concurrentUpdatesByDefaultOverride,
|
||||
identifierPrefix
|
||||
concurrentUpdatesByDefaultOverride, // TODO: We have several of these arguments that are conceptually part of the
|
||||
// host config, but because they are passed in at runtime, we have to thread
|
||||
// them through the root constructor. Perhaps we should put them all into a
|
||||
// single type, like a DynamicHostConfig that is defined by the renderer.
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix);
|
||||
var root = new FiberRootNode(
|
||||
containerInfo,
|
||||
tag,
|
||||
hydrate,
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
);
|
||||
// stateNode is any.
|
||||
|
||||
var uninitializedFiber = createHostRootFiber(
|
||||
|
@ -23526,7 +23632,7 @@ function createFiberRoot(
|
|||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.0.0-rc.0-51947a14b-20220113";
|
||||
var ReactVersion = "18.0.0-rc.0-a3bde7974-20220208";
|
||||
|
||||
function createPortal(
|
||||
children,
|
||||
|
@ -23654,7 +23760,8 @@ function createContainer(
|
|||
hydrationCallbacks,
|
||||
isStrictMode,
|
||||
concurrentUpdatesByDefaultOverride,
|
||||
identifierPrefix
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
return createFiberRoot(
|
||||
containerInfo,
|
||||
|
@ -23663,7 +23770,8 @@ function createContainer(
|
|||
hydrationCallbacks,
|
||||
isStrictMode,
|
||||
concurrentUpdatesByDefaultOverride,
|
||||
identifierPrefix
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
);
|
||||
}
|
||||
function updateContainer(element, container, parentComponent, callback) {
|
||||
|
@ -24458,7 +24566,8 @@ function render(element, containerTag, callback, concurrentRoot) {
|
|||
null,
|
||||
false,
|
||||
null,
|
||||
""
|
||||
"",
|
||||
null
|
||||
);
|
||||
roots.set(containerTag, root);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<d101378706adbbc7947ba5d167b46aab>>
|
||||
* @generated SignedSource<<97d9d60e7b93063137af17ba2abdf915>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
@ -927,7 +927,7 @@ eventPluginOrder = Array.prototype.slice.call([
|
|||
"ReactNativeBridgeEventPlugin"
|
||||
]);
|
||||
recomputePluginOrdering();
|
||||
var injectedNamesToPlugins$jscomp$inline_220 = {
|
||||
var injectedNamesToPlugins$jscomp$inline_219 = {
|
||||
ResponderEventPlugin: ResponderEventPlugin,
|
||||
ReactNativeBridgeEventPlugin: {
|
||||
eventTypes: {},
|
||||
|
@ -962,33 +962,33 @@ var injectedNamesToPlugins$jscomp$inline_220 = {
|
|||
}
|
||||
}
|
||||
},
|
||||
isOrderingDirty$jscomp$inline_221 = !1,
|
||||
pluginName$jscomp$inline_222;
|
||||
for (pluginName$jscomp$inline_222 in injectedNamesToPlugins$jscomp$inline_220)
|
||||
isOrderingDirty$jscomp$inline_220 = !1,
|
||||
pluginName$jscomp$inline_221;
|
||||
for (pluginName$jscomp$inline_221 in injectedNamesToPlugins$jscomp$inline_219)
|
||||
if (
|
||||
injectedNamesToPlugins$jscomp$inline_220.hasOwnProperty(
|
||||
pluginName$jscomp$inline_222
|
||||
injectedNamesToPlugins$jscomp$inline_219.hasOwnProperty(
|
||||
pluginName$jscomp$inline_221
|
||||
)
|
||||
) {
|
||||
var pluginModule$jscomp$inline_223 =
|
||||
injectedNamesToPlugins$jscomp$inline_220[pluginName$jscomp$inline_222];
|
||||
var pluginModule$jscomp$inline_222 =
|
||||
injectedNamesToPlugins$jscomp$inline_219[pluginName$jscomp$inline_221];
|
||||
if (
|
||||
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_222) ||
|
||||
namesToPlugins[pluginName$jscomp$inline_222] !==
|
||||
pluginModule$jscomp$inline_223
|
||||
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_221) ||
|
||||
namesToPlugins[pluginName$jscomp$inline_221] !==
|
||||
pluginModule$jscomp$inline_222
|
||||
) {
|
||||
if (namesToPlugins[pluginName$jscomp$inline_222])
|
||||
if (namesToPlugins[pluginName$jscomp$inline_221])
|
||||
throw Error(
|
||||
"EventPluginRegistry: Cannot inject two different event plugins using the same name, `" +
|
||||
(pluginName$jscomp$inline_222 + "`.")
|
||||
(pluginName$jscomp$inline_221 + "`.")
|
||||
);
|
||||
namesToPlugins[
|
||||
pluginName$jscomp$inline_222
|
||||
] = pluginModule$jscomp$inline_223;
|
||||
isOrderingDirty$jscomp$inline_221 = !0;
|
||||
pluginName$jscomp$inline_221
|
||||
] = pluginModule$jscomp$inline_222;
|
||||
isOrderingDirty$jscomp$inline_220 = !0;
|
||||
}
|
||||
}
|
||||
isOrderingDirty$jscomp$inline_221 && recomputePluginOrdering();
|
||||
isOrderingDirty$jscomp$inline_220 && recomputePluginOrdering();
|
||||
function getInstanceFromInstance(instanceHandle) {
|
||||
return instanceHandle;
|
||||
}
|
||||
|
@ -1559,7 +1559,10 @@ function dispatchEvent(target, topLevelType, nativeEvent) {
|
|||
null != stateNode && (eventTarget = stateNode.canonical);
|
||||
}
|
||||
batchedUpdates(function() {
|
||||
var JSCompiler_inline_result = eventTarget;
|
||||
var event = { eventName: topLevelType, nativeEvent: nativeEvent };
|
||||
ReactNativePrivateInterface.RawEventEmitter.emit(topLevelType, event);
|
||||
ReactNativePrivateInterface.RawEventEmitter.emit("*", event);
|
||||
event = eventTarget;
|
||||
for (
|
||||
var events = null, legacyPlugins = plugins, i = 0;
|
||||
i < legacyPlugins.length;
|
||||
|
@ -1571,29 +1574,25 @@ function dispatchEvent(target, topLevelType, nativeEvent) {
|
|||
topLevelType,
|
||||
target,
|
||||
nativeEvent,
|
||||
JSCompiler_inline_result
|
||||
event
|
||||
)) &&
|
||||
(events = accumulateInto(events, possiblePlugin));
|
||||
}
|
||||
JSCompiler_inline_result = events;
|
||||
null !== JSCompiler_inline_result &&
|
||||
(eventQueue = accumulateInto(eventQueue, JSCompiler_inline_result));
|
||||
JSCompiler_inline_result = eventQueue;
|
||||
event = events;
|
||||
null !== event && (eventQueue = accumulateInto(eventQueue, event));
|
||||
event = eventQueue;
|
||||
eventQueue = null;
|
||||
if (JSCompiler_inline_result) {
|
||||
forEachAccumulated(
|
||||
JSCompiler_inline_result,
|
||||
executeDispatchesAndReleaseTopLevel
|
||||
);
|
||||
if (event) {
|
||||
forEachAccumulated(event, executeDispatchesAndReleaseTopLevel);
|
||||
if (eventQueue)
|
||||
throw Error(
|
||||
"processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented."
|
||||
);
|
||||
if (hasRethrowError)
|
||||
throw ((JSCompiler_inline_result = rethrowError),
|
||||
throw ((event = rethrowError),
|
||||
(hasRethrowError = !1),
|
||||
(rethrowError = null),
|
||||
JSCompiler_inline_result);
|
||||
event);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1619,12 +1618,6 @@ function onCommitRoot(root) {
|
|||
);
|
||||
} catch (err) {}
|
||||
}
|
||||
function injectProfilingHooks() {}
|
||||
function getLaneLabelMap() {
|
||||
for (var map = new Map(), lane = 1, index$3 = 0; 31 > index$3; index$3++)
|
||||
map.set(lane, void 0), (lane *= 2);
|
||||
return map;
|
||||
}
|
||||
var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback,
|
||||
log = Math.log,
|
||||
LN2 = Math.LN2;
|
||||
|
@ -1797,21 +1790,21 @@ function markRootFinished(root, remainingLanes) {
|
|||
remainingLanes = root.entanglements;
|
||||
var eventTimes = root.eventTimes;
|
||||
for (root = root.expirationTimes; 0 < noLongerPendingLanes; ) {
|
||||
var index$8 = 31 - clz32(noLongerPendingLanes),
|
||||
lane = 1 << index$8;
|
||||
remainingLanes[index$8] = 0;
|
||||
eventTimes[index$8] = -1;
|
||||
root[index$8] = -1;
|
||||
var index$7 = 31 - clz32(noLongerPendingLanes),
|
||||
lane = 1 << index$7;
|
||||
remainingLanes[index$7] = 0;
|
||||
eventTimes[index$7] = -1;
|
||||
root[index$7] = -1;
|
||||
noLongerPendingLanes &= ~lane;
|
||||
}
|
||||
}
|
||||
function markRootEntangled(root, entangledLanes) {
|
||||
var rootEntangledLanes = (root.entangledLanes |= entangledLanes);
|
||||
for (root = root.entanglements; rootEntangledLanes; ) {
|
||||
var index$9 = 31 - clz32(rootEntangledLanes),
|
||||
lane = 1 << index$9;
|
||||
(lane & entangledLanes) | (root[index$9] & entangledLanes) &&
|
||||
(root[index$9] |= entangledLanes);
|
||||
var index$8 = 31 - clz32(rootEntangledLanes),
|
||||
lane = 1 << index$8;
|
||||
(lane & entangledLanes) | (root[index$8] & entangledLanes) &&
|
||||
(root[index$8] |= entangledLanes);
|
||||
rootEntangledLanes &= ~lane;
|
||||
}
|
||||
}
|
||||
|
@ -2185,19 +2178,16 @@ function popProvider(context) {
|
|||
pop(valueCursor);
|
||||
context._currentValue2 = currentValue;
|
||||
}
|
||||
function scheduleWorkOnParentPath(parent, renderLanes) {
|
||||
function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) {
|
||||
for (; null !== parent; ) {
|
||||
var alternate = parent.alternate;
|
||||
if ((parent.childLanes & renderLanes) === renderLanes)
|
||||
if (
|
||||
null === alternate ||
|
||||
(alternate.childLanes & renderLanes) === renderLanes
|
||||
)
|
||||
break;
|
||||
else alternate.childLanes |= renderLanes;
|
||||
else
|
||||
(parent.childLanes |= renderLanes),
|
||||
null !== alternate && (alternate.childLanes |= renderLanes);
|
||||
(parent.childLanes & renderLanes) !== renderLanes
|
||||
? ((parent.childLanes |= renderLanes),
|
||||
null !== alternate && (alternate.childLanes |= renderLanes))
|
||||
: null !== alternate &&
|
||||
(alternate.childLanes & renderLanes) !== renderLanes &&
|
||||
(alternate.childLanes |= renderLanes);
|
||||
if (parent === propagationRoot) break;
|
||||
parent = parent.return;
|
||||
}
|
||||
}
|
||||
|
@ -3666,28 +3656,37 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
|||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function mountSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = mountWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var root = workInProgressRoot;
|
||||
if (null === root)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
if (
|
||||
hook.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged ||
|
||||
(null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1)
|
||||
) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
includesBlockingLane(root, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
hook.memoizedState = nextSnapshot;
|
||||
root = { value: nextSnapshot, getSnapshot: getSnapshot };
|
||||
hook.queue = root;
|
||||
mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [subscribe]);
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(subscribe, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
|
@ -4075,7 +4074,32 @@ var ContextOnlyDispatcher = {
|
|||
};
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
},
|
||||
useSyncExternalStore: mountSyncExternalStore,
|
||||
useSyncExternalStore: function(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = mountWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var root = workInProgressRoot;
|
||||
if (null === root)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(root, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
hook.memoizedState = nextSnapshot;
|
||||
root = { value: nextSnapshot, getSnapshot: getSnapshot };
|
||||
hook.queue = root;
|
||||
mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
return nextSnapshot;
|
||||
},
|
||||
useId: function() {
|
||||
var hook = mountWorkInProgressHook(),
|
||||
identifierPrefix = workInProgressRoot.identifierPrefix,
|
||||
|
@ -4124,46 +4148,7 @@ var ContextOnlyDispatcher = {
|
|||
return [isPending, start];
|
||||
},
|
||||
useMutableSource: updateMutableSource,
|
||||
useSyncExternalStore: function(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
if (
|
||||
hook.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged ||
|
||||
(null !== workInProgressHook &&
|
||||
workInProgressHook.memoizedState.tag & 1)
|
||||
) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
nextSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(subscribe, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
},
|
||||
useSyncExternalStore: updateSyncExternalStore,
|
||||
useId: updateId,
|
||||
unstable_isNewReconciler: !1
|
||||
},
|
||||
|
@ -4206,7 +4191,7 @@ var ContextOnlyDispatcher = {
|
|||
return [isPending, start];
|
||||
},
|
||||
useMutableSource: updateMutableSource,
|
||||
useSyncExternalStore: mountSyncExternalStore,
|
||||
useSyncExternalStore: updateSyncExternalStore,
|
||||
useId: updateId,
|
||||
unstable_isNewReconciler: !1
|
||||
};
|
||||
|
@ -4454,14 +4439,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
|||
break;
|
||||
case "collapsed":
|
||||
lastTailNode = renderState.tail;
|
||||
for (var lastTailNode$36 = null; null !== lastTailNode; )
|
||||
null !== lastTailNode.alternate && (lastTailNode$36 = lastTailNode),
|
||||
for (var lastTailNode$35 = null; null !== lastTailNode; )
|
||||
null !== lastTailNode.alternate && (lastTailNode$35 = lastTailNode),
|
||||
(lastTailNode = lastTailNode.sibling);
|
||||
null === lastTailNode$36
|
||||
null === lastTailNode$35
|
||||
? hasRenderedATailFallback || null === renderState.tail
|
||||
? (renderState.tail = null)
|
||||
: (renderState.tail.sibling = null)
|
||||
: (lastTailNode$36.sibling = null);
|
||||
: (lastTailNode$35.sibling = null);
|
||||
}
|
||||
}
|
||||
function bubbleProperties(completedWork) {
|
||||
|
@ -4471,19 +4456,19 @@ function bubbleProperties(completedWork) {
|
|||
newChildLanes = 0,
|
||||
subtreeFlags = 0;
|
||||
if (didBailout)
|
||||
for (var child$37 = completedWork.child; null !== child$37; )
|
||||
(newChildLanes |= child$37.lanes | child$37.childLanes),
|
||||
(subtreeFlags |= child$37.subtreeFlags & 14680064),
|
||||
(subtreeFlags |= child$37.flags & 14680064),
|
||||
(child$37.return = completedWork),
|
||||
(child$37 = child$37.sibling);
|
||||
for (var child$36 = completedWork.child; null !== child$36; )
|
||||
(newChildLanes |= child$36.lanes | child$36.childLanes),
|
||||
(subtreeFlags |= child$36.subtreeFlags & 14680064),
|
||||
(subtreeFlags |= child$36.flags & 14680064),
|
||||
(child$36.return = completedWork),
|
||||
(child$36 = child$36.sibling);
|
||||
else
|
||||
for (child$37 = completedWork.child; null !== child$37; )
|
||||
(newChildLanes |= child$37.lanes | child$37.childLanes),
|
||||
(subtreeFlags |= child$37.subtreeFlags),
|
||||
(subtreeFlags |= child$37.flags),
|
||||
(child$37.return = completedWork),
|
||||
(child$37 = child$37.sibling);
|
||||
for (child$36 = completedWork.child; null !== child$36; )
|
||||
(newChildLanes |= child$36.lanes | child$36.childLanes),
|
||||
(subtreeFlags |= child$36.subtreeFlags),
|
||||
(subtreeFlags |= child$36.flags),
|
||||
(child$36.return = completedWork),
|
||||
(child$36 = child$36.sibling);
|
||||
completedWork.subtreeFlags |= subtreeFlags;
|
||||
completedWork.childLanes = newChildLanes;
|
||||
return didBailout;
|
||||
|
@ -5548,11 +5533,11 @@ function updateSuspenseFallbackChildren(
|
|||
workInProgress.child = current;
|
||||
return fallbackChildren;
|
||||
}
|
||||
function scheduleWorkOnFiber(fiber, renderLanes) {
|
||||
function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) {
|
||||
fiber.lanes |= renderLanes;
|
||||
var alternate = fiber.alternate;
|
||||
null !== alternate && (alternate.lanes |= renderLanes);
|
||||
scheduleWorkOnParentPath(fiber.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot);
|
||||
}
|
||||
function initSuspenseListRenderState(
|
||||
workInProgress,
|
||||
|
@ -5591,8 +5576,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) {
|
|||
a: for (current = workInProgress.child; null !== current; ) {
|
||||
if (13 === current.tag)
|
||||
null !== current.memoizedState &&
|
||||
scheduleWorkOnFiber(current, renderLanes);
|
||||
else if (19 === current.tag) scheduleWorkOnFiber(current, renderLanes);
|
||||
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
||||
else if (19 === current.tag)
|
||||
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
||||
else if (null !== current.child) {
|
||||
current.child.return = current;
|
||||
current = current.child;
|
||||
|
@ -5906,8 +5892,8 @@ function commitHookEffectListMount(flags, finishedWork) {
|
|||
var effect = (finishedWork = finishedWork.next);
|
||||
do {
|
||||
if ((effect.tag & flags) === flags) {
|
||||
var create$81 = effect.create;
|
||||
effect.destroy = create$81();
|
||||
var create$80 = effect.create;
|
||||
effect.destroy = create$80();
|
||||
}
|
||||
effect = effect.next;
|
||||
} while (effect !== finishedWork);
|
||||
|
@ -6084,8 +6070,8 @@ function commitMutationEffects(root, firstChild) {
|
|||
switch (root.tag) {
|
||||
case 13:
|
||||
if (null !== root.memoizedState) {
|
||||
var current$85 = root.alternate;
|
||||
if (null === current$85 || null === current$85.memoizedState)
|
||||
var current$84 = root.alternate;
|
||||
if (null === current$84 || null === current$84.memoizedState)
|
||||
globalMostRecentFallbackTime = now();
|
||||
}
|
||||
}
|
||||
|
@ -6162,8 +6148,8 @@ function commitLayoutEffects(finishedWork) {
|
|||
commitUpdateQueue(firstChild, updateQueue, instance);
|
||||
break;
|
||||
case 3:
|
||||
var updateQueue$82 = firstChild.updateQueue;
|
||||
if (null !== updateQueue$82) {
|
||||
var updateQueue$81 = firstChild.updateQueue;
|
||||
if (null !== updateQueue$81) {
|
||||
current = null;
|
||||
if (null !== firstChild.child)
|
||||
switch (firstChild.child.tag) {
|
||||
|
@ -6173,7 +6159,7 @@ function commitLayoutEffects(finishedWork) {
|
|||
case 1:
|
||||
current = firstChild.child.stateNode;
|
||||
}
|
||||
commitUpdateQueue(firstChild, updateQueue$82, current);
|
||||
commitUpdateQueue(firstChild, updateQueue$81, current);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
@ -6250,8 +6236,9 @@ var ceil = Math.ceil,
|
|||
workInProgressRootFatalError = null,
|
||||
workInProgressRootSkippedLanes = 0,
|
||||
workInProgressRootInterleavedUpdatedLanes = 0,
|
||||
workInProgressRootRenderPhaseUpdatedLanes = 0,
|
||||
workInProgressRootPingedLanes = 0,
|
||||
workInProgressRootConcurrentErrors = null,
|
||||
workInProgressRootRecoverableErrors = null,
|
||||
globalMostRecentFallbackTime = 0,
|
||||
workInProgressRootRenderTargetTime = Infinity,
|
||||
hasUncaughtError = !1,
|
||||
|
@ -6310,19 +6297,18 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
|
|||
var root = markUpdateLaneFromFiberToRoot(fiber, lane);
|
||||
if (null === root) return null;
|
||||
markRootUpdated(root, lane, eventTime);
|
||||
0 !== (executionContext & 2) && root === workInProgressRoot
|
||||
? (workInProgressRootRenderPhaseUpdatedLanes |= lane)
|
||||
: (root === workInProgressRoot &&
|
||||
(0 === (executionContext & 2) &&
|
||||
(workInProgressRootInterleavedUpdatedLanes |= lane),
|
||||
4 === workInProgressRootExitStatus &&
|
||||
markRootSuspended$1(root, workInProgressRootRenderLanes)),
|
||||
if (0 === (executionContext & 2) || root !== workInProgressRoot)
|
||||
root === workInProgressRoot &&
|
||||
(0 === (executionContext & 2) &&
|
||||
(workInProgressRootInterleavedUpdatedLanes |= lane),
|
||||
4 === workInProgressRootExitStatus &&
|
||||
markRootSuspended$1(root, workInProgressRootRenderLanes)),
|
||||
ensureRootIsScheduled(root, eventTime),
|
||||
1 === lane &&
|
||||
0 === executionContext &&
|
||||
0 === (fiber.mode & 1) &&
|
||||
((workInProgressRootRenderTargetTime = now() + 500),
|
||||
includesLegacySyncCallbacks && flushSyncCallbacks()));
|
||||
includesLegacySyncCallbacks && flushSyncCallbacks());
|
||||
return root;
|
||||
}
|
||||
function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
||||
|
@ -6348,12 +6334,12 @@ function ensureRootIsScheduled(root, currentTime) {
|
|||
0 < lanes;
|
||||
|
||||
) {
|
||||
var index$6 = 31 - clz32(lanes),
|
||||
lane = 1 << index$6,
|
||||
expirationTime = expirationTimes[index$6];
|
||||
var index$5 = 31 - clz32(lanes),
|
||||
lane = 1 << index$5,
|
||||
expirationTime = expirationTimes[index$5];
|
||||
if (-1 === expirationTime) {
|
||||
if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes))
|
||||
expirationTimes[index$6] = computeExpirationTime(lane, currentTime);
|
||||
expirationTimes[index$5] = computeExpirationTime(lane, currentTime);
|
||||
} else expirationTime <= currentTime && (root.expiredLanes |= lane);
|
||||
lanes &= ~lane;
|
||||
}
|
||||
|
@ -6493,7 +6479,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
case 1:
|
||||
throw Error("Root did not complete. This is a bug in React.");
|
||||
case 2:
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 3:
|
||||
markRootSuspended$1(root, lanes);
|
||||
|
@ -6510,22 +6496,22 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
break;
|
||||
}
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
didTimeout
|
||||
);
|
||||
break;
|
||||
}
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 4:
|
||||
markRootSuspended$1(root, lanes);
|
||||
if ((lanes & 4194240) === lanes) break;
|
||||
didTimeout = root.eventTimes;
|
||||
for (prevExecutionContext = -1; 0 < lanes; ) {
|
||||
var index$5 = 31 - clz32(lanes);
|
||||
prevDispatcher = 1 << index$5;
|
||||
index$5 = didTimeout[index$5];
|
||||
index$5 > prevExecutionContext && (prevExecutionContext = index$5);
|
||||
var index$4 = 31 - clz32(lanes);
|
||||
prevDispatcher = 1 << index$4;
|
||||
index$4 = didTimeout[index$4];
|
||||
index$4 > prevExecutionContext && (prevExecutionContext = index$4);
|
||||
lanes &= ~prevDispatcher;
|
||||
}
|
||||
lanes = prevExecutionContext;
|
||||
|
@ -6546,15 +6532,15 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
: 1960 * ceil(lanes / 1960)) - lanes;
|
||||
if (10 < lanes) {
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
lanes
|
||||
);
|
||||
break;
|
||||
}
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 5:
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
default:
|
||||
throw Error("Unknown root exit status.");
|
||||
|
@ -6569,15 +6555,18 @@ function recoverFromConcurrentError(root, errorRetryLanes) {
|
|||
var prevExecutionContext = executionContext;
|
||||
executionContext |= 8;
|
||||
root.isDehydrated && (root.isDehydrated = !1);
|
||||
for (
|
||||
var exitStatus, i = 0;
|
||||
50 > i &&
|
||||
((exitStatus = renderRootSync(root, errorRetryLanes)),
|
||||
2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes);
|
||||
i++
|
||||
);
|
||||
var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
|
||||
root = renderRootSync(root, errorRetryLanes);
|
||||
2 !== root &&
|
||||
null !== errorsFromFirstAttempt &&
|
||||
(null === workInProgressRootConcurrentErrors
|
||||
? (workInProgressRootRecoverableErrors = errorsFromFirstAttempt)
|
||||
: (workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply(
|
||||
null,
|
||||
errorsFromFirstAttempt
|
||||
)));
|
||||
executionContext = prevExecutionContext;
|
||||
return exitStatus;
|
||||
return root;
|
||||
}
|
||||
function isRenderConsistentWithExternalStores(finishedWork) {
|
||||
for (var node = finishedWork; ; ) {
|
||||
|
@ -6619,9 +6608,9 @@ function markRootSuspended$1(root, suspendedLanes) {
|
|||
root.suspendedLanes |= suspendedLanes;
|
||||
root.pingedLanes &= ~suspendedLanes;
|
||||
for (root = root.expirationTimes; 0 < suspendedLanes; ) {
|
||||
var index$7 = 31 - clz32(suspendedLanes),
|
||||
lane = 1 << index$7;
|
||||
root[index$7] = -1;
|
||||
var index$6 = 31 - clz32(suspendedLanes),
|
||||
lane = 1 << index$6;
|
||||
root[index$6] = -1;
|
||||
suspendedLanes &= ~lane;
|
||||
}
|
||||
}
|
||||
|
@ -6646,7 +6635,7 @@ function performSyncWorkOnRoot(root) {
|
|||
exitStatus);
|
||||
root.finishedWork = root.current.alternate;
|
||||
root.finishedLanes = lanes;
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
ensureRootIsScheduled(root, now());
|
||||
return null;
|
||||
}
|
||||
|
@ -6703,7 +6692,8 @@ function prepareFreshStack(root, lanes) {
|
|||
workInProgressRootRenderLanes = subtreeRenderLanes = lanes;
|
||||
workInProgressRootExitStatus = 0;
|
||||
workInProgressRootFatalError = null;
|
||||
workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0;
|
||||
workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0;
|
||||
workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null;
|
||||
if (null !== interleavedQueues) {
|
||||
for (root = 0; root < interleavedQueues.length; root++)
|
||||
if (
|
||||
|
@ -6871,8 +6861,12 @@ function handleError(root$jscomp$0, thrownValue) {
|
|||
" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."
|
||||
);
|
||||
}
|
||||
root = value;
|
||||
4 !== workInProgressRootExitStatus &&
|
||||
(workInProgressRootExitStatus = 2);
|
||||
null === workInProgressRootConcurrentErrors
|
||||
? (workInProgressRootConcurrentErrors = [root])
|
||||
: workInProgressRootConcurrentErrors.push(root);
|
||||
value = createCapturedValue(value, sourceFiber);
|
||||
root = returnFiber;
|
||||
do {
|
||||
|
@ -6904,12 +6898,12 @@ function handleError(root$jscomp$0, thrownValue) {
|
|||
root.flags |= 65536;
|
||||
thrownValue &= -thrownValue;
|
||||
root.lanes |= thrownValue;
|
||||
var update$32 = createClassErrorUpdate(
|
||||
var update$31 = createClassErrorUpdate(
|
||||
root,
|
||||
wakeable,
|
||||
thrownValue
|
||||
);
|
||||
enqueueCapturedUpdate(root, update$32);
|
||||
enqueueCapturedUpdate(root, update$31);
|
||||
break a;
|
||||
}
|
||||
}
|
||||
|
@ -7004,20 +6998,20 @@ function completeUnitOfWork(unitOfWork) {
|
|||
} while (null !== completedWork);
|
||||
0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5);
|
||||
}
|
||||
function commitRoot(root) {
|
||||
function commitRoot(root, recoverableErrors) {
|
||||
var previousUpdateLanePriority = currentUpdatePriority,
|
||||
prevTransition = ReactCurrentBatchConfig$2.transition;
|
||||
try {
|
||||
(ReactCurrentBatchConfig$2.transition = 0),
|
||||
(currentUpdatePriority = 1),
|
||||
commitRootImpl(root, previousUpdateLanePriority);
|
||||
commitRootImpl(root, recoverableErrors, previousUpdateLanePriority);
|
||||
} finally {
|
||||
(ReactCurrentBatchConfig$2.transition = prevTransition),
|
||||
(currentUpdatePriority = previousUpdateLanePriority);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function commitRootImpl(root, renderPriorityLevel) {
|
||||
function commitRootImpl(root, recoverableErrors, renderPriorityLevel) {
|
||||
do flushPassiveEffects();
|
||||
while (null !== rootWithPendingPassiveEffects);
|
||||
if (0 !== (executionContext & 6))
|
||||
|
@ -7072,6 +7066,15 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|||
0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null);
|
||||
onCommitRoot(finishedWork.stateNode, renderPriorityLevel);
|
||||
ensureRootIsScheduled(root, now());
|
||||
if (null !== recoverableErrors)
|
||||
for (
|
||||
renderPriorityLevel = 0;
|
||||
renderPriorityLevel < recoverableErrors.length;
|
||||
renderPriorityLevel++
|
||||
)
|
||||
(finishedWork = recoverableErrors[renderPriorityLevel]),
|
||||
(lanes = root.onRecoverableError),
|
||||
null !== lanes && lanes(finishedWork);
|
||||
if (hasUncaughtError)
|
||||
throw ((hasUncaughtError = !1),
|
||||
(root = firstUncaughtError),
|
||||
|
@ -7644,7 +7647,11 @@ beginWork$1 = function(current, workInProgress, renderLanes) {
|
|||
newValue.lanes |= renderLanes;
|
||||
dependency = newValue.alternate;
|
||||
null !== dependency && (dependency.lanes |= renderLanes);
|
||||
scheduleWorkOnParentPath(newValue.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(
|
||||
newValue.return,
|
||||
renderLanes,
|
||||
workInProgress
|
||||
);
|
||||
list.lanes |= renderLanes;
|
||||
break;
|
||||
}
|
||||
|
@ -7949,7 +7956,13 @@ function createFiberFromPortal(portal, mode, lanes) {
|
|||
};
|
||||
return mode;
|
||||
}
|
||||
function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
||||
function FiberRootNode(
|
||||
containerInfo,
|
||||
tag,
|
||||
hydrate,
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
this.tag = tag;
|
||||
this.containerInfo = containerInfo;
|
||||
this.finishedWork = this.pingCache = this.current = this.pendingChildren = null;
|
||||
|
@ -7963,6 +7976,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
|||
this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0;
|
||||
this.entanglements = createLaneMap(0);
|
||||
this.identifierPrefix = identifierPrefix;
|
||||
this.onRecoverableError = onRecoverableError;
|
||||
}
|
||||
function createPortal(children, containerInfo, implementation) {
|
||||
var key =
|
||||
|
@ -8166,10 +8180,10 @@ batchedUpdatesImpl = function(fn, a) {
|
|||
}
|
||||
};
|
||||
var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_926 = {
|
||||
devToolsConfig$jscomp$inline_927 = {
|
||||
findFiberByHostInstance: getInstanceFromInstance,
|
||||
bundleType: 0,
|
||||
version: "18.0.0-rc.0-51947a14b-20220113",
|
||||
version: "18.0.0-rc.0-a3bde7974-20220208",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForViewTag: function() {
|
||||
|
@ -8184,11 +8198,11 @@ var roots = new Map(),
|
|||
}.bind(null, findNodeHandle)
|
||||
}
|
||||
};
|
||||
var internals$jscomp$inline_1179 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_926.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_926.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_926.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_926.rendererConfig,
|
||||
var internals$jscomp$inline_1181 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_927.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_927.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_927.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_927.rendererConfig,
|
||||
overrideHookState: null,
|
||||
overrideHookStateDeletePath: null,
|
||||
overrideHookStateRenamePath: null,
|
||||
|
@ -8204,29 +8218,26 @@ var internals$jscomp$inline_1179 = {
|
|||
return null === fiber ? null : fiber.stateNode;
|
||||
},
|
||||
findFiberByHostInstance:
|
||||
devToolsConfig$jscomp$inline_926.findFiberByHostInstance ||
|
||||
devToolsConfig$jscomp$inline_927.findFiberByHostInstance ||
|
||||
emptyFindFiberByHostInstance,
|
||||
findHostInstancesForRefresh: null,
|
||||
scheduleRefresh: null,
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113"
|
||||
reconcilerVersion: "18.0.0-rc.0-a3bde7974-20220208"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1180 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
var hook$jscomp$inline_1182 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (
|
||||
!hook$jscomp$inline_1180.isDisabled &&
|
||||
hook$jscomp$inline_1180.supportsFiber
|
||||
!hook$jscomp$inline_1182.isDisabled &&
|
||||
hook$jscomp$inline_1182.supportsFiber
|
||||
)
|
||||
try {
|
||||
(rendererID = hook$jscomp$inline_1180.inject(
|
||||
Object.assign({}, internals$jscomp$inline_1179, {
|
||||
getLaneLabelMap: getLaneLabelMap,
|
||||
injectProfilingHooks: injectProfilingHooks
|
||||
})
|
||||
(rendererID = hook$jscomp$inline_1182.inject(
|
||||
internals$jscomp$inline_1181
|
||||
)),
|
||||
(injectedHook = hook$jscomp$inline_1180);
|
||||
(injectedHook = hook$jscomp$inline_1182);
|
||||
} catch (err) {}
|
||||
}
|
||||
exports.createPortal = function(children, containerTag) {
|
||||
|
@ -8266,7 +8277,7 @@ exports.render = function(element, containerTag, callback, concurrentRoot) {
|
|||
var root = roots.get(containerTag);
|
||||
root ||
|
||||
((root = concurrentRoot ? 1 : 0),
|
||||
(concurrentRoot = new FiberRootNode(containerTag, root, !1, "")),
|
||||
(concurrentRoot = new FiberRootNode(containerTag, root, !1, "", null)),
|
||||
(root = createFiber(3, null, null, 1 === root ? 1 : 0)),
|
||||
(concurrentRoot.current = root),
|
||||
(root.stateNode = concurrentRoot),
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<ed6282c0e752a40e526104dcc0d5c8b8>>
|
||||
* @generated SignedSource<<5c079c38f5734a3f694bc72a4da400d4>>
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1570,7 +1570,10 @@ function dispatchEvent(target, topLevelType, nativeEvent) {
|
|||
null != stateNode && (eventTarget = stateNode.canonical);
|
||||
}
|
||||
batchedUpdates(function() {
|
||||
var JSCompiler_inline_result = eventTarget;
|
||||
var event = { eventName: topLevelType, nativeEvent: nativeEvent };
|
||||
ReactNativePrivateInterface.RawEventEmitter.emit(topLevelType, event);
|
||||
ReactNativePrivateInterface.RawEventEmitter.emit("*", event);
|
||||
event = eventTarget;
|
||||
for (
|
||||
var events = null, legacyPlugins = plugins, i = 0;
|
||||
i < legacyPlugins.length;
|
||||
|
@ -1582,29 +1585,25 @@ function dispatchEvent(target, topLevelType, nativeEvent) {
|
|||
topLevelType,
|
||||
target,
|
||||
nativeEvent,
|
||||
JSCompiler_inline_result
|
||||
event
|
||||
)) &&
|
||||
(events = accumulateInto(events, possiblePlugin));
|
||||
}
|
||||
JSCompiler_inline_result = events;
|
||||
null !== JSCompiler_inline_result &&
|
||||
(eventQueue = accumulateInto(eventQueue, JSCompiler_inline_result));
|
||||
JSCompiler_inline_result = eventQueue;
|
||||
event = events;
|
||||
null !== event && (eventQueue = accumulateInto(eventQueue, event));
|
||||
event = eventQueue;
|
||||
eventQueue = null;
|
||||
if (JSCompiler_inline_result) {
|
||||
forEachAccumulated(
|
||||
JSCompiler_inline_result,
|
||||
executeDispatchesAndReleaseTopLevel
|
||||
);
|
||||
if (event) {
|
||||
forEachAccumulated(event, executeDispatchesAndReleaseTopLevel);
|
||||
if (eventQueue)
|
||||
throw Error(
|
||||
"processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented."
|
||||
);
|
||||
if (hasRethrowError)
|
||||
throw ((JSCompiler_inline_result = rethrowError),
|
||||
throw ((event = rethrowError),
|
||||
(hasRethrowError = !1),
|
||||
(rethrowError = null),
|
||||
JSCompiler_inline_result);
|
||||
event);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2306,19 +2305,16 @@ function popProvider(context) {
|
|||
pop(valueCursor);
|
||||
context._currentValue2 = currentValue;
|
||||
}
|
||||
function scheduleWorkOnParentPath(parent, renderLanes) {
|
||||
function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) {
|
||||
for (; null !== parent; ) {
|
||||
var alternate = parent.alternate;
|
||||
if ((parent.childLanes & renderLanes) === renderLanes)
|
||||
if (
|
||||
null === alternate ||
|
||||
(alternate.childLanes & renderLanes) === renderLanes
|
||||
)
|
||||
break;
|
||||
else alternate.childLanes |= renderLanes;
|
||||
else
|
||||
(parent.childLanes |= renderLanes),
|
||||
null !== alternate && (alternate.childLanes |= renderLanes);
|
||||
(parent.childLanes & renderLanes) !== renderLanes
|
||||
? ((parent.childLanes |= renderLanes),
|
||||
null !== alternate && (alternate.childLanes |= renderLanes))
|
||||
: null !== alternate &&
|
||||
(alternate.childLanes & renderLanes) !== renderLanes &&
|
||||
(alternate.childLanes |= renderLanes);
|
||||
if (parent === propagationRoot) break;
|
||||
parent = parent.return;
|
||||
}
|
||||
}
|
||||
|
@ -3792,28 +3788,37 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
|||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function mountSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = mountWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var root = workInProgressRoot;
|
||||
if (null === root)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
if (
|
||||
hook.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged ||
|
||||
(null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1)
|
||||
) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
includesBlockingLane(root, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
hook.memoizedState = nextSnapshot;
|
||||
root = { value: nextSnapshot, getSnapshot: getSnapshot };
|
||||
hook.queue = root;
|
||||
mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [subscribe]);
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(subscribe, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
|
@ -4203,7 +4208,32 @@ var ContextOnlyDispatcher = {
|
|||
};
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
},
|
||||
useSyncExternalStore: mountSyncExternalStore,
|
||||
useSyncExternalStore: function(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = mountWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var root = workInProgressRoot;
|
||||
if (null === root)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(root, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
hook.memoizedState = nextSnapshot;
|
||||
root = { value: nextSnapshot, getSnapshot: getSnapshot };
|
||||
hook.queue = root;
|
||||
mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
return nextSnapshot;
|
||||
},
|
||||
useId: function() {
|
||||
var hook = mountWorkInProgressHook(),
|
||||
identifierPrefix = workInProgressRoot.identifierPrefix,
|
||||
|
@ -4252,46 +4282,7 @@ var ContextOnlyDispatcher = {
|
|||
return [isPending, start];
|
||||
},
|
||||
useMutableSource: updateMutableSource,
|
||||
useSyncExternalStore: function(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
if (
|
||||
hook.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged ||
|
||||
(null !== workInProgressHook &&
|
||||
workInProgressHook.memoizedState.tag & 1)
|
||||
) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
nextSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(subscribe, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
},
|
||||
useSyncExternalStore: updateSyncExternalStore,
|
||||
useId: updateId,
|
||||
unstable_isNewReconciler: !1
|
||||
},
|
||||
|
@ -4334,7 +4325,7 @@ var ContextOnlyDispatcher = {
|
|||
return [isPending, start];
|
||||
},
|
||||
useMutableSource: updateMutableSource,
|
||||
useSyncExternalStore: mountSyncExternalStore,
|
||||
useSyncExternalStore: updateSyncExternalStore,
|
||||
useId: updateId,
|
||||
unstable_isNewReconciler: !1
|
||||
},
|
||||
|
@ -5806,11 +5797,11 @@ function updateSuspenseFallbackChildren(
|
|||
workInProgress.child = current;
|
||||
return fallbackChildren;
|
||||
}
|
||||
function scheduleWorkOnFiber(fiber, renderLanes) {
|
||||
function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) {
|
||||
fiber.lanes |= renderLanes;
|
||||
var alternate = fiber.alternate;
|
||||
null !== alternate && (alternate.lanes |= renderLanes);
|
||||
scheduleWorkOnParentPath(fiber.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot);
|
||||
}
|
||||
function initSuspenseListRenderState(
|
||||
workInProgress,
|
||||
|
@ -5849,8 +5840,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) {
|
|||
a: for (current = workInProgress.child; null !== current; ) {
|
||||
if (13 === current.tag)
|
||||
null !== current.memoizedState &&
|
||||
scheduleWorkOnFiber(current, renderLanes);
|
||||
else if (19 === current.tag) scheduleWorkOnFiber(current, renderLanes);
|
||||
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
||||
else if (19 === current.tag)
|
||||
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
||||
else if (null !== current.child) {
|
||||
current.child.return = current;
|
||||
current = current.child;
|
||||
|
@ -6698,8 +6690,9 @@ var ceil = Math.ceil,
|
|||
workInProgressRootFatalError = null,
|
||||
workInProgressRootSkippedLanes = 0,
|
||||
workInProgressRootInterleavedUpdatedLanes = 0,
|
||||
workInProgressRootRenderPhaseUpdatedLanes = 0,
|
||||
workInProgressRootPingedLanes = 0,
|
||||
workInProgressRootConcurrentErrors = null,
|
||||
workInProgressRootRecoverableErrors = null,
|
||||
globalMostRecentFallbackTime = 0,
|
||||
workInProgressRootRenderTargetTime = Infinity,
|
||||
hasUncaughtError = !1,
|
||||
|
@ -6759,9 +6752,8 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
|
|||
var root = markUpdateLaneFromFiberToRoot(fiber, lane);
|
||||
if (null === root) return null;
|
||||
markRootUpdated(root, lane, eventTime);
|
||||
0 !== (executionContext & 2) && root === workInProgressRoot
|
||||
? (workInProgressRootRenderPhaseUpdatedLanes |= lane)
|
||||
: (isDevToolsPresent && addFiberToLanesMap(root, fiber, lane),
|
||||
if (0 === (executionContext & 2) || root !== workInProgressRoot)
|
||||
isDevToolsPresent && addFiberToLanesMap(root, fiber, lane),
|
||||
root === workInProgressRoot &&
|
||||
(0 === (executionContext & 2) &&
|
||||
(workInProgressRootInterleavedUpdatedLanes |= lane),
|
||||
|
@ -6772,7 +6764,7 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
|
|||
0 === executionContext &&
|
||||
0 === (fiber.mode & 1) &&
|
||||
((workInProgressRootRenderTargetTime = now() + 500),
|
||||
includesLegacySyncCallbacks && flushSyncCallbacks()));
|
||||
includesLegacySyncCallbacks && flushSyncCallbacks());
|
||||
return root;
|
||||
}
|
||||
function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
||||
|
@ -6957,7 +6949,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
case 1:
|
||||
throw Error("Root did not complete. This is a bug in React.");
|
||||
case 2:
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 3:
|
||||
markRootSuspended$1(root, lanes);
|
||||
|
@ -6974,12 +6966,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
break;
|
||||
}
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
didTimeout
|
||||
);
|
||||
break;
|
||||
}
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 4:
|
||||
markRootSuspended$1(root, lanes);
|
||||
|
@ -7010,15 +7002,15 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
: 1960 * ceil(lanes / 1960)) - lanes;
|
||||
if (10 < lanes) {
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
lanes
|
||||
);
|
||||
break;
|
||||
}
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 5:
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
default:
|
||||
throw Error("Unknown root exit status.");
|
||||
|
@ -7033,15 +7025,18 @@ function recoverFromConcurrentError(root, errorRetryLanes) {
|
|||
var prevExecutionContext = executionContext;
|
||||
executionContext |= 8;
|
||||
root.isDehydrated && (root.isDehydrated = !1);
|
||||
for (
|
||||
var exitStatus, i = 0;
|
||||
50 > i &&
|
||||
((exitStatus = renderRootSync(root, errorRetryLanes)),
|
||||
2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes);
|
||||
i++
|
||||
);
|
||||
var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
|
||||
root = renderRootSync(root, errorRetryLanes);
|
||||
2 !== root &&
|
||||
null !== errorsFromFirstAttempt &&
|
||||
(null === workInProgressRootConcurrentErrors
|
||||
? (workInProgressRootRecoverableErrors = errorsFromFirstAttempt)
|
||||
: (workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply(
|
||||
null,
|
||||
errorsFromFirstAttempt
|
||||
)));
|
||||
executionContext = prevExecutionContext;
|
||||
return exitStatus;
|
||||
return root;
|
||||
}
|
||||
function isRenderConsistentWithExternalStores(finishedWork) {
|
||||
for (var node = finishedWork; ; ) {
|
||||
|
@ -7112,7 +7107,7 @@ function performSyncWorkOnRoot(root) {
|
|||
exitStatus);
|
||||
root.finishedWork = root.current.alternate;
|
||||
root.finishedLanes = lanes;
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
ensureRootIsScheduled(root, now());
|
||||
return null;
|
||||
}
|
||||
|
@ -7169,7 +7164,8 @@ function prepareFreshStack(root, lanes) {
|
|||
workInProgressRootRenderLanes = subtreeRenderLanes = lanes;
|
||||
workInProgressRootExitStatus = 0;
|
||||
workInProgressRootFatalError = null;
|
||||
workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0;
|
||||
workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0;
|
||||
workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null;
|
||||
if (null !== interleavedQueues) {
|
||||
for (root = 0; root < interleavedQueues.length; root++)
|
||||
if (
|
||||
|
@ -7364,8 +7360,12 @@ function handleError(root, thrownValue) {
|
|||
" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."
|
||||
);
|
||||
}
|
||||
wakeable = value;
|
||||
4 !== workInProgressRootExitStatus &&
|
||||
(workInProgressRootExitStatus = 2);
|
||||
null === workInProgressRootConcurrentErrors
|
||||
? (workInProgressRootConcurrentErrors = [wakeable])
|
||||
: workInProgressRootConcurrentErrors.push(wakeable);
|
||||
value = createCapturedValue(value, sourceFiber);
|
||||
wakeable = returnFiber;
|
||||
do {
|
||||
|
@ -7528,20 +7528,20 @@ function completeUnitOfWork(unitOfWork) {
|
|||
} while (null !== completedWork);
|
||||
0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5);
|
||||
}
|
||||
function commitRoot(root) {
|
||||
function commitRoot(root, recoverableErrors) {
|
||||
var previousUpdateLanePriority = currentUpdatePriority,
|
||||
prevTransition = ReactCurrentBatchConfig$2.transition;
|
||||
try {
|
||||
(ReactCurrentBatchConfig$2.transition = 0),
|
||||
(currentUpdatePriority = 1),
|
||||
commitRootImpl(root, previousUpdateLanePriority);
|
||||
commitRootImpl(root, recoverableErrors, previousUpdateLanePriority);
|
||||
} finally {
|
||||
(ReactCurrentBatchConfig$2.transition = prevTransition),
|
||||
(currentUpdatePriority = previousUpdateLanePriority);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function commitRootImpl(root, renderPriorityLevel) {
|
||||
function commitRootImpl(root, recoverableErrors, renderPriorityLevel) {
|
||||
do flushPassiveEffects();
|
||||
while (null !== rootWithPendingPassiveEffects);
|
||||
if (0 !== (executionContext & 6))
|
||||
|
@ -7607,6 +7607,15 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|||
onCommitRoot(finishedWork.stateNode, renderPriorityLevel);
|
||||
isDevToolsPresent && root.memoizedUpdaters.clear();
|
||||
ensureRootIsScheduled(root, now());
|
||||
if (null !== recoverableErrors)
|
||||
for (
|
||||
renderPriorityLevel = 0;
|
||||
renderPriorityLevel < recoverableErrors.length;
|
||||
renderPriorityLevel++
|
||||
)
|
||||
(finishedWork = recoverableErrors[renderPriorityLevel]),
|
||||
(lanes = root.onRecoverableError),
|
||||
null !== lanes && lanes(finishedWork);
|
||||
if (hasUncaughtError)
|
||||
throw ((hasUncaughtError = !1),
|
||||
(root = firstUncaughtError),
|
||||
|
@ -8261,7 +8270,11 @@ beginWork$1 = function(current, workInProgress, renderLanes) {
|
|||
newValue.lanes |= renderLanes;
|
||||
dependency = newValue.alternate;
|
||||
null !== dependency && (dependency.lanes |= renderLanes);
|
||||
scheduleWorkOnParentPath(newValue.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(
|
||||
newValue.return,
|
||||
renderLanes,
|
||||
workInProgress
|
||||
);
|
||||
list.lanes |= renderLanes;
|
||||
break;
|
||||
}
|
||||
|
@ -8582,7 +8595,13 @@ function createFiberFromPortal(portal, mode, lanes) {
|
|||
};
|
||||
return mode;
|
||||
}
|
||||
function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
||||
function FiberRootNode(
|
||||
containerInfo,
|
||||
tag,
|
||||
hydrate,
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
this.tag = tag;
|
||||
this.containerInfo = containerInfo;
|
||||
this.finishedWork = this.pingCache = this.current = this.pendingChildren = null;
|
||||
|
@ -8596,6 +8615,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
|||
this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0;
|
||||
this.entanglements = createLaneMap(0);
|
||||
this.identifierPrefix = identifierPrefix;
|
||||
this.onRecoverableError = onRecoverableError;
|
||||
this.passiveEffectDuration = this.effectDuration = 0;
|
||||
this.memoizedUpdaters = new Set();
|
||||
containerInfo = this.pendingUpdatersLaneMap = [];
|
||||
|
@ -8806,10 +8826,10 @@ batchedUpdatesImpl = function(fn, a) {
|
|||
}
|
||||
};
|
||||
var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1002 = {
|
||||
devToolsConfig$jscomp$inline_1004 = {
|
||||
findFiberByHostInstance: getInstanceFromInstance,
|
||||
bundleType: 0,
|
||||
version: "18.0.0-rc.0-51947a14b-20220113",
|
||||
version: "18.0.0-rc.0-a3bde7974-20220208",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForViewTag: function() {
|
||||
|
@ -8824,11 +8844,24 @@ var roots = new Map(),
|
|||
}.bind(null, findNodeHandle)
|
||||
}
|
||||
};
|
||||
var internals$jscomp$inline_1279 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_1002.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_1002.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_1002.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_1002.rendererConfig,
|
||||
(function(internals) {
|
||||
if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1;
|
||||
var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (hook.isDisabled || !hook.supportsFiber) return !0;
|
||||
try {
|
||||
(internals = Object.assign({}, internals, {
|
||||
getLaneLabelMap: getLaneLabelMap,
|
||||
injectProfilingHooks: injectProfilingHooks
|
||||
})),
|
||||
(rendererID = hook.inject(internals)),
|
||||
(injectedHook = hook);
|
||||
} catch (err) {}
|
||||
return hook.checkDCE ? !0 : !1;
|
||||
})({
|
||||
bundleType: devToolsConfig$jscomp$inline_1004.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_1004.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_1004.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_1004.rendererConfig,
|
||||
overrideHookState: null,
|
||||
overrideHookStateDeletePath: null,
|
||||
overrideHookStateRenamePath: null,
|
||||
|
@ -8844,31 +8877,15 @@ var internals$jscomp$inline_1279 = {
|
|||
return null === fiber ? null : fiber.stateNode;
|
||||
},
|
||||
findFiberByHostInstance:
|
||||
devToolsConfig$jscomp$inline_1002.findFiberByHostInstance ||
|
||||
devToolsConfig$jscomp$inline_1004.findFiberByHostInstance ||
|
||||
emptyFindFiberByHostInstance,
|
||||
findHostInstancesForRefresh: null,
|
||||
scheduleRefresh: null,
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1280 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (
|
||||
!hook$jscomp$inline_1280.isDisabled &&
|
||||
hook$jscomp$inline_1280.supportsFiber
|
||||
)
|
||||
try {
|
||||
(rendererID = hook$jscomp$inline_1280.inject(
|
||||
Object.assign({}, internals$jscomp$inline_1279, {
|
||||
getLaneLabelMap: getLaneLabelMap,
|
||||
injectProfilingHooks: injectProfilingHooks
|
||||
})
|
||||
)),
|
||||
(injectedHook = hook$jscomp$inline_1280);
|
||||
} catch (err) {}
|
||||
}
|
||||
reconcilerVersion: "18.0.0-rc.0-a3bde7974-20220208"
|
||||
});
|
||||
exports.createPortal = function(children, containerTag) {
|
||||
return createPortal(
|
||||
children,
|
||||
|
@ -8906,7 +8923,7 @@ exports.render = function(element, containerTag, callback, concurrentRoot) {
|
|||
var root = roots.get(containerTag);
|
||||
root ||
|
||||
((root = concurrentRoot ? 1 : 0),
|
||||
(concurrentRoot = new FiberRootNode(containerTag, root, !1, "")),
|
||||
(concurrentRoot = new FiberRootNode(containerTag, root, !1, "", null)),
|
||||
(root = 1 === root ? 1 : 0),
|
||||
isDevToolsPresent && (root |= 2),
|
||||
(root = createFiber(3, null, null, root)),
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<3ab224d749aabfd2af41824a03d0c6ce>>
|
||||
* @generated SignedSource<<a3fc488ac380d16e0f8e3aefb9be8290>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
@ -4283,12 +4283,17 @@ function injectInternals(internals) {
|
|||
}
|
||||
|
||||
try {
|
||||
rendererID = hook.inject(
|
||||
Object.assign({}, internals, {
|
||||
if (enableSchedulingProfiler) {
|
||||
// Conditionally inject these hooks only if Timeline profiler is supported by this build.
|
||||
// This gives DevTools a way to feature detect that isn't tied to version number
|
||||
// (since profiling and timeline are controlled by different feature flags).
|
||||
internals = Object.assign({}, internals, {
|
||||
getLaneLabelMap: getLaneLabelMap,
|
||||
injectProfilingHooks: injectProfilingHooks
|
||||
})
|
||||
); // We have successfully injected, so now it is safe to set up hooks.
|
||||
});
|
||||
}
|
||||
|
||||
rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks.
|
||||
|
||||
injectedHook = hook;
|
||||
} catch (err) {
|
||||
|
@ -4422,16 +4427,18 @@ function injectProfilingHooks(profilingHooks) {
|
|||
}
|
||||
|
||||
function getLaneLabelMap() {
|
||||
var map = new Map();
|
||||
var lane = 1;
|
||||
{
|
||||
var map = new Map();
|
||||
var lane = 1;
|
||||
|
||||
for (var index = 0; index < TotalLanes; index++) {
|
||||
var label = getLabelForLane(lane);
|
||||
map.set(lane, label);
|
||||
lane *= 2;
|
||||
for (var index = 0; index < TotalLanes; index++) {
|
||||
var label = getLabelForLane(lane);
|
||||
map.set(lane, label);
|
||||
lane *= 2;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
function markCommitStarted(lanes) {
|
||||
|
@ -7175,7 +7182,7 @@ function popProvider(context, providerFiber) {
|
|||
context._currentValue = currentValue;
|
||||
}
|
||||
}
|
||||
function scheduleWorkOnParentPath(parent, renderLanes) {
|
||||
function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) {
|
||||
// Update the child lanes of all the ancestors, including the alternates.
|
||||
var node = parent;
|
||||
|
||||
|
@ -7193,14 +7200,23 @@ function scheduleWorkOnParentPath(parent, renderLanes) {
|
|||
!isSubsetOfLanes(alternate.childLanes, renderLanes)
|
||||
) {
|
||||
alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes);
|
||||
} else {
|
||||
// Neither alternate was updated, which means the rest of the
|
||||
// ancestor path already has sufficient priority.
|
||||
}
|
||||
|
||||
if (node === propagationRoot) {
|
||||
break;
|
||||
}
|
||||
|
||||
node = node.return;
|
||||
}
|
||||
|
||||
{
|
||||
if (node !== propagationRoot) {
|
||||
error(
|
||||
"Expected to find the propagation root when scheduling context work. " +
|
||||
"This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
function propagateContextChange(workInProgress, context, renderLanes) {
|
||||
{
|
||||
|
@ -7265,7 +7281,11 @@ function propagateContextChange_eager(workInProgress, context, renderLanes) {
|
|||
alternate.lanes = mergeLanes(alternate.lanes, renderLanes);
|
||||
}
|
||||
|
||||
scheduleWorkOnParentPath(fiber.return, renderLanes); // Mark the updated lanes on the list, too.
|
||||
scheduleContextWorkOnParentPath(
|
||||
fiber.return,
|
||||
renderLanes,
|
||||
workInProgress
|
||||
); // Mark the updated lanes on the list, too.
|
||||
|
||||
list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the
|
||||
// dependency list.
|
||||
|
@ -9140,7 +9160,7 @@ function popTreeContext(workInProgress) {
|
|||
}
|
||||
}
|
||||
|
||||
var isHydrating = false;
|
||||
var isHydrating = false; // Hydration errors that were thrown inside this boundary
|
||||
|
||||
function enterHydrationState(fiber) {
|
||||
{
|
||||
|
@ -14081,7 +14101,7 @@ function throwException(
|
|||
// over and traverse parent path again, this time treating the exception
|
||||
// as an error.
|
||||
|
||||
renderDidError();
|
||||
renderDidError(value);
|
||||
value = createCapturedValue(value, sourceFiber);
|
||||
var workInProgress = returnFiber;
|
||||
|
||||
|
@ -16944,7 +16964,7 @@ function updateSuspenseFallbackChildren(
|
|||
return fallbackChildFragment;
|
||||
}
|
||||
|
||||
function scheduleWorkOnFiber(fiber, renderLanes) {
|
||||
function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) {
|
||||
fiber.lanes = mergeLanes(fiber.lanes, renderLanes);
|
||||
var alternate = fiber.alternate;
|
||||
|
||||
|
@ -16952,7 +16972,7 @@ function scheduleWorkOnFiber(fiber, renderLanes) {
|
|||
alternate.lanes = mergeLanes(alternate.lanes, renderLanes);
|
||||
}
|
||||
|
||||
scheduleWorkOnParentPath(fiber.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot);
|
||||
}
|
||||
|
||||
function propagateSuspenseContextChange(
|
||||
|
@ -16970,7 +16990,7 @@ function propagateSuspenseContextChange(
|
|||
var state = node.memoizedState;
|
||||
|
||||
if (state !== null) {
|
||||
scheduleWorkOnFiber(node, renderLanes);
|
||||
scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress);
|
||||
}
|
||||
} else if (node.tag === SuspenseListComponent) {
|
||||
// If the tail is hidden there might not be an Suspense boundaries
|
||||
|
@ -16978,7 +16998,7 @@ function propagateSuspenseContextChange(
|
|||
// list itself.
|
||||
// We don't have to traverse to the children of the list since
|
||||
// the list will propagate the change when it rerenders.
|
||||
scheduleWorkOnFiber(node, renderLanes);
|
||||
scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress);
|
||||
} else if (node.child !== null) {
|
||||
node.child.return = node;
|
||||
node = node.child;
|
||||
|
@ -18270,6 +18290,16 @@ function safelyDetachRef(current, nearestMountedAncestor) {
|
|||
reportUncaughtErrorInDEV(error);
|
||||
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
||||
}
|
||||
|
||||
{
|
||||
if (typeof retVal === "function") {
|
||||
error(
|
||||
"Unexpected return value from a callback ref in %s. " +
|
||||
"A callback ref should not return a function.",
|
||||
getComponentNameFromFiber(current)
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ref.current = null;
|
||||
}
|
||||
|
@ -19051,6 +19081,16 @@ function commitAttachRef(finishedWork) {
|
|||
} else {
|
||||
retVal = ref(instanceToUse);
|
||||
}
|
||||
|
||||
{
|
||||
if (typeof retVal === "function") {
|
||||
error(
|
||||
"Unexpected return value from a callback ref in %s. " +
|
||||
"A callback ref should not return a function.",
|
||||
getComponentNameFromFiber(finishedWork)
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
{
|
||||
if (!ref.hasOwnProperty("current")) {
|
||||
|
@ -20486,9 +20526,12 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an
|
|||
|
||||
var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event).
|
||||
|
||||
var workInProgressRootRenderPhaseUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render.
|
||||
var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase.
|
||||
|
||||
var workInProgressRootPingedLanes = NoLanes; // The most recent time we committed a fallback. This lets us ensure a train
|
||||
var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI.
|
||||
// We will log them once the tree commits.
|
||||
|
||||
var workInProgressRootRecoverableErrors = null; // The most recent time we committed a fallback. This lets us ensure a train
|
||||
// model where we don't commit new loading states in too quick succession.
|
||||
|
||||
var globalMostRecentFallbackTime = 0;
|
||||
|
@ -20636,11 +20679,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
|
|||
// function), but there are some internal React features that use this as
|
||||
// an implementation detail, like selective hydration.
|
||||
warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase
|
||||
|
||||
workInProgressRootRenderPhaseUpdatedLanes = mergeLanes(
|
||||
workInProgressRootRenderPhaseUpdatedLanes,
|
||||
lane
|
||||
);
|
||||
} else {
|
||||
// This is a normal update, scheduled from outside the render phase. For
|
||||
// example, during an input event.
|
||||
|
@ -21017,30 +21055,34 @@ function recoverFromConcurrentError(root, errorRetryLanes) {
|
|||
}
|
||||
}
|
||||
|
||||
var exitStatus;
|
||||
var MAX_ERROR_RETRY_ATTEMPTS = 50;
|
||||
var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
|
||||
var exitStatus = renderRootSync(root, errorRetryLanes);
|
||||
|
||||
for (var i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) {
|
||||
exitStatus = renderRootSync(root, errorRetryLanes);
|
||||
|
||||
if (
|
||||
exitStatus === RootErrored &&
|
||||
workInProgressRootRenderPhaseUpdatedLanes !== NoLanes
|
||||
) {
|
||||
// There was a render phase update during this render. Some internal React
|
||||
// implementation details may use this as a trick to schedule another
|
||||
// render pass. To protect against an inifinite loop, eventually
|
||||
// we'll give up.
|
||||
continue;
|
||||
if (exitStatus !== RootErrored) {
|
||||
// Successfully finished rendering on retry
|
||||
if (errorsFromFirstAttempt !== null) {
|
||||
// The errors from the failed first attempt have been recovered. Add
|
||||
// them to the collection of recoverable errors. We'll log them in the
|
||||
// commit phase.
|
||||
queueRecoverableErrors(errorsFromFirstAttempt);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
executionContext = prevExecutionContext;
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
function queueRecoverableErrors(errors) {
|
||||
if (workInProgressRootConcurrentErrors === null) {
|
||||
workInProgressRootRecoverableErrors = errors;
|
||||
} else {
|
||||
workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply(
|
||||
null,
|
||||
errors
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function finishConcurrentRender(root, exitStatus, lanes) {
|
||||
switch (exitStatus) {
|
||||
case RootIncomplete:
|
||||
|
@ -21054,7 +21096,7 @@ function finishConcurrentRender(root, exitStatus, lanes) {
|
|||
case RootErrored: {
|
||||
// We should have already attempted to retry this tree. If we reached
|
||||
// this point, it errored again. Commit it.
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -21094,14 +21136,14 @@ function finishConcurrentRender(root, exitStatus, lanes) {
|
|||
// immediately, wait for more data to arrive.
|
||||
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
msUntilTimeout
|
||||
);
|
||||
break;
|
||||
}
|
||||
} // The work expired. Commit immediately.
|
||||
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -21132,20 +21174,20 @@ function finishConcurrentRender(root, exitStatus, lanes) {
|
|||
// Instead of committing the fallback immediately, wait for more data
|
||||
// to arrive.
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
_msUntilTimeout
|
||||
);
|
||||
break;
|
||||
}
|
||||
} // Commit the placeholder.
|
||||
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
}
|
||||
|
||||
case RootCompleted: {
|
||||
// The work completed. Ready to commit.
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -21276,7 +21318,7 @@ function performSyncWorkOnRoot(root) {
|
|||
var finishedWork = root.current.alternate;
|
||||
root.finishedWork = finishedWork;
|
||||
root.finishedLanes = lanes;
|
||||
commitRoot(root); // Before exiting, make sure there's a callback scheduled for the next
|
||||
commitRoot(root, workInProgressRootRecoverableErrors); // Before exiting, make sure there's a callback scheduled for the next
|
||||
// pending level.
|
||||
|
||||
ensureRootIsScheduled(root, now());
|
||||
|
@ -21383,8 +21425,9 @@ function prepareFreshStack(root, lanes) {
|
|||
workInProgressRootFatalError = null;
|
||||
workInProgressRootSkippedLanes = NoLanes;
|
||||
workInProgressRootInterleavedUpdatedLanes = NoLanes;
|
||||
workInProgressRootRenderPhaseUpdatedLanes = NoLanes;
|
||||
workInProgressRootPingedLanes = NoLanes;
|
||||
workInProgressRootConcurrentErrors = null;
|
||||
workInProgressRootRecoverableErrors = null;
|
||||
enqueueInterleavedUpdates();
|
||||
|
||||
{
|
||||
|
@ -21537,10 +21580,16 @@ function renderDidSuspendDelayIfPossible() {
|
|||
markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes);
|
||||
}
|
||||
}
|
||||
function renderDidError() {
|
||||
function renderDidError(error) {
|
||||
if (workInProgressRootExitStatus !== RootSuspendedWithDelay) {
|
||||
workInProgressRootExitStatus = RootErrored;
|
||||
}
|
||||
|
||||
if (workInProgressRootConcurrentErrors === null) {
|
||||
workInProgressRootConcurrentErrors = [error];
|
||||
} else {
|
||||
workInProgressRootConcurrentErrors.push(error);
|
||||
}
|
||||
} // Called during render to determine if anything has suspended.
|
||||
// Returns false if we're not sure.
|
||||
|
||||
|
@ -21809,7 +21858,7 @@ function completeUnitOfWork(unitOfWork) {
|
|||
}
|
||||
}
|
||||
|
||||
function commitRoot(root) {
|
||||
function commitRoot(root, recoverableErrors) {
|
||||
// TODO: This no longer makes any sense. We already wrap the mutation and
|
||||
// layout phases. Should be able to remove.
|
||||
var previousUpdateLanePriority = getCurrentUpdatePriority();
|
||||
|
@ -21818,7 +21867,7 @@ function commitRoot(root) {
|
|||
try {
|
||||
ReactCurrentBatchConfig$2.transition = 0;
|
||||
setCurrentUpdatePriority(DiscreteEventPriority);
|
||||
commitRootImpl(root, previousUpdateLanePriority);
|
||||
commitRootImpl(root, recoverableErrors, previousUpdateLanePriority);
|
||||
} finally {
|
||||
ReactCurrentBatchConfig$2.transition = prevTransition;
|
||||
setCurrentUpdatePriority(previousUpdateLanePriority);
|
||||
|
@ -21827,7 +21876,7 @@ function commitRoot(root) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function commitRootImpl(root, renderPriorityLevel) {
|
||||
function commitRootImpl(root, recoverableErrors, renderPriorityLevel) {
|
||||
do {
|
||||
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
|
||||
// means `flushPassiveEffects` will sometimes result in additional
|
||||
|
@ -22032,6 +22081,19 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|||
|
||||
ensureRootIsScheduled(root, now());
|
||||
|
||||
if (recoverableErrors !== null) {
|
||||
// There were errors during this render, but recovered from them without
|
||||
// needing to surface it to the UI. We log them here.
|
||||
for (var i = 0; i < recoverableErrors.length; i++) {
|
||||
var recoverableError = recoverableErrors[i];
|
||||
var onRecoverableError = root.onRecoverableError;
|
||||
|
||||
if (onRecoverableError !== null) {
|
||||
onRecoverableError(recoverableError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasUncaughtError) {
|
||||
hasUncaughtError = false;
|
||||
var error$1 = firstUncaughtError;
|
||||
|
@ -23855,7 +23917,13 @@ function assignFiberPropertiesInDEV(target, source) {
|
|||
return target;
|
||||
}
|
||||
|
||||
function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
||||
function FiberRootNode(
|
||||
containerInfo,
|
||||
tag,
|
||||
hydrate,
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
this.tag = tag;
|
||||
this.containerInfo = containerInfo;
|
||||
this.pendingChildren = null;
|
||||
|
@ -23879,6 +23947,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
|||
this.entangledLanes = NoLanes;
|
||||
this.entanglements = createLaneMap(NoLanes);
|
||||
this.identifierPrefix = identifierPrefix;
|
||||
this.onRecoverableError = onRecoverableError;
|
||||
|
||||
{
|
||||
this.effectDuration = 0;
|
||||
|
@ -23913,10 +23982,20 @@ function createFiberRoot(
|
|||
hydrate,
|
||||
hydrationCallbacks,
|
||||
isStrictMode,
|
||||
concurrentUpdatesByDefaultOverride,
|
||||
identifierPrefix
|
||||
concurrentUpdatesByDefaultOverride, // TODO: We have several of these arguments that are conceptually part of the
|
||||
// host config, but because they are passed in at runtime, we have to thread
|
||||
// them through the root constructor. Perhaps we should put them all into a
|
||||
// single type, like a DynamicHostConfig that is defined by the renderer.
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix);
|
||||
var root = new FiberRootNode(
|
||||
containerInfo,
|
||||
tag,
|
||||
hydrate,
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
);
|
||||
// stateNode is any.
|
||||
|
||||
var uninitializedFiber = createHostRootFiber(
|
||||
|
@ -23938,7 +24017,7 @@ function createFiberRoot(
|
|||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.0.0-rc.0-51947a14b-20220113";
|
||||
var ReactVersion = "18.0.0-rc.0-a3bde7974-20220208";
|
||||
|
||||
function createPortal(
|
||||
children,
|
||||
|
@ -24066,7 +24145,8 @@ function createContainer(
|
|||
hydrationCallbacks,
|
||||
isStrictMode,
|
||||
concurrentUpdatesByDefaultOverride,
|
||||
identifierPrefix
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
return createFiberRoot(
|
||||
containerInfo,
|
||||
|
@ -24075,7 +24155,8 @@ function createContainer(
|
|||
hydrationCallbacks,
|
||||
isStrictMode,
|
||||
concurrentUpdatesByDefaultOverride,
|
||||
identifierPrefix
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
);
|
||||
}
|
||||
function updateContainer(element, container, parentComponent, callback) {
|
||||
|
@ -24861,7 +24942,8 @@ function render(element, containerTag, callback) {
|
|||
null,
|
||||
false,
|
||||
null,
|
||||
""
|
||||
"",
|
||||
null
|
||||
);
|
||||
roots.set(containerTag, root);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<d0187f2344bce0afc1b8e7f4e743a98b>>
|
||||
* @generated SignedSource<<74ace7caaea78f5e62bae1f9669d8351>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
@ -926,7 +926,7 @@ eventPluginOrder = Array.prototype.slice.call([
|
|||
"ReactNativeBridgeEventPlugin"
|
||||
]);
|
||||
recomputePluginOrdering();
|
||||
var injectedNamesToPlugins$jscomp$inline_223 = {
|
||||
var injectedNamesToPlugins$jscomp$inline_222 = {
|
||||
ResponderEventPlugin: ResponderEventPlugin,
|
||||
ReactNativeBridgeEventPlugin: {
|
||||
eventTypes: {},
|
||||
|
@ -961,33 +961,33 @@ var injectedNamesToPlugins$jscomp$inline_223 = {
|
|||
}
|
||||
}
|
||||
},
|
||||
isOrderingDirty$jscomp$inline_224 = !1,
|
||||
pluginName$jscomp$inline_225;
|
||||
for (pluginName$jscomp$inline_225 in injectedNamesToPlugins$jscomp$inline_223)
|
||||
isOrderingDirty$jscomp$inline_223 = !1,
|
||||
pluginName$jscomp$inline_224;
|
||||
for (pluginName$jscomp$inline_224 in injectedNamesToPlugins$jscomp$inline_222)
|
||||
if (
|
||||
injectedNamesToPlugins$jscomp$inline_223.hasOwnProperty(
|
||||
pluginName$jscomp$inline_225
|
||||
injectedNamesToPlugins$jscomp$inline_222.hasOwnProperty(
|
||||
pluginName$jscomp$inline_224
|
||||
)
|
||||
) {
|
||||
var pluginModule$jscomp$inline_226 =
|
||||
injectedNamesToPlugins$jscomp$inline_223[pluginName$jscomp$inline_225];
|
||||
var pluginModule$jscomp$inline_225 =
|
||||
injectedNamesToPlugins$jscomp$inline_222[pluginName$jscomp$inline_224];
|
||||
if (
|
||||
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_225) ||
|
||||
namesToPlugins[pluginName$jscomp$inline_225] !==
|
||||
pluginModule$jscomp$inline_226
|
||||
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_224) ||
|
||||
namesToPlugins[pluginName$jscomp$inline_224] !==
|
||||
pluginModule$jscomp$inline_225
|
||||
) {
|
||||
if (namesToPlugins[pluginName$jscomp$inline_225])
|
||||
if (namesToPlugins[pluginName$jscomp$inline_224])
|
||||
throw Error(
|
||||
"EventPluginRegistry: Cannot inject two different event plugins using the same name, `" +
|
||||
(pluginName$jscomp$inline_225 + "`.")
|
||||
(pluginName$jscomp$inline_224 + "`.")
|
||||
);
|
||||
namesToPlugins[
|
||||
pluginName$jscomp$inline_225
|
||||
] = pluginModule$jscomp$inline_226;
|
||||
isOrderingDirty$jscomp$inline_224 = !0;
|
||||
pluginName$jscomp$inline_224
|
||||
] = pluginModule$jscomp$inline_225;
|
||||
isOrderingDirty$jscomp$inline_223 = !0;
|
||||
}
|
||||
}
|
||||
isOrderingDirty$jscomp$inline_224 && recomputePluginOrdering();
|
||||
isOrderingDirty$jscomp$inline_223 && recomputePluginOrdering();
|
||||
var instanceCache = new Map(),
|
||||
instanceProps = new Map();
|
||||
function getInstanceFromTag(tag) {
|
||||
|
@ -1697,12 +1697,6 @@ function onCommitRoot(root) {
|
|||
);
|
||||
} catch (err) {}
|
||||
}
|
||||
function injectProfilingHooks() {}
|
||||
function getLaneLabelMap() {
|
||||
for (var map = new Map(), lane = 1, index$4 = 0; 31 > index$4; index$4++)
|
||||
map.set(lane, void 0), (lane *= 2);
|
||||
return map;
|
||||
}
|
||||
var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback,
|
||||
log = Math.log,
|
||||
LN2 = Math.LN2;
|
||||
|
@ -1875,21 +1869,21 @@ function markRootFinished(root, remainingLanes) {
|
|||
remainingLanes = root.entanglements;
|
||||
var eventTimes = root.eventTimes;
|
||||
for (root = root.expirationTimes; 0 < noLongerPendingLanes; ) {
|
||||
var index$9 = 31 - clz32(noLongerPendingLanes),
|
||||
lane = 1 << index$9;
|
||||
remainingLanes[index$9] = 0;
|
||||
eventTimes[index$9] = -1;
|
||||
root[index$9] = -1;
|
||||
var index$8 = 31 - clz32(noLongerPendingLanes),
|
||||
lane = 1 << index$8;
|
||||
remainingLanes[index$8] = 0;
|
||||
eventTimes[index$8] = -1;
|
||||
root[index$8] = -1;
|
||||
noLongerPendingLanes &= ~lane;
|
||||
}
|
||||
}
|
||||
function markRootEntangled(root, entangledLanes) {
|
||||
var rootEntangledLanes = (root.entangledLanes |= entangledLanes);
|
||||
for (root = root.entanglements; rootEntangledLanes; ) {
|
||||
var index$10 = 31 - clz32(rootEntangledLanes),
|
||||
lane = 1 << index$10;
|
||||
(lane & entangledLanes) | (root[index$10] & entangledLanes) &&
|
||||
(root[index$10] |= entangledLanes);
|
||||
var index$9 = 31 - clz32(rootEntangledLanes),
|
||||
lane = 1 << index$9;
|
||||
(lane & entangledLanes) | (root[index$9] & entangledLanes) &&
|
||||
(root[index$9] |= entangledLanes);
|
||||
rootEntangledLanes &= ~lane;
|
||||
}
|
||||
}
|
||||
|
@ -2161,19 +2155,16 @@ function popProvider(context) {
|
|||
pop(valueCursor);
|
||||
context._currentValue = currentValue;
|
||||
}
|
||||
function scheduleWorkOnParentPath(parent, renderLanes) {
|
||||
function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) {
|
||||
for (; null !== parent; ) {
|
||||
var alternate = parent.alternate;
|
||||
if ((parent.childLanes & renderLanes) === renderLanes)
|
||||
if (
|
||||
null === alternate ||
|
||||
(alternate.childLanes & renderLanes) === renderLanes
|
||||
)
|
||||
break;
|
||||
else alternate.childLanes |= renderLanes;
|
||||
else
|
||||
(parent.childLanes |= renderLanes),
|
||||
null !== alternate && (alternate.childLanes |= renderLanes);
|
||||
(parent.childLanes & renderLanes) !== renderLanes
|
||||
? ((parent.childLanes |= renderLanes),
|
||||
null !== alternate && (alternate.childLanes |= renderLanes))
|
||||
: null !== alternate &&
|
||||
(alternate.childLanes & renderLanes) !== renderLanes &&
|
||||
(alternate.childLanes |= renderLanes);
|
||||
if (parent === propagationRoot) break;
|
||||
parent = parent.return;
|
||||
}
|
||||
}
|
||||
|
@ -3642,28 +3633,37 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
|||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function mountSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = mountWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var root = workInProgressRoot;
|
||||
if (null === root)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
if (
|
||||
hook.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged ||
|
||||
(null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1)
|
||||
) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
includesBlockingLane(root, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
hook.memoizedState = nextSnapshot;
|
||||
root = { value: nextSnapshot, getSnapshot: getSnapshot };
|
||||
hook.queue = root;
|
||||
mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [subscribe]);
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(subscribe, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
|
@ -4051,7 +4051,32 @@ var ContextOnlyDispatcher = {
|
|||
};
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
},
|
||||
useSyncExternalStore: mountSyncExternalStore,
|
||||
useSyncExternalStore: function(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = mountWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var root = workInProgressRoot;
|
||||
if (null === root)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(root, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
hook.memoizedState = nextSnapshot;
|
||||
root = { value: nextSnapshot, getSnapshot: getSnapshot };
|
||||
hook.queue = root;
|
||||
mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
return nextSnapshot;
|
||||
},
|
||||
useId: function() {
|
||||
var hook = mountWorkInProgressHook(),
|
||||
identifierPrefix = workInProgressRoot.identifierPrefix,
|
||||
|
@ -4100,46 +4125,7 @@ var ContextOnlyDispatcher = {
|
|||
return [isPending, start];
|
||||
},
|
||||
useMutableSource: updateMutableSource,
|
||||
useSyncExternalStore: function(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
if (
|
||||
hook.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged ||
|
||||
(null !== workInProgressHook &&
|
||||
workInProgressHook.memoizedState.tag & 1)
|
||||
) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
nextSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(subscribe, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
},
|
||||
useSyncExternalStore: updateSyncExternalStore,
|
||||
useId: updateId,
|
||||
unstable_isNewReconciler: !1
|
||||
},
|
||||
|
@ -4182,7 +4168,7 @@ var ContextOnlyDispatcher = {
|
|||
return [isPending, start];
|
||||
},
|
||||
useMutableSource: updateMutableSource,
|
||||
useSyncExternalStore: mountSyncExternalStore,
|
||||
useSyncExternalStore: updateSyncExternalStore,
|
||||
useId: updateId,
|
||||
unstable_isNewReconciler: !1
|
||||
};
|
||||
|
@ -4298,14 +4284,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
|||
break;
|
||||
case "collapsed":
|
||||
lastTailNode = renderState.tail;
|
||||
for (var lastTailNode$36 = null; null !== lastTailNode; )
|
||||
null !== lastTailNode.alternate && (lastTailNode$36 = lastTailNode),
|
||||
for (var lastTailNode$35 = null; null !== lastTailNode; )
|
||||
null !== lastTailNode.alternate && (lastTailNode$35 = lastTailNode),
|
||||
(lastTailNode = lastTailNode.sibling);
|
||||
null === lastTailNode$36
|
||||
null === lastTailNode$35
|
||||
? hasRenderedATailFallback || null === renderState.tail
|
||||
? (renderState.tail = null)
|
||||
: (renderState.tail.sibling = null)
|
||||
: (lastTailNode$36.sibling = null);
|
||||
: (lastTailNode$35.sibling = null);
|
||||
}
|
||||
}
|
||||
function bubbleProperties(completedWork) {
|
||||
|
@ -4315,19 +4301,19 @@ function bubbleProperties(completedWork) {
|
|||
newChildLanes = 0,
|
||||
subtreeFlags = 0;
|
||||
if (didBailout)
|
||||
for (var child$37 = completedWork.child; null !== child$37; )
|
||||
(newChildLanes |= child$37.lanes | child$37.childLanes),
|
||||
(subtreeFlags |= child$37.subtreeFlags & 14680064),
|
||||
(subtreeFlags |= child$37.flags & 14680064),
|
||||
(child$37.return = completedWork),
|
||||
(child$37 = child$37.sibling);
|
||||
for (var child$36 = completedWork.child; null !== child$36; )
|
||||
(newChildLanes |= child$36.lanes | child$36.childLanes),
|
||||
(subtreeFlags |= child$36.subtreeFlags & 14680064),
|
||||
(subtreeFlags |= child$36.flags & 14680064),
|
||||
(child$36.return = completedWork),
|
||||
(child$36 = child$36.sibling);
|
||||
else
|
||||
for (child$37 = completedWork.child; null !== child$37; )
|
||||
(newChildLanes |= child$37.lanes | child$37.childLanes),
|
||||
(subtreeFlags |= child$37.subtreeFlags),
|
||||
(subtreeFlags |= child$37.flags),
|
||||
(child$37.return = completedWork),
|
||||
(child$37 = child$37.sibling);
|
||||
for (child$36 = completedWork.child; null !== child$36; )
|
||||
(newChildLanes |= child$36.lanes | child$36.childLanes),
|
||||
(subtreeFlags |= child$36.subtreeFlags),
|
||||
(subtreeFlags |= child$36.flags),
|
||||
(child$36.return = completedWork),
|
||||
(child$36 = child$36.sibling);
|
||||
completedWork.subtreeFlags |= subtreeFlags;
|
||||
completedWork.childLanes = newChildLanes;
|
||||
return didBailout;
|
||||
|
@ -5321,11 +5307,11 @@ function updateSuspenseFallbackChildren(
|
|||
workInProgress.child = primaryChildren;
|
||||
return fallbackChildren;
|
||||
}
|
||||
function scheduleWorkOnFiber(fiber, renderLanes) {
|
||||
function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) {
|
||||
fiber.lanes |= renderLanes;
|
||||
var alternate = fiber.alternate;
|
||||
null !== alternate && (alternate.lanes |= renderLanes);
|
||||
scheduleWorkOnParentPath(fiber.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot);
|
||||
}
|
||||
function initSuspenseListRenderState(
|
||||
workInProgress,
|
||||
|
@ -5364,8 +5350,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) {
|
|||
a: for (current = workInProgress.child; null !== current; ) {
|
||||
if (13 === current.tag)
|
||||
null !== current.memoizedState &&
|
||||
scheduleWorkOnFiber(current, renderLanes);
|
||||
else if (19 === current.tag) scheduleWorkOnFiber(current, renderLanes);
|
||||
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
||||
else if (19 === current.tag)
|
||||
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
||||
else if (null !== current.child) {
|
||||
current.child.return = current;
|
||||
current = current.child;
|
||||
|
@ -5679,8 +5666,8 @@ function commitHookEffectListMount(flags, finishedWork) {
|
|||
var effect = (finishedWork = finishedWork.next);
|
||||
do {
|
||||
if ((effect.tag & flags) === flags) {
|
||||
var create$81 = effect.create;
|
||||
effect.destroy = create$81();
|
||||
var create$80 = effect.create;
|
||||
effect.destroy = create$80();
|
||||
}
|
||||
effect = effect.next;
|
||||
} while (effect !== finishedWork);
|
||||
|
@ -6130,8 +6117,8 @@ function commitMutationEffects(root, firstChild) {
|
|||
switch (firstChild.tag) {
|
||||
case 13:
|
||||
if (null !== firstChild.memoizedState) {
|
||||
var current$86 = firstChild.alternate;
|
||||
if (null === current$86 || null === current$86.memoizedState)
|
||||
var current$85 = firstChild.alternate;
|
||||
if (null === current$85 || null === current$85.memoizedState)
|
||||
globalMostRecentFallbackTime = now();
|
||||
}
|
||||
break;
|
||||
|
@ -6282,8 +6269,8 @@ function commitLayoutEffects(finishedWork) {
|
|||
commitUpdateQueue(firstChild, updateQueue, instance);
|
||||
break;
|
||||
case 3:
|
||||
var updateQueue$82 = firstChild.updateQueue;
|
||||
if (null !== updateQueue$82) {
|
||||
var updateQueue$81 = firstChild.updateQueue;
|
||||
if (null !== updateQueue$81) {
|
||||
current = null;
|
||||
if (null !== firstChild.child)
|
||||
switch (firstChild.child.tag) {
|
||||
|
@ -6293,7 +6280,7 @@ function commitLayoutEffects(finishedWork) {
|
|||
case 1:
|
||||
current = firstChild.child.stateNode;
|
||||
}
|
||||
commitUpdateQueue(firstChild, updateQueue$82, current);
|
||||
commitUpdateQueue(firstChild, updateQueue$81, current);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
@ -6366,8 +6353,9 @@ var ceil = Math.ceil,
|
|||
workInProgressRootFatalError = null,
|
||||
workInProgressRootSkippedLanes = 0,
|
||||
workInProgressRootInterleavedUpdatedLanes = 0,
|
||||
workInProgressRootRenderPhaseUpdatedLanes = 0,
|
||||
workInProgressRootPingedLanes = 0,
|
||||
workInProgressRootConcurrentErrors = null,
|
||||
workInProgressRootRecoverableErrors = null,
|
||||
globalMostRecentFallbackTime = 0,
|
||||
workInProgressRootRenderTargetTime = Infinity,
|
||||
hasUncaughtError = !1,
|
||||
|
@ -6413,19 +6401,18 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
|
|||
var root = markUpdateLaneFromFiberToRoot(fiber, lane);
|
||||
if (null === root) return null;
|
||||
markRootUpdated(root, lane, eventTime);
|
||||
0 !== (executionContext & 2) && root === workInProgressRoot
|
||||
? (workInProgressRootRenderPhaseUpdatedLanes |= lane)
|
||||
: (root === workInProgressRoot &&
|
||||
(0 === (executionContext & 2) &&
|
||||
(workInProgressRootInterleavedUpdatedLanes |= lane),
|
||||
4 === workInProgressRootExitStatus &&
|
||||
markRootSuspended$1(root, workInProgressRootRenderLanes)),
|
||||
if (0 === (executionContext & 2) || root !== workInProgressRoot)
|
||||
root === workInProgressRoot &&
|
||||
(0 === (executionContext & 2) &&
|
||||
(workInProgressRootInterleavedUpdatedLanes |= lane),
|
||||
4 === workInProgressRootExitStatus &&
|
||||
markRootSuspended$1(root, workInProgressRootRenderLanes)),
|
||||
ensureRootIsScheduled(root, eventTime),
|
||||
1 === lane &&
|
||||
0 === executionContext &&
|
||||
0 === (fiber.mode & 1) &&
|
||||
((workInProgressRootRenderTargetTime = now() + 500),
|
||||
includesLegacySyncCallbacks && flushSyncCallbacks()));
|
||||
includesLegacySyncCallbacks && flushSyncCallbacks());
|
||||
return root;
|
||||
}
|
||||
function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
||||
|
@ -6451,12 +6438,12 @@ function ensureRootIsScheduled(root, currentTime) {
|
|||
0 < lanes;
|
||||
|
||||
) {
|
||||
var index$7 = 31 - clz32(lanes),
|
||||
lane = 1 << index$7,
|
||||
expirationTime = expirationTimes[index$7];
|
||||
var index$6 = 31 - clz32(lanes),
|
||||
lane = 1 << index$6,
|
||||
expirationTime = expirationTimes[index$6];
|
||||
if (-1 === expirationTime) {
|
||||
if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes))
|
||||
expirationTimes[index$7] = computeExpirationTime(lane, currentTime);
|
||||
expirationTimes[index$6] = computeExpirationTime(lane, currentTime);
|
||||
} else expirationTime <= currentTime && (root.expiredLanes |= lane);
|
||||
lanes &= ~lane;
|
||||
}
|
||||
|
@ -6596,7 +6583,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
case 1:
|
||||
throw Error("Root did not complete. This is a bug in React.");
|
||||
case 2:
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 3:
|
||||
markRootSuspended$1(root, lanes);
|
||||
|
@ -6613,22 +6600,22 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
break;
|
||||
}
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
didTimeout
|
||||
);
|
||||
break;
|
||||
}
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 4:
|
||||
markRootSuspended$1(root, lanes);
|
||||
if ((lanes & 4194240) === lanes) break;
|
||||
didTimeout = root.eventTimes;
|
||||
for (prevExecutionContext = -1; 0 < lanes; ) {
|
||||
var index$6 = 31 - clz32(lanes);
|
||||
prevDispatcher = 1 << index$6;
|
||||
index$6 = didTimeout[index$6];
|
||||
index$6 > prevExecutionContext && (prevExecutionContext = index$6);
|
||||
var index$5 = 31 - clz32(lanes);
|
||||
prevDispatcher = 1 << index$5;
|
||||
index$5 = didTimeout[index$5];
|
||||
index$5 > prevExecutionContext && (prevExecutionContext = index$5);
|
||||
lanes &= ~prevDispatcher;
|
||||
}
|
||||
lanes = prevExecutionContext;
|
||||
|
@ -6649,15 +6636,15 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
: 1960 * ceil(lanes / 1960)) - lanes;
|
||||
if (10 < lanes) {
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
lanes
|
||||
);
|
||||
break;
|
||||
}
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 5:
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
default:
|
||||
throw Error("Unknown root exit status.");
|
||||
|
@ -6672,15 +6659,18 @@ function recoverFromConcurrentError(root, errorRetryLanes) {
|
|||
var prevExecutionContext = executionContext;
|
||||
executionContext |= 8;
|
||||
root.isDehydrated && (root.isDehydrated = !1);
|
||||
for (
|
||||
var exitStatus, i = 0;
|
||||
50 > i &&
|
||||
((exitStatus = renderRootSync(root, errorRetryLanes)),
|
||||
2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes);
|
||||
i++
|
||||
);
|
||||
var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
|
||||
root = renderRootSync(root, errorRetryLanes);
|
||||
2 !== root &&
|
||||
null !== errorsFromFirstAttempt &&
|
||||
(null === workInProgressRootConcurrentErrors
|
||||
? (workInProgressRootRecoverableErrors = errorsFromFirstAttempt)
|
||||
: (workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply(
|
||||
null,
|
||||
errorsFromFirstAttempt
|
||||
)));
|
||||
executionContext = prevExecutionContext;
|
||||
return exitStatus;
|
||||
return root;
|
||||
}
|
||||
function isRenderConsistentWithExternalStores(finishedWork) {
|
||||
for (var node = finishedWork; ; ) {
|
||||
|
@ -6722,9 +6712,9 @@ function markRootSuspended$1(root, suspendedLanes) {
|
|||
root.suspendedLanes |= suspendedLanes;
|
||||
root.pingedLanes &= ~suspendedLanes;
|
||||
for (root = root.expirationTimes; 0 < suspendedLanes; ) {
|
||||
var index$8 = 31 - clz32(suspendedLanes),
|
||||
lane = 1 << index$8;
|
||||
root[index$8] = -1;
|
||||
var index$7 = 31 - clz32(suspendedLanes),
|
||||
lane = 1 << index$7;
|
||||
root[index$7] = -1;
|
||||
suspendedLanes &= ~lane;
|
||||
}
|
||||
}
|
||||
|
@ -6749,7 +6739,7 @@ function performSyncWorkOnRoot(root) {
|
|||
exitStatus);
|
||||
root.finishedWork = root.current.alternate;
|
||||
root.finishedLanes = lanes;
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
ensureRootIsScheduled(root, now());
|
||||
return null;
|
||||
}
|
||||
|
@ -6806,7 +6796,8 @@ function prepareFreshStack(root, lanes) {
|
|||
workInProgressRootRenderLanes = subtreeRenderLanes = lanes;
|
||||
workInProgressRootExitStatus = 0;
|
||||
workInProgressRootFatalError = null;
|
||||
workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0;
|
||||
workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0;
|
||||
workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null;
|
||||
if (null !== interleavedQueues) {
|
||||
for (root = 0; root < interleavedQueues.length; root++)
|
||||
if (
|
||||
|
@ -6960,8 +6951,12 @@ function handleError(root$jscomp$0, thrownValue) {
|
|||
" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."
|
||||
);
|
||||
}
|
||||
root = value;
|
||||
4 !== workInProgressRootExitStatus &&
|
||||
(workInProgressRootExitStatus = 2);
|
||||
null === workInProgressRootConcurrentErrors
|
||||
? (workInProgressRootConcurrentErrors = [root])
|
||||
: workInProgressRootConcurrentErrors.push(root);
|
||||
value = createCapturedValue(value, sourceFiber);
|
||||
root = returnFiber;
|
||||
do {
|
||||
|
@ -6993,12 +6988,12 @@ function handleError(root$jscomp$0, thrownValue) {
|
|||
root.flags |= 65536;
|
||||
thrownValue &= -thrownValue;
|
||||
root.lanes |= thrownValue;
|
||||
var update$34 = createClassErrorUpdate(
|
||||
var update$33 = createClassErrorUpdate(
|
||||
root,
|
||||
wakeable,
|
||||
thrownValue
|
||||
);
|
||||
enqueueCapturedUpdate(root, update$34);
|
||||
enqueueCapturedUpdate(root, update$33);
|
||||
break a;
|
||||
}
|
||||
}
|
||||
|
@ -7093,20 +7088,20 @@ function completeUnitOfWork(unitOfWork) {
|
|||
} while (null !== completedWork);
|
||||
0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5);
|
||||
}
|
||||
function commitRoot(root) {
|
||||
function commitRoot(root, recoverableErrors) {
|
||||
var previousUpdateLanePriority = currentUpdatePriority,
|
||||
prevTransition = ReactCurrentBatchConfig$2.transition;
|
||||
try {
|
||||
(ReactCurrentBatchConfig$2.transition = 0),
|
||||
(currentUpdatePriority = 1),
|
||||
commitRootImpl(root, previousUpdateLanePriority);
|
||||
commitRootImpl(root, recoverableErrors, previousUpdateLanePriority);
|
||||
} finally {
|
||||
(ReactCurrentBatchConfig$2.transition = prevTransition),
|
||||
(currentUpdatePriority = previousUpdateLanePriority);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function commitRootImpl(root, renderPriorityLevel) {
|
||||
function commitRootImpl(root, recoverableErrors, renderPriorityLevel) {
|
||||
do flushPassiveEffects();
|
||||
while (null !== rootWithPendingPassiveEffects);
|
||||
if (0 !== (executionContext & 6))
|
||||
|
@ -7161,6 +7156,15 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|||
0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null);
|
||||
onCommitRoot(finishedWork.stateNode, renderPriorityLevel);
|
||||
ensureRootIsScheduled(root, now());
|
||||
if (null !== recoverableErrors)
|
||||
for (
|
||||
renderPriorityLevel = 0;
|
||||
renderPriorityLevel < recoverableErrors.length;
|
||||
renderPriorityLevel++
|
||||
)
|
||||
(finishedWork = recoverableErrors[renderPriorityLevel]),
|
||||
(lanes = root.onRecoverableError),
|
||||
null !== lanes && lanes(finishedWork);
|
||||
if (hasUncaughtError)
|
||||
throw ((hasUncaughtError = !1),
|
||||
(root = firstUncaughtError),
|
||||
|
@ -7733,7 +7737,11 @@ beginWork$1 = function(current, workInProgress, renderLanes) {
|
|||
newValue.lanes |= renderLanes;
|
||||
dependency = newValue.alternate;
|
||||
null !== dependency && (dependency.lanes |= renderLanes);
|
||||
scheduleWorkOnParentPath(newValue.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(
|
||||
newValue.return,
|
||||
renderLanes,
|
||||
workInProgress
|
||||
);
|
||||
list.lanes |= renderLanes;
|
||||
break;
|
||||
}
|
||||
|
@ -8031,7 +8039,13 @@ function createFiberFromPortal(portal, mode, lanes) {
|
|||
};
|
||||
return mode;
|
||||
}
|
||||
function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
||||
function FiberRootNode(
|
||||
containerInfo,
|
||||
tag,
|
||||
hydrate,
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
this.tag = tag;
|
||||
this.containerInfo = containerInfo;
|
||||
this.finishedWork = this.pingCache = this.current = this.pendingChildren = null;
|
||||
|
@ -8045,6 +8059,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
|||
this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0;
|
||||
this.entanglements = createLaneMap(0);
|
||||
this.identifierPrefix = identifierPrefix;
|
||||
this.onRecoverableError = onRecoverableError;
|
||||
}
|
||||
function createPortal(children, containerInfo, implementation) {
|
||||
var key =
|
||||
|
@ -8255,10 +8270,10 @@ batchedUpdatesImpl = function(fn, a) {
|
|||
}
|
||||
};
|
||||
var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_967 = {
|
||||
devToolsConfig$jscomp$inline_968 = {
|
||||
findFiberByHostInstance: getInstanceFromTag,
|
||||
bundleType: 0,
|
||||
version: "18.0.0-rc.0-51947a14b-20220113",
|
||||
version: "18.0.0-rc.0-a3bde7974-20220208",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForViewTag: function() {
|
||||
|
@ -8273,11 +8288,11 @@ var roots = new Map(),
|
|||
}.bind(null, findNodeHandle)
|
||||
}
|
||||
};
|
||||
var internals$jscomp$inline_1230 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_967.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_967.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_967.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_967.rendererConfig,
|
||||
var internals$jscomp$inline_1232 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_968.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_968.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_968.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_968.rendererConfig,
|
||||
overrideHookState: null,
|
||||
overrideHookStateDeletePath: null,
|
||||
overrideHookStateRenamePath: null,
|
||||
|
@ -8293,29 +8308,26 @@ var internals$jscomp$inline_1230 = {
|
|||
return null === fiber ? null : fiber.stateNode;
|
||||
},
|
||||
findFiberByHostInstance:
|
||||
devToolsConfig$jscomp$inline_967.findFiberByHostInstance ||
|
||||
devToolsConfig$jscomp$inline_968.findFiberByHostInstance ||
|
||||
emptyFindFiberByHostInstance,
|
||||
findHostInstancesForRefresh: null,
|
||||
scheduleRefresh: null,
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113"
|
||||
reconcilerVersion: "18.0.0-rc.0-a3bde7974-20220208"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1231 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
var hook$jscomp$inline_1233 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (
|
||||
!hook$jscomp$inline_1231.isDisabled &&
|
||||
hook$jscomp$inline_1231.supportsFiber
|
||||
!hook$jscomp$inline_1233.isDisabled &&
|
||||
hook$jscomp$inline_1233.supportsFiber
|
||||
)
|
||||
try {
|
||||
(rendererID = hook$jscomp$inline_1231.inject(
|
||||
Object.assign({}, internals$jscomp$inline_1230, {
|
||||
getLaneLabelMap: getLaneLabelMap,
|
||||
injectProfilingHooks: injectProfilingHooks
|
||||
})
|
||||
(rendererID = hook$jscomp$inline_1233.inject(
|
||||
internals$jscomp$inline_1232
|
||||
)),
|
||||
(injectedHook = hook$jscomp$inline_1231);
|
||||
(injectedHook = hook$jscomp$inline_1233);
|
||||
} catch (err) {}
|
||||
}
|
||||
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
||||
|
@ -8361,7 +8373,7 @@ exports.findNodeHandle = findNodeHandle;
|
|||
exports.render = function(element, containerTag, callback) {
|
||||
var root = roots.get(containerTag);
|
||||
if (!root) {
|
||||
root = new FiberRootNode(containerTag, 0, !1, "");
|
||||
root = new FiberRootNode(containerTag, 0, !1, "", null);
|
||||
var JSCompiler_inline_result = createFiber(3, null, null, 0);
|
||||
root.current = JSCompiler_inline_result;
|
||||
JSCompiler_inline_result.stateNode = root;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<b48d0cdae51eab70302c920e0a867d32>>
|
||||
* @generated SignedSource<<6fb23e3f27b69a5703944d58969d32f4>>
|
||||
*/
|
||||
|
||||
|
||||
|
@ -2282,19 +2282,16 @@ function popProvider(context) {
|
|||
pop(valueCursor);
|
||||
context._currentValue = currentValue;
|
||||
}
|
||||
function scheduleWorkOnParentPath(parent, renderLanes) {
|
||||
function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) {
|
||||
for (; null !== parent; ) {
|
||||
var alternate = parent.alternate;
|
||||
if ((parent.childLanes & renderLanes) === renderLanes)
|
||||
if (
|
||||
null === alternate ||
|
||||
(alternate.childLanes & renderLanes) === renderLanes
|
||||
)
|
||||
break;
|
||||
else alternate.childLanes |= renderLanes;
|
||||
else
|
||||
(parent.childLanes |= renderLanes),
|
||||
null !== alternate && (alternate.childLanes |= renderLanes);
|
||||
(parent.childLanes & renderLanes) !== renderLanes
|
||||
? ((parent.childLanes |= renderLanes),
|
||||
null !== alternate && (alternate.childLanes |= renderLanes))
|
||||
: null !== alternate &&
|
||||
(alternate.childLanes & renderLanes) !== renderLanes &&
|
||||
(alternate.childLanes |= renderLanes);
|
||||
if (parent === propagationRoot) break;
|
||||
parent = parent.return;
|
||||
}
|
||||
}
|
||||
|
@ -3768,28 +3765,37 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
|||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function mountSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = mountWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var root = workInProgressRoot;
|
||||
if (null === root)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
if (
|
||||
hook.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged ||
|
||||
(null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1)
|
||||
) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
includesBlockingLane(root, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
hook.memoizedState = nextSnapshot;
|
||||
root = { value: nextSnapshot, getSnapshot: getSnapshot };
|
||||
hook.queue = root;
|
||||
mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [subscribe]);
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(subscribe, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
|
@ -4179,7 +4185,32 @@ var ContextOnlyDispatcher = {
|
|||
};
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
},
|
||||
useSyncExternalStore: mountSyncExternalStore,
|
||||
useSyncExternalStore: function(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = mountWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var root = workInProgressRoot;
|
||||
if (null === root)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(root, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
hook.memoizedState = nextSnapshot;
|
||||
root = { value: nextSnapshot, getSnapshot: getSnapshot };
|
||||
hook.queue = root;
|
||||
mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
return nextSnapshot;
|
||||
},
|
||||
useId: function() {
|
||||
var hook = mountWorkInProgressHook(),
|
||||
identifierPrefix = workInProgressRoot.identifierPrefix,
|
||||
|
@ -4228,46 +4259,7 @@ var ContextOnlyDispatcher = {
|
|||
return [isPending, start];
|
||||
},
|
||||
useMutableSource: updateMutableSource,
|
||||
useSyncExternalStore: function(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
]);
|
||||
if (
|
||||
hook.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged ||
|
||||
(null !== workInProgressHook &&
|
||||
workInProgressHook.memoizedState.tag & 1)
|
||||
) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
nextSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
void 0,
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe)
|
||||
throw Error(
|
||||
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
||||
);
|
||||
includesBlockingLane(subscribe, renderLanes) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
},
|
||||
useSyncExternalStore: updateSyncExternalStore,
|
||||
useId: updateId,
|
||||
unstable_isNewReconciler: !1
|
||||
},
|
||||
|
@ -4310,7 +4302,7 @@ var ContextOnlyDispatcher = {
|
|||
return [isPending, start];
|
||||
},
|
||||
useMutableSource: updateMutableSource,
|
||||
useSyncExternalStore: mountSyncExternalStore,
|
||||
useSyncExternalStore: updateSyncExternalStore,
|
||||
useId: updateId,
|
||||
unstable_isNewReconciler: !1
|
||||
},
|
||||
|
@ -5577,11 +5569,11 @@ function updateSuspenseFallbackChildren(
|
|||
workInProgress.child = primaryChildren;
|
||||
return fallbackChildren;
|
||||
}
|
||||
function scheduleWorkOnFiber(fiber, renderLanes) {
|
||||
function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) {
|
||||
fiber.lanes |= renderLanes;
|
||||
var alternate = fiber.alternate;
|
||||
null !== alternate && (alternate.lanes |= renderLanes);
|
||||
scheduleWorkOnParentPath(fiber.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot);
|
||||
}
|
||||
function initSuspenseListRenderState(
|
||||
workInProgress,
|
||||
|
@ -5620,8 +5612,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) {
|
|||
a: for (current = workInProgress.child; null !== current; ) {
|
||||
if (13 === current.tag)
|
||||
null !== current.memoizedState &&
|
||||
scheduleWorkOnFiber(current, renderLanes);
|
||||
else if (19 === current.tag) scheduleWorkOnFiber(current, renderLanes);
|
||||
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
||||
else if (19 === current.tag)
|
||||
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
||||
else if (null !== current.child) {
|
||||
current.child.return = current;
|
||||
current = current.child;
|
||||
|
@ -6806,8 +6799,9 @@ var ceil = Math.ceil,
|
|||
workInProgressRootFatalError = null,
|
||||
workInProgressRootSkippedLanes = 0,
|
||||
workInProgressRootInterleavedUpdatedLanes = 0,
|
||||
workInProgressRootRenderPhaseUpdatedLanes = 0,
|
||||
workInProgressRootPingedLanes = 0,
|
||||
workInProgressRootConcurrentErrors = null,
|
||||
workInProgressRootRecoverableErrors = null,
|
||||
globalMostRecentFallbackTime = 0,
|
||||
workInProgressRootRenderTargetTime = Infinity,
|
||||
hasUncaughtError = !1,
|
||||
|
@ -6854,9 +6848,8 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
|
|||
var root = markUpdateLaneFromFiberToRoot(fiber, lane);
|
||||
if (null === root) return null;
|
||||
markRootUpdated(root, lane, eventTime);
|
||||
0 !== (executionContext & 2) && root === workInProgressRoot
|
||||
? (workInProgressRootRenderPhaseUpdatedLanes |= lane)
|
||||
: (isDevToolsPresent && addFiberToLanesMap(root, fiber, lane),
|
||||
if (0 === (executionContext & 2) || root !== workInProgressRoot)
|
||||
isDevToolsPresent && addFiberToLanesMap(root, fiber, lane),
|
||||
root === workInProgressRoot &&
|
||||
(0 === (executionContext & 2) &&
|
||||
(workInProgressRootInterleavedUpdatedLanes |= lane),
|
||||
|
@ -6867,7 +6860,7 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
|
|||
0 === executionContext &&
|
||||
0 === (fiber.mode & 1) &&
|
||||
((workInProgressRootRenderTargetTime = now() + 500),
|
||||
includesLegacySyncCallbacks && flushSyncCallbacks()));
|
||||
includesLegacySyncCallbacks && flushSyncCallbacks());
|
||||
return root;
|
||||
}
|
||||
function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
||||
|
@ -7052,7 +7045,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
case 1:
|
||||
throw Error("Root did not complete. This is a bug in React.");
|
||||
case 2:
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 3:
|
||||
markRootSuspended$1(root, lanes);
|
||||
|
@ -7069,12 +7062,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
break;
|
||||
}
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
didTimeout
|
||||
);
|
||||
break;
|
||||
}
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 4:
|
||||
markRootSuspended$1(root, lanes);
|
||||
|
@ -7105,15 +7098,15 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|||
: 1960 * ceil(lanes / 1960)) - lanes;
|
||||
if (10 < lanes) {
|
||||
root.timeoutHandle = scheduleTimeout(
|
||||
commitRoot.bind(null, root),
|
||||
commitRoot.bind(null, root, workInProgressRootRecoverableErrors),
|
||||
lanes
|
||||
);
|
||||
break;
|
||||
}
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
case 5:
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
break;
|
||||
default:
|
||||
throw Error("Unknown root exit status.");
|
||||
|
@ -7128,15 +7121,18 @@ function recoverFromConcurrentError(root, errorRetryLanes) {
|
|||
var prevExecutionContext = executionContext;
|
||||
executionContext |= 8;
|
||||
root.isDehydrated && (root.isDehydrated = !1);
|
||||
for (
|
||||
var exitStatus, i = 0;
|
||||
50 > i &&
|
||||
((exitStatus = renderRootSync(root, errorRetryLanes)),
|
||||
2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes);
|
||||
i++
|
||||
);
|
||||
var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
|
||||
root = renderRootSync(root, errorRetryLanes);
|
||||
2 !== root &&
|
||||
null !== errorsFromFirstAttempt &&
|
||||
(null === workInProgressRootConcurrentErrors
|
||||
? (workInProgressRootRecoverableErrors = errorsFromFirstAttempt)
|
||||
: (workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply(
|
||||
null,
|
||||
errorsFromFirstAttempt
|
||||
)));
|
||||
executionContext = prevExecutionContext;
|
||||
return exitStatus;
|
||||
return root;
|
||||
}
|
||||
function isRenderConsistentWithExternalStores(finishedWork) {
|
||||
for (var node = finishedWork; ; ) {
|
||||
|
@ -7207,7 +7203,7 @@ function performSyncWorkOnRoot(root) {
|
|||
exitStatus);
|
||||
root.finishedWork = root.current.alternate;
|
||||
root.finishedLanes = lanes;
|
||||
commitRoot(root);
|
||||
commitRoot(root, workInProgressRootRecoverableErrors);
|
||||
ensureRootIsScheduled(root, now());
|
||||
return null;
|
||||
}
|
||||
|
@ -7264,7 +7260,8 @@ function prepareFreshStack(root, lanes) {
|
|||
workInProgressRootRenderLanes = subtreeRenderLanes = lanes;
|
||||
workInProgressRootExitStatus = 0;
|
||||
workInProgressRootFatalError = null;
|
||||
workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0;
|
||||
workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0;
|
||||
workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null;
|
||||
if (null !== interleavedQueues) {
|
||||
for (root = 0; root < interleavedQueues.length; root++)
|
||||
if (
|
||||
|
@ -7445,8 +7442,12 @@ function handleError(root, thrownValue) {
|
|||
" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."
|
||||
);
|
||||
}
|
||||
wakeable = value;
|
||||
4 !== workInProgressRootExitStatus &&
|
||||
(workInProgressRootExitStatus = 2);
|
||||
null === workInProgressRootConcurrentErrors
|
||||
? (workInProgressRootConcurrentErrors = [wakeable])
|
||||
: workInProgressRootConcurrentErrors.push(wakeable);
|
||||
value = createCapturedValue(value, sourceFiber);
|
||||
wakeable = returnFiber;
|
||||
do {
|
||||
|
@ -7609,20 +7610,20 @@ function completeUnitOfWork(unitOfWork) {
|
|||
} while (null !== completedWork);
|
||||
0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5);
|
||||
}
|
||||
function commitRoot(root) {
|
||||
function commitRoot(root, recoverableErrors) {
|
||||
var previousUpdateLanePriority = currentUpdatePriority,
|
||||
prevTransition = ReactCurrentBatchConfig$2.transition;
|
||||
try {
|
||||
(ReactCurrentBatchConfig$2.transition = 0),
|
||||
(currentUpdatePriority = 1),
|
||||
commitRootImpl(root, previousUpdateLanePriority);
|
||||
commitRootImpl(root, recoverableErrors, previousUpdateLanePriority);
|
||||
} finally {
|
||||
(ReactCurrentBatchConfig$2.transition = prevTransition),
|
||||
(currentUpdatePriority = previousUpdateLanePriority);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function commitRootImpl(root, renderPriorityLevel) {
|
||||
function commitRootImpl(root, recoverableErrors, renderPriorityLevel) {
|
||||
do flushPassiveEffects();
|
||||
while (null !== rootWithPendingPassiveEffects);
|
||||
if (0 !== (executionContext & 6))
|
||||
|
@ -7688,6 +7689,15 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|||
onCommitRoot(finishedWork.stateNode, renderPriorityLevel);
|
||||
isDevToolsPresent && root.memoizedUpdaters.clear();
|
||||
ensureRootIsScheduled(root, now());
|
||||
if (null !== recoverableErrors)
|
||||
for (
|
||||
renderPriorityLevel = 0;
|
||||
renderPriorityLevel < recoverableErrors.length;
|
||||
renderPriorityLevel++
|
||||
)
|
||||
(finishedWork = recoverableErrors[renderPriorityLevel]),
|
||||
(lanes = root.onRecoverableError),
|
||||
null !== lanes && lanes(finishedWork);
|
||||
if (hasUncaughtError)
|
||||
throw ((hasUncaughtError = !1),
|
||||
(root = firstUncaughtError),
|
||||
|
@ -8342,7 +8352,11 @@ beginWork$1 = function(current, workInProgress, renderLanes) {
|
|||
newValue.lanes |= renderLanes;
|
||||
dependency = newValue.alternate;
|
||||
null !== dependency && (dependency.lanes |= renderLanes);
|
||||
scheduleWorkOnParentPath(newValue.return, renderLanes);
|
||||
scheduleContextWorkOnParentPath(
|
||||
newValue.return,
|
||||
renderLanes,
|
||||
workInProgress
|
||||
);
|
||||
list.lanes |= renderLanes;
|
||||
break;
|
||||
}
|
||||
|
@ -8656,7 +8670,13 @@ function createFiberFromPortal(portal, mode, lanes) {
|
|||
};
|
||||
return mode;
|
||||
}
|
||||
function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
||||
function FiberRootNode(
|
||||
containerInfo,
|
||||
tag,
|
||||
hydrate,
|
||||
identifierPrefix,
|
||||
onRecoverableError
|
||||
) {
|
||||
this.tag = tag;
|
||||
this.containerInfo = containerInfo;
|
||||
this.finishedWork = this.pingCache = this.current = this.pendingChildren = null;
|
||||
|
@ -8670,6 +8690,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
|
|||
this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0;
|
||||
this.entanglements = createLaneMap(0);
|
||||
this.identifierPrefix = identifierPrefix;
|
||||
this.onRecoverableError = onRecoverableError;
|
||||
this.passiveEffectDuration = this.effectDuration = 0;
|
||||
this.memoizedUpdaters = new Set();
|
||||
containerInfo = this.pendingUpdatersLaneMap = [];
|
||||
|
@ -8887,10 +8908,10 @@ batchedUpdatesImpl = function(fn, a) {
|
|||
}
|
||||
};
|
||||
var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1043 = {
|
||||
devToolsConfig$jscomp$inline_1045 = {
|
||||
findFiberByHostInstance: getInstanceFromTag,
|
||||
bundleType: 0,
|
||||
version: "18.0.0-rc.0-51947a14b-20220113",
|
||||
version: "18.0.0-rc.0-a3bde7974-20220208",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForViewTag: function() {
|
||||
|
@ -8905,11 +8926,24 @@ var roots = new Map(),
|
|||
}.bind(null, findNodeHandle)
|
||||
}
|
||||
};
|
||||
var internals$jscomp$inline_1330 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_1043.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_1043.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_1043.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_1043.rendererConfig,
|
||||
(function(internals) {
|
||||
if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1;
|
||||
var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (hook.isDisabled || !hook.supportsFiber) return !0;
|
||||
try {
|
||||
(internals = Object.assign({}, internals, {
|
||||
getLaneLabelMap: getLaneLabelMap,
|
||||
injectProfilingHooks: injectProfilingHooks
|
||||
})),
|
||||
(rendererID = hook.inject(internals)),
|
||||
(injectedHook = hook);
|
||||
} catch (err) {}
|
||||
return hook.checkDCE ? !0 : !1;
|
||||
})({
|
||||
bundleType: devToolsConfig$jscomp$inline_1045.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_1045.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_1045.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_1045.rendererConfig,
|
||||
overrideHookState: null,
|
||||
overrideHookStateDeletePath: null,
|
||||
overrideHookStateRenamePath: null,
|
||||
|
@ -8925,31 +8959,15 @@ var internals$jscomp$inline_1330 = {
|
|||
return null === fiber ? null : fiber.stateNode;
|
||||
},
|
||||
findFiberByHostInstance:
|
||||
devToolsConfig$jscomp$inline_1043.findFiberByHostInstance ||
|
||||
devToolsConfig$jscomp$inline_1045.findFiberByHostInstance ||
|
||||
emptyFindFiberByHostInstance,
|
||||
findHostInstancesForRefresh: null,
|
||||
scheduleRefresh: null,
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1331 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (
|
||||
!hook$jscomp$inline_1331.isDisabled &&
|
||||
hook$jscomp$inline_1331.supportsFiber
|
||||
)
|
||||
try {
|
||||
(rendererID = hook$jscomp$inline_1331.inject(
|
||||
Object.assign({}, internals$jscomp$inline_1330, {
|
||||
getLaneLabelMap: getLaneLabelMap,
|
||||
injectProfilingHooks: injectProfilingHooks
|
||||
})
|
||||
)),
|
||||
(injectedHook = hook$jscomp$inline_1331);
|
||||
} catch (err) {}
|
||||
}
|
||||
reconcilerVersion: "18.0.0-rc.0-a3bde7974-20220208"
|
||||
});
|
||||
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
||||
computeComponentStackForErrorReporting: function(reactTag) {
|
||||
return (reactTag = getInstanceFromTag(reactTag))
|
||||
|
@ -8993,7 +9011,7 @@ exports.findNodeHandle = findNodeHandle;
|
|||
exports.render = function(element, containerTag, callback) {
|
||||
var root = roots.get(containerTag);
|
||||
if (!root) {
|
||||
root = new FiberRootNode(containerTag, 0, !1, "");
|
||||
root = new FiberRootNode(containerTag, 0, !1, "", null);
|
||||
var JSCompiler_inline_result = 0;
|
||||
isDevToolsPresent && (JSCompiler_inline_result |= 2);
|
||||
JSCompiler_inline_result = createFiber(
|
||||
|
|
|
@ -37,7 +37,12 @@ describe('iOS', () => {
|
|||
it('should normalize iOS Dynamic colors with named colors', () => {
|
||||
const color = DynamicColorIOS({light: 'black', dark: 'white'});
|
||||
const normalizedColor = normalizeColor(color);
|
||||
const expectedColor = {dynamic: {light: 'black', dark: 'white'}};
|
||||
const expectedColor = {
|
||||
dynamic: {
|
||||
light: normalizeColor('black'),
|
||||
dark: normalizeColor('white'),
|
||||
},
|
||||
};
|
||||
expect(normalizedColor).toEqual(expectedColor);
|
||||
});
|
||||
|
||||
|
@ -51,10 +56,10 @@ describe('iOS', () => {
|
|||
const normalizedColor = normalizeColor(color);
|
||||
const expectedColor = {
|
||||
dynamic: {
|
||||
light: 'black',
|
||||
dark: 'white',
|
||||
highContrastLight: 'red',
|
||||
highContrastDark: 'blue',
|
||||
light: normalizeColor('black'),
|
||||
dark: normalizeColor('white'),
|
||||
highContrastLight: normalizeColor('red'),
|
||||
highContrastDark: normalizeColor('blue'),
|
||||
},
|
||||
};
|
||||
expect(normalizedColor).toEqual(expectedColor);
|
||||
|
|
|
@ -22,7 +22,7 @@ function normalizeColor(
|
|||
const {normalizeColorObject} = require('./PlatformColorValueTypes');
|
||||
const normalizedColor = normalizeColorObject(color);
|
||||
if (normalizedColor != null) {
|
||||
return color;
|
||||
return normalizedColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -270,38 +270,13 @@ static RCTUIColor *defaultPlaceholderColor() // [macOS]
|
|||
|
||||
- (void)setAttributedText:(NSAttributedString *)attributedText
|
||||
{
|
||||
// Using `setAttributedString:` while user is typing breaks some internal mechanics
|
||||
// when entering complex input languages such as Chinese, Korean or Japanese.
|
||||
// see: https://github.com/facebook/react-native/issues/19339
|
||||
|
||||
// We try to avoid calling this method as much as we can.
|
||||
// If the text has changed, there is nothing we can do.
|
||||
#if !TARGET_OS_OSX // [macOS]
|
||||
if (![super.attributedText.string isEqualToString:attributedText.string]) {
|
||||
[super setAttributedText:attributedText];
|
||||
} else {
|
||||
// But if the text is preserved, we just copying the attributes from the source string.
|
||||
if (![super.attributedText isEqualToAttributedString:attributedText]) {
|
||||
[self copyTextAttributesFrom:attributedText];
|
||||
}
|
||||
}
|
||||
[super setAttributedText:attributedText];
|
||||
#else // [macOS
|
||||
if (![self.textStorage isEqualTo:attributedText.string]) {
|
||||
// Break undo coalescing when the text is changed by JS (e.g. autocomplete).
|
||||
[self breakUndoCoalescing];
|
||||
|
||||
if (attributedText != nil) {
|
||||
[self.textStorage setAttributedString:attributedText];
|
||||
} else {
|
||||
// Avoid Exception thrown while executing UI block: *** -[NSBigMutableString replaceCharactersInRange:withString:]: nil argument
|
||||
[self.textStorage setAttributedString:[NSAttributedString new]];
|
||||
}
|
||||
} else {
|
||||
// But if the text is preserved, we just copy the attributes from the source string.
|
||||
if (![self.textStorage isEqualToAttributedString:attributedText]) {
|
||||
[self copyTextAttributesFrom:attributedText];
|
||||
}
|
||||
}
|
||||
// Break undo coalescing when the text is changed by JS (e.g. autocomplete).
|
||||
[self breakUndoCoalescing];
|
||||
// Avoid Exception thrown while executing UI block: *** -[NSBigMutableString replaceCharactersInRange:withString:]: nil argument
|
||||
[self.textStorage setAttributedString:attributedText ?: [NSAttributedString new]];
|
||||
#endif // macOS]
|
||||
[self textDidChange];
|
||||
}
|
||||
|
@ -625,18 +600,4 @@ static RCTUIColor *defaultPlaceholderColor() // [macOS]
|
|||
|
||||
#pragma mark - Utility Methods
|
||||
|
||||
- (void)copyTextAttributesFrom:(NSAttributedString *)sourceString
|
||||
{
|
||||
[self.textStorage beginEditing];
|
||||
|
||||
NSTextStorage *textStorage = self.textStorage;
|
||||
[sourceString enumerateAttributesInRange:NSMakeRange(0, sourceString.length)
|
||||
options:NSAttributedStringEnumerationReverse
|
||||
usingBlock:^(NSDictionary<NSAttributedStringKey,id> * _Nonnull attrs, NSRange range, BOOL * _Nonnull stop) {
|
||||
[textStorage setAttributes:attrs range:range];
|
||||
}];
|
||||
|
||||
[self.textStorage endEditing];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
#if !TARGET_OS_OSX // [macOS]
|
||||
@protocol RCTBackedTextInputViewProtocol <UITextInput>
|
||||
#else // [macOS
|
||||
@protocol RCTBackedTextInputViewProtocol
|
||||
@protocol RCTBackedTextInputViewProtocol <NSTextInputClient>
|
||||
#endif // macOS]
|
||||
|
||||
@property (nonatomic, copy, nullable) NSAttributedString *attributedText;
|
||||
|
@ -76,7 +76,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
#endif // macOS]
|
||||
|
||||
#if TARGET_OS_OSX // [macOS
|
||||
- (BOOL)hasMarkedText;
|
||||
// UITextInput method for OSX
|
||||
- (CGSize)sizeThatFits:(CGSize)size;
|
||||
#endif // macOS]
|
||||
|
|
|
@ -112,6 +112,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder)
|
|||
// Similarly, when the user is in the middle of inputting some text in Japanese/Chinese, there will be styling on the
|
||||
// text that we should disregard. See https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc
|
||||
// for more info.
|
||||
// Also, updating the attributed text while inputting Korean language will break input mechanism.
|
||||
// If the user added an emoji, the system adds a font attribute for the emoji and stores the original font in NSOriginalFont.
|
||||
// Lastly, when entering a password, etc., there will be additional styling on the field as the native text view
|
||||
// handles showing the last character for a split second.
|
||||
|
@ -125,12 +126,16 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder)
|
|||
BOOL shouldFallbackToBareTextComparison =
|
||||
#if !TARGET_OS_OSX // [macOS]
|
||||
[self.backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] ||
|
||||
[self.backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"ko-KR"] ||
|
||||
self.backedTextInputView.markedTextRange ||
|
||||
self.backedTextInputView.isSecureTextEntry ||
|
||||
fontHasBeenUpdatedBySystem;
|
||||
#else // [macOS
|
||||
NO;
|
||||
// There are multiple Korean input sources (2-Set, 3-Set, etc). Check substring instead instead
|
||||
[[[self.backedTextInputView inputContext] selectedKeyboardInputSource] containsString:@"com.apple.inputmethod.Korean"] ||
|
||||
[self.backedTextInputView hasMarkedText] ||
|
||||
[self.backedTextInputView isKindOfClass:[NSSecureTextField class]] ||
|
||||
#endif // macOS]
|
||||
fontHasBeenUpdatedBySystem;
|
||||
|
||||
if (shouldFallbackToBareTextComparison) {
|
||||
return ([newText.string isEqualToString:oldText.string]);
|
||||
|
@ -154,12 +159,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder)
|
|||
range:NSMakeRange(0, attributedTextCopy.length)];
|
||||
|
||||
textNeedsUpdate = ([self textOf:attributedTextCopy equals:backedTextInputViewTextCopy] == NO);
|
||||
#if TARGET_OS_OSX // [macOS
|
||||
// If we are in a language that uses conversion (e.g. Japanese), ignore updates if we have unconverted text.
|
||||
if ([self.backedTextInputView hasMarkedText]) {
|
||||
textNeedsUpdate = NO;
|
||||
}
|
||||
#endif // macOS]
|
||||
|
||||
if (eventLag == 0 && textNeedsUpdate) {
|
||||
#if !TARGET_OS_OSX // [macOS]
|
||||
|
|
|
@ -132,6 +132,12 @@
|
|||
{
|
||||
return ((NSTextView *)self.currentEditor).hasMarkedText;
|
||||
}
|
||||
|
||||
- (NSArray<NSAttributedStringKey> *)validAttributesForMarkedText
|
||||
{
|
||||
return ((NSTextView *)self.currentEditor).validAttributesForMarkedText;
|
||||
}
|
||||
|
||||
#endif // macOS]
|
||||
|
||||
#pragma mark - Accessibility
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import {type EventSubscription} from './EventSubscription';
|
||||
import type {EventSubscription} from './EventSubscription';
|
||||
import type EventSubscriptionVendor from './_EventSubscriptionVendor';
|
||||
|
||||
/**
|
||||
|
|
|
@ -647,8 +647,9 @@ using namespace facebook::react;
|
|||
// the settings on a dictation.
|
||||
// Similarly, when the user is in the middle of inputting some text in Japanese/Chinese, there will be styling on the
|
||||
// text that we should disregard. See
|
||||
// https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc for more info. If
|
||||
// the user added an emoji, the system adds a font attribute for the emoji and stores the original font in
|
||||
// https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc for more info.
|
||||
// Also, updating the attributed text while inputting Korean language will break input mechanism.
|
||||
// If the user added an emoji, the system adds a font attribute for the emoji and stores the original font in
|
||||
// NSOriginalFont. Lastly, when entering a password, etc., there will be additional styling on the field as the native
|
||||
// text view handles showing the last character for a split second.
|
||||
__block BOOL fontHasBeenUpdatedBySystem = false;
|
||||
|
@ -661,19 +662,23 @@ using namespace facebook::react;
|
|||
}
|
||||
}];
|
||||
|
||||
#if !TARGET_OS_OSX // [macOS]
|
||||
BOOL shouldFallbackToBareTextComparison =
|
||||
[_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] ||
|
||||
#if !TARGET_OS_OSX // [macOS]
|
||||
[_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"ko-KR"] ||
|
||||
_backedTextInputView.markedTextRange || _backedTextInputView.isSecureTextEntry || fontHasBeenUpdatedBySystem;
|
||||
|
||||
#else // [macOS
|
||||
// There are multiple Korean input sources (2-Set, 3-Set, etc). Check substring instead instead
|
||||
[[[self.backedTextInputView inputContext] selectedKeyboardInputSource] containsString:@"com.apple.inputmethod.Korean"] ||
|
||||
[self.backedTextInputView hasMarkedText] ||
|
||||
[self.backedTextInputView isKindOfClass:[NSSecureTextField class]] ||
|
||||
fontHasBeenUpdatedBySystem;
|
||||
#endif // macOS]
|
||||
if (shouldFallbackToBareTextComparison) {
|
||||
return ([newText.string isEqualToString:oldText.string]);
|
||||
} else {
|
||||
#endif // [macOS]
|
||||
return ([newText isEqualToAttributedString:oldText]);
|
||||
#if !TARGET_OS_OSX // [macOS]
|
||||
}
|
||||
#endif // [macOS]
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -97,6 +97,14 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|||
_mountingManager.delegate = self;
|
||||
|
||||
_scheduler = [self _createScheduler];
|
||||
|
||||
auto reactNativeConfig = _contextContainer->at<std::shared_ptr<ReactNativeConfig const>>("ReactNativeConfig");
|
||||
if (reactNativeConfig->getBool("react_native_new_architecture:suspend_before_app_termination")) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(_applicationWillTerminate)
|
||||
name:UIApplicationWillTerminateNotification
|
||||
object:nil];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -281,6 +289,8 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|||
auto weakRuntimeScheduler = _contextContainer->find<std::weak_ptr<RuntimeScheduler>>("RuntimeScheduler");
|
||||
auto runtimeScheduler = weakRuntimeScheduler.has_value() ? weakRuntimeScheduler.value().lock() : nullptr;
|
||||
if (runtimeScheduler) {
|
||||
runtimeScheduler->setEnableYielding(
|
||||
reactNativeConfig->getBool("react_native_new_architecture:runtimescheduler_enable_yielding_ios"));
|
||||
runtimeExecutor = [runtimeScheduler](std::function<void(jsi::Runtime & runtime)> &&callback) {
|
||||
runtimeScheduler->scheduleWork(std::move(callback));
|
||||
};
|
||||
|
@ -335,6 +345,11 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|||
}];
|
||||
}
|
||||
|
||||
- (void)_applicationWillTerminate
|
||||
{
|
||||
[self suspend];
|
||||
}
|
||||
|
||||
#pragma mark - RCTSchedulerDelegate
|
||||
|
||||
- (void)schedulerDidFinishTransaction:(MountingCoordinator::Shared const &)mountingCoordinator
|
||||
|
|
|
@ -1112,33 +1112,49 @@ static CGFloat RCTDefaultIfNegativeTo(CGFloat defaultValue, CGFloat x)
|
|||
};
|
||||
}
|
||||
|
||||
#if !TARGET_OS_OSX // [macOS]
|
||||
- (RCTBorderColors)borderColorsWithTraitCollection:(UITraitCollection *)traitCollection
|
||||
#else // [macOS
|
||||
- (RCTBorderColors)borderColors
|
||||
#endif // macOS]
|
||||
{
|
||||
const BOOL isRTL = _reactLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;
|
||||
|
||||
RCTUIColor *directionAwareBorderLeftColor = nil;
|
||||
RCTUIColor *directionAwareBorderRightColor = nil;
|
||||
|
||||
if ([[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) {
|
||||
RCTUIColor *borderStartColor = _borderStartColor ?: _borderLeftColor; // macOS RCTUIColor
|
||||
RCTUIColor *borderEndColor = _borderEndColor ?: _borderRightColor; // macOS RCTUIColor
|
||||
|
||||
RCTUIColor *directionAwareBorderLeftColor = isRTL ? borderEndColor : borderStartColor; // macOS RCTUIColor
|
||||
RCTUIColor *directionAwareBorderRightColor = isRTL ? borderStartColor : borderEndColor; // macOS RCTUIColor
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
RCTUIColor *directionAwareBorderLeftColor = isRTL ? _borderEndColor : _borderStartColor; // macOS RCTUIColor
|
||||
RCTUIColor *directionAwareBorderRightColor = isRTL ? _borderStartColor : _borderEndColor; // macOS RCTUIColor
|
||||
RCTUIColor *borderColor = _borderColor;
|
||||
RCTUIColor *borderTopColor = _borderTopColor;
|
||||
RCTUIColor *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,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1169,8 +1185,11 @@ static CGFloat RCTDefaultIfNegativeTo(CGFloat defaultValue, CGFloat x)
|
|||
|
||||
const RCTCornerRadii cornerRadii = [self cornerRadii];
|
||||
const UIEdgeInsets borderInsets = [self bordersAsInsets];
|
||||
#if !TARGET_OS_OSX // [macOS]
|
||||
const RCTBorderColors borderColors = [self borderColorsWithTraitCollection:self.traitCollection];
|
||||
#else // [macOS
|
||||
const RCTBorderColors borderColors = [self borderColors];
|
||||
|
||||
#endif // macOS]
|
||||
BOOL useIOSBorderRendering = RCTCornerRadiiAreEqual(cornerRadii) && RCTBorderInsetsAreEqual(borderInsets) &&
|
||||
RCTBorderColorsAreEqual(borderColors) && _borderStyle == RCTBorderStyleSolid &&
|
||||
|
||||
|
|
|
@ -595,4 +595,29 @@ RCT_EXPORT_SHADOW_PROPERTY(onLayout, RCTDirectEventBlock)
|
|||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(direction, YGDirection)
|
||||
|
||||
// The events below define the properties that are not used by native directly, but required in the view config for new
|
||||
// renderer to function.
|
||||
// They can be deleted after Static View Configs are rolled out.
|
||||
|
||||
// PanResponder handlers
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onMoveShouldSetResponder, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onMoveShouldSetResponderCapture, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onStartShouldSetResponder, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onStartShouldSetResponderCapture, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onResponderGrant, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onResponderReject, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onResponderStart, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onResponderEnd, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onResponderRelease, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onResponderMove, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onResponderTerminate, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onResponderTerminationRequest, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onShouldBlockNativeResponder, BOOL, RCTView) {}
|
||||
|
||||
// Touch events
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onTouchStart, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onTouchMove, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onTouchEnd, BOOL, RCTView) {}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onTouchCancel, BOOL, RCTView) {}
|
||||
|
||||
@end
|
||||
|
|
|
@ -351,6 +351,12 @@ android {
|
|||
packagingOptions {
|
||||
exclude("META-INF/NOTICE")
|
||||
exclude("META-INF/LICENSE")
|
||||
// We intentionally don't want to bundle any JS Runtime inside the Android AAR
|
||||
// we produce. The reason behind this is that we want to allow users to pick the
|
||||
// JS engine by specifying a dependency on either `hermes-engine` or `android-jsc`
|
||||
// that will include the necessary .so files to load.
|
||||
exclude("**/libhermes.so")
|
||||
exclude("**/libjsc.so")
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
|
|
@ -24,17 +24,15 @@
|
|||
# See http://sourceforge.net/p/proguard/bugs/466/
|
||||
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
|
||||
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
|
||||
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
|
||||
-keep,allowobfuscation @interface com.facebook.jni.annotations.DoNotStrip
|
||||
|
||||
# Do not strip any method/class that is annotated with @DoNotStrip
|
||||
-keep @com.facebook.proguard.annotations.DoNotStrip class *
|
||||
-keep @com.facebook.common.internal.DoNotStrip class *
|
||||
-keep @com.facebook.jni.annotations.DoNotStrip class *
|
||||
-keepclassmembers class * {
|
||||
@com.facebook.proguard.annotations.DoNotStrip *;
|
||||
@com.facebook.common.internal.DoNotStrip *;
|
||||
@com.facebook.jni.annotations.DoNotStrip *;
|
||||
}
|
||||
|
||||
-keep @com.facebook.proguard.annotations.DoNotStripAny class * {
|
||||
*;
|
||||
}
|
||||
|
||||
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
|
||||
|
|
|
@ -47,6 +47,7 @@ static ::hermes::vm::RuntimeConfig makeRuntimeConfig(jlong heapSizeMB) {
|
|||
|
||||
return vm::RuntimeConfig::Builder()
|
||||
.withGCConfig(gcConfigBuilder.build())
|
||||
.withEnableSampleProfiling(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,10 +81,10 @@ import com.facebook.react.common.annotations.VisibleForTesting;
|
|||
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;
|
||||
|
|
|
@ -26,9 +26,9 @@ import com.facebook.react.common.LifecycleState;
|
|||
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;
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.facebook.react.common.LifecycleState;
|
|||
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;
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.facebook.react.animated;
|
||||
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
|
||||
/** Indicates that AnimatedNode is able to receive native config updates. */
|
||||
public interface AnimatedNodeWithUpdateableConfig {
|
||||
void onUpdateConfig(ReadableMap config);
|
||||
}
|
|
@ -7,47 +7,60 @@
|
|||
|
||||
package com.facebook.react.animated;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import com.facebook.react.bridge.ColorPropConverter;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.views.view.ColorUtil;
|
||||
|
||||
/** Animated node that represents a color. */
|
||||
/*package*/ class ColorAnimatedNode extends AnimatedNode {
|
||||
/*package*/ class ColorAnimatedNode extends AnimatedNode
|
||||
implements AnimatedNodeWithUpdateableConfig {
|
||||
|
||||
private final NativeAnimatedNodesManager mNativeAnimatedNodesManager;
|
||||
private final int mRNodeId;
|
||||
private final int mGNodeId;
|
||||
private final int mBNodeId;
|
||||
private final int mANodeId;
|
||||
private int mColor;
|
||||
private final ReactApplicationContext mReactApplicationContext;
|
||||
private int mRNodeId;
|
||||
private int mGNodeId;
|
||||
private int mBNodeId;
|
||||
private int mANodeId;
|
||||
private ReadableMap mNativeColor;
|
||||
private boolean mNativeColorApplied;
|
||||
|
||||
public ColorAnimatedNode(
|
||||
ReadableMap config, NativeAnimatedNodesManager nativeAnimatedNodesManager) {
|
||||
ReadableMap config,
|
||||
NativeAnimatedNodesManager nativeAnimatedNodesManager,
|
||||
ReactApplicationContext reactApplicationContext) {
|
||||
mNativeAnimatedNodesManager = nativeAnimatedNodesManager;
|
||||
mReactApplicationContext = reactApplicationContext;
|
||||
onUpdateConfig(config);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
tryApplyNativeColor();
|
||||
|
||||
ValueAnimatedNode rNode = (ValueAnimatedNode) mNativeAnimatedNodesManager.getNodeById(mRNodeId);
|
||||
ValueAnimatedNode gNode = (ValueAnimatedNode) mNativeAnimatedNodesManager.getNodeById(mGNodeId);
|
||||
ValueAnimatedNode bNode = (ValueAnimatedNode) mNativeAnimatedNodesManager.getNodeById(mBNodeId);
|
||||
ValueAnimatedNode aNode = (ValueAnimatedNode) mNativeAnimatedNodesManager.getNodeById(mANodeId);
|
||||
|
||||
double r = rNode.getValue();
|
||||
double g = gNode.getValue();
|
||||
double b = bNode.getValue();
|
||||
double a = aNode.getValue();
|
||||
|
||||
return ColorUtil.normalize(r, g, b, a);
|
||||
}
|
||||
|
||||
public void onUpdateConfig(ReadableMap config) {
|
||||
mRNodeId = config.getInt("r");
|
||||
mGNodeId = config.getInt("g");
|
||||
mBNodeId = config.getInt("b");
|
||||
mANodeId = config.getInt("a");
|
||||
|
||||
// TODO (T110930421): Support platform color
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return mColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
AnimatedNode rNode = mNativeAnimatedNodesManager.getNodeById(mRNodeId);
|
||||
AnimatedNode gNode = mNativeAnimatedNodesManager.getNodeById(mGNodeId);
|
||||
AnimatedNode bNode = mNativeAnimatedNodesManager.getNodeById(mBNodeId);
|
||||
AnimatedNode aNode = mNativeAnimatedNodesManager.getNodeById(mANodeId);
|
||||
|
||||
double r = ((ValueAnimatedNode) rNode).getValue();
|
||||
double g = ((ValueAnimatedNode) gNode).getValue();
|
||||
double b = ((ValueAnimatedNode) bNode).getValue();
|
||||
double a = ((ValueAnimatedNode) aNode).getValue();
|
||||
|
||||
mColor = ColorUtil.normalize(r, g, b, a);
|
||||
mNativeColor = config.getMap("nativeColor");
|
||||
mNativeColorApplied = false;
|
||||
tryApplyNativeColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,4 +76,56 @@ import com.facebook.react.views.view.ColorUtil;
|
|||
+ " a: "
|
||||
+ mANodeId;
|
||||
}
|
||||
|
||||
private void tryApplyNativeColor() {
|
||||
if (mNativeColor == null || mNativeColorApplied) {
|
||||
return;
|
||||
}
|
||||
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int color = ColorPropConverter.getColor(mNativeColor, context);
|
||||
|
||||
ValueAnimatedNode rNode = (ValueAnimatedNode) mNativeAnimatedNodesManager.getNodeById(mRNodeId);
|
||||
ValueAnimatedNode gNode = (ValueAnimatedNode) mNativeAnimatedNodesManager.getNodeById(mGNodeId);
|
||||
ValueAnimatedNode bNode = (ValueAnimatedNode) mNativeAnimatedNodesManager.getNodeById(mBNodeId);
|
||||
ValueAnimatedNode aNode = (ValueAnimatedNode) mNativeAnimatedNodesManager.getNodeById(mANodeId);
|
||||
|
||||
rNode.mValue = Color.red(color);
|
||||
gNode.mValue = Color.green(color);
|
||||
bNode.mValue = Color.blue(color);
|
||||
aNode.mValue = Color.alpha(color) / 255.0;
|
||||
|
||||
mNativeColorApplied = true;
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
Context context = mReactApplicationContext.getCurrentActivity();
|
||||
if (context != null) {
|
||||
return context;
|
||||
}
|
||||
|
||||
// There are cases where the activity may not exist (such as for VRShell panel apps). In this
|
||||
// case we will search for a view associated with a PropsAnimatedNode to get the context.
|
||||
return getContextHelper(this);
|
||||
}
|
||||
|
||||
private static Context getContextHelper(AnimatedNode node) {
|
||||
// Search children depth-first until we get to a PropsAnimatedNode, from which we can
|
||||
// get the view and its context
|
||||
if (node.mChildren != null) {
|
||||
for (AnimatedNode child : node.mChildren) {
|
||||
if (child instanceof PropsAnimatedNode) {
|
||||
View view = ((PropsAnimatedNode) child).getConnectedView();
|
||||
return view != null ? view.getContext() : null;
|
||||
} else {
|
||||
return getContextHelper(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -460,6 +460,32 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAnimatedNodeConfig(final double tagDouble, final ReadableMap config) {
|
||||
final int tag = (int) tagDouble;
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
"queue updateAnimatedNodeConfig: " + tag + " config: " + config.toHashMap().toString());
|
||||
}
|
||||
|
||||
addOperation(
|
||||
new UIThreadOperation() {
|
||||
@Override
|
||||
public void execute(NativeAnimatedNodesManager animatedNodesManager) {
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
"execute updateAnimatedNodeConfig: "
|
||||
+ tag
|
||||
+ " config: "
|
||||
+ config.toHashMap().toString());
|
||||
}
|
||||
animatedNodesManager.updateAnimatedNodeConfig(tag, config);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startListeningToAnimatedNodeValue(final double tagDouble) {
|
||||
final int tag = (int) tagDouble;
|
||||
|
|
|
@ -130,7 +130,7 @@ import java.util.Queue;
|
|||
} else if ("value".equals(type)) {
|
||||
node = new ValueAnimatedNode(config);
|
||||
} else if ("color".equals(type)) {
|
||||
node = new ColorAnimatedNode(config, this);
|
||||
node = new ColorAnimatedNode(config, this, mReactApplicationContext);
|
||||
} else if ("props".equals(type)) {
|
||||
node = new PropsAnimatedNode(config, this);
|
||||
} else if ("interpolation".equals(type)) {
|
||||
|
@ -159,6 +159,21 @@ import java.util.Queue;
|
|||
mUpdatedNodes.put(tag, node);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void updateAnimatedNodeConfig(int tag, ReadableMap config) {
|
||||
AnimatedNode node = mAnimatedNodes.get(tag);
|
||||
if (node == null) {
|
||||
throw new JSApplicationIllegalArgumentException(
|
||||
"updateAnimatedNode: Animated node [" + tag + "] does not exist");
|
||||
}
|
||||
|
||||
if (node instanceof AnimatedNodeWithUpdateableConfig) {
|
||||
stopAnimationsForNode(node);
|
||||
((AnimatedNodeWithUpdateableConfig) node).onUpdateConfig(config);
|
||||
mUpdatedNodes.put(tag, node);
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void dropAnimatedNode(int tag) {
|
||||
mAnimatedNodes.remove(tag);
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
|
||||
package com.facebook.react.animated;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.JavaOnlyMap;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.uimanager.IllegalViewOperationException;
|
||||
import com.facebook.react.uimanager.common.UIManagerType;
|
||||
import com.facebook.react.uimanager.common.ViewUtil;
|
||||
import java.util.HashMap;
|
||||
|
@ -116,6 +118,16 @@ import java.util.Map;
|
|||
mUIManager.synchronouslyUpdateViewOnUIThread(mConnectedViewTag, mPropMap);
|
||||
}
|
||||
|
||||
public View getConnectedView() {
|
||||
try {
|
||||
return mUIManager.resolveView(mConnectedViewTag);
|
||||
} catch (IllegalViewOperationException ex) {
|
||||
// resolveView throws an {@link IllegalViewOperationException} when the view doesn't exist
|
||||
// (this can happen if the surface is being deallocated).
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String prettyPrint() {
|
||||
return "PropsAnimatedNode["
|
||||
+ mTag
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import java.util.List;
|
||||
|
@ -91,7 +92,7 @@ public class ReactMarker {
|
|||
@DoNotStrip
|
||||
public static void logFabricMarker(
|
||||
ReactMarkerConstants name, @Nullable String tag, int instanceKey) {
|
||||
logFabricMarker(name, tag, instanceKey, -1);
|
||||
logFabricMarker(name, tag, instanceKey, SystemClock.uptimeMillis());
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
|
|
|
@ -37,4 +37,7 @@ public interface SurfaceDelegate {
|
|||
|
||||
/** Hide the surface containing the React content view */
|
||||
void hide();
|
||||
|
||||
/** Check if the surface is currently showing */
|
||||
boolean isShowing();
|
||||
}
|
||||
|
|
|
@ -101,7 +101,4 @@ public class ReactFeatureFlags {
|
|||
|
||||
/** TODO: T103427072 Delete ReactFeatureFlags.enableNestedTextOnPressEventFix */
|
||||
public static boolean enableNestedTextOnPressEventFix = true;
|
||||
|
||||
/** TODO: T107492383 Delete this flag. Enables postprocessor for rounded corners for Image */
|
||||
public static boolean enableRoundedCornerPostprocessing = false;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.facebook.react.common.futures.SimpleSettableFuture;
|
|||
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
|
||||
import com.facebook.react.devsupport.interfaces.DevOptionHandler;
|
||||
import com.facebook.react.devsupport.interfaces.DevSplitBundleCallback;
|
||||
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
|
||||
import com.facebook.react.packagerconnection.RequestHandler;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
|
|||
import com.facebook.react.common.SurfaceDelegateFactory;
|
||||
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.packagerconnection.RequestHandler;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -51,6 +51,7 @@ import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
|||
import com.facebook.react.devsupport.interfaces.ErrorCustomizer;
|
||||
import com.facebook.react.devsupport.interfaces.ErrorType;
|
||||
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
|
||||
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
|
||||
import com.facebook.react.devsupport.interfaces.StackFrame;
|
||||
import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
|
||||
import com.facebook.react.packagerconnection.RequestHandler;
|
||||
|
@ -96,7 +97,7 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
|||
private final DefaultNativeModuleCallExceptionHandler mDefaultNativeModuleCallExceptionHandler;
|
||||
private final DevLoadingViewController mDevLoadingViewController;
|
||||
|
||||
private @Nullable RedBoxDialog mRedBoxDialog;
|
||||
private @Nullable SurfaceDelegate mRedBoxSurfaceDelegate;
|
||||
private @Nullable AlertDialog mDevOptionsDialog;
|
||||
private @Nullable DebugOverlayController mDebugOverlayController;
|
||||
private boolean mDevLoadingViewVisible = false;
|
||||
|
@ -197,7 +198,7 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
|||
final String bundleFile = subclassTag + "ReactNativeDevBundle.js";
|
||||
mJSBundleDownloadedFile = new File(applicationContext.getFilesDir(), bundleFile);
|
||||
|
||||
final String splitBundlesDir = subclassTag.toLowerCase() + "_dev_js_split_bundles";
|
||||
final String splitBundlesDir = subclassTag.toLowerCase(Locale.ROOT) + "_dev_js_split_bundles";
|
||||
mJSSplitBundlesDir = mApplicationContext.getDir(splitBundlesDir, Context.MODE_PRIVATE);
|
||||
|
||||
mDefaultNativeModuleCallExceptionHandler = new DefaultNativeModuleCallExceptionHandler();
|
||||
|
@ -272,7 +273,8 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
|||
mErrorCustomizers.add(errorCustomizer);
|
||||
}
|
||||
|
||||
private Pair<String, StackFrame[]> processErrorCustomizers(Pair<String, StackFrame[]> errorInfo) {
|
||||
@Override
|
||||
public Pair<String, StackFrame[]> processErrorCustomizers(Pair<String, StackFrame[]> errorInfo) {
|
||||
if (mErrorCustomizers == null) {
|
||||
return errorInfo;
|
||||
} else {
|
||||
|
@ -296,33 +298,25 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
|||
// Since we only show the first JS error in a succession of JS errors, make sure we only
|
||||
// update the error message for that error message. This assumes that updateJSError
|
||||
// belongs to the most recent showNewJSError
|
||||
if (mRedBoxDialog == null
|
||||
|| !mRedBoxDialog.isShowing()
|
||||
|| errorCookie != mLastErrorCookie) {
|
||||
if (!mRedBoxSurfaceDelegate.isShowing() || errorCookie != mLastErrorCookie) {
|
||||
return;
|
||||
}
|
||||
StackFrame[] stack = StackTraceHelper.convertJsStackTrace(details);
|
||||
Pair<String, StackFrame[]> errorInfo =
|
||||
processErrorCustomizers(Pair.create(message, stack));
|
||||
mRedBoxDialog.setExceptionDetails(errorInfo.first, errorInfo.second);
|
||||
updateLastErrorInfo(message, stack, errorCookie, ErrorType.JS);
|
||||
// JS errors are reported here after source mapping.
|
||||
if (mRedBoxHandler != null) {
|
||||
mRedBoxHandler.handleRedbox(message, stack, ErrorType.JS);
|
||||
mRedBoxDialog.resetReporting();
|
||||
}
|
||||
mRedBoxDialog.show();
|
||||
|
||||
// The RedBox surface delegate will always show the latest error
|
||||
updateLastErrorInfo(
|
||||
message, StackTraceHelper.convertJsStackTrace(details), errorCookie, ErrorType.JS);
|
||||
mRedBoxSurfaceDelegate.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideRedboxDialog() {
|
||||
// dismiss redbox if exists
|
||||
if (mRedBoxDialog != null) {
|
||||
mRedBoxDialog.dismiss();
|
||||
mRedBoxDialog = null;
|
||||
if (mRedBoxSurfaceDelegate == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mRedBoxSurfaceDelegate.hide();
|
||||
}
|
||||
|
||||
public @Nullable View createRootView(String appKey) {
|
||||
|
@ -349,41 +343,27 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
|||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Activity context = mReactInstanceDevHelper.getCurrentActivity();
|
||||
if (context != null && !context.isFinishing() && currentActivity != context) {
|
||||
currentActivity = context;
|
||||
// Create a new RedBox when currentActivity get updated
|
||||
mRedBoxDialog =
|
||||
new RedBoxDialog(currentActivity, DevSupportManagerBase.this, mRedBoxHandler);
|
||||
if (mRedBoxSurfaceDelegate == null) {
|
||||
@Nullable SurfaceDelegate redBoxSurfaceDelegate = createSurfaceDelegate("RedBox");
|
||||
if (redBoxSurfaceDelegate != null) {
|
||||
mRedBoxSurfaceDelegate = redBoxSurfaceDelegate;
|
||||
} else {
|
||||
mRedBoxSurfaceDelegate =
|
||||
new RedBoxDialogSurfaceDelegate(DevSupportManagerBase.this);
|
||||
}
|
||||
|
||||
mRedBoxSurfaceDelegate.createContentView("RedBox");
|
||||
}
|
||||
if (currentActivity == null || currentActivity.isFinishing()) {
|
||||
FLog.e(
|
||||
ReactConstants.TAG,
|
||||
"Unable to launch redbox because react activity "
|
||||
+ "is not available, here is the error that redbox would've displayed: "
|
||||
+ message);
|
||||
return;
|
||||
}
|
||||
if (mRedBoxDialog == null) {
|
||||
mRedBoxDialog =
|
||||
new RedBoxDialog(currentActivity, DevSupportManagerBase.this, mRedBoxHandler);
|
||||
}
|
||||
if (mRedBoxDialog.isShowing()) {
|
||||
|
||||
if (mRedBoxSurfaceDelegate.isShowing()) {
|
||||
// Sometimes errors cause multiple errors to be thrown in JS in quick succession. Only
|
||||
// show the first and most actionable one.
|
||||
return;
|
||||
}
|
||||
Pair<String, StackFrame[]> errorInfo =
|
||||
processErrorCustomizers(Pair.create(message, stack));
|
||||
mRedBoxDialog.setExceptionDetails(errorInfo.first, errorInfo.second);
|
||||
|
||||
// The RedBox surface delegate will always show the latest error
|
||||
updateLastErrorInfo(message, stack, errorCookie, errorType);
|
||||
// Only report native errors here. JS errors are reported
|
||||
// inside {@link #updateJSError} after source mapping.
|
||||
if (mRedBoxHandler != null && errorType == ErrorType.NATIVE) {
|
||||
mRedBoxHandler.handleRedbox(message, stack, ErrorType.NATIVE);
|
||||
}
|
||||
mRedBoxDialog.resetReporting();
|
||||
mRedBoxDialog.show();
|
||||
mRedBoxSurfaceDelegate.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -622,6 +602,11 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
|||
return mDevSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedBoxHandler getRedBoxHandler() {
|
||||
return mRedBoxHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewReactContextCreated(ReactContext reactContext) {
|
||||
resetCurrentContext(reactContext);
|
||||
|
@ -887,6 +872,11 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
|||
return mLastErrorStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLastErrorCookie() {
|
||||
return mLastErrorCookie;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable ErrorType getLastErrorType() {
|
||||
return mLastErrorType;
|
||||
|
|
|
@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
|
|||
import com.facebook.react.common.SurfaceDelegateFactory;
|
||||
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.packagerconnection.RequestHandler;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package com.facebook.react.devsupport;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler;
|
||||
|
@ -21,6 +22,7 @@ import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
|||
import com.facebook.react.devsupport.interfaces.ErrorCustomizer;
|
||||
import com.facebook.react.devsupport.interfaces.ErrorType;
|
||||
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
|
||||
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
|
||||
import com.facebook.react.devsupport.interfaces.StackFrame;
|
||||
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
|
||||
import java.io.File;
|
||||
|
@ -94,6 +96,11 @@ public class DisabledDevSupportManager implements DevSupportManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedBoxHandler getRedBoxHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewReactContextCreated(ReactContext reactContext) {}
|
||||
|
||||
|
@ -166,9 +173,19 @@ public class DisabledDevSupportManager implements DevSupportManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLastErrorCookie() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerErrorCustomizer(ErrorCustomizer errorCustomizer) {}
|
||||
|
||||
@Override
|
||||
public Pair<String, StackFrame[]> processErrorCustomizers(Pair<String, StackFrame[]> errorInfo) {
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPackagerLocationCustomizer(
|
||||
DevSupportManager.PackagerLocationCustomizer packagerLocationCustomizer) {}
|
||||
|
|
|
@ -14,7 +14,7 @@ import android.widget.EditText;
|
|||
|
||||
/**
|
||||
* A class allows recognizing double key tap of "R", used to reload JS in {@link
|
||||
* AbstractReactActivity}, {@link RedBoxDialog} and {@link ReactActivity}.
|
||||
* AbstractReactActivity}, {@link RedBoxDialogSurfaceDelegate} and {@link ReactActivity}.
|
||||
*/
|
||||
public class DoubleTapReloadRecognizer {
|
||||
private boolean mDoRefresh = false;
|
||||
|
|
|
@ -55,7 +55,7 @@ public class LogBoxDialogSurfaceDelegate implements SurfaceDelegate {
|
|||
|
||||
@Override
|
||||
public void show() {
|
||||
if (isSurfaceVisible() || !isContentViewReady()) {
|
||||
if (isShowing() || !isContentViewReady()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class LogBoxDialogSurfaceDelegate implements SurfaceDelegate {
|
|||
|
||||
@Override
|
||||
public void hide() {
|
||||
if (!isSurfaceVisible()) {
|
||||
if (!isShowing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,8 @@ public class LogBoxDialogSurfaceDelegate implements SurfaceDelegate {
|
|||
mDialog = null;
|
||||
}
|
||||
|
||||
private boolean isSurfaceVisible() {
|
||||
return mDialog != null;
|
||||
@Override
|
||||
public boolean isShowing() {
|
||||
return mDialog != null && mDialog.isShowing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,21 +7,20 @@
|
|||
|
||||
package com.facebook.react.devsupport;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.text.SpannedString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.KeyEvent;
|
||||
import android.util.Pair;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
@ -31,8 +30,10 @@ import com.facebook.infer.annotation.Assertions;
|
|||
import com.facebook.react.R;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.devsupport.RedBoxHandler.ReportCompletedListener;
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
||||
import com.facebook.react.devsupport.interfaces.ErrorType;
|
||||
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
|
||||
import com.facebook.react.devsupport.interfaces.RedBoxHandler.ReportCompletedListener;
|
||||
import com.facebook.react.devsupport.interfaces.StackFrame;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
@ -41,12 +42,10 @@ import okhttp3.RequestBody;
|
|||
import org.json.JSONObject;
|
||||
|
||||
/** Dialog for displaying JS errors in an eye-catching form (red box). */
|
||||
/* package */ class RedBoxDialog extends Dialog implements AdapterView.OnItemClickListener {
|
||||
|
||||
private final DevSupportManager mDevSupportManager;
|
||||
private final DoubleTapReloadRecognizer mDoubleTapReloadRecognizer;
|
||||
private final @Nullable RedBoxHandler mRedBoxHandler;
|
||||
public class RedBoxContentView extends LinearLayout implements AdapterView.OnItemClickListener {
|
||||
|
||||
private @Nullable RedBoxHandler mRedBoxHandler;
|
||||
private DevSupportManager mDevSupportManager;
|
||||
private ListView mStackView;
|
||||
private Button mReloadJsButton;
|
||||
private Button mDismissButton;
|
||||
|
@ -235,17 +234,22 @@ import org.json.JSONObject;
|
|||
}
|
||||
}
|
||||
|
||||
protected RedBoxDialog(
|
||||
Context context, DevSupportManager devSupportManager, @Nullable RedBoxHandler redBoxHandler) {
|
||||
super(context, R.style.Theme_Catalyst_RedBox);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.redbox_view);
|
||||
public RedBoxContentView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public RedBoxContentView setDevSupportManager(DevSupportManager devSupportManager) {
|
||||
mDevSupportManager = devSupportManager;
|
||||
mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
|
||||
return this;
|
||||
}
|
||||
|
||||
public RedBoxContentView setRedBoxHandler(@Nullable RedBoxHandler redBoxHandler) {
|
||||
mRedBoxHandler = redBoxHandler;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
LayoutInflater.from(getContext()).inflate(R.layout.redbox_view, this);
|
||||
|
||||
mStackView = (ListView) findViewById(R.id.rn_redbox_stack);
|
||||
mStackView.setOnItemClickListener(this);
|
||||
|
@ -255,7 +259,7 @@ import org.json.JSONObject;
|
|||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
Assertions.assertNotNull(mDevSupportManager).handleReloadJS();
|
||||
}
|
||||
});
|
||||
mDismissButton = (Button) findViewById(R.id.rn_redbox_dismiss_button);
|
||||
|
@ -263,7 +267,7 @@ import org.json.JSONObject;
|
|||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
Assertions.assertNotNull(mDevSupportManager).hideRedboxDialog();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -297,20 +301,25 @@ import org.json.JSONObject;
|
|||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
new OpenStackFrameTask(mDevSupportManager)
|
||||
new OpenStackFrameTask(Assertions.assertNotNull(mDevSupportManager))
|
||||
.executeOnExecutor(
|
||||
AsyncTask.THREAD_POOL_EXECUTOR, (StackFrame) mStackView.getAdapter().getItem(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
mDevSupportManager.showDevOptionsDialog();
|
||||
return true;
|
||||
/** Refresh the content view with latest errors from dev support manager */
|
||||
public void refreshContentView() {
|
||||
@Nullable String message = mDevSupportManager.getLastErrorTitle();
|
||||
@Nullable StackFrame[] stack = mDevSupportManager.getLastErrorStack();
|
||||
@Nullable ErrorType errorType = mDevSupportManager.getLastErrorType();
|
||||
Pair<String, StackFrame[]> errorInfo =
|
||||
mDevSupportManager.processErrorCustomizers(Pair.create(message, stack));
|
||||
setExceptionDetails(errorInfo.first, errorInfo.second);
|
||||
|
||||
// JS errors are reported here after source mapping.
|
||||
RedBoxHandler redBoxHandler = mDevSupportManager.getRedBoxHandler();
|
||||
if (redBoxHandler != null) {
|
||||
redBoxHandler.handleRedbox(message, stack, errorType);
|
||||
resetReporting();
|
||||
}
|
||||
if (mDoubleTapReloadRecognizer.didDoubleTapR(keyCode, getCurrentFocus())) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
}
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.facebook.react.devsupport;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Window;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.R;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.SurfaceDelegate;
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
||||
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
|
||||
|
||||
/**
|
||||
* The implementation of SurfaceDelegate with {@link Activity}. This is the default SurfaceDelegate
|
||||
* for Mobile.
|
||||
*/
|
||||
public class RedBoxDialogSurfaceDelegate implements SurfaceDelegate {
|
||||
|
||||
private final DoubleTapReloadRecognizer mDoubleTapReloadRecognizer;
|
||||
private final DevSupportManager mDevSupportManager;
|
||||
|
||||
private @Nullable Dialog mDialog;
|
||||
private @Nullable RedBoxContentView mRedBoxContentView;
|
||||
|
||||
public RedBoxDialogSurfaceDelegate(DevSupportManager devSupportManager) {
|
||||
mDevSupportManager = devSupportManager;
|
||||
mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createContentView(String appKey) {
|
||||
// The content view is created in android instead of using react app. Hence the appKey is not
|
||||
// used here.
|
||||
RedBoxHandler redBoxHandler = mDevSupportManager.getRedBoxHandler();
|
||||
Activity context = mDevSupportManager.getCurrentActivity();
|
||||
// Create a new RedBox when currentActivity get updated
|
||||
mRedBoxContentView = new RedBoxContentView(context);
|
||||
mRedBoxContentView
|
||||
.setDevSupportManager(mDevSupportManager)
|
||||
.setRedBoxHandler(redBoxHandler)
|
||||
.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isContentViewReady() {
|
||||
return mRedBoxContentView != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyContentView() {
|
||||
mRedBoxContentView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
@Nullable String message = mDevSupportManager.getLastErrorTitle();
|
||||
Activity context = mDevSupportManager.getCurrentActivity();
|
||||
if (context == null || context.isFinishing()) {
|
||||
FLog.e(
|
||||
ReactConstants.TAG,
|
||||
"Unable to launch redbox because react activity "
|
||||
+ "is not available, here is the error that redbox would've displayed: "
|
||||
+ (message != null ? message : "N/A"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (mRedBoxContentView == null || mRedBoxContentView.getContext() != context) {
|
||||
// Create a new RedBox when currentActivity get updated
|
||||
createContentView("RedBox");
|
||||
}
|
||||
|
||||
mRedBoxContentView.refreshContentView();
|
||||
if (mDialog == null) {
|
||||
mDialog =
|
||||
new Dialog(context, R.style.Theme_Catalyst_RedBox) {
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
mDevSupportManager.showDevOptionsDialog();
|
||||
return true;
|
||||
}
|
||||
if (mDoubleTapReloadRecognizer.didDoubleTapR(keyCode, getCurrentFocus())) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
}
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
};
|
||||
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
mDialog.setContentView(mRedBoxContentView);
|
||||
}
|
||||
mDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
// dismiss redbox if exists
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
destroyContentView();
|
||||
mDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowing() {
|
||||
return mDialog != null && mDialog.isShowing();
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
package com.facebook.react.devsupport.interfaces;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
|
||||
|
@ -51,6 +52,8 @@ public interface DevSupportManager extends NativeModuleCallExceptionHandler {
|
|||
|
||||
DeveloperSettings getDevSettings();
|
||||
|
||||
RedBoxHandler getRedBoxHandler();
|
||||
|
||||
void onNewReactContextCreated(ReactContext reactContext);
|
||||
|
||||
void onReactInstanceDestroyed(ReactContext reactContext);
|
||||
|
@ -97,8 +100,12 @@ public interface DevSupportManager extends NativeModuleCallExceptionHandler {
|
|||
@Nullable
|
||||
ErrorType getLastErrorType();
|
||||
|
||||
int getLastErrorCookie();
|
||||
|
||||
void registerErrorCustomizer(ErrorCustomizer errorCustomizer);
|
||||
|
||||
Pair<String, StackFrame[]> processErrorCustomizers(Pair<String, StackFrame[]> errorInfo);
|
||||
|
||||
/**
|
||||
* The PackagerLocationCustomizer allows you to have a dynamic packager location that is
|
||||
* determined right before loading the packager. Your customizer must call |callback|, as loading
|
||||
|
|
|
@ -5,13 +5,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.devsupport;
|
||||
package com.facebook.react.devsupport.interfaces;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.SpannedString;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.devsupport.interfaces.ErrorType;
|
||||
import com.facebook.react.devsupport.interfaces.StackFrame;
|
||||
|
||||
/**
|
||||
* Interface used by {@link BridgeDevSupportManager} to allow interception on any redboxes during
|
|
@ -9,11 +9,11 @@
|
|||
#include <react/renderer/core/EventBeat.h>
|
||||
#include <react/renderer/uimanager/primitives.h>
|
||||
|
||||
#include "AsyncEventBeatV2.h"
|
||||
#include "AsyncEventBeat.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
AsyncEventBeatV2::AsyncEventBeatV2(
|
||||
AsyncEventBeat::AsyncEventBeat(
|
||||
EventBeat::SharedOwnerBox const &ownerBox,
|
||||
EventBeatManager *eventBeatManager,
|
||||
RuntimeExecutor runtimeExecutor,
|
||||
|
@ -25,11 +25,11 @@ AsyncEventBeatV2::AsyncEventBeatV2(
|
|||
eventBeatManager->addObserver(*this);
|
||||
}
|
||||
|
||||
AsyncEventBeatV2::~AsyncEventBeatV2() {
|
||||
AsyncEventBeat::~AsyncEventBeat() {
|
||||
eventBeatManager_->removeObserver(*this);
|
||||
}
|
||||
|
||||
void AsyncEventBeatV2::tick() const {
|
||||
void AsyncEventBeat::tick() const {
|
||||
if (!isRequested_ || isBeatCallbackScheduled_) {
|
||||
return;
|
||||
}
|
||||
|
@ -50,11 +50,11 @@ void AsyncEventBeatV2::tick() const {
|
|||
});
|
||||
}
|
||||
|
||||
void AsyncEventBeatV2::induce() const {
|
||||
void AsyncEventBeat::induce() const {
|
||||
tick();
|
||||
}
|
||||
|
||||
void AsyncEventBeatV2::request() const {
|
||||
void AsyncEventBeat::request() const {
|
||||
bool alreadyRequested = isRequested_;
|
||||
EventBeat::request();
|
||||
if (!alreadyRequested) {
|
|
@ -7,14 +7,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <jsi/jsi.h>
|
||||
#include <react/renderer/core/EventBeat.h>
|
||||
#include <react/renderer/uimanager/primitives.h>
|
||||
|
||||
#include "EventBeatManager.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
namespace facebook::react {
|
||||
|
||||
class AsyncEventBeat final : public EventBeat, public EventBeatManagerObserver {
|
||||
public:
|
||||
|
@ -22,50 +19,21 @@ class AsyncEventBeat final : public EventBeat, public EventBeatManagerObserver {
|
|||
EventBeat::SharedOwnerBox const &ownerBox,
|
||||
EventBeatManager *eventBeatManager,
|
||||
RuntimeExecutor runtimeExecutor,
|
||||
jni::global_ref<jobject> javaUIManager)
|
||||
: EventBeat(ownerBox),
|
||||
eventBeatManager_(eventBeatManager),
|
||||
runtimeExecutor_(std::move(runtimeExecutor)),
|
||||
javaUIManager_(std::move(javaUIManager)) {
|
||||
eventBeatManager->addObserver(*this);
|
||||
}
|
||||
jni::global_ref<jobject> javaUIManager);
|
||||
|
||||
~AsyncEventBeat() {
|
||||
eventBeatManager_->removeObserver(*this);
|
||||
}
|
||||
~AsyncEventBeat() override;
|
||||
|
||||
void tick() const override {
|
||||
runtimeExecutor_([this, ownerBox = ownerBox_](jsi::Runtime &runtime) {
|
||||
auto owner = ownerBox->owner.lock();
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
void tick() const override;
|
||||
|
||||
this->beat(runtime);
|
||||
});
|
||||
}
|
||||
void induce() const override;
|
||||
|
||||
void induce() const override {
|
||||
tick();
|
||||
}
|
||||
|
||||
void request() const override {
|
||||
bool alreadyRequested = isRequested_;
|
||||
EventBeat::request();
|
||||
if (!alreadyRequested) {
|
||||
// Notifies java side that an event will be dispatched (e.g. LayoutEvent)
|
||||
static auto onRequestEventBeat =
|
||||
jni::findClassStatic("com/facebook/react/fabric/FabricUIManager")
|
||||
->getMethod<void()>("onRequestEventBeat");
|
||||
onRequestEventBeat(javaUIManager_);
|
||||
}
|
||||
}
|
||||
void request() const override;
|
||||
|
||||
private:
|
||||
EventBeatManager *eventBeatManager_;
|
||||
RuntimeExecutor runtimeExecutor_;
|
||||
jni::global_ref<jobject> javaUIManager_;
|
||||
mutable std::atomic<bool> isBeatCallbackScheduled_{false};
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
} // namespace facebook::react
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/renderer/core/EventBeat.h>
|
||||
|
||||
#include "EventBeatManager.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
class AsyncEventBeatV2 final : public EventBeat,
|
||||
public EventBeatManagerObserver {
|
||||
public:
|
||||
AsyncEventBeatV2(
|
||||
EventBeat::SharedOwnerBox const &ownerBox,
|
||||
EventBeatManager *eventBeatManager,
|
||||
RuntimeExecutor runtimeExecutor,
|
||||
jni::global_ref<jobject> javaUIManager);
|
||||
|
||||
~AsyncEventBeatV2() override;
|
||||
|
||||
void tick() const override;
|
||||
|
||||
void induce() const override;
|
||||
|
||||
void request() const override;
|
||||
|
||||
private:
|
||||
EventBeatManager *eventBeatManager_;
|
||||
RuntimeExecutor runtimeExecutor_;
|
||||
jni::global_ref<jobject> javaUIManager_;
|
||||
mutable std::atomic<bool> isBeatCallbackScheduled_{false};
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "Binding.h"
|
||||
#include "AsyncEventBeat.h"
|
||||
#include "AsyncEventBeatV2.h"
|
||||
#include "EventEmitterWrapper.h"
|
||||
#include "ReactNativeConfigHolder.h"
|
||||
#include "StateWrapperImpl.h"
|
||||
|
@ -60,9 +59,8 @@ Binding::getInspectorDataForInstance(
|
|||
}
|
||||
|
||||
EventEmitterWrapper *cEventEmitter = cthis(eventEmitterWrapper);
|
||||
InspectorData data = scheduler->getInspectorDataForInstance(
|
||||
enableEventEmitterRawPointer_ ? *cEventEmitter->eventEmitterPointer
|
||||
: *cEventEmitter->eventEmitter);
|
||||
InspectorData data =
|
||||
scheduler->getInspectorDataForInstance(*cEventEmitter->eventEmitter);
|
||||
|
||||
folly::dynamic result = folly::dynamic::object;
|
||||
result["fileName"] = data.fileName;
|
||||
|
@ -266,13 +264,37 @@ void Binding::stopSurface(jint surfaceId) {
|
|||
}
|
||||
|
||||
void Binding::registerSurface(SurfaceHandlerBinding *surfaceHandlerBinding) {
|
||||
auto const &surfaceHandler = surfaceHandlerBinding->getSurfaceHandler();
|
||||
auto scheduler = getScheduler();
|
||||
scheduler->registerSurface(surfaceHandlerBinding->getSurfaceHandler());
|
||||
if (!scheduler) {
|
||||
LOG(ERROR) << "Binding::registerSurface: scheduler disappeared";
|
||||
return;
|
||||
}
|
||||
scheduler->registerSurface(surfaceHandler);
|
||||
|
||||
auto mountingManager =
|
||||
verifyMountingManager("FabricUIManagerBinding::registerSurface");
|
||||
if (!mountingManager) {
|
||||
return;
|
||||
}
|
||||
mountingManager->onSurfaceStart(surfaceHandler.getSurfaceId());
|
||||
}
|
||||
|
||||
void Binding::unregisterSurface(SurfaceHandlerBinding *surfaceHandlerBinding) {
|
||||
auto const &surfaceHandler = surfaceHandlerBinding->getSurfaceHandler();
|
||||
auto scheduler = getScheduler();
|
||||
scheduler->unregisterSurface(surfaceHandlerBinding->getSurfaceHandler());
|
||||
if (!scheduler) {
|
||||
LOG(ERROR) << "Binding::unregisterSurface: scheduler disappeared";
|
||||
return;
|
||||
}
|
||||
scheduler->unregisterSurface(surfaceHandler);
|
||||
|
||||
auto mountingManager =
|
||||
verifyMountingManager("FabricUIManagerBinding::unregisterSurface");
|
||||
if (!mountingManager) {
|
||||
return;
|
||||
}
|
||||
mountingManager->onSurfaceStop(surfaceHandler.getSurfaceId());
|
||||
}
|
||||
|
||||
void Binding::setConstraints(
|
||||
|
@ -345,9 +367,6 @@ void Binding::installFabricUIManager(
|
|||
disableRevisionCheckForPreallocation_ =
|
||||
config->getBool("react_fabric:disable_revision_check_for_preallocation");
|
||||
|
||||
enableEventEmitterRawPointer_ =
|
||||
config->getBool("react_fabric:enable_event_emitter_wrapper_raw_pointer");
|
||||
|
||||
if (enableFabricLogs_) {
|
||||
LOG(WARNING) << "Binding::installFabricUIManager() was called (address: "
|
||||
<< this << ").";
|
||||
|
@ -369,46 +388,34 @@ void Binding::installFabricUIManager(
|
|||
if (runtimeSchedulerHolder) {
|
||||
auto runtimeScheduler = runtimeSchedulerHolder->cthis()->get().lock();
|
||||
if (runtimeScheduler) {
|
||||
runtimeScheduler->setEnableYielding(config->getBool(
|
||||
"react_native_new_architecture:runtimescheduler_enable_yielding_android"));
|
||||
runtimeExecutor =
|
||||
[runtimeScheduler](
|
||||
std::function<void(jsi::Runtime & runtime)> &&callback) {
|
||||
runtimeScheduler->scheduleWork(std::move(callback));
|
||||
};
|
||||
contextContainer->insert(
|
||||
"RuntimeScheduler",
|
||||
std::weak_ptr<RuntimeScheduler>(runtimeScheduler));
|
||||
}
|
||||
}
|
||||
|
||||
auto enableV2AsynchronousEventBeat =
|
||||
config->getBool("react_fabric:enable_asynchronous_event_beat_v2_android");
|
||||
|
||||
// TODO: T31905686 Create synchronous Event Beat
|
||||
EventBeat::Factory synchronousBeatFactory =
|
||||
[eventBeatManager,
|
||||
runtimeExecutor,
|
||||
globalJavaUiManager,
|
||||
enableV2AsynchronousEventBeat](EventBeat::SharedOwnerBox const &ownerBox)
|
||||
[eventBeatManager, runtimeExecutor, globalJavaUiManager](
|
||||
EventBeat::SharedOwnerBox const &ownerBox)
|
||||
-> std::unique_ptr<EventBeat> {
|
||||
if (enableV2AsynchronousEventBeat) {
|
||||
return std::make_unique<AsyncEventBeatV2>(
|
||||
ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager);
|
||||
} else {
|
||||
return std::make_unique<AsyncEventBeat>(
|
||||
ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager);
|
||||
}
|
||||
return std::make_unique<AsyncEventBeat>(
|
||||
ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager);
|
||||
};
|
||||
|
||||
EventBeat::Factory asynchronousBeatFactory =
|
||||
[eventBeatManager,
|
||||
runtimeExecutor,
|
||||
globalJavaUiManager,
|
||||
enableV2AsynchronousEventBeat](EventBeat::SharedOwnerBox const &ownerBox)
|
||||
[eventBeatManager, runtimeExecutor, globalJavaUiManager](
|
||||
EventBeat::SharedOwnerBox const &ownerBox)
|
||||
-> std::unique_ptr<EventBeat> {
|
||||
if (enableV2AsynchronousEventBeat) {
|
||||
return std::make_unique<AsyncEventBeatV2>(
|
||||
ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager);
|
||||
} else {
|
||||
return std::make_unique<AsyncEventBeat>(
|
||||
ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager);
|
||||
}
|
||||
return std::make_unique<AsyncEventBeat>(
|
||||
ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager);
|
||||
};
|
||||
|
||||
contextContainer->insert("ReactNativeConfig", config);
|
||||
|
|
|
@ -155,7 +155,6 @@ class Binding : public jni::HybridClass<Binding>,
|
|||
bool disablePreallocateViews_{false};
|
||||
bool enableFabricLogs_{false};
|
||||
bool disableRevisionCheckForPreallocation_{false};
|
||||
bool enableEventEmitterRawPointer_{false};
|
||||
bool dispatchPreallocationInBackground_{false};
|
||||
};
|
||||
|
||||
|
|
|
@ -22,15 +22,6 @@ void EventEmitterWrapper::invokeEvent(
|
|||
std::string const &eventName,
|
||||
NativeMap *payload,
|
||||
int category) {
|
||||
if (eventEmitterPointer) {
|
||||
eventEmitterPointer->dispatchEvent(
|
||||
eventName,
|
||||
payload->consume(),
|
||||
EventPriority::AsynchronousBatched,
|
||||
static_cast<RawEvent::Category>(category));
|
||||
return;
|
||||
}
|
||||
|
||||
// It is marginal, but possible for this to be constructed without a valid
|
||||
// EventEmitter. In those cases, make sure we noop/blackhole events instead of
|
||||
// crashing.
|
||||
|
@ -47,10 +38,6 @@ void EventEmitterWrapper::invokeUniqueEvent(
|
|||
std::string const &eventName,
|
||||
NativeMap *payload,
|
||||
int customCoalesceKey) {
|
||||
if (eventEmitterPointer) {
|
||||
eventEmitterPointer->dispatchUniqueEvent(eventName, payload->consume());
|
||||
return;
|
||||
}
|
||||
// TODO: customCoalesceKey currently unused
|
||||
// It is marginal, but possible for this to be constructed without a valid
|
||||
// EventEmitter. In those cases, make sure we noop/blackhole events instead of
|
||||
|
|
|
@ -24,7 +24,6 @@ class EventEmitterWrapper : public jni::HybridClass<EventEmitterWrapper> {
|
|||
static void registerNatives();
|
||||
|
||||
SharedEventEmitter eventEmitter;
|
||||
EventEmitter const *eventEmitterPointer;
|
||||
|
||||
void
|
||||
invokeEvent(std::string const &eventName, NativeMap *params, int category);
|
||||
|
|
|
@ -545,11 +545,7 @@ void FabricMountingManager::executeMount(
|
|||
mountItem.newChildShadowView.eventEmitter;
|
||||
auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs();
|
||||
EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter);
|
||||
if (enableEventEmitterRawPointer_) {
|
||||
cEventEmitter->eventEmitterPointer = eventEmitter.get();
|
||||
} else {
|
||||
cEventEmitter->eventEmitter = eventEmitter;
|
||||
}
|
||||
cEventEmitter->eventEmitter = eventEmitter;
|
||||
temp[0] = mountItem.newChildShadowView.tag;
|
||||
temp[1] = isLayoutable;
|
||||
env->SetIntArrayRegion(intBufferArray, intBufferPosition, 2, temp);
|
||||
|
@ -729,11 +725,7 @@ void FabricMountingManager::executeMount(
|
|||
// Do not hold a reference to javaEventEmitter from the C++ side.
|
||||
auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs();
|
||||
EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter);
|
||||
if (enableEventEmitterRawPointer_) {
|
||||
cEventEmitter->eventEmitterPointer = eventEmitter.get();
|
||||
} else {
|
||||
cEventEmitter->eventEmitter = eventEmitter;
|
||||
}
|
||||
cEventEmitter->eventEmitter = eventEmitter;
|
||||
|
||||
(*objBufferArray)[objBufferPosition++] = javaEventEmitter.get();
|
||||
}
|
||||
|
@ -830,11 +822,7 @@ void FabricMountingManager::preallocateShadowView(
|
|||
if (eventEmitter != nullptr) {
|
||||
javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs();
|
||||
EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter);
|
||||
if (enableEventEmitterRawPointer_) {
|
||||
cEventEmitter->eventEmitterPointer = eventEmitter.get();
|
||||
} else {
|
||||
cEventEmitter->eventEmitter = eventEmitter;
|
||||
}
|
||||
cEventEmitter->eventEmitter = eventEmitter;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -947,8 +935,6 @@ FabricMountingManager::FabricMountingManager(
|
|||
: javaUIManager_(javaUIManager) {
|
||||
enableEarlyEventEmitterUpdate_ =
|
||||
config->getBool("react_fabric:enable_early_event_emitter_update");
|
||||
enableEventEmitterRawPointer_ =
|
||||
config->getBool("react_fabric:enable_event_emitter_wrapper_raw_pointer");
|
||||
disablePreallocateViews_ =
|
||||
config->getBool("react_fabric:disabled_view_preallocation_android");
|
||||
disableRevisionCheckForPreallocation_ =
|
||||
|
|
|
@ -71,7 +71,6 @@ class FabricMountingManager {
|
|||
butter::map<SurfaceId, butter::set<Tag>> allocatedViewRegistry_{};
|
||||
std::recursive_mutex allocatedViewsMutex_;
|
||||
|
||||
bool enableEventEmitterRawPointer_{false};
|
||||
bool enableEarlyEventEmitterUpdate_{false};
|
||||
bool disablePreallocateViews_{false};
|
||||
bool disableRevisionCheckForPreallocation_{false};
|
||||
|
|
|
@ -548,7 +548,8 @@ public class SurfaceMountingManager {
|
|||
// generated.
|
||||
// This represents a perf issue only, not a correctness issue. In the future we need to
|
||||
// refactor View preallocation to correct the currently incorrect assumptions.
|
||||
if (getNullableViewState(reactTag) != null) {
|
||||
ViewState viewState = getNullableViewState(reactTag);
|
||||
if (viewState != null && viewState.mView != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.nio.charset.Charset;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import okhttp3.Call;
|
||||
|
@ -376,7 +377,9 @@ public final class NetworkingModule extends NativeNetworkingAndroidSpec {
|
|||
}
|
||||
|
||||
RequestBody requestBody;
|
||||
if (data == null || method.toLowerCase().equals("get") || method.toLowerCase().equals("head")) {
|
||||
if (data == null
|
||||
|| method.toLowerCase(Locale.ROOT).equals("get")
|
||||
|| method.toLowerCase(Locale.ROOT).equals("head")) {
|
||||
requestBody = RequestBodyUtil.getEmptyBody(method);
|
||||
} else if (handler != null) {
|
||||
requestBody = handler.toRequestBody(data, contentType);
|
||||
|
|
|
@ -190,7 +190,7 @@ public class StatusBarModule extends NativeStatusBarManagerAndroidSpec {
|
|||
@TargetApi(Build.VERSION_CODES.R)
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
|
||||
WindowInsetsController insetsController = activity.getWindow().getInsetsController();
|
||||
if ("dark-content".equals(style)) {
|
||||
// dark-content means dark icons on a light status bar
|
||||
|
|
|
@ -14,10 +14,12 @@ rn_android_library(
|
|||
],
|
||||
),
|
||||
autoglob = False,
|
||||
exported_provided_deps = [
|
||||
react_native_dep("third-party/android/androidx:annotation"),
|
||||
],
|
||||
is_androidx = True,
|
||||
labels = ["supermodule:xplat/default/public.react_native.infra"],
|
||||
provided_deps = [
|
||||
react_native_dep("third-party/android/androidx:annotation"),
|
||||
react_native_dep("third-party/android/androidx:core"),
|
||||
react_native_dep("third-party/android/androidx:fragment"),
|
||||
react_native_dep("third-party/android/androidx:legacy-support-core-ui"),
|
||||
|
@ -51,7 +53,6 @@ rn_android_library(
|
|||
],
|
||||
exported_deps = [
|
||||
":DisplayMetrics",
|
||||
react_native_dep("third-party/android/androidx:annotation"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/uimanager/common:common"),
|
||||
react_native_target("java/com/facebook/react/uimanager/interfaces:interfaces"),
|
||||
|
@ -76,7 +77,6 @@ rn_android_library(
|
|||
deps = [
|
||||
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/android/androidx:annotation"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
react_native_target("java/com/facebook/react/common:common"),
|
||||
|
|
|
@ -486,18 +486,103 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
|||
FLog.w(ReactConstants.TAG, "%s doesn't support property '%s'", getName(), propName);
|
||||
}
|
||||
|
||||
@ReactProp(name = "pointerenter")
|
||||
public void setPointerEnter(@NonNull T view, @Nullable boolean value) {
|
||||
@ReactProp(name = "onPointerEnter")
|
||||
public void setPointerEnter(@NonNull T view, boolean value) {
|
||||
view.setTag(R.id.pointer_enter, value);
|
||||
}
|
||||
|
||||
@ReactProp(name = "pointerleave")
|
||||
public void setPointerLeave(@NonNull T view, @Nullable boolean value) {
|
||||
@ReactProp(name = "onPointerLeave")
|
||||
public void setPointerLeave(@NonNull T view, boolean value) {
|
||||
view.setTag(R.id.pointer_leave, value);
|
||||
}
|
||||
|
||||
@ReactProp(name = "pointermove")
|
||||
public void setPointerMove(@NonNull T view, @Nullable boolean value) {
|
||||
@ReactProp(name = "onPointerMove")
|
||||
public void setPointerMove(@NonNull T view, boolean value) {
|
||||
view.setTag(R.id.pointer_move, value);
|
||||
}
|
||||
|
||||
@ReactProp(name = "onMoveShouldSetResponder")
|
||||
public void setMoveShouldSetResponder(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onMoveShouldSetResponderCapture")
|
||||
public void setMoveShouldSetResponderCapture(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onStartShouldSetResponder")
|
||||
public void setStartShouldSetResponder(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onStartShouldSetResponderCapture")
|
||||
public void setStartShouldSetResponderCapture(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onResponderGrant")
|
||||
public void setResponderGrant(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onResponderReject")
|
||||
public void setResponderReject(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onResponderStart")
|
||||
public void setResponderStart(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onResponderEnd")
|
||||
public void setResponderEnd(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onResponderRelease")
|
||||
public void setResponderRelease(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onResponderMove")
|
||||
public void setResponderMove(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onResponderTerminate")
|
||||
public void setResponderTerminate(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onResponderTerminationRequest")
|
||||
public void setResponderTerminationRequest(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onShouldBlockNativeResponder")
|
||||
public void setShouldBlockNativeResponder(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onTouchStart")
|
||||
public void setTouchStart(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onTouchMove")
|
||||
public void setTouchMove(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onTouchEnd")
|
||||
public void setTouchEnd(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
|
||||
@ReactProp(name = "onTouchCancel")
|
||||
public void setTouchCancel(@NonNull T view, boolean value) {
|
||||
// no-op, handled by JSResponder
|
||||
}
|
||||
}
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче