first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

22
node_modules/react-native/Libraries/Renderer/README.md generated vendored Normal file
View File

@@ -0,0 +1,22 @@
# React & React Native Versions
This page describes how React and React Native versions interact each other.
The version alignment between the two frameworks relies on two synchronization points:
1. The versions in the `package.json` of the new app template. For example [for React Native 0.68.1](https://github.com/facebook/react-native/blob/0.68-stable/template/package.json#L12-L15) the versions are aligned as follows:
```
"dependencies": {
"react": "17.0.2",
"react-native": "0.68.1"
},
```
1. The React renderers **shipped** with React Native inside this folder, the [./Libraries/Renderer](https://github.com/facebook/react-native/tree/main/Libraries/Renderer) folder, of React Native.
This practically means that you **can't bump** the version of React in your `package.json` to a later version,
as you will still be using the older renderer from the folder mentioned above. Bumping the react version in your `package.json` will lead to unexpected behaviors.
For the sake of React 18, the first version of React Native compatible with React 18 is **0.69.0**. Users on React Native 0.68.0 and previous versions won't be able to use React 18.
If you use the [React Native Upgrade Helper](https://react-native-community.github.io/upgrade-helper/), you'll bump to the correct React version once you upgrade React Native.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
/**
* 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.
*
* @noformat
* @nolint
* @flow
* @generated SignedSource<<cf323fc5ca893bab5669c7d321660412>>
*/
'use strict';
import {BatchedBridge} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
import type {ReactFabricType} from './ReactNativeTypes';
let ReactFabric: ReactFabricType;
if (__DEV__) {
ReactFabric = require('../implementations/ReactFabric-dev');
} else {
ReactFabric = require('../implementations/ReactFabric-prod');
}
global.RN$stopSurface = ReactFabric.stopSurface;
if (global.RN$Bridgeless !== true) {
BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
}
export default ReactFabric;

View File

@@ -0,0 +1,19 @@
/**
* 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.
*
* @noformat
* @nolint
* @flow strict-local
* @generated SignedSource<<908f5fb85384725318e261f40e49d9a6>>
*/
'use strict';
const ReactFeatureFlags = {
debugRenderPhaseSideEffects: false,
};
export default ReactFeatureFlags;

View File

@@ -0,0 +1,26 @@
/**
* 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.
*
* @noformat
* @nolint
* @flow
*
* This file is no longer sync'd from the facebook/react repository.
* The version compatability check is removed. Use at your own risk.
*/
'use strict';
import type {ReactNativeType} from './ReactNativeTypes';
let ReactNative: ReactNativeType;
if (__DEV__) {
ReactNative = require('../implementations/ReactNativeRenderer-dev');
} else {
ReactNative = require('../implementations/ReactNativeRenderer-prod');
}
export default ReactNative;

View File

@@ -0,0 +1,258 @@
/**
* 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.
*
* @noformat
* @nolint
* @flow strict
* @generated SignedSource<<c0e57723772ea5f1aa8c3c897ac3c216>>
*/
import type {
// $FlowFixMe[nonstrict-import] TODO(@rubennorte)
HostInstance as PublicInstance,
// $FlowFixMe[nonstrict-import] TODO(@rubennorte)
MeasureOnSuccessCallback,
// $FlowFixMe[nonstrict-import] TODO(@rubennorte)
PublicRootInstance,
// $FlowFixMe[nonstrict-import] TODO(@rubennorte)
PublicTextInstance,
} from 'react-native';
import * as React from 'react';
export type AttributeType<T, V> =
| true
| $ReadOnly<{
diff?: (arg1: T, arg2: T) => boolean,
process?: (arg1: V) => T,
}>;
// We either force that `diff` and `process` always use mixed,
// or we allow them to define specific types and use this hack
export type AnyAttributeType = AttributeType<$FlowFixMe, $FlowFixMe>;
export type AttributeConfiguration = $ReadOnly<{
[propName: string]: AnyAttributeType | void,
style?: $ReadOnly<{
[propName: string]: AnyAttributeType,
...
}>,
...
}>;
export type ViewConfig = $ReadOnly<{
Commands?: $ReadOnly<{[commandName: string]: number, ...}>,
Constants?: $ReadOnly<{[name: string]: mixed, ...}>,
Manager?: string,
NativeProps?: $ReadOnly<{[propName: string]: string, ...}>,
baseModuleName?: ?string,
bubblingEventTypes?: $ReadOnly<{
[eventName: string]: $ReadOnly<{
phasedRegistrationNames: $ReadOnly<{
captured: string,
bubbled: string,
skipBubbling?: ?boolean,
}>,
}>,
...
}>,
directEventTypes?: $ReadOnly<{
[eventName: string]: $ReadOnly<{
registrationName: string,
}>,
...
}>,
supportsRawText?: boolean,
uiViewClassName: string,
validAttributes: AttributeConfiguration,
}>;
export type PartialViewConfig = $ReadOnly<{
bubblingEventTypes?: ViewConfig['bubblingEventTypes'],
directEventTypes?: ViewConfig['directEventTypes'],
supportsRawText?: boolean,
uiViewClassName: string,
validAttributes?: AttributeConfiguration,
}>;
type InspectorDataProps = $ReadOnly<{
[propName: string]: string,
...
}>;
type InspectorDataGetter = (
<TElementType: React.ElementType>(
componentOrHandle: React.ElementRef<TElementType> | number,
) => ?number,
) => $ReadOnly<{
measure: (callback: MeasureOnSuccessCallback) => void,
props: InspectorDataProps,
}>;
export type InspectorData = $ReadOnly<{
closestInstance?: mixed,
hierarchy: Array<{
name: ?string,
getInspectorData: InspectorDataGetter,
}>,
selectedIndex: ?number,
props: InspectorDataProps,
componentStack: string,
}>;
export type TouchedViewDataAtPoint = $ReadOnly<
{
pointerY: number,
touchedViewTag?: number,
frame: $ReadOnly<{
top: number,
left: number,
width: number,
height: number,
}>,
closestPublicInstance?: PublicInstance,
} & InspectorData,
>;
export type RenderRootOptions = {
onUncaughtError?: (
error: mixed,
errorInfo: {+componentStack?: ?string},
) => void,
onCaughtError?: (
error: mixed,
errorInfo: {
+componentStack?: ?string,
// $FlowFixMe[unclear-type] unknown props and state.
// $FlowFixMe[value-as-type] Component in react repo is any-typed, but it will be well typed externally.
+errorBoundary?: ?React.Component<any, any>,
},
) => void,
onRecoverableError?: (
error: mixed,
errorInfo: {+componentStack?: ?string},
) => void,
onDefaultTransitionIndicator?: () => void | (() => void),
};
/**
* Flat ReactNative renderer bundles are too big for Flow to parse efficiently.
* Provide minimal Flow typing for the high-level RN API and call it a day.
*/
export type ReactNativeType = {
findHostInstance_DEPRECATED<TElementType: React.ElementType>(
componentOrHandle: ?(React.ElementRef<TElementType> | number),
): ?PublicInstance,
findNodeHandle<TElementType: React.ElementType>(
componentOrHandle: ?(React.ElementRef<TElementType> | number),
): ?number,
isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean,
dispatchCommand(
handle: PublicInstance,
command: string,
args: Array<mixed>,
): void,
sendAccessibilityEvent(handle: PublicInstance, eventType: string): void,
render(
element: React.MixedElement,
containerTag: number,
callback: ?() => void,
options: ?RenderRootOptions,
): ?React.ElementRef<React.ElementType>,
unmountComponentAtNode(containerTag: number): void,
unmountComponentAtNodeAndRemoveContainer(containerTag: number): void,
+unstable_batchedUpdates: <T>(fn: (T) => void, bookkeeping: T) => void,
...
};
export opaque type Node = mixed;
export opaque type InternalInstanceHandle = mixed;
export type ReactFabricType = {
findHostInstance_DEPRECATED<TElementType: React.ElementType>(
componentOrHandle: ?(React.ElementRef<TElementType> | number),
): ?PublicInstance,
findNodeHandle<TElementType: React.ElementType>(
componentOrHandle: ?(React.ElementRef<TElementType> | number),
): ?number,
dispatchCommand(
handle: PublicInstance,
command: string,
args: Array<mixed>,
): void,
isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean,
sendAccessibilityEvent(handle: PublicInstance, eventType: string): void,
render(
element: React.MixedElement,
containerTag: number,
callback: ?() => void,
concurrentRoot: ?boolean,
options: ?RenderRootOptions,
): ?React.ElementRef<React.ElementType>,
unmountComponentAtNode(containerTag: number): void,
getNodeFromInternalInstanceHandle(
internalInstanceHandle: InternalInstanceHandle,
): ?Node,
getPublicInstanceFromInternalInstanceHandle(
internalInstanceHandle: InternalInstanceHandle,
): PublicInstance | PublicTextInstance | null,
getPublicInstanceFromRootTag(rootTag: number): PublicRootInstance | null,
...
};
export type ReactFabricEventTouch = {
identifier: number,
locationX: number,
locationY: number,
pageX: number,
pageY: number,
screenX: number,
screenY: number,
target: number,
timestamp: number,
force: number,
...
};
export type ReactFabricEvent = {
touches: Array<ReactFabricEventTouch>,
changedTouches: Array<ReactFabricEventTouch>,
targetTouches: Array<ReactFabricEventTouch>,
target: number,
...
};
// Imperative LayoutAnimation API types
//
export type LayoutAnimationType =
| 'spring'
| 'linear'
| 'easeInEaseOut'
| 'easeIn'
| 'easeOut'
| 'keyboard';
export type LayoutAnimationProperty =
| 'opacity'
| 'scaleX'
| 'scaleY'
| 'scaleXY';
export type LayoutAnimationAnimationConfig = $ReadOnly<{
duration?: number,
delay?: number,
springDamping?: number,
initialVelocity?: number,
type?: LayoutAnimationType,
property?: LayoutAnimationProperty,
}>;
export type LayoutAnimationConfig = $ReadOnly<{
duration: number,
create?: LayoutAnimationAnimationConfig,
update?: LayoutAnimationAnimationConfig,
delete?: LayoutAnimationAnimationConfig,
}>;

View File

@@ -0,0 +1,125 @@
/**
* 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.
*
* @noformat
* @nolint
* @flow strict-local
* @generated SignedSource<<1f7876c0dc0b05685a730513dc410236>>
*/
'use strict';
import {type ViewConfig} from './ReactNativeTypes';
import invariant from 'invariant';
// Event configs
export const customBubblingEventTypes: {
[eventName: string]: $ReadOnly<{
phasedRegistrationNames: $ReadOnly<{
captured: string,
bubbled: string,
skipBubbling?: ?boolean,
}>,
}>,
} = {};
export const customDirectEventTypes: {
[eventName: string]: $ReadOnly<{
registrationName: string,
}>,
} = {};
const viewConfigCallbacks = new Map<string, ?() => ViewConfig>();
const viewConfigs = new Map<string, ViewConfig>();
function processEventTypes(viewConfig: ViewConfig): void {
const {bubblingEventTypes, directEventTypes} = viewConfig;
if (__DEV__) {
if (bubblingEventTypes != null && directEventTypes != null) {
for (const topLevelType in directEventTypes) {
invariant(
bubblingEventTypes[topLevelType] == null,
'Event cannot be both direct and bubbling: %s',
topLevelType,
);
}
}
}
if (bubblingEventTypes != null) {
for (const topLevelType in bubblingEventTypes) {
if (customBubblingEventTypes[topLevelType] == null) {
customBubblingEventTypes[topLevelType] =
bubblingEventTypes[topLevelType];
}
}
}
if (directEventTypes != null) {
for (const topLevelType in directEventTypes) {
if (customDirectEventTypes[topLevelType] == null) {
customDirectEventTypes[topLevelType] = directEventTypes[topLevelType];
}
}
}
}
/**
* Registers a native view/component by name.
* A callback is provided to load the view config from UIManager.
* The callback is deferred until the view is actually rendered.
*/
export function register(name: string, callback: () => ViewConfig): string {
invariant(
!viewConfigCallbacks.has(name),
'Tried to register two views with the same name %s',
name,
);
invariant(
typeof callback === 'function',
'View config getter callback for component `%s` must be a function (received `%s`)',
name,
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
* roll out. See https://fburl.com/workplace/5whu3i34. */
callback === null ? 'null' : typeof callback,
);
viewConfigCallbacks.set(name, callback);
return name;
}
/**
* Retrieves a config for the specified view.
* If this is the first time the view has been used,
* This configuration will be lazy-loaded from UIManager.
*/
export function get(name: string): ViewConfig {
let viewConfig = viewConfigs.get(name);
if (viewConfig == null) {
const callback = viewConfigCallbacks.get(name);
if (typeof callback !== 'function') {
invariant(
false,
'View config getter callback for component `%s` must be a function (received `%s`).%s',
name,
callback === null ? 'null' : typeof callback,
// $FlowFixMe[recursive-definition]
typeof name[0] === 'string' && /[a-z]/.test(name[0])
? ' Make sure to start component names with a capital letter.'
: '',
);
}
viewConfig = callback();
invariant(viewConfig, 'View config not found for component `%s`', name);
processEventTypes(viewConfig);
viewConfigs.set(name, viewConfig);
// Clear the callback after the config is set so that
// we don't mask any errors during registration.
viewConfigCallbacks.set(name, null);
}
return viewConfig;
}

View File

@@ -0,0 +1,35 @@
/**
* 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.
*
* @noformat
* @nolint
* @flow strict-local
* @generated SignedSource<<52163887de05f1cff05388145cf85b3b>>
*/
'use strict';
import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
import {type ViewConfig} from './ReactNativeTypes';
const {register} = ReactNativeViewConfigRegistry;
/**
* Creates a renderable ReactNative host component.
* Use this method for view configs that are loaded from UIManager.
* Use createReactNativeComponentClass() for view configs defined within JavaScript.
*
* @param {string} config iOS View configuration.
* @private
*/
const createReactNativeComponentClass = function (
name: string,
callback: () => ViewConfig,
): string {
return register(name, callback);
};
export default createReactNativeComponentClass;