mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Transform $ReadOnly to Readonly 38/n (#55067)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55067 Differential Revision: D90146229 fbshipit-source-id: 62733ba51fd0c318140b7a76b499b1a7ac1f7853
This commit is contained in:
1 parent
1cc30dc1ad
commit
41efc3b588
156 files changed
+344
-344
No files matched your search
+47
-47
@@ -12,9 +12,9 @@
|
||||
|
||||
export type PlatformType = 'iOS' | 'android';
|
||||
|
||||
export type SchemaType = $ReadOnly<{
|
||||
export type SchemaType = Readonly<{
|
||||
libraryName?: string,
|
||||
modules: $ReadOnly<{
|
||||
modules: Readonly<{
|
||||
[hasteModuleName: string]: ComponentSchema | NativeModuleSchema,
|
||||
}>,
|
||||
}>;
|
||||
@@ -22,41 +22,41 @@ export type SchemaType = $ReadOnly<{
|
||||
/**
|
||||
* Component Type Annotations
|
||||
*/
|
||||
export type DoubleTypeAnnotation = $ReadOnly<{
|
||||
export type DoubleTypeAnnotation = Readonly<{
|
||||
type: 'DoubleTypeAnnotation',
|
||||
}>;
|
||||
|
||||
export type FloatTypeAnnotation = $ReadOnly<{
|
||||
export type FloatTypeAnnotation = Readonly<{
|
||||
type: 'FloatTypeAnnotation',
|
||||
}>;
|
||||
|
||||
export type NumberTypeAnnotation = $ReadOnly<{
|
||||
export type NumberTypeAnnotation = Readonly<{
|
||||
type: 'NumberTypeAnnotation',
|
||||
}>;
|
||||
|
||||
export type BooleanTypeAnnotation = $ReadOnly<{
|
||||
export type BooleanTypeAnnotation = Readonly<{
|
||||
type: 'BooleanTypeAnnotation',
|
||||
}>;
|
||||
|
||||
export type Int32TypeAnnotation = $ReadOnly<{
|
||||
export type Int32TypeAnnotation = Readonly<{
|
||||
type: 'Int32TypeAnnotation',
|
||||
}>;
|
||||
|
||||
export type NumberLiteralTypeAnnotation = $ReadOnly<{
|
||||
export type NumberLiteralTypeAnnotation = Readonly<{
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: number,
|
||||
}>;
|
||||
|
||||
export type StringTypeAnnotation = $ReadOnly<{
|
||||
export type StringTypeAnnotation = Readonly<{
|
||||
type: 'StringTypeAnnotation',
|
||||
}>;
|
||||
|
||||
export type StringLiteralTypeAnnotation = $ReadOnly<{
|
||||
export type StringLiteralTypeAnnotation = Readonly<{
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: string,
|
||||
}>;
|
||||
|
||||
export type BooleanLiteralTypeAnnotation = $ReadOnly<{
|
||||
export type BooleanLiteralTypeAnnotation = Readonly<{
|
||||
type: 'BooleanLiteralTypeAnnotation',
|
||||
value: boolean,
|
||||
}>;
|
||||
@@ -64,51 +64,51 @@ export type BooleanLiteralTypeAnnotation = $ReadOnly<{
|
||||
export type StringLiteralUnionTypeAnnotation =
|
||||
UnionTypeAnnotation<StringLiteralTypeAnnotation>;
|
||||
|
||||
export type VoidTypeAnnotation = $ReadOnly<{
|
||||
export type VoidTypeAnnotation = Readonly<{
|
||||
type: 'VoidTypeAnnotation',
|
||||
}>;
|
||||
|
||||
export type ObjectTypeAnnotation<+T> = $ReadOnly<{
|
||||
export type ObjectTypeAnnotation<+T> = Readonly<{
|
||||
type: 'ObjectTypeAnnotation',
|
||||
properties: $ReadOnlyArray<NamedShape<T>>,
|
||||
// metadata for objects that generated from interfaces
|
||||
baseTypes?: $ReadOnlyArray<string>,
|
||||
}>;
|
||||
|
||||
export type UnionTypeAnnotation<+T> = $ReadOnly<{
|
||||
export type UnionTypeAnnotation<+T> = Readonly<{
|
||||
type: 'UnionTypeAnnotation',
|
||||
types: $ReadOnlyArray<T>,
|
||||
}>;
|
||||
|
||||
export type MixedTypeAnnotation = $ReadOnly<{
|
||||
export type MixedTypeAnnotation = Readonly<{
|
||||
type: 'MixedTypeAnnotation',
|
||||
}>;
|
||||
|
||||
export type EventEmitterTypeAnnotation = $ReadOnly<{
|
||||
export type EventEmitterTypeAnnotation = Readonly<{
|
||||
type: 'EventEmitterTypeAnnotation',
|
||||
typeAnnotation: NativeModuleEventEmitterTypeAnnotation | $FlowFixMe,
|
||||
}>;
|
||||
|
||||
type FunctionTypeAnnotation<+P, +R> = $ReadOnly<{
|
||||
type FunctionTypeAnnotation<+P, +R> = Readonly<{
|
||||
type: 'FunctionTypeAnnotation',
|
||||
params: $ReadOnlyArray<NamedShape<P>>,
|
||||
returnTypeAnnotation: R,
|
||||
}>;
|
||||
|
||||
export type NamedShape<+T> = $ReadOnly<{
|
||||
export type NamedShape<+T> = Readonly<{
|
||||
name: string,
|
||||
optional: boolean,
|
||||
typeAnnotation: T,
|
||||
}>;
|
||||
|
||||
export type ComponentSchema = $ReadOnly<{
|
||||
export type ComponentSchema = Readonly<{
|
||||
type: 'Component',
|
||||
components: $ReadOnly<{
|
||||
components: Readonly<{
|
||||
[componentName: string]: ComponentShape,
|
||||
}>,
|
||||
}>;
|
||||
|
||||
export type ComponentShape = $ReadOnly<{
|
||||
export type ComponentShape = Readonly<{
|
||||
...OptionsShape,
|
||||
extendsProps: $ReadOnlyArray<ExtendsPropsShape>,
|
||||
events: $ReadOnlyArray<EventTypeShape>,
|
||||
@@ -116,7 +116,7 @@ export type ComponentShape = $ReadOnly<{
|
||||
commands: $ReadOnlyArray<NamedShape<CommandTypeAnnotation>>,
|
||||
}>;
|
||||
|
||||
export type OptionsShape = $ReadOnly<{
|
||||
export type OptionsShape = Readonly<{
|
||||
// Use to generate only interfaces of components (C++ Props, C++ EventEmitters, JVM interfaces) and not their implementation.
|
||||
// This is useful for components that have a custom implementation of ShadowNode, ComponentDescriptor, State.
|
||||
interfaceOnly?: boolean,
|
||||
@@ -134,17 +134,17 @@ export type OptionsShape = $ReadOnly<{
|
||||
generateOptionalObjectProperties?: boolean,
|
||||
}>;
|
||||
|
||||
export type ExtendsPropsShape = $ReadOnly<{
|
||||
export type ExtendsPropsShape = Readonly<{
|
||||
type: 'ReactNativeBuiltInType',
|
||||
knownTypeName: 'ReactNativeCoreViewProps',
|
||||
}>;
|
||||
|
||||
export type EventTypeShape = $ReadOnly<{
|
||||
export type EventTypeShape = Readonly<{
|
||||
name: string,
|
||||
bubblingType: 'direct' | 'bubble',
|
||||
optional: boolean,
|
||||
paperTopLevelNameDeprecated?: string,
|
||||
typeAnnotation: $ReadOnly<{
|
||||
typeAnnotation: Readonly<{
|
||||
type: 'EventTypeAnnotation',
|
||||
argument?: ObjectTypeAnnotation<EventTypeAnnotation>,
|
||||
}>,
|
||||
@@ -168,7 +168,7 @@ export type ComponentArrayTypeAnnotation = ArrayTypeAnnotation<
|
||||
| FloatTypeAnnotation
|
||||
| Int32TypeAnnotation
|
||||
| MixedTypeAnnotation
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'StringEnumTypeAnnotation',
|
||||
default: string,
|
||||
options: $ReadOnlyArray<string>,
|
||||
@@ -191,38 +191,38 @@ export type ComponentCommandArrayTypeAnnotation = ArrayTypeAnnotation<
|
||||
| MixedTypeAnnotation,
|
||||
>;
|
||||
|
||||
export type ArrayTypeAnnotation<+T> = $ReadOnly<{
|
||||
export type ArrayTypeAnnotation<+T> = Readonly<{
|
||||
type: 'ArrayTypeAnnotation',
|
||||
elementType: T,
|
||||
}>;
|
||||
|
||||
export type PropTypeAnnotation =
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'BooleanTypeAnnotation',
|
||||
default: boolean | null,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'StringTypeAnnotation',
|
||||
default: string | null,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'DoubleTypeAnnotation',
|
||||
default: number,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'FloatTypeAnnotation',
|
||||
default: number | null,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'Int32TypeAnnotation',
|
||||
default: number,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'StringEnumTypeAnnotation',
|
||||
default: string,
|
||||
options: $ReadOnlyArray<string>,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'Int32EnumTypeAnnotation',
|
||||
default: number,
|
||||
options: $ReadOnlyArray<number>,
|
||||
@@ -232,7 +232,7 @@ export type PropTypeAnnotation =
|
||||
| ComponentArrayTypeAnnotation
|
||||
| MixedTypeAnnotation;
|
||||
|
||||
export type ReservedPropTypeAnnotation = $ReadOnly<{
|
||||
export type ReservedPropTypeAnnotation = Readonly<{
|
||||
type: 'ReservedPropTypeAnnotation',
|
||||
name:
|
||||
| 'ColorPrimitive'
|
||||
@@ -257,7 +257,7 @@ export type CommandParamTypeAnnotation =
|
||||
| StringTypeAnnotation
|
||||
| ComponentCommandArrayTypeAnnotation;
|
||||
|
||||
export type ReservedTypeAnnotation = $ReadOnly<{
|
||||
export type ReservedTypeAnnotation = Readonly<{
|
||||
type: 'ReservedTypeAnnotation',
|
||||
name: 'RootTag', // Union with more custom types.
|
||||
}>;
|
||||
@@ -269,12 +269,12 @@ export type Nullable<+T: NativeModuleTypeAnnotation> =
|
||||
| NullableTypeAnnotation<T>
|
||||
| T;
|
||||
|
||||
export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = $ReadOnly<{
|
||||
export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = Readonly<{
|
||||
type: 'NullableTypeAnnotation',
|
||||
typeAnnotation: T,
|
||||
}>;
|
||||
|
||||
export type NativeModuleSchema = $ReadOnly<{
|
||||
export type NativeModuleSchema = Readonly<{
|
||||
type: 'NativeModule',
|
||||
aliasMap: NativeModuleAliasMap,
|
||||
enumMap: NativeModuleEnumMap,
|
||||
@@ -286,7 +286,7 @@ export type NativeModuleSchema = $ReadOnly<{
|
||||
excludedPlatforms?: $ReadOnlyArray<PlatformType>,
|
||||
}>;
|
||||
|
||||
type NativeModuleSpec = $ReadOnly<{
|
||||
type NativeModuleSpec = Readonly<{
|
||||
eventEmitters: $ReadOnlyArray<NativeModuleEventEmitterShape>,
|
||||
methods: $ReadOnlyArray<NativeModulePropertyShape>,
|
||||
}>;
|
||||
@@ -298,11 +298,11 @@ export type NativeModulePropertyShape = NamedShape<
|
||||
Nullable<NativeModuleFunctionTypeAnnotation>,
|
||||
>;
|
||||
|
||||
export type NativeModuleEnumMap = $ReadOnly<{
|
||||
export type NativeModuleEnumMap = Readonly<{
|
||||
[enumName: string]: NativeModuleEnumDeclarationWithMembers,
|
||||
}>;
|
||||
|
||||
export type NativeModuleAliasMap = $ReadOnly<{
|
||||
export type NativeModuleAliasMap = Readonly<{
|
||||
[aliasName: string]: NativeModuleObjectTypeAnnotation,
|
||||
}>;
|
||||
|
||||
@@ -330,7 +330,7 @@ export type UnsafeAnyTypeAnnotation = {
|
||||
type: 'AnyTypeAnnotation',
|
||||
};
|
||||
|
||||
export type NativeModuleNumberTypeAnnotation = $ReadOnly<{
|
||||
export type NativeModuleNumberTypeAnnotation = Readonly<{
|
||||
type: 'NumberTypeAnnotation',
|
||||
}>;
|
||||
|
||||
@@ -343,7 +343,7 @@ export type NativeModuleEnumMemberType =
|
||||
| 'NumberTypeAnnotation'
|
||||
| 'StringTypeAnnotation';
|
||||
|
||||
export type NativeModuleEnumDeclaration = $ReadOnly<{
|
||||
export type NativeModuleEnumDeclaration = Readonly<{
|
||||
name: string,
|
||||
type: 'EnumDeclaration',
|
||||
memberType: NativeModuleEnumMemberType,
|
||||
@@ -356,7 +356,7 @@ export type NativeModuleEnumDeclarationWithMembers = {
|
||||
members: $ReadOnlyArray<NativeModuleEnumMember>,
|
||||
};
|
||||
|
||||
export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{
|
||||
export type NativeModuleGenericObjectTypeAnnotation = Readonly<{
|
||||
type: 'GenericObjectTypeAnnotation',
|
||||
// a dictionary type is codegen as "Object"
|
||||
// but we know all its members are in the same type
|
||||
@@ -364,12 +364,12 @@ export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{
|
||||
dictionaryValueType?: Nullable<NativeModuleTypeAnnotation>,
|
||||
}>;
|
||||
|
||||
export type NativeModuleTypeAliasTypeAnnotation = $ReadOnly<{
|
||||
export type NativeModuleTypeAliasTypeAnnotation = Readonly<{
|
||||
type: 'TypeAliasTypeAnnotation',
|
||||
name: string,
|
||||
}>;
|
||||
|
||||
export type NativeModulePromiseTypeAnnotation = $ReadOnly<{
|
||||
export type NativeModulePromiseTypeAnnotation = Readonly<{
|
||||
type: 'PromiseTypeAnnotation',
|
||||
elementType: VoidTypeAnnotation | Nullable<NativeModuleBaseTypeAnnotation>,
|
||||
}>;
|
||||
@@ -386,7 +386,7 @@ export type NativeModuleUnionTypeAnnotationMemberType =
|
||||
export type NativeModuleUnionTypeAnnotation =
|
||||
UnionTypeAnnotation<NativeModuleUnionTypeAnnotationMemberType>;
|
||||
|
||||
export type NativeModuleMixedTypeAnnotation = $ReadOnly<{
|
||||
export type NativeModuleMixedTypeAnnotation = Readonly<{
|
||||
type: 'MixedTypeAnnotation',
|
||||
}>;
|
||||
|
||||
|
||||
@@ -82,11 +82,11 @@ export type GenerateFunction = (
|
||||
includeGetDebugPropsImplementation?: boolean,
|
||||
) => FilesOutput;
|
||||
|
||||
export type LibraryGeneratorsFunctions = $ReadOnly<{
|
||||
export type LibraryGeneratorsFunctions = Readonly<{
|
||||
[string]: Array<GenerateFunction>,
|
||||
}>;
|
||||
|
||||
export type LibraryOptions = $ReadOnly<{
|
||||
export type LibraryOptions = Readonly<{
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
outputDirectory: string,
|
||||
@@ -97,7 +97,7 @@ export type LibraryOptions = $ReadOnly<{
|
||||
libraryGenerators?: LibraryGeneratorsFunctions,
|
||||
}>;
|
||||
|
||||
export type SchemasOptions = $ReadOnly<{
|
||||
export type SchemasOptions = Readonly<{
|
||||
schemas: {[string]: SchemaType},
|
||||
outputDirectory: string,
|
||||
supportedApplePlatforms?: {[string]: {[string]: boolean}},
|
||||
@@ -118,12 +118,12 @@ export type LibraryGenerators =
|
||||
|
||||
export type SchemasGenerators = 'providerIOS';
|
||||
|
||||
export type LibraryConfig = $ReadOnly<{
|
||||
export type LibraryConfig = Readonly<{
|
||||
generators: Array<LibraryGenerators>,
|
||||
test?: boolean,
|
||||
}>;
|
||||
|
||||
export type SchemasConfig = $ReadOnly<{
|
||||
export type SchemasConfig = Readonly<{
|
||||
generators: Array<SchemasGenerators>,
|
||||
test?: boolean,
|
||||
}>;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ const {IncludeTemplate, generateEventStructName} = require('./CppHelpers');
|
||||
// File path -> contents
|
||||
type FilesOutput = Map<string, string>;
|
||||
|
||||
type ComponentCollection = $ReadOnly<{
|
||||
type ComponentCollection = Readonly<{
|
||||
[component: string]: ComponentShape,
|
||||
...
|
||||
}>;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ const nullthrows = require('nullthrows');
|
||||
type FilesOutput = Map<string, string>;
|
||||
type StructsMap = Map<string, string>;
|
||||
|
||||
type ComponentCollection = $ReadOnly<{
|
||||
type ComponentCollection = Readonly<{
|
||||
[component: string]: ComponentShape,
|
||||
...
|
||||
}>;
|
||||
|
||||
Vendored
+10
-10
@@ -40,39 +40,39 @@ export type PojoTypeAliasAnnotation = {
|
||||
};
|
||||
|
||||
export type PojoTypeAnnotation =
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'BooleanTypeAnnotation',
|
||||
default: boolean | null,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'StringTypeAnnotation',
|
||||
default: string | null,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'DoubleTypeAnnotation',
|
||||
default: number,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'FloatTypeAnnotation',
|
||||
default: number | null,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'Int32TypeAnnotation',
|
||||
default: number,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'StringEnumTypeAnnotation',
|
||||
default: string,
|
||||
options: $ReadOnlyArray<string>,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'Int32EnumTypeAnnotation',
|
||||
default: number,
|
||||
options: $ReadOnlyArray<number>,
|
||||
}>
|
||||
| ReservedPropTypeAnnotation
|
||||
| PojoTypeAliasAnnotation
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'ArrayTypeAnnotation',
|
||||
elementType:
|
||||
| BooleanTypeAnnotation
|
||||
@@ -81,14 +81,14 @@ export type PojoTypeAnnotation =
|
||||
| FloatTypeAnnotation
|
||||
| Int32TypeAnnotation
|
||||
| MixedTypeAnnotation
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'StringEnumTypeAnnotation',
|
||||
default: string,
|
||||
options: $ReadOnlyArray<string>,
|
||||
}>
|
||||
| PojoTypeAliasAnnotation
|
||||
| ReservedPropTypeAnnotation
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'ArrayTypeAnnotation',
|
||||
elementType: PojoTypeAliasAnnotation,
|
||||
}>,
|
||||
|
||||
@@ -18,7 +18,7 @@ const {getImports} = require('./CppHelpers');
|
||||
type FilesOutput = Map<string, string>;
|
||||
type PropValueType = string | number | boolean;
|
||||
|
||||
type TestCase = $ReadOnly<{
|
||||
type TestCase = Readonly<{
|
||||
propName: string,
|
||||
propValue: ?PropValueType,
|
||||
testName?: string,
|
||||
|
||||
@@ -163,14 +163,14 @@ const ModuleSpecClassDeclarationTemplate = ({
|
||||
moduleEventEmitters,
|
||||
moduleFunctions,
|
||||
methods,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
moduleName: string,
|
||||
structs: string,
|
||||
enums: string,
|
||||
moduleEventEmitters: EventEmitterCpp[],
|
||||
moduleFunctions: string[],
|
||||
methods: $ReadOnlyArray<$ReadOnly<{methodName: string, paramCount: number}>>,
|
||||
methods: $ReadOnlyArray<Readonly<{methodName: string, paramCount: number}>>,
|
||||
}>) => {
|
||||
return `${enums}${structs}
|
||||
template <typename T>
|
||||
@@ -196,7 +196,7 @@ ${moduleFunctions.join('\n\n')}
|
||||
|
||||
const FileTemplate = ({
|
||||
modules,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
modules: string[],
|
||||
}>) => {
|
||||
return `/**
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ const {createAliasResolver, getModules} = require('./Utils');
|
||||
type FilesOutput = Map<string, string>;
|
||||
|
||||
function FileTemplate(
|
||||
config: $ReadOnly<{
|
||||
config: Readonly<{
|
||||
packageName: string,
|
||||
className: string,
|
||||
jsName: string,
|
||||
@@ -92,7 +92,7 @@ function EventEmitterTemplate(
|
||||
}
|
||||
|
||||
function MethodTemplate(
|
||||
config: $ReadOnly<{
|
||||
config: Readonly<{
|
||||
abstract: boolean,
|
||||
methodBody: ?string,
|
||||
methodJavaAnnotation: string,
|
||||
|
||||
+4
-4
@@ -42,7 +42,7 @@ const HostFunctionTemplate = ({
|
||||
propertyName,
|
||||
jniSignature,
|
||||
jsReturnType,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
propertyName: string,
|
||||
jniSignature: string,
|
||||
@@ -58,7 +58,7 @@ const ModuleClassConstructorTemplate = ({
|
||||
hasteModuleName,
|
||||
eventEmitters,
|
||||
methods,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
eventEmitters: $ReadOnlyArray<NativeModuleEventEmitterShape>,
|
||||
methods: $ReadOnlyArray<{
|
||||
@@ -94,7 +94,7 @@ ${methods
|
||||
const ModuleLookupTemplate = ({
|
||||
moduleName,
|
||||
hasteModuleName,
|
||||
}: $ReadOnly<{moduleName: string, hasteModuleName: string}>) => {
|
||||
}: Readonly<{moduleName: string, hasteModuleName: string}>) => {
|
||||
return ` if (moduleName == "${moduleName}") {
|
||||
return std::make_shared<${hasteModuleName}SpecJSI>(params);
|
||||
}`;
|
||||
@@ -105,7 +105,7 @@ const FileTemplate = ({
|
||||
include,
|
||||
modules,
|
||||
moduleLookups,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
libraryName: string,
|
||||
include: string,
|
||||
modules: string,
|
||||
|
||||
@@ -18,7 +18,7 @@ type FilesOutput = Map<string, string>;
|
||||
|
||||
const ModuleClassDeclarationTemplate = ({
|
||||
hasteModuleName,
|
||||
}: $ReadOnly<{hasteModuleName: string}>) => {
|
||||
}: Readonly<{hasteModuleName: string}>) => {
|
||||
return `/**
|
||||
* JNI C++ class for module '${hasteModuleName}'
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
const HeaderFileTemplate = ({
|
||||
modules,
|
||||
libraryName,
|
||||
}: $ReadOnly<{modules: string, libraryName: string}>) => {
|
||||
}: Readonly<{modules: string, libraryName: string}>) => {
|
||||
return `
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
@@ -64,7 +64,7 @@ std::shared_ptr<TurboModule> ${libraryName}_ModuleProvider(const std::string &mo
|
||||
const CMakeListsTemplate = ({
|
||||
libraryName,
|
||||
targetName,
|
||||
}: $ReadOnly<{libraryName: string, targetName: string}>) => {
|
||||
}: Readonly<{libraryName: string, targetName: string}>) => {
|
||||
return `# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
|
||||
Vendored
+4
-4
@@ -44,13 +44,13 @@ const {
|
||||
|
||||
type StructContext = 'CONSTANTS' | 'REGULAR';
|
||||
|
||||
export type RegularStruct = $ReadOnly<{
|
||||
export type RegularStruct = Readonly<{
|
||||
context: 'REGULAR',
|
||||
name: string,
|
||||
properties: $ReadOnlyArray<StructProperty>,
|
||||
}>;
|
||||
|
||||
export type ConstantsStruct = $ReadOnly<{
|
||||
export type ConstantsStruct = Readonly<{
|
||||
context: 'CONSTANTS',
|
||||
name: string,
|
||||
properties: $ReadOnlyArray<StructProperty>,
|
||||
@@ -58,7 +58,7 @@ export type ConstantsStruct = $ReadOnly<{
|
||||
|
||||
export type Struct = RegularStruct | ConstantsStruct;
|
||||
|
||||
export type StructProperty = $ReadOnly<{
|
||||
export type StructProperty = Readonly<{
|
||||
name: string,
|
||||
optional: boolean,
|
||||
typeAnnotation: Nullable<StructTypeAnnotation>,
|
||||
@@ -200,7 +200,7 @@ class StructCollector {
|
||||
): void {
|
||||
// $FlowFixMe[missing-type-arg]
|
||||
const properties = objectTypeAnnotation.properties.map<
|
||||
$ReadOnly<{
|
||||
Readonly<{
|
||||
name: string,
|
||||
optional: boolean,
|
||||
typeAnnotation: Nullable<StructTypeAnnotation>,
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ const StructTemplate = ({
|
||||
hasteModuleName,
|
||||
structName,
|
||||
builderInputProps,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
structName: string,
|
||||
builderInputProps: string,
|
||||
@@ -65,7 +65,7 @@ const MethodTemplate = ({
|
||||
hasteModuleName,
|
||||
structName,
|
||||
properties,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
structName: string,
|
||||
properties: string,
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ const StructTemplate = ({
|
||||
hasteModuleName,
|
||||
structName,
|
||||
structProperties,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
structName: string,
|
||||
structProperties: string,
|
||||
@@ -53,7 +53,7 @@ const MethodTemplate = ({
|
||||
structName,
|
||||
propertyName,
|
||||
safePropertyName,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
returnType: string,
|
||||
returnValue: string,
|
||||
hasteModuleName: string,
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@ import type {Struct} from '../StructCollector';
|
||||
const {serializeConstantsStruct} = require('./serializeConstantsStruct');
|
||||
const {serializeRegularStruct} = require('./serializeRegularStruct');
|
||||
|
||||
export type StructSerilizationOutput = $ReadOnly<{
|
||||
export type StructSerilizationOutput = Readonly<{
|
||||
methods: string,
|
||||
declaration: string,
|
||||
}>;
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ const ModuleDeclarationTemplate = ({
|
||||
structDeclarations,
|
||||
eventEmitters,
|
||||
protocolMethods,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
structDeclarations: string,
|
||||
eventEmitters: string,
|
||||
@@ -63,7 +63,7 @@ const HeaderFileTemplate = ({
|
||||
moduleDeclarations,
|
||||
structInlineMethods,
|
||||
assumeNonnull,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
headerFileName: string,
|
||||
moduleDeclarations: string,
|
||||
structInlineMethods: string,
|
||||
@@ -118,7 +118,7 @@ const HeaderFileTemplate = ({
|
||||
const SourceFileTemplate = ({
|
||||
headerFileName,
|
||||
moduleImplementations,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
headerFileName: string,
|
||||
moduleImplementations: string,
|
||||
}>) => `/**
|
||||
|
||||
Vendored
+4
-4
@@ -33,13 +33,13 @@ const ProtocolMethodTemplate = ({
|
||||
returnObjCType,
|
||||
methodName,
|
||||
params,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
returnObjCType: string,
|
||||
methodName: string,
|
||||
params: string,
|
||||
}>) => `- (${returnObjCType})${methodName}${params};`;
|
||||
|
||||
export type StructParameterRecord = $ReadOnly<{
|
||||
export type StructParameterRecord = Readonly<{
|
||||
paramIndex: number,
|
||||
structName: string,
|
||||
}>;
|
||||
@@ -53,7 +53,7 @@ type ReturnJSType =
|
||||
| 'NumberKind'
|
||||
| 'StringKind';
|
||||
|
||||
export type MethodSerializationOutput = $ReadOnly<{
|
||||
export type MethodSerializationOutput = Readonly<{
|
||||
methodName: string,
|
||||
protocolMethod: string,
|
||||
selector: string,
|
||||
@@ -186,7 +186,7 @@ function getParamObjCType(
|
||||
structName: string,
|
||||
structCollector: StructCollector,
|
||||
resolveAlias: AliasResolver,
|
||||
): $ReadOnly<{objCType: string, isStruct: boolean}> {
|
||||
): Readonly<{objCType: string, isStruct: boolean}> {
|
||||
const {name: paramName, typeAnnotation: nullableTypeAnnotation} = param;
|
||||
const [typeAnnotation, nullable] = unwrapNullable(nullableTypeAnnotation);
|
||||
const isRequired = !param.optional && !nullable;
|
||||
|
||||
Vendored
+4
-4
@@ -27,7 +27,7 @@ const ModuleTemplate = ({
|
||||
moduleName,
|
||||
eventEmitters,
|
||||
methodSerializationOutputs,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
structs: $ReadOnlyArray<Struct>,
|
||||
moduleName: string,
|
||||
@@ -96,7 +96,7 @@ namespace facebook::react {
|
||||
const RCTCxxConvertCategoryTemplate = ({
|
||||
hasteModuleName,
|
||||
structName,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
structName: string,
|
||||
}>) => `@implementation RCTCxxConvert (${hasteModuleName}_${structName})
|
||||
@@ -111,7 +111,7 @@ const InlineHostFunctionTemplate = ({
|
||||
methodName,
|
||||
returnJSType,
|
||||
selector,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
methodName: string,
|
||||
returnJSType: string,
|
||||
@@ -126,7 +126,7 @@ const MethodMapEntryTemplate = ({
|
||||
methodName,
|
||||
structParamRecords,
|
||||
argCount,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
hasteModuleName: string,
|
||||
methodName: string,
|
||||
structParamRecords: $ReadOnlyArray<StructParameterRecord>,
|
||||
|
||||
@@ -36,7 +36,7 @@ function createAliasResolver(aliasMap: NativeModuleAliasMap): AliasResolver {
|
||||
|
||||
function getModules(
|
||||
schema: SchemaType,
|
||||
): $ReadOnly<{[hasteModuleName: string]: NativeModuleSchema}> {
|
||||
): Readonly<{[hasteModuleName: string]: NativeModuleSchema}> {
|
||||
return Object.keys(schema.modules).reduce<{[string]: NativeModuleSchema}>(
|
||||
(modules, hasteModuleName: string) => {
|
||||
const module = schema.modules[hasteModuleName];
|
||||
|
||||
@@ -28,7 +28,7 @@ function buildCommandSchema(
|
||||
property: EventTypeAST,
|
||||
types: TypeDeclarationMap,
|
||||
parser: Parser,
|
||||
): $ReadOnly<{
|
||||
): Readonly<{
|
||||
name: string,
|
||||
optional: boolean,
|
||||
typeAnnotation: {
|
||||
|
||||
+2
-2
@@ -419,7 +419,7 @@ describe('Flow Module Parser', () => {
|
||||
propName: string,
|
||||
propType: string,
|
||||
): [
|
||||
$ReadOnly<{
|
||||
Readonly<{
|
||||
name: string,
|
||||
optional: boolean,
|
||||
typeAnnotation: NativeModuleBaseTypeAnnotation,
|
||||
@@ -954,7 +954,7 @@ describe('Flow Module Parser', () => {
|
||||
propName: string,
|
||||
propType: string,
|
||||
): [
|
||||
$ReadOnly<{
|
||||
Readonly<{
|
||||
name: string,
|
||||
optional: boolean,
|
||||
typeAnnotation: NativeModuleBaseTypeAnnotation,
|
||||
|
||||
@@ -16,7 +16,7 @@ const hermesParser = require('hermes-parser');
|
||||
|
||||
function parseFlowAndThrowErrors(
|
||||
code: string,
|
||||
options: $ReadOnly<{filename?: ?string}> = {},
|
||||
options: Readonly<{filename?: ?string}> = {},
|
||||
): ESTreeProgram {
|
||||
let ast;
|
||||
try {
|
||||
|
||||
@@ -77,7 +77,7 @@ const {
|
||||
} = require('./utils');
|
||||
const invariant = require('invariant');
|
||||
|
||||
export type CommandOptions = $ReadOnly<{
|
||||
export type CommandOptions = Readonly<{
|
||||
supportedCommands: $ReadOnlyArray<string>,
|
||||
}>;
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import type {
|
||||
SchemaType,
|
||||
} from '../CodegenSchema.js';
|
||||
|
||||
export type ComponentSchemaBuilderConfig = $ReadOnly<{
|
||||
export type ComponentSchemaBuilderConfig = Readonly<{
|
||||
filename: string,
|
||||
componentName: string,
|
||||
extendsProps: $ReadOnlyArray<ExtendsPropsShape>,
|
||||
|
||||
+2
-2
@@ -495,7 +495,7 @@ describe('TypeScript Module Parser', () => {
|
||||
propName: string,
|
||||
propType: string,
|
||||
): [
|
||||
$ReadOnly<{
|
||||
Readonly<{
|
||||
name: string,
|
||||
optional: boolean,
|
||||
typeAnnotation: NativeModuleBaseTypeAnnotation,
|
||||
@@ -1029,7 +1029,7 @@ describe('TypeScript Module Parser', () => {
|
||||
propName: string,
|
||||
propType: string,
|
||||
): [
|
||||
$ReadOnly<{
|
||||
Readonly<{
|
||||
name: string,
|
||||
optional: boolean,
|
||||
typeAnnotation: NativeModuleBaseTypeAnnotation,
|
||||
|
||||
+3
-3
@@ -16,12 +16,12 @@ const path = require('path');
|
||||
export type TypeDeclarationMap = {[declarationName: string]: $FlowFixMe};
|
||||
|
||||
export type TypeResolutionStatus =
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
type: 'alias' | 'enum',
|
||||
successful: true,
|
||||
name: string,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
successful: false,
|
||||
}>;
|
||||
|
||||
@@ -66,7 +66,7 @@ function createParserErrorCapturer(): [
|
||||
function verifyPlatforms(
|
||||
hasteModuleName: string,
|
||||
moduleName: string,
|
||||
): $ReadOnly<{
|
||||
): Readonly<{
|
||||
cxxOnly: boolean,
|
||||
excludedPlatforms: Array<'iOS' | 'android'>,
|
||||
}> {
|
||||
|
||||
+5
-5
@@ -27,7 +27,7 @@ import type {
|
||||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
bool: boolean,
|
||||
string: string,
|
||||
@@ -49,12 +49,12 @@ type NativeProps = $ReadOnly<{
|
||||
stringUnion?: WithDefault<'foo' | 'bar', 'bar'>,
|
||||
intUnion?: WithDefault<1 | 2, 1>,
|
||||
|
||||
nestedObject: $ReadOnly<{
|
||||
nestedObject: Readonly<{
|
||||
string: string,
|
||||
color: ColorValue,
|
||||
}>,
|
||||
|
||||
nestedObjectChanged: $ReadOnly<{
|
||||
nestedObjectChanged: Readonly<{
|
||||
string: boolean,
|
||||
color: ColorValue,
|
||||
}>,
|
||||
@@ -66,14 +66,14 @@ type NativeProps = $ReadOnly<{
|
||||
>,
|
||||
|
||||
arrayNestedObject: $ReadOnlyArray<
|
||||
$ReadOnly<{
|
||||
Readonly<{
|
||||
string: string,
|
||||
color: ColorValue,
|
||||
}>,
|
||||
>,
|
||||
|
||||
arrayNestedObjectChange: $ReadOnlyArray<
|
||||
$ReadOnly<{
|
||||
Readonly<{
|
||||
string: boolean,
|
||||
color: ColorValue,
|
||||
}>,
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import type {
|
||||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
}>;
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import type {
|
||||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
}>;
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTyp
|
||||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
}>;
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import type {Int32} from 'react-native/Libraries/Types/CodegenTypes';
|
||||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
}>;
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import type {Int32} from 'react-native/Libraries/Types/CodegenTypes';
|
||||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
}>;
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import type {Int32} from 'react-native/Libraries/Types/CodegenTypes';
|
||||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
}>;
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import type {
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
text: string,
|
||||
backgroundColor?: WithDefault<string, 'transparent'>,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import type {
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
text: string,
|
||||
backgroundColor?: WithDefault<string, 'transparent'>,
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import type {
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
bool: boolean,
|
||||
string: string,
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
sizes?: WithDefault<$ReadOnlyArray<'small' | 'large' | 'huge'>, 'small'>,
|
||||
}>;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
sizes?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>,
|
||||
}>;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import type {
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
text: Int32,
|
||||
backgroundColor?: WithDefault<string, 'transparent'>,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import type {
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
text: string,
|
||||
backgroundColor?: WithDefault<string, 'white'>,
|
||||
|
||||
+2
-2
@@ -18,12 +18,12 @@ import type {
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
text: string,
|
||||
backgroundColor?: WithDefault<string, 'transparent'>,
|
||||
height?: WithDefault<Int32, 100>,
|
||||
pins: $ReadOnly<{
|
||||
pins: Readonly<{
|
||||
x: Float,
|
||||
y: Float,
|
||||
color?: WithDefault<string, 'red'>,
|
||||
|
||||
+2
-2
@@ -18,12 +18,12 @@ import type {
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
text: string,
|
||||
backgroundColor?: WithDefault<string, 'transparent'>,
|
||||
height?: WithDefault<Int32, 100>,
|
||||
pins: $ReadOnly<{
|
||||
pins: Readonly<{
|
||||
x: Float,
|
||||
y: Float,
|
||||
color: string,
|
||||
|
||||
+2
-2
@@ -18,12 +18,12 @@ import type {
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
text: string,
|
||||
backgroundColor?: WithDefault<string, 'transparent'>,
|
||||
height?: WithDefault<Int32, 100>,
|
||||
pins: $ReadOnly<{
|
||||
pins: Readonly<{
|
||||
x: Float,
|
||||
y: Float,
|
||||
}>,
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
size?: WithDefault<'small' | 'huge' | 'large', 'small'>,
|
||||
}>;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
size?: WithDefault<'small' | 'large', 'small'>,
|
||||
}>;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import type {
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
text: string,
|
||||
backgroundColor?: WithDefault<string, 'transparent'>,
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTyp
|
||||
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export type Props = $ReadOnly<{
|
||||
export type Props = Readonly<{
|
||||
...ViewProps,
|
||||
}>;
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+exampleFunction: (a: string, b: number) => void;
|
||||
+getConstants: () => $ReadOnly<{
|
||||
+getConstants: () => Readonly<{
|
||||
constant?: string,
|
||||
}>;
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+exampleFunction: (a: string, b: number) => void;
|
||||
+getConstants: () => $ReadOnly<{
|
||||
+getConstants: () => Readonly<{
|
||||
constant: string,
|
||||
}>;
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+exampleFunction: (a: string, b: number) => void;
|
||||
+getConstants: () => $ReadOnly<{}>;
|
||||
+getConstants: () => Readonly<{}>;
|
||||
}
|
||||
|
||||
export default (TurboModuleRegistry.getEnforcing<Spec>(
|
||||
|
||||
@@ -20,12 +20,12 @@ import * as React from 'react';
|
||||
import {useCallback, useImperativeHandle, useRef} from 'react';
|
||||
|
||||
type PopupMenuSelectionEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
Readonly<{
|
||||
item: number,
|
||||
}>,
|
||||
>;
|
||||
|
||||
type PopupMenuDismissEvent = NativeSyntheticEvent<$ReadOnly<{}>>;
|
||||
type PopupMenuDismissEvent = NativeSyntheticEvent<Readonly<{}>>;
|
||||
|
||||
export type PopupMenuAndroidInstance = {
|
||||
+show: () => void,
|
||||
|
||||
+3
-3
@@ -19,13 +19,13 @@ import * as React from 'react';
|
||||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type PopupMenuSelectionEvent = $ReadOnly<{
|
||||
type PopupMenuSelectionEvent = Readonly<{
|
||||
item: Int32,
|
||||
}>;
|
||||
|
||||
type PopupMenuDismissEvent = $ReadOnly<{}>;
|
||||
type PopupMenuDismissEvent = Readonly<{}>;
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
|
||||
//Props
|
||||
|
||||
+2
-2
@@ -21,12 +21,12 @@ import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNative
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
type NativeSwitchChangeEvent = $ReadOnly<{
|
||||
type NativeSwitchChangeEvent = Readonly<{
|
||||
value: boolean,
|
||||
target: Int32,
|
||||
}>;
|
||||
|
||||
type SwitchNativeProps = $ReadOnly<{
|
||||
type SwitchNativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
|
||||
// Props
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import type {HostComponent} from '../../types/HostComponent';
|
||||
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type UnimplementedNativeViewNativeProps = $ReadOnly<{
|
||||
type UnimplementedNativeViewNativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
name?: WithDefault<string, ''>,
|
||||
}>;
|
||||
|
||||
@@ -101,10 +101,10 @@ interface Spec extends TurboModule {
|
||||
takeMountingManagerLogs: (surfaceId: RootTag) => Array<string>;
|
||||
getDirectManipulationProps: (
|
||||
shadowNode: unknown /* ShadowNode */,
|
||||
) => $ReadOnly<{
|
||||
) => Readonly<{
|
||||
[string]: unknown,
|
||||
}>;
|
||||
getFabricUpdateProps: (shadowNode: unknown /* ShadowNode */) => $ReadOnly<{
|
||||
getFabricUpdateProps: (shadowNode: unknown /* ShadowNode */) => Readonly<{
|
||||
[string]: unknown,
|
||||
}>;
|
||||
flushMessageQueue: () => void;
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@
|
||||
import type EventTarget from './EventTarget';
|
||||
import type {EventCallback} from './EventTarget';
|
||||
|
||||
type EventHandler = $ReadOnly<{
|
||||
type EventHandler = Readonly<{
|
||||
handleEvent: EventCallback,
|
||||
}>;
|
||||
type EventHandlerAttributeMap = Map<string, EventHandler | null>;
|
||||
|
||||
@@ -40,11 +40,11 @@ export type EventHandler = interface {
|
||||
};
|
||||
export type EventListener = EventCallback | EventHandler;
|
||||
|
||||
export type EventListenerOptions = $ReadOnly<{
|
||||
export type EventListenerOptions = Readonly<{
|
||||
capture?: boolean,
|
||||
}>;
|
||||
|
||||
export type AddEventListenerOptions = $ReadOnly<{
|
||||
export type AddEventListenerOptions = Readonly<{
|
||||
...EventListenerOptions,
|
||||
passive?: boolean,
|
||||
once?: boolean,
|
||||
|
||||
@@ -247,7 +247,7 @@ export interface RefinedSpec {
|
||||
*/
|
||||
+getBorderWidth: (
|
||||
nativeElementReference: NativeElementReference,
|
||||
) => $ReadOnly<
|
||||
) => Readonly<
|
||||
[
|
||||
/* topWidth: */ number,
|
||||
/* rightWidth: */ number,
|
||||
@@ -270,7 +270,7 @@ export interface RefinedSpec {
|
||||
+getBoundingClientRect: (
|
||||
nativeElementReference: NativeElementReference,
|
||||
includeTransform: boolean,
|
||||
) => $ReadOnly<
|
||||
) => Readonly<
|
||||
[
|
||||
/* x: */ number,
|
||||
/* y: */ number,
|
||||
@@ -293,7 +293,7 @@ export interface RefinedSpec {
|
||||
*/
|
||||
+getInnerSize: (
|
||||
nativeElementReference: NativeElementReference,
|
||||
) => $ReadOnly<[/* width: */ number, /* height: */ number]>;
|
||||
) => Readonly<[/* width: */ number, /* height: */ number]>;
|
||||
|
||||
/**
|
||||
* This is a method to access scroll information for a shadow node, to
|
||||
@@ -308,7 +308,7 @@ export interface RefinedSpec {
|
||||
*/
|
||||
+getScrollPosition: (
|
||||
nativeElementReference: NativeElementReference,
|
||||
) => $ReadOnly<[/* scrollLeft: */ number, /* scrollTop: */ number]>;
|
||||
) => Readonly<[/* scrollLeft: */ number, /* scrollTop: */ number]>;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -324,7 +324,7 @@ export interface RefinedSpec {
|
||||
*/
|
||||
+getScrollSize: (
|
||||
nativeElementReference: NativeElementReference,
|
||||
) => $ReadOnly<[/* scrollWidth: */ number, /* scrollHeight: */ number]>;
|
||||
) => Readonly<[/* scrollWidth: */ number, /* scrollHeight: */ number]>;
|
||||
|
||||
/**
|
||||
* This is a method to access the normalized tag name of a shadow node, to
|
||||
@@ -377,7 +377,7 @@ export interface RefinedSpec {
|
||||
*/
|
||||
+getOffset: (
|
||||
nativeElementReference: NativeElementReference,
|
||||
) => $ReadOnly<
|
||||
) => Readonly<
|
||||
[
|
||||
/* offsetParent: */ ?InstanceHandle,
|
||||
/* top: */ number,
|
||||
|
||||
+1
-1
@@ -2978,7 +2978,7 @@ describe('IntersectionObserver', () => {
|
||||
};
|
||||
};
|
||||
|
||||
function Observe({children}: $ReadOnly<{children?: React.Node}>) {
|
||||
function Observe({children}: Readonly<{children?: React.Node}>) {
|
||||
return <View ref={observeRef}>{children}</View>;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -38,7 +38,7 @@ let isConnected: boolean = false;
|
||||
|
||||
const registeredMutationObservers: Map<
|
||||
MutationObserverId,
|
||||
$ReadOnly<{observer: MutationObserver, callback: MutationObserverCallback}>,
|
||||
Readonly<{observer: MutationObserver, callback: MutationObserverCallback}>,
|
||||
> = new Map();
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,17 +37,17 @@ import {PerformanceMark, PerformanceMeasure} from './UserTiming';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
export type PerformanceMeasureOptions =
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
detail?: DetailType,
|
||||
start?: DOMHighResTimeStamp | string,
|
||||
duration?: DOMHighResTimeStamp,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
detail?: DetailType,
|
||||
start?: DOMHighResTimeStamp | string,
|
||||
end?: DOMHighResTimeStamp | string,
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
| Readonly<{
|
||||
detail?: DetailType,
|
||||
duration?: DOMHighResTimeStamp | string,
|
||||
end?: DOMHighResTimeStamp | string,
|
||||
|
||||
@@ -16,7 +16,7 @@ import {NativeModules, StyleSheet, Text, View} from 'react-native';
|
||||
|
||||
const {TestModule} = NativeModules;
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
shouldThrow?: boolean,
|
||||
waitOneFrame?: boolean,
|
||||
}>;
|
||||
|
||||
@@ -24,7 +24,7 @@ function debug(...args: Array<void | LayoutRectangle | string>) {
|
||||
// console.log.apply(null, arguments);
|
||||
}
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
|
||||
type State = {
|
||||
didAnimation: boolean,
|
||||
|
||||
@@ -16,7 +16,7 @@ const ReactNative = require('react-native');
|
||||
const {StyleSheet, Text, View} = ReactNative;
|
||||
const {TestModule} = ReactNative.NativeModules;
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
|
||||
type State = {
|
||||
count: number,
|
||||
|
||||
@@ -25,7 +25,7 @@ type ColorChangedEvent = {
|
||||
},
|
||||
};
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
opacity?: number,
|
||||
color?: string,
|
||||
|
||||
@@ -13,7 +13,7 @@ import type {CodegenTypes, HostComponent, ViewProps} from 'react-native';
|
||||
import * as React from 'react';
|
||||
import {codegenNativeCommands, codegenNativeComponent} from 'react-native';
|
||||
|
||||
type Event = $ReadOnly<{
|
||||
type Event = Readonly<{
|
||||
values: $ReadOnlyArray<CodegenTypes.Int32>,
|
||||
boolValues: $ReadOnlyArray<boolean>,
|
||||
floats: $ReadOnlyArray<CodegenTypes.Float>,
|
||||
@@ -24,11 +24,11 @@ type Event = $ReadOnly<{
|
||||
multiArrays: $ReadOnlyArray<$ReadOnlyArray<CodegenTypes.Int32>>,
|
||||
}>;
|
||||
|
||||
type LegacyStyleEvent = $ReadOnly<{
|
||||
type LegacyStyleEvent = Readonly<{
|
||||
string: string,
|
||||
}>;
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
opacity?: CodegenTypes.Float,
|
||||
values: $ReadOnlyArray<CodegenTypes.Int32>,
|
||||
|
||||
@@ -19,10 +19,10 @@ import type {
|
||||
const {requireNativeComponent} = require('react-native');
|
||||
|
||||
type SnapshotReadyEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{testIdentifier: string, ...}>,
|
||||
Readonly<{testIdentifier: string, ...}>,
|
||||
>;
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
onSnapshotReady?: ?(event: SnapshotReadyEvent) => unknown,
|
||||
testIdentifier?: ?string,
|
||||
|
||||
@@ -13,7 +13,7 @@ import type {ViewProps} from 'react-native';
|
||||
|
||||
import {codegenNativeComponent} from 'react-native';
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
type NativeProps = Readonly<{
|
||||
...ViewProps,
|
||||
}>;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import * as React from 'react';
|
||||
import {useContext} from 'react';
|
||||
import {StyleSheet, View} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
children?: ?React.Node,
|
||||
testID?: string,
|
||||
}>;
|
||||
|
||||
@@ -18,7 +18,7 @@ import * as React from 'react';
|
||||
import {useContext, useState} from 'react';
|
||||
import {Pressable, StyleSheet, Text, View} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
testID?: ?string,
|
||||
label: string,
|
||||
onPress?: ?(event: GestureResponderEvent) => unknown,
|
||||
|
||||
@@ -13,7 +13,7 @@ import * as React from 'react';
|
||||
import {useContext} from 'react';
|
||||
import {StyleSheet, Text, View} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
children?: React.Node,
|
||||
title?: ?string,
|
||||
description?: ?string,
|
||||
|
||||
@@ -15,7 +15,7 @@ import type {GestureResponderEvent} from 'react-native';
|
||||
import React from 'react';
|
||||
import {Pressable, StyleSheet, Text} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
testID?: string,
|
||||
textTestID?: string,
|
||||
children?: React.Node,
|
||||
|
||||
@@ -13,7 +13,7 @@ import {RNTesterThemeContext} from './RNTesterTheme';
|
||||
const React = require('react');
|
||||
const {StyleSheet, Text} = require('react-native');
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
children: string,
|
||||
}>;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as React from 'react';
|
||||
import {Image, StyleSheet, TouchableOpacity} from 'react-native';
|
||||
import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
documentationURL: string,
|
||||
}>;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ const ComponentTab = ({
|
||||
isComponentActive,
|
||||
handleNavBarPress,
|
||||
theme,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
handleNavBarPress: NavBarOnPressHandler,
|
||||
isComponentActive: boolean,
|
||||
theme: RNTesterTheme,
|
||||
@@ -78,7 +78,7 @@ const PlaygroundTab = ({
|
||||
isComponentActive,
|
||||
handleNavBarPress,
|
||||
theme,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
handleNavBarPress: NavBarOnPressHandler,
|
||||
isComponentActive: boolean,
|
||||
theme: RNTesterTheme,
|
||||
@@ -99,7 +99,7 @@ const APITab = ({
|
||||
isAPIActive,
|
||||
handleNavBarPress,
|
||||
theme,
|
||||
}: $ReadOnly<{
|
||||
}: Readonly<{
|
||||
handleNavBarPress: NavBarOnPressHandler,
|
||||
isAPIActive: boolean,
|
||||
theme: RNTesterTheme,
|
||||
@@ -116,7 +116,7 @@ const APITab = ({
|
||||
/>
|
||||
);
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
handleNavBarPress: NavBarOnPressHandler,
|
||||
screen: string,
|
||||
isExamplePageOpen: boolean,
|
||||
|
||||
@@ -15,7 +15,7 @@ import {useContext} from 'react';
|
||||
const React = require('react');
|
||||
const {Platform, ScrollView, StyleSheet, View} = require('react-native');
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
children?: React.Node,
|
||||
title?: ?string,
|
||||
noScroll?: ?boolean,
|
||||
|
||||
@@ -14,7 +14,7 @@ import {RNTesterThemeContext} from './RNTesterTheme';
|
||||
import React, {useContext, useMemo} from 'react';
|
||||
import {Text} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
...TextProps,
|
||||
variant?: 'body' | 'label' | 'caption',
|
||||
}>;
|
||||
|
||||
@@ -15,7 +15,7 @@ import {createContext} from 'react';
|
||||
import {use} from 'react';
|
||||
import {Appearance} from 'react-native';
|
||||
|
||||
export type RNTesterTheme = $ReadOnly<{
|
||||
export type RNTesterTheme = Readonly<{
|
||||
LabelColor: ColorValue,
|
||||
SecondaryLabelColor: ColorValue,
|
||||
TertiaryLabelColor: ColorValue,
|
||||
|
||||
@@ -12,7 +12,7 @@ import {RNTesterThemeContext} from './RNTesterTheme';
|
||||
import React from 'react';
|
||||
import {StyleSheet, Text, View} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
title: string,
|
||||
}>;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import * as React from 'react';
|
||||
import {StyleSheet, Text, View} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
children?: React.Node,
|
||||
title?: ?string,
|
||||
note?: ?string,
|
||||
|
||||
@@ -16,7 +16,7 @@ const {RNTesterThemeContext} = require('../../components/RNTesterTheme');
|
||||
const React = require('react');
|
||||
const {Alert, Text, View} = require('react-native');
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
class AccessibilityIOSExample extends React.Component<Props> {
|
||||
render(): React.Node {
|
||||
return (
|
||||
|
||||
@@ -32,7 +32,7 @@ const DESTRUCTIVE_INDEX = 3;
|
||||
const CANCEL_INDEX = 4;
|
||||
const DISABLED_BUTTON_INDICES = [1, 2];
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
type State = {clicked: string};
|
||||
class ActionSheetExample extends React.Component<Props, State> {
|
||||
state: State = {
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
useWindowDimensions,
|
||||
} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
const boxSize = 12;
|
||||
const padding = 8;
|
||||
const leftToRightTimingConfig = (useNativeDriver: boolean) => ({
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
|
||||
type EasingListItem = {
|
||||
title: string,
|
||||
|
||||
@@ -56,7 +56,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
|
||||
function MovingBoxView({useNativeDriver}: {useNativeDriver: boolean}) {
|
||||
const x = useRef(new Animated.Value(0));
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
function TextBox({children}: $ReadOnly<{children: React.Node}>): React.Node {
|
||||
function TextBox({children}: Readonly<{children: React.Node}>): React.Node {
|
||||
// Prevent touch from being hijacked by Text
|
||||
return (
|
||||
<View pointerEvents="none">
|
||||
@@ -34,8 +34,8 @@ function TextBox({children}: $ReadOnly<{children: React.Node}>): React.Node {
|
||||
function AnimatedEventExample({
|
||||
containerPageXY,
|
||||
useNativeDriver,
|
||||
}: $ReadOnly<{
|
||||
containerPageXY: $ReadOnly<{x: number, y: number}>,
|
||||
}: Readonly<{
|
||||
containerPageXY: Readonly<{x: number, y: number}>,
|
||||
useNativeDriver: boolean,
|
||||
}>): React.Node {
|
||||
const boxRef = useRef<?React.ElementRef<typeof Animated.View>>();
|
||||
@@ -128,7 +128,7 @@ function AnimatedEventExample({
|
||||
|
||||
function PanResponderExample({
|
||||
useNativeDriver,
|
||||
}: $ReadOnly<{useNativeDriver: boolean}>): React.Node {
|
||||
}: Readonly<{useNativeDriver: boolean}>): React.Node {
|
||||
const finalOffsetXY = useRef(
|
||||
new Animated.ValueXY({x: 0, y: 0}, {useNativeDriver}),
|
||||
).current;
|
||||
|
||||
@@ -22,7 +22,7 @@ const randColor = () => {
|
||||
return `rgb(${colors.join(',')})`;
|
||||
};
|
||||
|
||||
type AnExSetProps = $ReadOnly<{
|
||||
type AnExSetProps = Readonly<{
|
||||
openVal: Animated.Value,
|
||||
containerLayout: {width: number, height: number},
|
||||
id: string,
|
||||
|
||||
@@ -16,7 +16,7 @@ import usePlatformTestHarness from './usePlatformTestHarness';
|
||||
import * as React from 'react';
|
||||
import {StyleSheet, Text, View} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
title: string,
|
||||
description: string,
|
||||
instructions?: $ReadOnlyArray<string>,
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ import type {ViewProps} from 'react-native';
|
||||
|
||||
import {useMemo} from 'react';
|
||||
|
||||
type EventRecorderOptions = $ReadOnly<{
|
||||
type EventRecorderOptions = Readonly<{
|
||||
mergeEventTypes: Array<string>,
|
||||
relevantEvents: Array<string>,
|
||||
}>;
|
||||
@@ -104,7 +104,7 @@ export default class RNTesterPlatformTestEventRecorder {
|
||||
createRecorderTestEventHandlers(
|
||||
targetNames: $ReadOnlyArray<string>,
|
||||
callback?: (event: Object, eventType: string, targetName: string) => void,
|
||||
): $ReadOnly<{[targetName: string]: ViewProps}> {
|
||||
): Readonly<{[targetName: string]: ViewProps}> {
|
||||
const result: {[targetName: string]: ViewProps} = {};
|
||||
for (const targetName of targetNames) {
|
||||
const recordedEventHandler =
|
||||
@@ -173,7 +173,7 @@ export function useRecorderTestEventHandlers(
|
||||
eventRecorder: RNTesterPlatformTestEventRecorder,
|
||||
targetNames: $ReadOnlyArray<string>,
|
||||
callback?: (event: Object, eventType: string, targetName: string) => void,
|
||||
): $ReadOnly<{[targetName: string]: ViewProps}> {
|
||||
): Readonly<{[targetName: string]: ViewProps}> {
|
||||
return useMemo(
|
||||
() => eventRecorder.createRecorderTestEventHandlers(targetNames, callback),
|
||||
[eventRecorder, targetNames, callback],
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
|
||||
import * as React from 'react';
|
||||
import {StyleSheet, Text, View} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
instructions?: $ReadOnlyArray<string>,
|
||||
style?: ?ViewStyleProp,
|
||||
}>;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import RNTesterPlatformTestResultsText from './RNTesterPlatformTestResultsText';
|
||||
import * as React from 'react';
|
||||
import {StyleSheet, Text, TouchableHighlight, View} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
numFail: number,
|
||||
numError: number,
|
||||
numPass: number,
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ const DISPLAY_STATUS_MAPPING: {[PlatformTestResultStatus]: string} = {
|
||||
SKIPPED: 'Skipped',
|
||||
};
|
||||
|
||||
type FilterModalProps = $ReadOnly<{
|
||||
type FilterModalProps = Readonly<{
|
||||
filterText: string,
|
||||
setFilterText: (newFilterText: string) => void,
|
||||
filterFail: boolean,
|
||||
@@ -176,7 +176,7 @@ function renderTableRow({item}: ListRenderItemInfo<PlatformTestResult>) {
|
||||
return <TableRow testResult={item} />;
|
||||
}
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
numPending: number,
|
||||
reset: () => void,
|
||||
results: $ReadOnlyArray<PlatformTestResult>,
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
import * as React from 'react';
|
||||
import {StyleSheet, Text} from 'react-native';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
type Props = Readonly<{
|
||||
numPass: number,
|
||||
numFail: number,
|
||||
numError: number,
|
||||
|
||||
+8
-8
@@ -8,17 +8,17 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
type BasePlatformTestAssertionResult = $ReadOnly<{
|
||||
type BasePlatformTestAssertionResult = Readonly<{
|
||||
name: string,
|
||||
description: string,
|
||||
}>;
|
||||
|
||||
export type PassingPlatformTestAssertionResult = $ReadOnly<{
|
||||
export type PassingPlatformTestAssertionResult = Readonly<{
|
||||
...BasePlatformTestAssertionResult,
|
||||
passing: true,
|
||||
}>;
|
||||
|
||||
export type FailingPlatformTestAssertionResult = $ReadOnly<{
|
||||
export type FailingPlatformTestAssertionResult = Readonly<{
|
||||
...BasePlatformTestAssertionResult,
|
||||
passing: false,
|
||||
failureMessage: string,
|
||||
@@ -30,14 +30,14 @@ export type PlatformTestAssertionResult =
|
||||
|
||||
export type PlatformTestResultStatus = 'PASS' | 'FAIL' | 'ERROR' | 'SKIPPED';
|
||||
|
||||
export type PlatformTestResult = $ReadOnly<{
|
||||
export type PlatformTestResult = Readonly<{
|
||||
name: string,
|
||||
status: PlatformTestResultStatus,
|
||||
assertions: $ReadOnlyArray<PlatformTestAssertionResult>,
|
||||
error: unknown | null, // null is technically unnecessary but is kept to ensure the error is described as nullable
|
||||
}>;
|
||||
|
||||
export type PlatformTestContext = $ReadOnly<{
|
||||
export type PlatformTestContext = Readonly<{
|
||||
assert_true(a: boolean, description: string): void,
|
||||
assert_equals(a: any, b: any, description: string): void,
|
||||
assert_not_equals(a: any, b: any, description: string): void,
|
||||
@@ -47,16 +47,16 @@ export type PlatformTestContext = $ReadOnly<{
|
||||
|
||||
export type PlatformTestCase = (context: PlatformTestContext) => void;
|
||||
|
||||
export type AsyncPlatformTest = $ReadOnly<{
|
||||
export type AsyncPlatformTest = Readonly<{
|
||||
done(): void,
|
||||
step(testcase: PlatformTestCase): void,
|
||||
}>;
|
||||
|
||||
export type SyncTestOptions = $ReadOnly<{
|
||||
export type SyncTestOptions = Readonly<{
|
||||
skip?: boolean,
|
||||
}>;
|
||||
|
||||
export type PlatformTestHarness = $ReadOnly<{
|
||||
export type PlatformTestHarness = Readonly<{
|
||||
test(
|
||||
testcase: PlatformTestCase,
|
||||
name: string,
|
||||
|
||||
@@ -32,8 +32,8 @@ function constructAsyncTestHook(
|
||||
addTestResult: (newResult: PlatformTestResult) => void,
|
||||
updateAsyncTestStatuses: (
|
||||
(
|
||||
$ReadOnly<{[string]: AsyncTestStatus}>,
|
||||
) => $ReadOnly<{[string]: AsyncTestStatus}>,
|
||||
Readonly<{[string]: AsyncTestStatus}>,
|
||||
) => Readonly<{[string]: AsyncTestStatus}>,
|
||||
) => void,
|
||||
runTestCase: (
|
||||
testCase: PlatformTestCase,
|
||||
@@ -131,7 +131,7 @@ function constructAsyncTestHook(
|
||||
};
|
||||
}
|
||||
|
||||
export type PlatformTestHarnessHookResult = $ReadOnly<{
|
||||
export type PlatformTestHarnessHookResult = Readonly<{
|
||||
testKey: number,
|
||||
harness: PlatformTestHarness,
|
||||
numPending: number,
|
||||
@@ -180,7 +180,7 @@ export default function usePlatformTestHarness(): PlatformTestHarnessHookResult
|
||||
const [testElementKey, setTestElementKey] = useState<number>(0);
|
||||
|
||||
const [asyncTestStatuses, updateAsyncTestStatuses] = useState<
|
||||
$ReadOnly<{[string]: AsyncTestStatus}>,
|
||||
Readonly<{[string]: AsyncTestStatus}>,
|
||||
>({});
|
||||
|
||||
const reset = useCallback(() => {
|
||||
|
||||
+1
-1
@@ -258,7 +258,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
export default function PointerEventAttributesHoverablePointers(
|
||||
props: Props,
|
||||
): React.MixedElement {
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
export default function PointerEventAttributesNoHoverPointers(
|
||||
props: Props,
|
||||
): React.MixedElement {
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
export default function PointerEventCaptureMouse(
|
||||
props: Props,
|
||||
): React.MixedElement {
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
export default function PointerEventClickTouch(
|
||||
props: Props,
|
||||
): React.MixedElement {
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
export default function PointerEventClickTouchHierarchy(
|
||||
props: Props,
|
||||
): React.MixedElement {
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
type Props = $ReadOnly<{}>;
|
||||
type Props = Readonly<{}>;
|
||||
export default function PointerEventClickTouchHierarchyPointerEvents(
|
||||
props: Props,
|
||||
): React.MixedElement {
|
||||
|
||||
Loaded 100 of 156 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user