mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Move MutationObserver to react-native/src/private (#45791)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45791 Changelog: [internal] These files are safe to move because they haven't been enabled in OSS and people shouldn't be importing them directly. Reviewed By: rshest Differential Revision: D60377869 fbshipit-source-id: 02bc0335385859c0589a494de9b59b0c2ebc06f6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e84d313209
commit
8a4ddab2c2
@@ -1,13 +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.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
export * from '../../src/private/specs/modules/NativeMutationObserver';
|
||||
import NativeMutationObserver from '../../src/private/specs/modules/NativeMutationObserver';
|
||||
export default NativeMutationObserver;
|
||||
@@ -6393,83 +6393,6 @@ declare export default typeof RCTModalHostViewNativeComponent;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/MutationObserver/MutationObserver.js 1`] = `
|
||||
"export type MutationObserverCallback = (
|
||||
mutationRecords: $ReadOnlyArray<MutationRecord>,
|
||||
observer: MutationObserver
|
||||
) => mixed;
|
||||
type MutationObserverInit = $ReadOnly<{
|
||||
subtree?: boolean,
|
||||
childList: true,
|
||||
attributes?: boolean,
|
||||
attributeFilter?: $ReadOnlyArray<string>,
|
||||
attributeOldValue?: boolean,
|
||||
characterData?: boolean,
|
||||
characterDataOldValue?: boolean,
|
||||
}>;
|
||||
declare export default class MutationObserver {
|
||||
_callback: MutationObserverCallback;
|
||||
_observationTargets: Set<ReactNativeElement>;
|
||||
_mutationObserverId: ?MutationObserverId;
|
||||
constructor(callback: MutationObserverCallback): void;
|
||||
observe(target: ReactNativeElement, options?: MutationObserverInit): void;
|
||||
_unobserve(target: ReactNativeElement): void;
|
||||
disconnect(): void;
|
||||
_getOrCreateMutationObserverId(): MutationObserverId;
|
||||
__getObserverID(): ?MutationObserverId;
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/MutationObserver/MutationObserverManager.js 1`] = `
|
||||
"export type MutationObserverId = number;
|
||||
declare export function registerObserver(
|
||||
observer: MutationObserver,
|
||||
callback: MutationObserverCallback
|
||||
): MutationObserverId;
|
||||
declare export function unregisterObserver(
|
||||
mutationObserverId: MutationObserverId
|
||||
): void;
|
||||
declare export function observe({
|
||||
mutationObserverId: MutationObserverId,
|
||||
target: ReactNativeElement,
|
||||
subtree: boolean,
|
||||
}): void;
|
||||
declare export function unobserve(
|
||||
mutationObserverId: number,
|
||||
target: ReactNativeElement
|
||||
): void;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/MutationObserver/MutationRecord.js 1`] = `
|
||||
"export type MutationType = \\"attributes\\" | \\"characterData\\" | \\"childList\\";
|
||||
declare export default class MutationRecord {
|
||||
_target: ReactNativeElement;
|
||||
_addedNodes: NodeList<ReadOnlyNode>;
|
||||
_removedNodes: NodeList<ReadOnlyNode>;
|
||||
constructor(nativeRecord: NativeMutationRecord): void;
|
||||
get addedNodes(): NodeList<ReadOnlyNode>;
|
||||
get attributeName(): string | null;
|
||||
get nextSibling(): ReadOnlyNode | null;
|
||||
get oldValue(): mixed | null;
|
||||
get previousSibling(): ReadOnlyNode | null;
|
||||
get removedNodes(): NodeList<ReadOnlyNode>;
|
||||
get target(): ReactNativeElement;
|
||||
get type(): MutationType;
|
||||
}
|
||||
declare export function createMutationRecord(
|
||||
entry: NativeMutationRecord
|
||||
): MutationRecord;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/MutationObserver/NativeMutationObserver.js 1`] = `
|
||||
"export * from \\"../../src/private/specs/modules/NativeMutationObserver\\";
|
||||
declare export default typeof NativeMutationObserver;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/NativeComponent/BaseViewConfig.js.flow 1`] = `
|
||||
"declare const PlatformBaseViewConfig: PartialViewConfigWithoutName;
|
||||
declare export default typeof PlatformBaseViewConfig;
|
||||
|
||||
@@ -41,7 +41,7 @@ const FILES_WITH_KNOWN_ERRORS = new Set([
|
||||
'Libraries/Core/setUpErrorHandling.js',
|
||||
'Libraries/Core/setUpGlobals.js',
|
||||
'src/private/setup/setUpIntersectionObserver.js',
|
||||
'Libraries/Core/setUpMutationObserver.js',
|
||||
'src/private/setup/setUpMutationObserver.js',
|
||||
'Libraries/Core/setUpNavigator.js',
|
||||
'Libraries/Core/setUpPerformance.js',
|
||||
'Libraries/Core/setUpPerformanceObserver.js',
|
||||
|
||||
+2
-2
@@ -8,9 +8,9 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {polyfillGlobal} from '../Utilities/PolyfillFunctions';
|
||||
import {polyfillGlobal} from '../../../Libraries/Utilities/PolyfillFunctions';
|
||||
|
||||
polyfillGlobal(
|
||||
'MutationObserver',
|
||||
() => require('../MutationObserver/MutationObserver').default,
|
||||
() => require('../webapis/mutationobserver/MutationObserver').default,
|
||||
);
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
import type {MutationObserverId} from './MutationObserverManager';
|
||||
import type MutationRecord from './MutationRecord';
|
||||
|
||||
import ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
import ReactNativeElement from '../dom/nodes/ReactNativeElement';
|
||||
import * as MutationObserverManager from './MutationObserverManager';
|
||||
|
||||
export type MutationObserverCallback = (
|
||||
+5
-5
@@ -18,20 +18,20 @@
|
||||
* the notifications together.
|
||||
*/
|
||||
|
||||
import type ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
import type ReactNativeElement from '../dom/nodes/ReactNativeElement';
|
||||
import type MutationObserver, {
|
||||
MutationObserverCallback,
|
||||
} from './MutationObserver';
|
||||
import type MutationRecord from './MutationRecord';
|
||||
|
||||
import * as Systrace from '../../../../Libraries/Performance/Systrace';
|
||||
import warnOnce from '../../../../Libraries/Utilities/warnOnce';
|
||||
import {
|
||||
getPublicInstanceFromInternalInstanceHandle,
|
||||
getShadowNode,
|
||||
} from '../../src/private/webapis/dom/nodes/ReadOnlyNode';
|
||||
import * as Systrace from '../Performance/Systrace';
|
||||
import warnOnce from '../Utilities/warnOnce';
|
||||
} from '../dom/nodes/ReadOnlyNode';
|
||||
import {createMutationRecord} from './MutationRecord';
|
||||
import NativeMutationObserver from './NativeMutationObserver';
|
||||
import NativeMutationObserver from './specs/NativeMutationObserver';
|
||||
|
||||
export type MutationObserverId = number;
|
||||
|
||||
+4
-6
@@ -10,13 +10,11 @@
|
||||
|
||||
// flowlint unsafe-getters-setters:off
|
||||
|
||||
import type ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
import type ReadOnlyNode from '../../src/private/webapis/dom/nodes/ReadOnlyNode';
|
||||
import type {NativeMutationRecord} from './NativeMutationObserver';
|
||||
import type ReactNativeElement from '../dom/nodes/ReactNativeElement';
|
||||
import type ReadOnlyNode from '../dom/nodes/ReadOnlyNode';
|
||||
import type {NativeMutationRecord} from './specs/NativeMutationObserver';
|
||||
|
||||
import NodeList, {
|
||||
createNodeList,
|
||||
} from '../../src/private/webapis/dom/oldstylecollections/NodeList';
|
||||
import NodeList, {createNodeList} from '../dom/oldstylecollections/NodeList';
|
||||
|
||||
export type MutationType = 'attributes' | 'characterData' | 'childList';
|
||||
|
||||
+2
-2
@@ -8,9 +8,9 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
|
||||
import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
|
||||
|
||||
import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
|
||||
import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type MutationObserverId = number;
|
||||
|
||||
+5
-5
@@ -15,12 +15,12 @@
|
||||
* JavaScript as an integration test using only public APIs.
|
||||
*/
|
||||
|
||||
import type {NodeSet} from '../../ReactNative/FabricUIManager';
|
||||
import type {RootTag} from '../../ReactNative/RootTag';
|
||||
import type {NodeSet} from '../../../../../../Libraries/ReactNative/FabricUIManager';
|
||||
import type {RootTag} from '../../../../../../Libraries/ReactNative/RootTag';
|
||||
import type {
|
||||
InternalInstanceHandle,
|
||||
Node,
|
||||
} from '../../Renderer/shims/ReactNativeTypes';
|
||||
} from '../../../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
||||
import type {
|
||||
MutationObserverId,
|
||||
NativeMutationObserverObserveOptions,
|
||||
@@ -28,14 +28,14 @@ import type {
|
||||
Spec,
|
||||
} from '../NativeMutationObserver';
|
||||
|
||||
import ReadOnlyNode from '../../../src/private/webapis/dom/nodes/ReadOnlyNode';
|
||||
import {
|
||||
type NodeMock,
|
||||
type UIManagerCommitHook,
|
||||
fromNode,
|
||||
getFabricUIManager,
|
||||
getNodeInChildSet,
|
||||
} from '../../ReactNative/__mocks__/FabricUIManager';
|
||||
} from '../../../../../../Libraries/ReactNative/__mocks__/FabricUIManager';
|
||||
import ReadOnlyNode from '../../../dom/nodes/ReadOnlyNode';
|
||||
import invariant from 'invariant';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
@@ -15,8 +15,8 @@ import {RNTesterThemeContext} from '../../components/RNTesterTheme';
|
||||
import * as React from 'react';
|
||||
import {type ElementRef, useContext, useEffect, useRef, useState} from 'react';
|
||||
import {Pressable, ScrollView, StyleSheet, Text, View} from 'react-native';
|
||||
import MutationObserver from 'react-native/Libraries/MutationObserver/MutationObserver';
|
||||
import ReadOnlyElement from 'react-native/src/private/webapis/dom/nodes/ReadOnlyElement';
|
||||
import MutationObserver from 'react-native/src/private/webapis/mutationobserver/MutationObserver';
|
||||
|
||||
export const name = 'MutationObserver Example';
|
||||
export const title = name;
|
||||
|
||||
+1
-1
@@ -11,9 +11,9 @@
|
||||
import type DOMRectReadOnly from 'react-native/src/private/webapis/dom/geometry/DOMRectReadOnly';
|
||||
import type ReadOnlyNode from 'react-native/src/private/webapis/dom/nodes/ReadOnlyNode';
|
||||
|
||||
import MutationObserver from 'react-native/Libraries/MutationObserver/MutationObserver';
|
||||
import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
import IntersectionObserver from 'react-native/src/private/webapis/intersectionobserver/IntersectionObserver';
|
||||
import MutationObserver from 'react-native/src/private/webapis/mutationobserver/MutationObserver';
|
||||
|
||||
export type VisualElement = {
|
||||
time: number,
|
||||
|
||||
Reference in New Issue
Block a user