Transform $ReadOnly to Readonly 37/n (#55066)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55066

We are transforming the following utility types to be more consistent with typescript and better AI integration:

* `$NonMaybeType` -> `NonNullable`
* `$ReadOnly` -> `Readonly`
* `$ReadOnlyArray` -> `ReadonlyArray`
* `$ReadOnlyMap` -> `ReadonlyMap`
* `$ReadOnlySet` -> `ReadonlySet`
* `$Keys` -> `keyof`
* `$Values` -> `Values`
* `mixed` -> `unknown`

See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/.

drop-conflicts

Command:

`js1 flow-runner codemod flow/transformUtilityType --legacy-type='$ReadOnly'`

Changelog:[internal]

Differential Revision: D90146145

fbshipit-source-id: 4b71784a36f8286f3be620969ea408cf8a0aac80
This commit is contained in:
Marco Wang authored and meta-codesync[bot] committed 2026-01-06 18:57:56 -08:00
1 parent 58bc6c3e38
commit 1cc30dc1ad
175 files changed
+512 -519

No files matched your search

+22 -22
View File
@@ -199,7 +199,7 @@ declare module 'buffer' {
declare var kMaxLength: number;
declare var INSPECT_MAX_BYTES: number;
declare var constants: $ReadOnly<{
declare var constants: Readonly<{
MAX_LENGTH: number,
MAX_STRING_LENGTH: number,
}>;
@@ -1467,7 +1467,7 @@ declare module 'fs' {
path: string,
options:
| string
| $ReadOnly<{
| Readonly<{
encoding?: string,
recursive?: boolean,
withFileTypes?: false,
@@ -1477,7 +1477,7 @@ declare module 'fs' {
): void;
declare function readdir(
path: string,
options: $ReadOnly<{
options: Readonly<{
encoding?: string,
recursive?: boolean,
withFileTypes: true,
@@ -1493,7 +1493,7 @@ declare module 'fs' {
path: string,
options?:
| string
| $ReadOnly<{
| Readonly<{
encoding?: string,
recursive?: boolean,
withFileTypes?: false,
@@ -1503,7 +1503,7 @@ declare module 'fs' {
path: string,
options?:
| string
| $ReadOnly<{
| Readonly<{
encoding?: string,
recursive?: boolean,
withFileTypes: true,
@@ -1527,13 +1527,13 @@ declare module 'fs' {
): void;
declare function openAsBlob(
path: string | Buffer | URL,
options?: $ReadOnly<{
options?: Readonly<{
type?: string, // Optional MIME type hint
}>,
): Promise<Blob>;
declare function opendir(
path: string,
options?: $ReadOnly<{
options?: Readonly<{
encoding?: string,
bufferSize?: number,
recursive?: boolean,
@@ -1542,7 +1542,7 @@ declare module 'fs' {
): void;
declare function opendirSync(
path: string,
options?: $ReadOnly<{
options?: Readonly<{
encoding?: string,
bufferSize?: number,
recursive?: boolean,
@@ -1770,7 +1770,7 @@ declare module 'fs' {
): void;
declare function watchFile(
filename: string,
options?: $ReadOnly<{
options?: Readonly<{
bigint?: boolean,
persistent?: boolean,
interval?: number,
@@ -1787,7 +1787,7 @@ declare module 'fs' {
): FSWatcher;
declare function watch(
filename: string,
options?: $ReadOnly<{
options?: Readonly<{
persistent?: boolean,
recursive?: boolean,
encoding?: string,
@@ -1835,7 +1835,7 @@ declare module 'fs' {
declare function cp(
src: string | URL,
dest: string | URL,
options: $ReadOnly<{
options: Readonly<{
dereference?: boolean,
errorOnExist?: boolean,
filter?: (src: string, dest: string) => boolean | Promise<boolean>,
@@ -1855,7 +1855,7 @@ declare module 'fs' {
declare function cpSync(
src: string | URL,
dest: string | URL,
options?: $ReadOnly<{
options?: Readonly<{
dereference?: boolean,
errorOnExist?: boolean,
filter?: (src: string, dest: string) => boolean,
@@ -2022,7 +2022,7 @@ declare module 'fs' {
chown(uid: number, guid: number): Promise<void>;
close(): Promise<void>;
createReadStream(
options?: $ReadOnly<{
options?: Readonly<{
encoding?: string,
autoClose?: boolean,
emitClose?: boolean,
@@ -2033,7 +2033,7 @@ declare module 'fs' {
}>,
): ReadStream;
createWriteStream(
options?: $ReadOnly<{
options?: Readonly<{
encoding?: string,
autoClose?: boolean,
emitClose?: boolean,
@@ -2055,12 +2055,12 @@ declare module 'fs' {
...
}>;
readableWebStream(
options?: $ReadOnly<{autoClose?: boolean}>,
options?: Readonly<{autoClose?: boolean}>,
): ReadableStream;
readFile(options: EncodingFlag): Promise<Buffer>;
readFile(options: string): Promise<string>;
readLines(
options?: $ReadOnly<{
options?: Readonly<{
encoding?: string,
autoClose?: boolean,
emitClose?: boolean,
@@ -2088,7 +2088,7 @@ declare module 'fs' {
): Promise<void>;
write(
buffer: Buffer | Uint8Array | DataView,
options?: $ReadOnly<{
options?: Readonly<{
offset?: number,
length?: number,
position?: number,
@@ -2119,7 +2119,7 @@ declare module 'fs' {
cp(
src: string | URL,
dest: string | URL,
options?: $ReadOnly<{
options?: Readonly<{
dereference?: boolean,
errorOnExist?: boolean,
filter?: (src: string, dest: string) => boolean | Promise<boolean>,
@@ -2171,7 +2171,7 @@ declare module 'fs' {
): Promise<FileHandle>,
opendir(
path: string,
options?: $ReadOnly<{
options?: Readonly<{
encoding?: string,
bufferSize?: number,
recursive?: boolean,
@@ -2192,7 +2192,7 @@ declare module 'fs' {
path: FSPromisePath,
options:
| string
| $ReadOnly<{
| Readonly<{
encoding?: string,
recursive?: boolean,
withFileTypes?: false,
@@ -2200,7 +2200,7 @@ declare module 'fs' {
) => Promise<Array<string>>) &
((
path: FSPromisePath,
options: $ReadOnly<{
options: Readonly<{
encoding?: string,
recursive?: boolean,
withFileTypes: true,
@@ -2249,7 +2249,7 @@ declare module 'fs' {
): Promise<void>,
watch(
filename: FSPromisePath,
options?: $ReadOnly<{
options?: Readonly<{
persistent?: boolean,
recursive?: boolean,
encoding?: string,
+4 -4
View File
@@ -13,9 +13,9 @@ declare module '@octokit/rest' {
declare class Octokit {
constructor(options?: {auth?: string, ...}): this;
repos: $ReadOnly<{
repos: Readonly<{
listReleaseAssets: (
params: $ReadOnly<{
params: Readonly<{
owner: string,
repo: string,
release_id: string,
@@ -29,13 +29,13 @@ declare module '@octokit/rest' {
...
}>,
uploadReleaseAsset: (
params: $ReadOnly<{
params: Readonly<{
owner: string,
repo: string,
release_id: string,
name: string,
data: Buffer,
headers: $ReadOnly<{
headers: Readonly<{
'content-type': string,
...
}>,
+7 -7
View File
@@ -97,7 +97,7 @@ declare module '@babel/traverse' {
/** Traverse node with current scope and path. */
traverse<S>(
node: BabelNode | Array<BabelNode>,
opts: $ReadOnly<TraverseOptions<S>>,
opts: Readonly<TraverseOptions<S>>,
state: S,
): void;
@@ -303,7 +303,7 @@ declare module '@babel/traverse' {
shouldStop: boolean;
removed: boolean;
state: unknown;
+opts: $ReadOnly<TraverseOptions<unknown>> | null;
+opts: Readonly<TraverseOptions<unknown>> | null;
skipKeys: null | {[key: string]: boolean};
parentPath: ?NodePath<>;
context: TraversalContext;
@@ -346,7 +346,7 @@ declare module '@babel/traverse' {
): TError;
traverse<TState>(
visitor: $ReadOnly<TraverseOptions<TState>>,
visitor: Readonly<TraverseOptions<TState>>,
state: TState,
): void;
@@ -1444,7 +1444,7 @@ declare module '@babel/traverse' {
| VisitNodeFunction<TNode, TState>
| VisitNodeObject<TNode, TState>;
declare export type Visitor<TState = void> = $ReadOnly<{
declare export type Visitor<TState = void> = Readonly<{
enter?: VisitNodeFunction<BabelNode, TState>,
exit?: VisitNodeFunction<BabelNode, TState>,
@@ -1872,7 +1872,7 @@ declare module '@babel/traverse' {
explode<TState>(visitor: Visitor<TState>): Visitor<TState>,
verify<TState>(visitor: Visitor<TState>): void,
merge(
visitors: Array<$ReadOnly<Visitor<any>>>,
visitors: Array<Readonly<Visitor<any>>>,
states: Array<any>,
wrapper?: ?Function,
): Array<Visitor<any>>,
@@ -1891,7 +1891,7 @@ declare module '@babel/traverse' {
declare export type Traverse = {
<TState>(
parent?: BabelNode | Array<BabelNode>,
opts?: $ReadOnly<TraverseOptions<TState>>,
opts?: Readonly<TraverseOptions<TState>>,
scope?: ?Scope,
state: TState,
parentPath?: ?NodePath<BabelNode>,
@@ -1909,7 +1909,7 @@ declare module '@babel/traverse' {
node<TState>(
node: BabelNode,
opts: $ReadOnly<TraverseOptions<TState>>,
opts: Readonly<TraverseOptions<TState>>,
scope: Scope,
state: TState,
parentPath: NodePath<>,
+6 -6
View File
@@ -10,7 +10,7 @@
'use strict';
type _BabelSourceMap = $ReadOnly<{
type _BabelSourceMap = Readonly<{
file?: string,
mappings: string,
names: Array<string>,
@@ -28,9 +28,9 @@ type _BabelSourceMapSegment = {
...
};
export type BabelSourceLocation = $ReadOnly<{
start: $ReadOnly<{line: number, column: number}>,
end: $ReadOnly<{line: number, column: number}>,
export type BabelSourceLocation = Readonly<{
start: Readonly<{line: number, column: number}>,
end: Readonly<{line: number, column: number}>,
}>;
declare module '@babel/parser' {
@@ -330,7 +330,7 @@ declare module '@babel/core' {
constructor(
options: BabelCoreOptions,
input: $ReadOnly<{ast: BabelNode, code: string, inputMap: any}>,
input: Readonly<{ast: BabelNode, code: string, inputMap: any}>,
): File;
getMetadata(): void;
@@ -1079,7 +1079,7 @@ declare module '@babel/core' {
declare type ValidatedOptions = BabelCoreOptions;
declare class PartialConfig {
+options: $ReadOnly<ValidatedOptions>;
+options: Readonly<ValidatedOptions>;
+babelrc: string | void;
+babelignore: string | void;
+config: string | void;
+1 -1
View File
@@ -46,7 +46,7 @@ declare module '@electron/packager' {
declare export type OsxUniversalOptions = $FlowFixMe;
declare export type Win32MetadataOptions = $ReadOnly<{
declare export type Win32MetadataOptions = Readonly<{
CompanyName?: string,
FileDescription?: string,
OriginalFilename?: string,
+7 -7
View File
@@ -91,25 +91,25 @@ declare module 'execa' {
(
file: string,
args?: $ReadOnlyArray<string>,
options?: $ReadOnly<Options>,
options?: Readonly<Options>,
): ExecaPromise;
(file: string, options?: $ReadOnly<Options>): ExecaPromise;
(file: string, options?: Readonly<Options>): ExecaPromise;
command(command: string, options?: $ReadOnly<Options>): ExecaPromise;
commandSync(command: string, options?: $ReadOnly<Options>): ExecaPromise;
command(command: string, options?: Readonly<Options>): ExecaPromise;
commandSync(command: string, options?: Readonly<Options>): ExecaPromise;
node(
path: string,
args?: $ReadOnlyArray<string>,
options?: $ReadOnly<Options>,
options?: Readonly<Options>,
): void;
sync(
file: string,
args?: $ReadOnlyArray<string>,
options?: $ReadOnly<SyncOptions>,
options?: Readonly<SyncOptions>,
): SyncResult;
sync(file: string, options?: $ReadOnly<SyncOptions>): SyncResult;
sync(file: string, options?: Readonly<SyncOptions>): SyncResult;
}
declare module.exports: Execa;
+2 -2
View File
@@ -22,7 +22,7 @@ declare module 'jsonc-parser' {
/**
* The scanner object, representing a JSON scanner at a position in the input string.
*/
export type JSONScanner = $ReadOnly<{
export type JSONScanner = Readonly<{
/**
* Sets the scan position to a new offset. A call to 'scan' is needed to get the first token.
*/
@@ -351,7 +351,7 @@ declare module 'jsonc-parser' {
/**
* Options used by {@linkcode format} when computing the formatting edit operations
*/
export type FormattingOptions = $ReadOnly<{
export type FormattingOptions = Readonly<{
/**
* If indentation is based on spaces (`insertSpaces` = true), the number of spaces that make an indent.
*/
+1 -1
View File
@@ -11,7 +11,7 @@
declare module 'open' {
import type {ChildProcess} from 'child_process';
declare export type Options = $ReadOnly<{
declare export type Options = Readonly<{
wait?: boolean,
background?: boolean,
newInstance?: boolean,
+1 -1
View File
@@ -12,7 +12,7 @@ declare module 'serve-static' {
import type {NextHandleFunction} from 'connect';
import type http from 'http';
declare export type Options = $ReadOnly<{
declare export type Options = Readonly<{
/**
* Enable or disable accepting ranged requests, defaults to true. Disabling
* this will not send `Accept-Ranges` and ignore the contents of the
+3 -3
View File
@@ -11,7 +11,7 @@
declare module 'tinybench' {
declare export class Task extends EventTarget {
name: string;
result: void | $ReadOnly<TaskResult>;
result: void | Readonly<TaskResult>;
runs: number;
reset(): void;
@@ -108,13 +108,13 @@ declare module 'tinybench' {
declare export class Bench extends EventTarget {
concurrency: null | 'task' | 'bench';
name?: string;
opts: $ReadOnly<BenchOptions>;
opts: Readonly<BenchOptions>;
threshold: number;
constructor(options?: BenchOptions): this;
// $FlowExpectedError[unsafe-getters-setters]
get results(): Array<$ReadOnly<TaskResult>>;
get results(): Array<Readonly<TaskResult>>;
// $FlowExpectedError[unsafe-getters-setters]
get tasks(): Array<Task>;
+5 -5
View File
@@ -18,25 +18,25 @@ declare module 'typescript' {
Bundler = 'Bundler',
}
declare type SourceFile = $ReadOnly<{
declare type SourceFile = Readonly<{
fileName: string,
text: string,
...
}>;
declare type Diagnostic = $ReadOnly<{
declare type Diagnostic = Readonly<{
file?: SourceFile,
start?: number,
messageText: string,
...
}>;
declare type EmitResult = $ReadOnly<{
declare type EmitResult = Readonly<{
diagnostics: Array<Diagnostic>,
...
}>;
declare type Program = $ReadOnly<{
declare type Program = Readonly<{
emit: () => EmitResult,
...
}>;
@@ -47,7 +47,7 @@ declare module 'typescript' {
getLineAndCharacterOfPosition(
file: SourceFile,
start?: number,
): $ReadOnly<{line: number, character: number}>,
): Readonly<{line: number, character: number}>,
convertCompilerOptionsFromJson(
jsonOptions: any,
basePath: string,
+1 -1
View File
@@ -15,7 +15,7 @@ declare interface undici$Agent$Options {
}
declare module 'undici' {
declare export type RequestOptions = $ReadOnly<{
declare export type RequestOptions = Readonly<{
dispatcher?: Dispatcher,
method?: string,
headers?: HeadersInit,
@@ -8,7 +8,7 @@
* @format
*/
export type PackagerAsset = $ReadOnly<{
export type PackagerAsset = Readonly<{
httpServerLocation: string,
name: string,
type: string,
@@ -12,7 +12,7 @@ import type {TerminalReporter} from 'metro';
import {styleText} from 'util';
type PageDescription = $ReadOnly<{
type PageDescription = Readonly<{
id: string,
title: string,
description: string,
@@ -45,7 +45,7 @@ export default function attachKeyHandlers({
reporter,
}: {
devServerUrl: string,
messageSocket: $ReadOnly<{
messageSocket: Readonly<{
broadcast: (type: string, params?: Record<string, unknown> | null) => void,
...
}>,
@@ -18,7 +18,7 @@ type LoggerFn = (...message: $ReadOnlyArray<string>) => void;
*/
export default function createDevMiddlewareLogger(
reporter: TerminalReporter,
): $ReadOnly<{
): Readonly<{
info: LoggerFn,
error: LoggerFn,
warn: LoggerFn,
@@ -20,7 +20,7 @@ const debug = require('debug')('ReactNative:CommunityCliPlugin');
export type {Config};
export type ConfigLoadingContext = $ReadOnly<{
export type ConfigLoadingContext = Readonly<{
root: Config['root'],
reactNativePath: Config['reactNativePath'],
platforms: Config['platforms'],
@@ -19,7 +19,7 @@ const {BrowserWindow, Menu, app, shell, ipcMain} = require('electron') as any;
const appSettings = new SettingsStore();
const windowMetadata = new WeakMap<
typeof BrowserWindow,
$ReadOnly<{
Readonly<{
windowKey: string,
}>,
>();
@@ -14,7 +14,7 @@ const {app} = require('electron') as any;
const fs = require('fs');
const path = require('path');
type Options = $ReadOnly<{
type Options = Readonly<{
name?: string,
defaults?: Object,
}>;
@@ -31,7 +31,7 @@ async function unstable_spawnDebuggerShellWithArgs(
mode = 'detached',
flavor = process.env.RNDT_DEV === '1' ? 'dev' : 'prebuilt',
prebuiltBinaryPath,
}: $ReadOnly<{
}: Readonly<{
// In 'syncAndExit' mode, the current process will block until the spawned process exits, and then it will exit
// with the same exit code as the spawned process.
// In 'detached' mode, the spawned process will be detached from the current process and the current process will
@@ -97,7 +97,7 @@ async function unstable_spawnDebuggerShellWithArgs(
});
}
export type DebuggerShellPreparationResult = $ReadOnly<{
export type DebuggerShellPreparationResult = Readonly<{
code:
| 'success'
| 'not_implemented'
@@ -21,18 +21,18 @@ import {createDebuggerMock} from './InspectorDebuggerUtils';
import {createDeviceMock} from './InspectorDeviceUtils';
import until from 'wait-for-expect';
export type CdpMessageFromTarget = $ReadOnly<{
export type CdpMessageFromTarget = Readonly<{
method: string,
id?: number,
params?: JSONSerializable,
}>;
export type CdpResponseFromTarget = $ReadOnly<{
export type CdpResponseFromTarget = Readonly<{
id: number,
result: JSONSerializable,
}>;
export type CdpMessageToTarget = $ReadOnly<{
export type CdpMessageToTarget = Readonly<{
method: string,
id: number,
params?: JSONSerializable,
@@ -108,7 +108,7 @@ export async function sendFromDebuggerToTarget<Message: CdpMessageToTarget>(
}
export async function createAndConnectTarget(
serverRef: $ReadOnly<{
serverRef: Readonly<{
serverBaseUrl: string,
serverBaseWsUrl: string,
...
@@ -119,7 +119,7 @@ export async function createAndConnectTarget(
debuggerHostHeader = null,
deviceId = null,
deviceHostHeader = null,
}: $ReadOnly<{
}: Readonly<{
debuggerHostHeader?: ?string,
deviceId?: ?string,
deviceHostHeader?: ?string,
@@ -8,7 +8,7 @@
* @format
*/
export function withAbortSignalForEachTest(): $ReadOnly<{signal: AbortSignal}> {
export function withAbortSignalForEachTest(): Readonly<{signal: AbortSignal}> {
const ref: {signal: AbortSignal} = {
// $FlowFixMe[unsafe-getters-setters]
get signal() {
@@ -25,7 +25,7 @@ type CreateServerOptions = {
};
type ConnectApp = ReturnType<typeof connect>;
export function withServerForEachTest(options: CreateServerOptions): $ReadOnly<{
export function withServerForEachTest(options: CreateServerOptions): Readonly<{
serverBaseUrl: string,
serverBaseWsUrl: string,
app: ConnectApp,
@@ -23,7 +23,7 @@ import connect from 'connect';
import path from 'path';
import serveStaticMiddleware from 'serve-static';
type Options = $ReadOnly<{
type Options = Readonly<{
/**
* The base URL to the dev server, as reachable from the machine on which
* dev-middleware is hosted. Typically `http://localhost:${metroPort}`.
@@ -70,7 +70,7 @@ type Options = $ReadOnly<{
unstable_trackInspectorProxyEventLoopPerf?: boolean,
}>;
type DevMiddlewareAPI = $ReadOnly<{
type DevMiddlewareAPI = Readonly<{
middleware: NextHandleFunction,
websocketEndpoints: {[path: string]: ws$WebSocketServer},
}>;
@@ -10,19 +10,19 @@
import type {JSONSerializable, Page} from './types';
type ExposedDevice = $ReadOnly<{
type ExposedDevice = Readonly<{
appId: string,
id: string,
name: string,
sendMessage: (message: JSONSerializable) => void,
}>;
type ExposedDebugger = $ReadOnly<{
type ExposedDebugger = Readonly<{
userAgent: string | null,
sendMessage: (message: JSONSerializable) => void,
}>;
export type CustomMessageHandlerConnection = $ReadOnly<{
export type CustomMessageHandlerConnection = Readonly<{
page: Page,
device: ExposedDevice,
debugger: ExposedDebugger,
@@ -68,7 +68,7 @@ type DebuggerConnection = {
const REACT_NATIVE_RELOADABLE_PAGE_ID = '-1';
export type DeviceOptions = $ReadOnly<{
export type DeviceOptions = Readonly<{
id: string,
name: string,
app: string,
@@ -302,7 +302,7 @@ export default class Device {
{
debuggerRelativeBaseUrl,
userAgent,
}: $ReadOnly<{
}: Readonly<{
debuggerRelativeBaseUrl: URL,
userAgent: string | null,
}>,
@@ -21,19 +21,19 @@ type PendingCommand = {
metadata: RequestMetadata,
};
type DeviceMetadata = $ReadOnly<{
type DeviceMetadata = Readonly<{
appId: string,
deviceId: string,
deviceName: string,
}>;
type RequestMetadata = $ReadOnly<{
type RequestMetadata = Readonly<{
pageId: string | null,
frontendUserAgent: string | null,
prefersFuseboxFrontend: boolean | null,
}>;
type ResponseMetadata = $ReadOnly<{
type ResponseMetadata = Readonly<{
pageId: string | null,
frontendUserAgent: string | null,
prefersFuseboxFrontend: boolean | null,
@@ -68,7 +68,7 @@ class DeviceEventReporter {
}
logRequest(
req: $ReadOnly<{id: number, method: string, ...}>,
req: Readonly<{id: number, method: string, ...}>,
origin: 'debugger' | 'proxy',
metadata: RequestMetadata,
): void {
@@ -164,7 +164,7 @@ class DeviceEventReporter {
logConnection(
connectedEntity: 'debugger',
metadata: $ReadOnly<{
metadata: Readonly<{
pageId: string,
frontendUserAgent: string | null,
}>,
@@ -12,7 +12,7 @@
* A capability flag disables a specific feature/hack in the InspectorProxy
* layer by indicating that the target supports one or more modern CDP features.
*/
export type TargetCapabilityFlags = $ReadOnly<{
export type TargetCapabilityFlags = Readonly<{
/**
* The target supports a stable page representation across reloads.
*
@@ -43,7 +43,7 @@ export type TargetCapabilityFlags = $ReadOnly<{
// each new instance of VM and can appear when user reloads React Native
// application.
export type PageFromDevice = $ReadOnly<{
export type PageFromDevice = Readonly<{
id: string,
title: string,
/** Sent from modern targets only */
@@ -54,15 +54,15 @@ export type PageFromDevice = $ReadOnly<{
capabilities?: TargetCapabilityFlags,
}>;
export type Page = $ReadOnly<{
export type Page = Readonly<{
...PageFromDevice,
capabilities: NonNullable<PageFromDevice['capabilities']>,
}>;
// Chrome Debugger Protocol message/event passed between device and debugger.
export type WrappedEvent = $ReadOnly<{
export type WrappedEvent = Readonly<{
event: 'wrappedEvent',
payload: $ReadOnly<{
payload: Readonly<{
pageId: string,
wrappedEvent: string,
}>,
@@ -70,16 +70,16 @@ export type WrappedEvent = $ReadOnly<{
// Request sent from Inspector Proxy to Device when new debugger is connected
// to particular page.
export type ConnectRequest = $ReadOnly<{
export type ConnectRequest = Readonly<{
event: 'connect',
payload: $ReadOnly<{pageId: string}>,
payload: Readonly<{pageId: string}>,
}>;
// Request sent from Inspector Proxy to Device to notify that debugger is
// disconnected.
export type DisconnectRequest = $ReadOnly<{
export type DisconnectRequest = Readonly<{
event: 'disconnect',
payload: $ReadOnly<{pageId: string}>,
payload: Readonly<{pageId: string}>,
}>;
// Request sent from Inspector Proxy to Device to get a list of pages.
@@ -105,7 +105,7 @@ export type MessageToDevice =
| DisconnectRequest;
// Page description object that is sent in response to /json HTTP request from debugger.
export type PageDescription = $ReadOnly<{
export type PageDescription = Readonly<{
id: string,
title: string,
appId: string,
@@ -121,7 +121,7 @@ export type PageDescription = $ReadOnly<{
vm?: string,
// React Native specific metadata
reactNative: $ReadOnly<{
reactNative: Readonly<{
logicalDeviceId: string,
capabilities: Page['capabilities'],
}>,
@@ -131,7 +131,7 @@ export type JsonPagesListResponse = Array<PageDescription>;
// Response to /json/version HTTP request from the debugger specifying browser type and
// Chrome protocol version.
export type JsonVersionResponse = $ReadOnly<{
export type JsonVersionResponse = Readonly<{
Browser: string,
'Protocol-Version': string,
}>;
@@ -27,7 +27,7 @@ import url from 'url';
const LEGACY_SYNTHETIC_PAGE_TITLE =
'React Native Experimental (Improved Chrome Reloads)';
type Options = $ReadOnly<{
type Options = Readonly<{
serverBaseUrl: string,
logger?: Logger,
browserLauncher: BrowserLauncher,
@@ -8,7 +8,7 @@
* @format
*/
export type Experiments = $ReadOnly<{
export type Experiments = Readonly<{
/**
* Enables the handling of GET requests in the /open-debugger endpoint,
* in addition to POST requests. GET requests respond by redirecting to
+1 -1
View File
@@ -8,7 +8,7 @@
* @format
*/
export type Logger = $ReadOnly<{
export type Logger = Readonly<{
error: (...message: Array<string>) => void,
info: (...message: Array<string>) => void,
warn: (...message: Array<string>) => void,
@@ -17,7 +17,7 @@ export default function getDevToolsFrontendUrl(
experiments: Experiments,
webSocketDebuggerUrl: string,
devServerUrl: string,
options?: $ReadOnly<{
options?: Readonly<{
relative?: boolean,
launchId?: string,
telemetryInfo?: string,
@@ -65,7 +65,7 @@ export default function getDevToolsFrontendUrl(
function getWsParam({
webSocketDebuggerUrl,
devServerUrl,
}: $ReadOnly<{
}: Readonly<{
webSocketDebuggerUrl: string,
devServerUrl: string,
}>): {
+2 -2
View File
@@ -64,7 +64,7 @@ export function getDefaultConfig(projectRoot: string): ConfigT {
require.resolve('react-native/Libraries/Core/InitializeCore'),
],
getPolyfills: () => require('@react-native/js-polyfills')(),
isThirdPartyModule({path: modulePath}: $ReadOnly<{path: string, ...}>) {
isThirdPartyModule({path: modulePath}: Readonly<{path: string, ...}>) {
return (
INTERNAL_CALLSITES_REGEX.test(modulePath) ||
/(?:^|[/\\])node_modules[/\\]/.test(modulePath)
@@ -75,7 +75,7 @@ export function getDefaultConfig(projectRoot: string): ConfigT {
port: Number(process.env.RCT_METRO_PORT) || 8081,
},
symbolicator: {
customizeFrame: (frame: $ReadOnly<{file: ?string, ...}>) => {
customizeFrame: (frame: Readonly<{file: ?string, ...}>) => {
const collapse = Boolean(
frame.file != null && INTERNAL_CALLSITES_REGEX.test(frame.file),
);
+2 -2
View File
@@ -24,9 +24,9 @@ import {
} from 'react-native';
import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser';
export type NewAppScreenProps = $ReadOnly<{
export type NewAppScreenProps = Readonly<{
templateFileName?: string,
safeAreaInsets?: $ReadOnly<{
safeAreaInsets?: Readonly<{
top: number,
bottom: number,
left: number,
@@ -16,7 +16,7 @@ import RCTActionSheetManager from './NativeActionSheetManager';
const processColor = require('../StyleSheet/processColor').default;
const invariant = require('invariant');
export type ActionSheetIOSOptions = $ReadOnly<{
export type ActionSheetIOSOptions = Readonly<{
title?: ?string,
message?: ?string,
options: Array<string>,
@@ -30,7 +30,7 @@ export type ActionSheetIOSOptions = $ReadOnly<{
disabledButtonIndices?: Array<number>,
}>;
export type ShareActionSheetIOSOptions = $ReadOnly<{
export type ShareActionSheetIOSOptions = Readonly<{
message?: ?string,
url?: ?string,
subject?: ?string,
@@ -42,7 +42,7 @@ export type ShareActionSheetIOSOptions = $ReadOnly<{
userInterfaceStyle?: ?string,
}>;
export type ShareActionSheetError = $ReadOnly<{
export type ShareActionSheetError = Readonly<{
domain: string,
code: string,
userInfo?: ?Object,
@@ -89,7 +89,7 @@ const diffClampImpl = function (
const _combineCallbacks = function (
callback: ?EndCallback,
config: $ReadOnly<{...AnimationConfig, ...}>,
config: Readonly<{...AnimationConfig, ...}>,
) {
if (callback && config.onComplete) {
return (...args: Array<EndResult>) => {
@@ -581,7 +581,7 @@ test('AnimatedValue.interpolate', () => {
let _interpolatedValueX;
const viewRef = createRef<HostInstance>();
function MyApp({outputRangeX}: $ReadOnly<{outputRangeX: number}>) {
function MyApp({outputRangeX}: Readonly<{outputRangeX: number}>) {
const valueX = useAnimatedValue(0.5, {useNativeDriver: true});
_valueX = valueX;
const offset = outputRangeX - 1;
@@ -24,7 +24,7 @@ export type EndResult = {
};
export type EndCallback = (result: EndResult) => void;
export type AnimationConfig = $ReadOnly<{
export type AnimationConfig = Readonly<{
isInteraction?: boolean,
useNativeDriver: boolean,
platformConfig?: PlatformConfig,
@@ -98,7 +98,7 @@ export default class Animation {
this.__active = false;
}
__getNativeAnimationConfig(): $ReadOnly<{
__getNativeAnimationConfig(): Readonly<{
platformConfig: ?PlatformConfig,
...
}> {
@@ -14,11 +14,11 @@ import type {AnimationConfig, EndCallback} from './Animation';
import Animation from './Animation';
export type DecayAnimationConfig = $ReadOnly<{
export type DecayAnimationConfig = Readonly<{
...AnimationConfig,
velocity:
| number
| $ReadOnly<{
| Readonly<{
x: number,
y: number,
...
@@ -27,7 +27,7 @@ export type DecayAnimationConfig = $ReadOnly<{
...
}>;
export type DecayAnimationConfigSingle = $ReadOnly<{
export type DecayAnimationConfigSingle = Readonly<{
...AnimationConfig,
velocity: number,
deceleration?: number,
@@ -52,7 +52,7 @@ export default class DecayAnimation extends Animation {
this._platformConfig = config.platformConfig;
}
__getNativeAnimationConfig(): $ReadOnly<{
__getNativeAnimationConfig(): Readonly<{
deceleration: number,
iterations: number,
platformConfig: ?PlatformConfig,
@@ -19,7 +19,7 @@ import * as SpringConfig from '../SpringConfig';
import Animation from './Animation';
import invariant from 'invariant';
export type SpringAnimationConfig = $ReadOnly<{
export type SpringAnimationConfig = Readonly<{
...AnimationConfig,
toValue:
| number
@@ -44,7 +44,7 @@ export type SpringAnimationConfig = $ReadOnly<{
restSpeedThreshold?: number,
velocity?:
| number
| $ReadOnly<{
| Readonly<{
x: number,
y: number,
...
@@ -60,7 +60,7 @@ export type SpringAnimationConfig = $ReadOnly<{
...
}>;
export type SpringAnimationConfigSingle = $ReadOnly<{
export type SpringAnimationConfigSingle = Readonly<{
...AnimationConfig,
toValue: number,
overshootClamping?: boolean,
@@ -78,7 +78,7 @@ export type SpringAnimationConfigSingle = $ReadOnly<{
...
}>;
opaque type SpringAnimationInternalState = $ReadOnly<{
opaque type SpringAnimationInternalState = Readonly<{
lastPosition: number,
lastVelocity: number,
lastTime: number,
@@ -168,7 +168,7 @@ export default class SpringAnimation extends Animation {
invariant(this._mass > 0, 'Mass value must be greater than 0');
}
__getNativeAnimationConfig(): $ReadOnly<{
__getNativeAnimationConfig(): Readonly<{
damping: number,
initialVelocity: number,
iterations: number,
@@ -18,12 +18,12 @@ import type {AnimationConfig, EndCallback} from './Animation';
import AnimatedColor from '../nodes/AnimatedColor';
import Animation from './Animation';
export type TimingAnimationConfig = $ReadOnly<{
export type TimingAnimationConfig = Readonly<{
...AnimationConfig,
toValue:
| number
| AnimatedValue
| $ReadOnly<{
| Readonly<{
x: number,
y: number,
...
@@ -38,7 +38,7 @@ export type TimingAnimationConfig = $ReadOnly<{
...
}>;
export type TimingAnimationConfigSingle = $ReadOnly<{
export type TimingAnimationConfigSingle = Readonly<{
...AnimationConfig,
toValue: number,
easing?: (value: number) => number,
@@ -80,7 +80,7 @@ export default class TimingAnimation extends Animation {
this._platformConfig = config.platformConfig;
}
__getNativeAnimationConfig(): $ReadOnly<{
__getNativeAnimationConfig(): Readonly<{
type: 'frames',
frames: $ReadOnlyArray<number>,
toValue: number,
@@ -61,7 +61,7 @@ type NonAnimatedProps =
| 'testID'
| 'disabled'
| 'accessibilityLabel';
type PassThroughProps = $ReadOnly<{
type PassThroughProps = Readonly<{
passthroughAnimatedPropExplicitValues?: ViewProps | null,
}>;
@@ -99,7 +99,7 @@ export default function createAnimatedComponent<
>(
Component: TInstance,
): AnimatedComponentType<
$ReadOnly<React.ElementConfig<TInstance>>,
Readonly<React.ElementConfig<TInstance>>,
React.ElementRef<TInstance>,
> {
return unstable_createAnimatedComponentWithAllowlist(Component, null);
@@ -22,7 +22,7 @@ import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes';
import AnimatedValue, {flushValue} from './AnimatedValue';
import AnimatedWithChildren from './AnimatedWithChildren';
export type AnimatedColorConfig = $ReadOnly<{
export type AnimatedColorConfig = Readonly<{
...AnimatedNodeConfig,
useNativeDriver: boolean,
}>;
@@ -112,7 +112,7 @@ function isRgbaAnimatedValue(value: any): boolean {
export function getRgbaValueAndNativeColor(
value: RgbaValue | ColorValue,
): $ReadOnly<{
): Readonly<{
rgbaValue: RgbaValue,
nativeColor?: NativeColorValue,
}> {
@@ -34,7 +34,7 @@ export type InterpolationConfigSupportedOutputType =
export type InterpolationConfigType<
OutputT: InterpolationConfigSupportedOutputType,
> = $ReadOnly<{
> = Readonly<{
...AnimatedNodeConfig,
inputRange: $ReadOnlyArray<number>,
outputRange: $ReadOnlyArray<OutputT>,
@@ -15,7 +15,7 @@ import invariant from 'invariant';
type ValueListenerCallback = (state: {value: number, ...}) => unknown;
export type AnimatedNodeConfig = $ReadOnly<{
export type AnimatedNodeConfig = Readonly<{
debugID?: string,
unstable_disableBatchingForNativeCreate?: boolean,
}>;
@@ -34,7 +34,7 @@ export default class AnimatedNode {
_platformConfig: ?PlatformConfig = undefined;
constructor(
config?: ?$ReadOnly<{
config?: ?Readonly<{
...AnimatedNodeConfig,
...
}>,
@@ -23,7 +23,7 @@ export function isPlainObject(
value: unknown,
/* $FlowFixMe[incompatible-type-guard] - Flow does not know that the prototype
and ReactElement checks preserve the type refinement of `value`. */
): value is $ReadOnly<{[string]: unknown}> {
): value is Readonly<{[string]: unknown}> {
const proto =
value !== null && typeof value === 'object'
? Object.getPrototypeOf(value)
@@ -24,7 +24,7 @@ import AnimatedObject from './AnimatedObject';
import AnimatedStyle from './AnimatedStyle';
import invariant from 'invariant';
export type AnimatedPropsAllowlist = $ReadOnly<{
export type AnimatedPropsAllowlist = Readonly<{
style?: ?AnimatedStyleAllowlist,
[key: string]: true | AnimatedStyleAllowlist,
}>;
@@ -358,6 +358,6 @@ export default class AnimatedProps extends AnimatedNode {
// this shim when they do.
// $FlowFixMe[method-unbinding]
const _hasOwnProp = Object.prototype.hasOwnProperty;
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean =
// $FlowFixMe[method-unbinding]
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
@@ -19,7 +19,7 @@ import AnimatedObject from './AnimatedObject';
import AnimatedTransform from './AnimatedTransform';
import AnimatedWithChildren from './AnimatedWithChildren';
export type AnimatedStyleAllowlist = $ReadOnly<{[string]: true}>;
export type AnimatedStyleAllowlist = Readonly<{[string]: true}>;
type FlatStyle = {[string]: unknown};
type FlatStyleForWeb<TStyle: FlatStyle> = [unknown, TStyle];
@@ -253,6 +253,6 @@ export default class AnimatedStyle extends AnimatedWithChildren {
// this shim when they do.
// $FlowFixMe[method-unbinding]
const _hasOwnProp = Object.prototype.hasOwnProperty;
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean =
// $FlowFixMe[method-unbinding]
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
@@ -24,7 +24,7 @@ import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHe
import AnimatedInterpolation from './AnimatedInterpolation';
import AnimatedWithChildren from './AnimatedWithChildren';
export type AnimatedValueConfig = $ReadOnly<{
export type AnimatedValueConfig = Readonly<{
...AnimatedNodeConfig,
useNativeDriver: boolean,
}>;
@@ -17,7 +17,7 @@ import AnimatedValue from './AnimatedValue';
import AnimatedWithChildren from './AnimatedWithChildren';
import invariant from 'invariant';
export type AnimatedValueXYConfig = $ReadOnly<{
export type AnimatedValueXYConfig = Readonly<{
...AnimatedNodeConfig,
useNativeDriver: boolean,
}>;
@@ -26,7 +26,7 @@ const GRAY = '#999999';
type IndicatorSize = number | 'small' | 'large';
type ActivityIndicatorIOSProps = $ReadOnly<{
type ActivityIndicatorIOSProps = Readonly<{
/**
Whether the indicator should hide when not animating.
@@ -34,7 +34,7 @@ type ActivityIndicatorIOSProps = $ReadOnly<{
*/
hidesWhenStopped?: ?boolean,
}>;
export type ActivityIndicatorProps = $ReadOnly<{
export type ActivityIndicatorProps = Readonly<{
...ViewProps,
...ActivityIndicatorIOSProps,
+1 -1
View File
@@ -27,7 +27,7 @@ import View from './View/View';
import invariant from 'invariant';
import * as React from 'react';
export type ButtonProps = $ReadOnly<{
export type ButtonProps = Readonly<{
/**
Text to display inside the button. On Android the given title will be
converted to the uppercased form.
@@ -22,12 +22,12 @@ import * as React from 'react';
export type DrawerStates = 'Idle' | 'Dragging' | 'Settling';
export type DrawerSlideEvent = NativeSyntheticEvent<
$ReadOnly<{
Readonly<{
offset: number,
}>,
>;
export type DrawerLayoutAndroidProps = $ReadOnly<{
export type DrawerLayoutAndroidProps = Readonly<{
...ViewProps,
/**
@@ -25,7 +25,7 @@ export type KeyboardEventEasing =
| 'linear'
| 'keyboard';
export type KeyboardMetrics = $ReadOnly<{
export type KeyboardMetrics = Readonly<{
screenX: number,
screenY: number,
width: number,
@@ -40,13 +40,13 @@ type BaseKeyboardEvent = {
endCoordinates: KeyboardMetrics,
};
export type AndroidKeyboardEvent = $ReadOnly<{
export type AndroidKeyboardEvent = Readonly<{
...BaseKeyboardEvent,
duration: 0,
easing: 'keyboard',
}>;
export type IOSKeyboardEvent = $ReadOnly<{
export type IOSKeyboardEvent = Readonly<{
...BaseKeyboardEvent,
startCoordinates: KeyboardMetrics,
isEventFromThisApp: boolean,
@@ -26,7 +26,7 @@ import Keyboard from './Keyboard';
import * as React from 'react';
import {createRef} from 'react';
export type KeyboardAvoidingViewProps = $ReadOnly<{
export type KeyboardAvoidingViewProps = Readonly<{
...ViewProps,
/**
@@ -12,7 +12,7 @@ import StyleSheet from '../../StyleSheet/StyleSheet';
import LayoutConformanceNativeComponent from './LayoutConformanceNativeComponent';
import * as React from 'react';
export type LayoutConformanceProps = $ReadOnly<{
export type LayoutConformanceProps = Readonly<{
/**
* strict: Layout in accordance with W3C spec, even when breaking
* compatibility: Layout with the same behavior as previous versions of React Native
@@ -13,7 +13,7 @@ import type {ViewProps} from '../View/ViewPropTypes';
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
type Props = $ReadOnly<{
type Props = Readonly<{
mode: 'strict' | 'compatibility',
...ViewProps,
}>;
@@ -29,11 +29,11 @@ import {memo, useMemo, useRef, useState} from 'react';
export type {PressableAndroidRippleConfig};
export type PressableStateCallbackType = $ReadOnly<{
export type PressableStateCallbackType = Readonly<{
pressed: boolean,
}>;
type PressableBaseProps = $ReadOnly<{
type PressableBaseProps = Readonly<{
/**
* Whether a press gesture can be interrupted by a parent gesture such as a
* scroll event. Defaults to true.
@@ -156,7 +156,7 @@ type PressableBaseProps = $ReadOnly<{
unstable_pressDelay?: ?number,
}>;
export type PressableProps = $ReadOnly<{
export type PressableProps = Readonly<{
// Pressability may override `onMouseEnter` and `onMouseLeave` to
// implement `onHoverIn` and `onHoverOut` in a platform-agnostic way.
// Hover events should be used instead of mouse events.
@@ -19,7 +19,7 @@ import invariant from 'invariant';
import * as React from 'react';
import {useMemo} from 'react';
type NativeBackgroundProp = $ReadOnly<{
type NativeBackgroundProp = Readonly<{
type: 'RippleAndroid',
color: ?number,
borderless: boolean,
@@ -40,13 +40,13 @@ export type PressableAndroidRippleConfig = {
export default function useAndroidRippleForView(
rippleConfig: ?PressableAndroidRippleConfig,
viewRef: {current: null | React.ElementRef<typeof View>},
): ?$ReadOnly<{
): ?Readonly<{
onPressIn: (event: GestureResponderEvent) => void,
onPressMove: (event: GestureResponderEvent) => void,
onPressOut: (event: GestureResponderEvent) => void,
viewProps:
| $ReadOnly<{nativeBackgroundAndroid: NativeBackgroundProp}>
| $ReadOnly<{nativeForegroundAndroid: NativeBackgroundProp}>,
| Readonly<{nativeBackgroundAndroid: NativeBackgroundProp}>
| Readonly<{nativeForegroundAndroid: NativeBackgroundProp}>,
}> {
const {color, borderless, radius, foreground} = rippleConfig ?? {};
@@ -35,7 +35,7 @@ type IndeterminateProgressBarAndroidStyleAttrProp = {
indeterminate: true,
};
type ProgressBarAndroidBaseProps = $ReadOnly<{
type ProgressBarAndroidBaseProps = Readonly<{
/**
* Whether to show the ProgressBar (true, the default) or hide it (false).
*/
@@ -51,12 +51,12 @@ type ProgressBarAndroidBaseProps = $ReadOnly<{
}>;
export type ProgressBarAndroidProps =
| $ReadOnly<{
| Readonly<{
...ViewProps,
...ProgressBarAndroidBaseProps,
...DeterminateProgressBarAndroidStyleAttrProp,
}>
| $ReadOnly<{
| Readonly<{
...ViewProps,
...ProgressBarAndroidBaseProps,
...IndeterminateProgressBarAndroidStyleAttrProp,
@@ -21,7 +21,7 @@ import * as React from 'react';
const Platform = require('../../Utilities/Platform').default;
export type RefreshControlPropsIOS = $ReadOnly<{
export type RefreshControlPropsIOS = Readonly<{
/**
* The color of the refresh indicator.
*/
@@ -36,7 +36,7 @@ export type RefreshControlPropsIOS = $ReadOnly<{
title?: ?string,
}>;
export type RefreshControlPropsAndroid = $ReadOnly<{
export type RefreshControlPropsAndroid = Readonly<{
/**
* Whether the pull to refresh functionality is enabled.
*/
@@ -55,7 +55,7 @@ export type RefreshControlPropsAndroid = $ReadOnly<{
size?: ?('default' | 'large'),
}>;
type RefreshControlBaseProps = $ReadOnly<{
type RefreshControlBaseProps = Readonly<{
/**
* Called when the view starts refreshing.
*/
@@ -72,7 +72,7 @@ type RefreshControlBaseProps = $ReadOnly<{
progressViewOffset?: ?number,
}>;
export type RefreshControlProps = $ReadOnly<{
export type RefreshControlProps = Readonly<{
...ViewProps,
...RefreshControlPropsIOS,
...RefreshControlPropsAndroid,
@@ -174,7 +174,7 @@ export interface PublicScrollViewInstance
type InnerViewInstance = React.ElementRef<typeof View>;
export type ScrollViewPropsIOS = $ReadOnly<{
export type ScrollViewPropsIOS = Readonly<{
/**
* Controls whether iOS should automatically adjust the content inset
* for scroll views that are placed behind a navigation bar or
@@ -330,7 +330,7 @@ export type ScrollViewPropsIOS = $ReadOnly<{
),
}>;
export type ScrollViewPropsAndroid = $ReadOnly<{
export type ScrollViewPropsAndroid = Readonly<{
/**
* Enables nested scrolling for Android API level 21+.
* Nested scrolling is supported by default on iOS
@@ -391,11 +391,11 @@ export type ScrollViewPropsAndroid = $ReadOnly<{
}>;
type StickyHeaderComponentType = component(
ref?: React.RefSetter<$ReadOnly<interface {setNextHeaderY: number => void}>>,
ref?: React.RefSetter<Readonly<interface {setNextHeaderY: number => void}>>,
...ScrollViewStickyHeaderProps
);
type ScrollViewBaseProps = $ReadOnly<{
type ScrollViewBaseProps = Readonly<{
/**
* These styles will be applied to the scroll view content container which
* wraps all of the child views. Example:
@@ -514,7 +514,7 @@ type ScrollViewBaseProps = $ReadOnly<{
* whether content is "visible" or not.
*
*/
maintainVisibleContentPosition?: ?$ReadOnly<{
maintainVisibleContentPosition?: ?Readonly<{
minIndexForVisible: number,
autoscrollToTopThreshold?: ?number,
}>,
@@ -673,7 +673,7 @@ type ScrollViewBaseProps = $ReadOnly<{
scrollViewRef?: React.RefSetter<PublicScrollViewInstance>,
}>;
export type ScrollViewProps = $ReadOnly<{
export type ScrollViewProps = Readonly<{
...Omit<ViewProps, 'experimental_accessibilityOrder'>,
...ScrollViewPropsIOS,
...ScrollViewPropsAndroid,
@@ -686,7 +686,7 @@ type ScrollViewState = {
const IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
export type ScrollViewComponentStatics = $ReadOnly<{
export type ScrollViewComponentStatics = Readonly<{
Context: typeof ScrollViewContext,
}>;
@@ -19,7 +19,7 @@ import type {
} from '../../Types/CoreEventTypes';
import type {ViewProps} from '../View/ViewPropTypes';
export type ScrollViewNativeProps = $ReadOnly<{
export type ScrollViewNativeProps = Readonly<{
...ViewProps,
alwaysBounceHorizontal?: ?boolean,
alwaysBounceVertical?: ?boolean,
@@ -46,7 +46,7 @@ export type ScrollViewNativeProps = $ReadOnly<{
indicatorStyle?: ?('default' | 'black' | 'white'),
isInvertedVirtualizedList?: ?boolean,
keyboardDismissMode?: ?('none' | 'on-drag' | 'interactive'),
maintainVisibleContentPosition?: ?$ReadOnly<{
maintainVisibleContentPosition?: ?Readonly<{
minIndexForVisible: number,
autoscrollToTopThreshold?: ?number,
}>,
@@ -25,7 +25,7 @@ import {
useState,
} from 'react';
export type ScrollViewStickyHeaderProps = $ReadOnly<{
export type ScrollViewStickyHeaderProps = Readonly<{
children?: React.Node,
nextHeaderLayoutY: ?number,
onLayout: (event: LayoutChangeEvent) => void,
@@ -12,7 +12,7 @@
import * as React from 'react';
type Props = $ReadOnly<{
type Props = Readonly<{
/**
* Indicates whether the render function needs to be called again
*/
@@ -55,7 +55,7 @@ export type StatusBarAnimation = $Keys<{
...
}>;
export type StatusBarPropsAndroid = $ReadOnly<{
export type StatusBarPropsAndroid = Readonly<{
/**
* The background color of the status bar.
*
@@ -76,7 +76,7 @@ export type StatusBarPropsAndroid = $ReadOnly<{
translucent?: ?boolean,
}>;
export type StatusBarPropsIOS = $ReadOnly<{
export type StatusBarPropsIOS = Readonly<{
/**
* If the network activity indicator should be visible.
*
@@ -92,7 +92,7 @@ export type StatusBarPropsIOS = $ReadOnly<{
showHideTransition?: ?('fade' | 'slide' | 'none'),
}>;
type StatusBarBaseProps = $ReadOnly<{
type StatusBarBaseProps = Readonly<{
/**
* If the status bar is hidden.
*/
@@ -108,7 +108,7 @@ type StatusBarBaseProps = $ReadOnly<{
barStyle?: ?('default' | 'light-content' | 'dark-content'),
}>;
export type StatusBarProps = $ReadOnly<{
export type StatusBarProps = Readonly<{
...StatusBarPropsAndroid,
...StatusBarPropsIOS,
...StatusBarBaseProps,
@@ -48,7 +48,7 @@ export type SwitchPropsIOS = {
tintColor?: ?ColorValue,
};
type SwitchChangeEventData = $ReadOnly<{
type SwitchChangeEventData = Readonly<{
target: number,
value: boolean,
}>;
@@ -82,7 +82,7 @@ type SwitchPropsBase = {
color of the background exposed by the shrunken track, use
[`ios_backgroundColor`](https://reactnative.dev/docs/switch#ios_backgroundColor).
*/
trackColor?: ?$ReadOnly<{
trackColor?: ?Readonly<{
false?: ?ColorValue,
true?: ?ColorValue,
}>,
@@ -109,7 +109,7 @@ type SwitchPropsBase = {
onValueChange?: ?(value: boolean) => Promise<void> | void,
};
export type SwitchProps = $ReadOnly<{
export type SwitchProps = Readonly<{
...ViewProps,
...SwitchPropsIOS,
...SwitchPropsBase,
@@ -63,7 +63,7 @@ export type ReturnKeyType =
export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
export type AndroidTextInputNativeProps = $ReadOnly<{
export type AndroidTextInputNativeProps = Readonly<{
// This allows us to inherit everything from ViewProps except for style (see below)
// This must be commented for Fabric codegen to work.
...Omit<ViewProps, 'style'>,
@@ -339,13 +339,13 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
* Callback that is called when the text input is blurred.
* `target` is the reactTag of the element
*/
onBlur?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>,
onBlur?: ?BubblingEventHandler<Readonly<{target: Int32}>>,
/**
* Callback that is called when the text input is focused.
* `target` is the reactTag of the element
*/
onFocus?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>,
onFocus?: ?BubblingEventHandler<Readonly<{target: Int32}>>,
/**
* Callback that is called when the text input's text changes.
@@ -353,7 +353,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
* TODO: differentiate between onChange and onChangeText
*/
onChange?: ?BubblingEventHandler<
$ReadOnly<{target: Int32, eventCount: Int32, text: string}>,
Readonly<{target: Int32, eventCount: Int32, text: string}>,
>,
/**
@@ -362,7 +362,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
* TODO: differentiate between onChange and onChangeText
*/
onChangeText?: ?BubblingEventHandler<
$ReadOnly<{target: Int32, eventCount: Int32, text: string}>,
Readonly<{target: Int32, eventCount: Int32, text: string}>,
>,
/**
@@ -373,18 +373,16 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
* Only called for multiline text inputs.
*/
onContentSizeChange?: ?DirectEventHandler<
$ReadOnly<{
Readonly<{
target: Int32,
contentSize: $ReadOnly<{width: Double, height: Double}>,
contentSize: Readonly<{width: Double, height: Double}>,
}>,
>,
/**
* Callback that is called when text input ends.
*/
onEndEditing?: ?BubblingEventHandler<
$ReadOnly<{target: Int32, text: string}>,
>,
onEndEditing?: ?BubblingEventHandler<Readonly<{target: Int32, text: string}>>,
/**
* Callback that is called when the text input selection is changed.
@@ -392,9 +390,9 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
* `{ nativeEvent: { selection: { start, end } } }`.
*/
onSelectionChange?: ?DirectEventHandler<
$ReadOnly<{
Readonly<{
target: Int32,
selection: $ReadOnly<{start: Double, end: Double}>,
selection: Readonly<{start: Double, end: Double}>,
}>,
>,
@@ -403,7 +401,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
* Invalid if `multiline={true}` is specified.
*/
onSubmitEditing?: ?BubblingEventHandler<
$ReadOnly<{target: Int32, text: string}>,
Readonly<{target: Int32, text: string}>,
>,
/**
@@ -413,7 +411,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
* the typed-in character otherwise including `' '` for space.
* Fires before `onChange` callbacks.
*/
onKeyPress?: ?BubblingEventHandler<$ReadOnly<{target: Int32, key: string}>>,
onKeyPress?: ?BubblingEventHandler<Readonly<{target: Int32, key: string}>>,
/**
* Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
@@ -421,28 +419,28 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
* is not provided for performance reasons.
*/
onScroll?: ?DirectEventHandler<
$ReadOnly<{
Readonly<{
target: Int32,
responderIgnoreScroll: boolean,
contentInset: $ReadOnly<{
contentInset: Readonly<{
top: Double, // always 0 on Android
bottom: Double, // always 0 on Android
left: Double, // always 0 on Android
right: Double, // always 0 on Android
}>,
contentOffset: $ReadOnly<{
contentOffset: Readonly<{
x: Double,
y: Double,
}>,
contentSize: $ReadOnly<{
contentSize: Readonly<{
width: Double, // always 0 on Android
height: Double, // always 0 on Android
}>,
layoutMeasurement: $ReadOnly<{
layoutMeasurement: Readonly<{
width: Double,
height: Double,
}>,
velocity: $ReadOnly<{
velocity: Readonly<{
x: Double, // always 0 on Android
y: Double, // always 0 on Android
}>,
@@ -479,7 +477,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
* The start and end of the text input's selection. Set start and end to
* the same value to position the cursor.
*/
selection?: ?$ReadOnly<{
selection?: ?Readonly<{
start: Int32,
end?: ?Int32,
}>,
@@ -582,7 +580,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{
textShadowRadius?: ?Float,
textDecorationLine?: ?string,
fontStyle?: ?string,
textShadowOffset?: ?$ReadOnly<{width?: ?Double, height?: ?Double}>,
textShadowOffset?: ?Readonly<{width?: ?Double, height?: ?Double}>,
lineHeight?: ?Float,
textTransform?: ?string,
color?: ?Int32,
@@ -76,7 +76,7 @@ import * as React from 'react';
* For an example, look at InputAccessoryViewExample.js in RNTester.
*/
export type InputAccessoryViewProps = $ReadOnly<{
export type InputAccessoryViewProps = Readonly<{
+children: React.Node,
/**
* An ID which is used to associate this `InputAccessoryView` to
@@ -25,7 +25,7 @@ import * as React from 'react';
/**
* @see TextInputProps.onChange
*/
type TextInputChangeEventData = $ReadOnly<{
type TextInputChangeEventData = Readonly<{
eventCount: number,
target: number,
text: string,
@@ -35,10 +35,10 @@ export type TextInputChangeEvent =
NativeSyntheticEvent<TextInputChangeEventData>;
export type TextInputEvent = NativeSyntheticEvent<
$ReadOnly<{
Readonly<{
eventCount: number,
previousText: string,
range: $ReadOnly<{
range: Readonly<{
start: number,
end: number,
}>,
@@ -47,9 +47,9 @@ export type TextInputEvent = NativeSyntheticEvent<
}>,
>;
type TextInputContentSizeChangeEventData = $ReadOnly<{
type TextInputContentSizeChangeEventData = Readonly<{
target: number,
contentSize: $ReadOnly<{
contentSize: Readonly<{
width: number,
height: number,
}>,
@@ -73,17 +73,17 @@ export type TextInputBlurEvent = BlurEvent;
*/
export type TextInputFocusEvent = FocusEvent;
type TargetEvent = $ReadOnly<{
type TargetEvent = Readonly<{
target: number,
...
}>;
export type Selection = $ReadOnly<{
export type Selection = Readonly<{
start: number,
end: number,
}>;
type TextInputSelectionChangeEventData = $ReadOnly<{
type TextInputSelectionChangeEventData = Readonly<{
...TargetEvent,
selection: Selection,
...
@@ -95,7 +95,7 @@ type TextInputSelectionChangeEventData = $ReadOnly<{
export type TextInputSelectionChangeEvent =
NativeSyntheticEvent<TextInputSelectionChangeEventData>;
type TextInputKeyPressEventData = $ReadOnly<{
type TextInputKeyPressEventData = Readonly<{
...TargetEvent,
key: string,
target?: ?number,
@@ -109,7 +109,7 @@ type TextInputKeyPressEventData = $ReadOnly<{
export type TextInputKeyPressEvent =
NativeSyntheticEvent<TextInputKeyPressEventData>;
type TextInputEndEditingEventData = $ReadOnly<{
type TextInputEndEditingEventData = Readonly<{
...TargetEvent,
eventCount: number,
text: string,
@@ -122,7 +122,7 @@ type TextInputEndEditingEventData = $ReadOnly<{
export type TextInputEndEditingEvent =
NativeSyntheticEvent<TextInputEndEditingEventData>;
type TextInputSubmitEditingEventData = $ReadOnly<{
type TextInputSubmitEditingEventData = Readonly<{
...TargetEvent,
eventCount: number,
text: string,
@@ -266,7 +266,7 @@ export type EnterKeyHintTypeOptions =
type PasswordRules = string;
export type TextInputIOSProps = $ReadOnly<{
export type TextInputIOSProps = Readonly<{
/**
* If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false.
* @platform ios
@@ -403,7 +403,7 @@ export type TextInputIOSProps = $ReadOnly<{
smartInsertDelete?: ?boolean,
}>;
export type TextInputAndroidProps = $ReadOnly<{
export type TextInputAndroidProps = Readonly<{
/**
* When provided it will set the color of the cursor (or "caret") in the component.
* Unlike the behavior of `selectionColor` the cursor color will be set independently
@@ -512,7 +512,7 @@ export type TextInputAndroidProps = $ReadOnly<{
underlineColorAndroid?: ?ColorValue,
}>;
type TextInputBaseProps = $ReadOnly<{
type TextInputBaseProps = Readonly<{
/**
* When provided, the text input will only accept drag and drop events for the specified
* types. If null or not provided, the text input will accept all types of drag and drop events.
@@ -946,7 +946,7 @@ type TextInputBaseProps = $ReadOnly<{
* The start and end of the text input's selection. Set start and end to
* the same value to position the cursor.
*/
selection?: ?$ReadOnly<{
selection?: ?Readonly<{
start: number,
end?: ?number,
}>,
@@ -1031,7 +1031,7 @@ type TextInputBaseProps = $ReadOnly<{
textAlign?: ?('left' | 'center' | 'right'),
}>;
export type TextInputProps = $ReadOnly<{
export type TextInputProps = Readonly<{
...Omit<ViewProps, 'style' | 'experimental_accessibilityOrder'>,
...TextInputIOSProps,
...TextInputAndroidProps,
@@ -1167,8 +1167,8 @@ type InternalTextInput = component(
...TextInputProps
);
export type TextInputComponentStatics = $ReadOnly<{
State: $ReadOnly<{
export type TextInputComponentStatics = Readonly<{
State: Readonly<{
currentlyFocusedInput: () => ?HostInstance,
currentlyFocusedField: () => ?number,
focusTextInput: (textField: ?HostInstance) => void,
@@ -120,7 +120,7 @@ export type {
TextInputSubmitEditingEvent,
};
type TextInputStateType = $ReadOnly<{
type TextInputStateType = Readonly<{
/**
* @deprecated Use currentlyFocusedInput
* Returns the ID of the currently focused text field, if one exists
@@ -965,7 +965,7 @@ TextInput.State = {
focusTextInput: TextInputState.focusTextInput,
};
export type TextInputComponentStatics = $ReadOnly<{
export type TextInputComponentStatics = Readonly<{
State: TextInputStateType,
}>;
@@ -19,7 +19,7 @@ import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
import Platform from '../../Utilities/Platform';
import * as React from 'react';
type TouchableBounceProps = $ReadOnly<{
type TouchableBounceProps = Readonly<{
...React.ElementConfig<TouchableWithoutFeedback>,
onPressAnimationComplete?: ?() => void,
@@ -31,7 +31,7 @@ type TouchableBounceProps = $ReadOnly<{
hostRef: React.RefSetter<React.ElementRef<typeof Animated.View>>,
}>;
type TouchableBounceState = $ReadOnly<{
type TouchableBounceState = Readonly<{
pressability: Pressability,
scale: Animated.Value,
}>;
@@ -226,10 +226,10 @@ export default (function TouchableBounceWrapper({
...props
}: {
ref: React.RefSetter<unknown>,
...$ReadOnly<Omit<TouchableBounceProps, 'hostRef'>>,
...Readonly<Omit<TouchableBounceProps, 'hostRef'>>,
}) {
return <TouchableBounce {...props} hostRef={hostRef} />;
} as component(
ref?: React.RefSetter<unknown>,
...props: $ReadOnly<Omit<TouchableBounceProps, 'hostRef'>>
...props: Readonly<Omit<TouchableBounceProps, 'hostRef'>>
));
@@ -22,7 +22,7 @@ import Platform from '../../Utilities/Platform';
import * as React from 'react';
import {cloneElement} from 'react';
type AndroidProps = $ReadOnly<{
type AndroidProps = Readonly<{
nextFocusDown?: ?number,
nextFocusForward?: ?number,
nextFocusLeft?: ?number,
@@ -30,14 +30,14 @@ type AndroidProps = $ReadOnly<{
nextFocusUp?: ?number,
}>;
type IOSProps = $ReadOnly<{
type IOSProps = Readonly<{
/**
* @deprecated Use `focusable` instead
*/
hasTVPreferredFocus?: ?boolean,
}>;
type TouchableHighlightBaseProps = $ReadOnly<{
type TouchableHighlightBaseProps = Readonly<{
/**
* Determines what the opacity of the wrapped view should be when touch is active.
*/
@@ -63,19 +63,19 @@ type TouchableHighlightBaseProps = $ReadOnly<{
hostRef?: React.RefSetter<React.ElementRef<typeof View>>,
}>;
export type TouchableHighlightProps = $ReadOnly<{
export type TouchableHighlightProps = Readonly<{
...TouchableWithoutFeedbackProps,
...AndroidProps,
...IOSProps,
...TouchableHighlightBaseProps,
}>;
type ExtraStyles = $ReadOnly<{
type ExtraStyles = Readonly<{
child: ViewStyleProp,
underlay: ViewStyleProp,
}>;
type TouchableHighlightState = $ReadOnly<{
type TouchableHighlightState = Readonly<{
pressability: Pressability,
extraStyles: ?ExtraStyles,
}>;
@@ -412,13 +412,13 @@ class TouchableHighlightImpl extends React.Component<
const TouchableHighlight: component(
ref?: React.RefSetter<React.ElementRef<typeof View>>,
...props: $ReadOnly<Omit<TouchableHighlightProps, 'hostRef'>>
...props: Readonly<Omit<TouchableHighlightProps, 'hostRef'>>
) = ({
ref: hostRef,
...props
}: {
ref?: React.RefSetter<React.ElementRef<typeof View>>,
...$ReadOnly<Omit<TouchableHighlightProps, 'hostRef'>>,
...Readonly<Omit<TouchableHighlightProps, 'hostRef'>>,
}) => <TouchableHighlightImpl {...props} hostRef={hostRef} />;
TouchableHighlight.displayName = 'TouchableHighlight';
@@ -69,7 +69,7 @@ type TouchableNativeFeedbackTVProps = {
nextFocusUp?: ?number,
};
export type TouchableNativeFeedbackProps = $ReadOnly<{
export type TouchableNativeFeedbackProps = Readonly<{
...TouchableWithoutFeedbackProps,
...TouchableNativeFeedbackTVProps,
/**
@@ -87,14 +87,14 @@ export type TouchableNativeFeedbackProps = $ReadOnly<{
* type is available on Android API level 21+
*/
background?: ?(
| $ReadOnly<{
| Readonly<{
type: 'ThemeAttrAndroid',
attribute:
| 'selectableItemBackground'
| 'selectableItemBackgroundBorderless',
rippleRadius: ?number,
}>
| $ReadOnly<{
| Readonly<{
type: 'RippleAndroid',
color: ?number,
borderless: boolean,
@@ -114,7 +114,7 @@ export type TouchableNativeFeedbackProps = $ReadOnly<{
useForeground?: ?boolean,
}>;
type TouchableNativeFeedbackState = $ReadOnly<{
type TouchableNativeFeedbackState = Readonly<{
pressability: Pressability,
}>;
@@ -138,7 +138,7 @@ class TouchableNativeFeedback extends React.Component<
*
* @param rippleRadius The radius of ripple effect
*/
static SelectableBackground: (rippleRadius?: ?number) => $ReadOnly<{
static SelectableBackground: (rippleRadius?: ?number) => Readonly<{
attribute: 'selectableItemBackground',
type: 'ThemeAttrAndroid',
rippleRadius: ?number,
@@ -155,7 +155,7 @@ class TouchableNativeFeedback extends React.Component<
*
* @param rippleRadius The radius of ripple effect
*/
static SelectableBackgroundBorderless: (rippleRadius?: ?number) => $ReadOnly<{
static SelectableBackgroundBorderless: (rippleRadius?: ?number) => Readonly<{
attribute: 'selectableItemBackgroundBorderless',
type: 'ThemeAttrAndroid',
rippleRadius: ?number,
@@ -180,7 +180,7 @@ class TouchableNativeFeedback extends React.Component<
color: string,
borderless: boolean,
rippleRadius?: ?number,
) => $ReadOnly<{
) => Readonly<{
borderless: boolean,
color: ?number,
rippleRadius: ?number,
@@ -21,7 +21,7 @@ import flattenStyle from '../../StyleSheet/flattenStyle';
import Platform from '../../Utilities/Platform';
import * as React from 'react';
export type TouchableOpacityTVProps = $ReadOnly<{
export type TouchableOpacityTVProps = Readonly<{
/**
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
*
@@ -66,7 +66,7 @@ export type TouchableOpacityTVProps = $ReadOnly<{
nextFocusUp?: ?number,
}>;
type TouchableOpacityBaseProps = $ReadOnly<{
type TouchableOpacityBaseProps = Readonly<{
/**
* Determines what the opacity of the wrapped view should be when touch is active.
* Defaults to 0.2
@@ -77,13 +77,13 @@ type TouchableOpacityBaseProps = $ReadOnly<{
hostRef?: ?React.RefSetter<React.ElementRef<typeof Animated.View>>,
}>;
export type TouchableOpacityProps = $ReadOnly<{
export type TouchableOpacityProps = Readonly<{
...TouchableWithoutFeedbackProps,
...TouchableOpacityTVProps,
...TouchableOpacityBaseProps,
}>;
type TouchableOpacityState = $ReadOnly<{
type TouchableOpacityState = Readonly<{
anim: Animated.Value,
pressability: Pressability,
}>;
@@ -36,7 +36,7 @@ export type TouchableWithoutFeedbackPropsAndroid = {
touchSoundDisabled?: ?boolean,
};
export type TouchableWithoutFeedbackProps = $ReadOnly<
export type TouchableWithoutFeedbackProps = Readonly<
{
children?: ?React.Node,
/**
@@ -14,7 +14,7 @@ import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
import StyleSheet from '../../StyleSheet/StyleSheet';
import * as React from 'react';
type Props = $ReadOnly<{
type Props = Readonly<{
style?: ?ViewStyleProp,
children?: React.Node,
...
@@ -154,7 +154,7 @@ export type AccessibilityActionName =
| 'escape';
// the info associated with an accessibility action
export type AccessibilityActionInfo = $ReadOnly<{
export type AccessibilityActionInfo = Readonly<{
name: AccessibilityActionName | string,
label?: string,
...
@@ -162,7 +162,7 @@ export type AccessibilityActionInfo = $ReadOnly<{
// The info included in the event sent to onAccessibilityAction
export type AccessibilityActionEvent = NativeSyntheticEvent<
$ReadOnly<{actionName: string, ...}>,
Readonly<{actionName: string, ...}>,
>;
export type AccessibilityState = {
@@ -189,7 +189,7 @@ export type AccessibilityState = {
...
};
export type AccessibilityValue = $ReadOnly<{
export type AccessibilityValue = Readonly<{
/**
* The minimum value of this component's range. (should be an integer)
*/
@@ -211,7 +211,7 @@ export type AccessibilityValue = $ReadOnly<{
text?: Stringish,
}>;
export type AccessibilityPropsAndroid = $ReadOnly<{
export type AccessibilityPropsAndroid = Readonly<{
/**
* Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props,
* the text is read aloud. The value should should match the nativeID of the related element.
@@ -268,7 +268,7 @@ export type AccessibilityPropsAndroid = $ReadOnly<{
screenReaderFocusable?: boolean,
}>;
export type AccessibilityPropsIOS = $ReadOnly<{
export type AccessibilityPropsIOS = Readonly<{
/**
* Prevents view from being inverted if set to true and color inversion is turned on.
*
@@ -338,7 +338,7 @@ export type AccessibilityPropsIOS = $ReadOnly<{
accessibilityRespondsToUserInteraction?: ?boolean,
}>;
export type AccessibilityProps = $ReadOnly<{
export type AccessibilityProps = Readonly<{
...AccessibilityPropsAndroid,
...AccessibilityPropsIOS,
/**
@@ -33,7 +33,7 @@ import * as React from 'react';
export type ViewLayout = LayoutRectangle;
export type ViewLayoutEvent = LayoutChangeEvent;
type DirectEventProps = $ReadOnly<{
type DirectEventProps = Readonly<{
/**
* When `accessible` is true, the system will try to invoke this function
* when the user performs an accessibility custom action.
@@ -79,13 +79,13 @@ type DirectEventProps = $ReadOnly<{
onAccessibilityEscape?: ?() => unknown,
}>;
type MouseEventProps = $ReadOnly<{
type MouseEventProps = Readonly<{
onMouseEnter?: ?(event: MouseEvent) => void,
onMouseLeave?: ?(event: MouseEvent) => void,
}>;
// Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use)
type PointerEventProps = $ReadOnly<{
type PointerEventProps = Readonly<{
onClick?: ?(event: PointerEvent) => void,
onClickCapture?: ?(event: PointerEvent) => void,
onPointerEnter?: ?(event: PointerEvent) => void,
@@ -110,21 +110,21 @@ type PointerEventProps = $ReadOnly<{
onLostPointerCaptureCapture?: ?(e: PointerEvent) => void,
}>;
type FocusEventProps = $ReadOnly<{
type FocusEventProps = Readonly<{
onBlur?: ?(event: BlurEvent) => void,
onBlurCapture?: ?(event: BlurEvent) => void,
onFocus?: ?(event: FocusEvent) => void,
onFocusCapture?: ?(event: FocusEvent) => void,
}>;
type KeyEventProps = $ReadOnly<{
type KeyEventProps = Readonly<{
onKeyDown?: ?(event: KeyDownEvent) => void,
onKeyDownCapture?: ?(event: KeyDownEvent) => void,
onKeyUp?: ?(event: KeyUpEvent) => void,
onKeyUpCapture?: ?(event: KeyUpEvent) => void,
}>;
type TouchEventProps = $ReadOnly<{
type TouchEventProps = Readonly<{
onTouchCancel?: ?(e: GestureResponderEvent) => void,
onTouchCancelCapture?: ?(e: GestureResponderEvent) => void,
onTouchEnd?: ?(e: GestureResponderEvent) => void,
@@ -140,7 +140,7 @@ type TouchEventProps = $ReadOnly<{
* `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`,
* `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion.
*/
export type GestureResponderHandlers = $ReadOnly<{
export type GestureResponderHandlers = Readonly<{
/**
* Does this view want to "claim" touch responsiveness? This is called for
* every touch move on the `View` when it is not the responder.
@@ -257,12 +257,12 @@ export type GestureResponderHandlers = $ReadOnly<{
onStartShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean,
}>;
type AndroidDrawableThemeAttr = $ReadOnly<{
type AndroidDrawableThemeAttr = Readonly<{
type: 'ThemeAttrAndroid',
attribute: string,
}>;
type AndroidDrawableRipple = $ReadOnly<{
type AndroidDrawableRipple = Readonly<{
type: 'RippleAndroid',
color?: ?number,
borderless?: ?boolean,
@@ -271,7 +271,7 @@ type AndroidDrawableRipple = $ReadOnly<{
type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple;
export type ViewPropsAndroid = $ReadOnly<{
export type ViewPropsAndroid = Readonly<{
nativeBackgroundAndroid?: ?AndroidDrawable,
nativeForegroundAndroid?: ?AndroidDrawable,
@@ -356,7 +356,7 @@ export type ViewPropsAndroid = $ReadOnly<{
onClick?: ?(event: GestureResponderEvent) => unknown,
}>;
export type TVViewPropsIOS = $ReadOnly<{
export type TVViewPropsIOS = Readonly<{
/**
* *(Apple TV only)* When set to true, this view will be focusable
* and navigable using the Apple TV remote.
@@ -401,7 +401,7 @@ export type TVViewPropsIOS = $ReadOnly<{
tvParallaxMagnification?: number,
}>;
export type ViewPropsIOS = $ReadOnly<{
export type ViewPropsIOS = Readonly<{
/**
* Whether this `View` should be rendered as a bitmap before compositing.
*
@@ -412,7 +412,7 @@ export type ViewPropsIOS = $ReadOnly<{
shouldRasterizeIOS?: ?boolean,
}>;
type ViewBaseProps = $ReadOnly<{
type ViewBaseProps = Readonly<{
children?: React.Node,
style?: ?ViewStyleProp,
@@ -508,7 +508,7 @@ type ViewBaseProps = $ReadOnly<{
experimental_accessibilityOrder?: ?Array<string>,
}>;
export type ViewProps = $ReadOnly<{
export type ViewProps = Readonly<{
...DirectEventProps,
...GestureResponderHandlers,
...MouseEventProps,
@@ -10,25 +10,25 @@
'use strict';
type HermesStackLocationNative = $ReadOnly<{
type HermesStackLocationNative = Readonly<{
type: 'NATIVE',
}>;
type HermesStackLocationSource = $ReadOnly<{
type HermesStackLocationSource = Readonly<{
type: 'SOURCE',
sourceUrl: string,
line1Based: number,
column1Based: number,
}>;
type HermesStackLocationInternalBytecode = $ReadOnly<{
type HermesStackLocationInternalBytecode = Readonly<{
type: 'INTERNAL_BYTECODE',
sourceUrl: string,
line1Based: number,
virtualOffset0Based: number,
}>;
type HermesStackLocationBytecode = $ReadOnly<{
type HermesStackLocationBytecode = Readonly<{
type: 'BYTECODE',
sourceUrl: string,
line1Based: number,
@@ -41,20 +41,20 @@ type HermesStackLocation =
| HermesStackLocationInternalBytecode
| HermesStackLocationBytecode;
type HermesStackEntryFrame = $ReadOnly<{
type HermesStackEntryFrame = Readonly<{
type: 'FRAME',
location: HermesStackLocation,
functionName: string,
}>;
type HermesStackEntrySkipped = $ReadOnly<{
type HermesStackEntrySkipped = Readonly<{
type: 'SKIPPED',
count: number,
}>;
type HermesStackEntry = HermesStackEntryFrame | HermesStackEntrySkipped;
export type HermesParsedStack = $ReadOnly<{
export type HermesParsedStack = Readonly<{
message: string,
entries: $ReadOnlyArray<HermesStackEntry>,
}>;
@@ -14,7 +14,7 @@ import type {StackFrame} from '../NativeExceptionsManager';
const getDevServer = require('./getDevServer').default;
export type CodeFrame = $ReadOnly<{
export type CodeFrame = Readonly<{
content: string,
location: ?{
row: number,
@@ -24,7 +24,7 @@ export type CodeFrame = $ReadOnly<{
fileName: string,
}>;
export type SymbolicatedStackTrace = $ReadOnly<{
export type SymbolicatedStackTrace = Readonly<{
stack: Array<StackFrame>,
codeFrame: ?CodeFrame,
}>;
+1 -1
View File
@@ -12,7 +12,7 @@ import type {IEventEmitter} from '../vendor/emitter/EventEmitter';
import EventEmitter from '../vendor/emitter/EventEmitter';
export type RawEventEmitterEvent = $ReadOnly<{
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),
@@ -19,7 +19,7 @@ export type FetchSegmentFunction = typeof __fetchSegment;
function __fetchSegment(
segmentId: number,
options: $ReadOnly<{
options: Readonly<{
otaBuildNumber: ?string,
requestedModuleName: string,
segmentHash: string,
@@ -45,9 +45,9 @@ type UnsafeNativeEventObject = Object;
* can theoretically listen to `RCTDeviceEventEmitter` (although discouraged).
*/
export default class NativeEventEmitter<
TEventToArgsMap: $ReadOnly<
TEventToArgsMap: Readonly<
Record<string, $ReadOnlyArray<UnsafeNativeEventObject>>,
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeNativeEventObject>>>,
> = Readonly<Record<string, $ReadOnlyArray<UnsafeNativeEventObject>>>,
> implements IEventEmitter<TEventToArgsMap>
{
_nativeModule: ?NativeModule;
@@ -19,7 +19,7 @@ import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter';
* Mock `NativeEventEmitter` to ignore Native Modules.
*/
export default class NativeEventEmitter<
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<unknown>>>,
TEventToArgsMap: Readonly<Record<string, $ReadOnlyArray<unknown>>>,
> implements IEventEmitter<TEventToArgsMap>
{
addListener<TEvent: $Keys<TEventToArgsMap>>(
@@ -22,7 +22,7 @@ export type ResolvedAssetSource = {
type AssetDestPathResolver = 'android' | 'generic';
// From @react-native/assets-registry
type PackagerAsset = $ReadOnly<{
type PackagerAsset = Readonly<{
__packager_asset: boolean,
fileSystemLocation: string,
httpServerLocation: string,
+9 -11
View File
@@ -38,7 +38,7 @@ type ImageProgressEventDataIOS = {
* @see ImagePropsIOS.onProgress
*/
export type ImageProgressEventIOS = NativeSyntheticEvent<
$ReadOnly<ImageProgressEventDataIOS>,
Readonly<ImageProgressEventDataIOS>,
>;
type ImageErrorEventData = {
@@ -46,7 +46,7 @@ type ImageErrorEventData = {
};
export type ImageErrorEvent = NativeSyntheticEvent<
$ReadOnly<ImageErrorEventData>,
Readonly<ImageErrorEventData>,
>;
type ImageLoadEventData = {
@@ -57,11 +57,9 @@ type ImageLoadEventData = {
},
};
export type ImageLoadEvent = NativeSyntheticEvent<
$ReadOnly<ImageLoadEventData>,
>;
export type ImageLoadEvent = NativeSyntheticEvent<Readonly<ImageLoadEventData>>;
export type ImagePropsIOS = $ReadOnly<{
export type ImagePropsIOS = Readonly<{
/**
* A static image to display while loading the image source.
*
@@ -82,13 +80,13 @@ export type ImagePropsIOS = $ReadOnly<{
onProgress?: ?(event: ImageProgressEventIOS) => void,
}>;
export type ImagePropsAndroid = $ReadOnly<{
export type ImagePropsAndroid = Readonly<{
/**
* similarly to `source`, this property represents the resource used to render
* the loading indicator for the image, displayed until image is ready to be
* displayed, typically after when it got downloaded from network.
*/
loadingIndicatorSource?: ?(number | $ReadOnly<ImageURISource>),
loadingIndicatorSource?: ?(number | Readonly<ImageURISource>),
progressiveRenderingEnabled?: ?boolean,
fadeDuration?: ?number,
@@ -127,7 +125,7 @@ export type ImagePropsAndroid = $ReadOnly<{
resizeMultiplier?: ?number,
}>;
export type ImagePropsBase = $ReadOnly<{
export type ImagePropsBase = Readonly<{
...Omit<ViewProps, 'style'>,
/**
* When true, indicates the image is an accessibility element.
@@ -333,7 +331,7 @@ export type ImagePropsBase = $ReadOnly<{
children?: empty,
}>;
export type ImageProps = $ReadOnly<{
export type ImageProps = Readonly<{
...ImagePropsIOS,
...ImagePropsAndroid,
...ImagePropsBase,
@@ -344,7 +342,7 @@ export type ImageProps = $ReadOnly<{
style?: ?ImageStyleProp,
}>;
export type ImageBackgroundProps = $ReadOnly<{
export type ImageBackgroundProps = Readonly<{
...ImageProps,
children?: React.Node,
+1 -1
View File
@@ -104,7 +104,7 @@ type ImageSourceProperties = {
export function getImageSourceProperties(
imageSource: ImageURISource,
): $ReadOnly<ImageSourceProperties> {
): Readonly<ImageSourceProperties> {
const object: ImageSourceProperties = {};
if (imageSource.body != null) {
object.body = imageSource.body;
@@ -23,7 +23,7 @@ export type ImageSize = {
export type ImageResolvedAssetSource = ResolvedAssetSource;
type ImageComponentStaticsIOS = $ReadOnly<{
type ImageComponentStaticsIOS = Readonly<{
getSize(uri: string): Promise<ImageSize>,
getSize(
uri: string,
@@ -60,7 +60,7 @@ type ImageComponentStaticsIOS = $ReadOnly<{
resolveAssetSource(source: ImageSource): ?ImageResolvedAssetSource,
}>;
type ImageComponentStaticsAndroid = $ReadOnly<{
type ImageComponentStaticsAndroid = Readonly<{
...ImageComponentStaticsIOS,
abortPrefetch(requestId: number): void,
}>;
@@ -26,7 +26,7 @@ import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIg
import codegenNativeCommands from '../Utilities/codegenNativeCommands';
import Platform from '../Utilities/Platform';
type ImageHostComponentProps = $ReadOnly<{
type ImageHostComponentProps = Readonly<{
...ImageProps,
...ViewProps,
@@ -37,9 +37,7 @@ type ImageHostComponentProps = $ReadOnly<{
// Android native props
shouldNotifyLoadEvents?: boolean,
src?:
| ?ResolvedAssetSource
| ?$ReadOnlyArray<?$ReadOnly<{uri?: ?string, ...}>>,
src?: ?ResolvedAssetSource | ?$ReadOnlyArray<?Readonly<{uri?: ?string, ...}>>,
headers?: ?{[string]: string},
defaultSource?: ?ImageSource | ?string,
loadingIndicatorSrc?: ?string,
@@ -18,10 +18,10 @@ import type {ImageResizeMode} from './ImageResizeMode';
import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
type RCTTextInlineImageNativeProps = $ReadOnly<{
type RCTTextInlineImageNativeProps = Readonly<{
...ViewProps,
resizeMode?: ?ImageResizeMode,
src?: ?$ReadOnlyArray<?$ReadOnly<{uri?: ?string, ...}>>,
src?: ?$ReadOnlyArray<?Readonly<{uri?: ?string, ...}>>,
tintColor?: ?ColorValue,
headers?: ?{[string]: string},
}>;
+1 -1
View File
@@ -12,7 +12,7 @@ import type {ImageURISource} from './ImageSource';
import Platform from '../Utilities/Platform';
type NativeImageSourceSpec = $ReadOnly<{
type NativeImageSourceSpec = Readonly<{
android?: string,
ios?: string,
default?: string,
@@ -204,7 +204,7 @@ export type GestureResponderHandlerMethods = {
onStartShouldSetResponderCapture: (event: GestureResponderEvent) => boolean,
};
export type PanResponderCallbacks = $ReadOnly<{
export type PanResponderCallbacks = Readonly<{
onMoveShouldSetPanResponder?: ?ActiveCallback,
onMoveShouldSetPanResponderCapture?: ?ActiveCallback,
onStartShouldSetPanResponder?: ?ActiveCallback,
@@ -31,11 +31,11 @@ export type {
// Reexport type
export type {LayoutAnimationConfig} from '../Renderer/shims/ReactNativeTypes';
export type LayoutAnimationTypes = $ReadOnly<{
export type LayoutAnimationTypes = Readonly<{
[type in LayoutAnimationType]: type,
}>;
export type LayoutAnimationProperties = $ReadOnly<{
export type LayoutAnimationProperties = Readonly<{
[prop in LayoutAnimationProperty]: prop,
}>;
+2 -2
View File
@@ -38,7 +38,7 @@ type RequiredFlatListProps<ItemT> = {
* An array (or array-like list) of items to render. Other data types can be
* used by targeting VirtualizedList directly.
*/
data: ?$ReadOnly<$ArrayLike<ItemT>>,
data: ?Readonly<$ArrayLike<ItemT>>,
};
type OptionalFlatListProps<ItemT> = {
/**
@@ -93,7 +93,7 @@ type OptionalFlatListProps<ItemT> = {
* specify `ItemSeparatorComponent`.
*/
getItemLayout?: (
data: ?$ReadOnly<$ArrayLike<ItemT>>,
data: ?Readonly<$ArrayLike<ItemT>>,
index: number,
) => {
length: number,
+1 -1
View File
@@ -101,7 +101,7 @@ type OptionalProps<ItemT, SectionT = DefaultSectionT> = {
removeClippedSubviews?: boolean,
};
export type Props<ItemT, SectionT = DefaultSectionT> = $ReadOnly<{
export type Props<ItemT, SectionT = DefaultSectionT> = Readonly<{
...Omit<
VirtualizedSectionListProps<ItemT, SectionT>,
'getItem' | 'getItemCount' | 'renderItem' | 'keyExtractor',
@@ -20,7 +20,7 @@ function testPropPropagatedToMountingLayer<TValue>({
value,
defaultValue,
renderChildrenForValue,
}: $ReadOnly<{
}: Readonly<{
propName: string,
value: TValue,
defaultValue: TValue,
@@ -29,7 +29,7 @@ function testPropPropagatedToMountingLayer<TValue>({
describe(propName, () => {
it('is propagated to the mounting layer', () => {
const root = Fantom.createRoot();
const props: FlatListProps<$ReadOnly<{}>> = {
const props: FlatListProps<Readonly<{}>> = {
// $FlowFixMe[incompatible-type]
[propName]: value,
};
@@ -53,7 +53,7 @@ function testPropPropagatedToMountingLayer<TValue>({
it(`default value is ${JSON.stringify(defaultValue) ?? 'null'}`, () => {
const root = Fantom.createRoot();
const props: FlatListProps<$ReadOnly<{}>> = {
const props: FlatListProps<Readonly<{}>> = {
// $FlowFixMe[incompatible-type]
[propName]: defaultValue,
};
@@ -36,7 +36,7 @@ describe('FlatList', () => {
expect(component).toMatchSnapshot();
});
it('renders simple list using ListItemComponent', async () => {
function ListItemComponent({item}: $ReadOnly<{item: {key: string}}>) {
function ListItemComponent({item}: Readonly<{item: {key: string}}>) {
return <item value={item.key} />;
}
const component = await create(
@@ -48,7 +48,7 @@ describe('FlatList', () => {
expect(component).toMatchSnapshot();
});
it('renders simple list using ListItemComponent (multiple columns)', async () => {
function ListItemComponent({item}: $ReadOnly<{item: {key: string}}>) {
function ListItemComponent({item}: Readonly<{item: {key: string}}>) {
return <item value={item.key} />;
}
const component = await create(
@@ -137,7 +137,7 @@ describe('FlatList', () => {
jest.resetModules();
jest.unmock('../../Components/ScrollView/ScrollView');
function ListItemComponent({item}: $ReadOnly<{item: {key: string}}>) {
function ListItemComponent({item}: Readonly<{item: {key: string}}>) {
return <item value={item.key} />;
}
const listRef = createRef<React.ElementRef<typeof FlatList>>();
@@ -99,7 +99,7 @@ describe('SectionList', () => {
});
});
function propStr(props: $ReadOnly<{[string]: $FlowFixMe}>) {
function propStr(props: Readonly<{[string]: $FlowFixMe}>) {
return Object.keys(props)
.map(k => {
const propObj = props[k] || {};
+7 -7
View File
@@ -26,7 +26,7 @@ import {parseLogBoxException} from './parseLogBoxLog';
import * as React from 'react';
export type LogBoxLogs = Set<LogBoxLog>;
export type LogData = $ReadOnly<{
export type LogData = Readonly<{
level: LogLevel,
message: Message,
category: Category,
@@ -36,7 +36,7 @@ export type LogData = $ReadOnly<{
}>;
export type Observer = (
$ReadOnly<{
Readonly<{
logs: LogBoxLogs,
isDisabled: boolean,
selectedLogIndex: number,
@@ -45,7 +45,7 @@ export type Observer = (
export type IgnorePattern = string | RegExp;
export type Subscription = $ReadOnly<{
export type Subscription = Readonly<{
unsubscribe: () => void,
}>;
@@ -61,7 +61,7 @@ export type WarningInfo = {
export type WarningFilter = (format: string) => WarningInfo;
type AppInfo = $ReadOnly<{
type AppInfo = Readonly<{
appVersion: string,
engine: string,
onPress?: ?() => void,
@@ -427,8 +427,8 @@ function observeNext(observer: Observer): Subscription {
};
}
type LogBoxStateSubscriptionProps = $ReadOnly<{}>;
type LogBoxStateSubscriptionState = $ReadOnly<{
type LogBoxStateSubscriptionProps = Readonly<{}>;
type LogBoxStateSubscriptionState = Readonly<{
logs: LogBoxLogs,
isDisabled: boolean,
hasError: boolean,
@@ -436,7 +436,7 @@ type LogBoxStateSubscriptionState = $ReadOnly<{
}>;
type SubscribedComponent = React.ComponentType<
$ReadOnly<{
Readonly<{
logs: $ReadOnlyArray<LogBoxLog>,
isDisabled: boolean,
selectedLogIndex: number,
Loaded 100 of 175 files, more files were not shown because too many files have changed in this diff. Show more