mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Revert D111190630: Stop using prettier-plugin-hermes-parser for formatting
Differential Revision: D111190630 Original commit changeset: e7ed7ee6f057 Original Phabricator Diff: D111190630 fbshipit-source-id: 49e33587fa084c181d64d35ac6bcf6ab73edfa5f
This commit is contained in:
1 parent
2235b8ec3f
commit
65af886291
70 files changed
+579
-279
No files matched your search
+7
-1
@@ -7,6 +7,11 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
let plugins = ['prettier-plugin-hermes-parser'];
|
||||
try {
|
||||
plugins = require('./.prettier-plugins.fb.js');
|
||||
} catch {}
|
||||
|
||||
module.exports = {
|
||||
arrowParens: 'avoid',
|
||||
bracketSameLine: true,
|
||||
@@ -15,6 +20,7 @@ module.exports = {
|
||||
singleQuote: true,
|
||||
trailingComma: 'all',
|
||||
endOfLine: 'lf',
|
||||
plugins,
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.code-workspace'],
|
||||
@@ -25,7 +31,7 @@ module.exports = {
|
||||
{
|
||||
files: ['*.js', '*.js.flow'],
|
||||
options: {
|
||||
parser: 'flow',
|
||||
parser: 'hermes',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Vendored
+33
-15
@@ -457,7 +457,8 @@ declare class child_process$ChildProcessTyped<
|
||||
TStdin extends stream$Writable | null,
|
||||
TStdout extends stream$Readable | null,
|
||||
TStderr extends stream$Readable | null,
|
||||
> extends events$EventEmitter {
|
||||
> extends events$EventEmitter
|
||||
{
|
||||
+stdin: TStdin;
|
||||
+stdout: TStdout;
|
||||
+stderr: TStderr;
|
||||
@@ -577,7 +578,8 @@ declare module 'child_process' {
|
||||
declare function execFile(
|
||||
file: string,
|
||||
argsOrCallback?:
|
||||
ReadonlyArray<string> | child_process$execFileCallback<string>,
|
||||
| ReadonlyArray<string>
|
||||
| child_process$execFileCallback<string>,
|
||||
callback?: child_process$execFileCallback<string>,
|
||||
): child_process$ChildProcessTyped<
|
||||
stream$Writable,
|
||||
@@ -926,7 +928,14 @@ type crypto$key =
|
||||
|
||||
declare class crypto$KeyObject {
|
||||
+asymmetricKeyType?:
|
||||
'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
|
||||
| 'rsa'
|
||||
| 'rsa-pss'
|
||||
| 'dsa'
|
||||
| 'ec'
|
||||
| 'ed25519'
|
||||
| 'ed448'
|
||||
| 'x25519'
|
||||
| 'x448';
|
||||
+asymmetricKeySize?: number;
|
||||
+symmetricKeySize?: number;
|
||||
+type: 'secret' | 'public' | 'private';
|
||||
@@ -2551,9 +2560,9 @@ declare class http$Agent<+SocketT = net$Socket> {
|
||||
sockets: {[name: string]: ReadonlyArray<SocketT>, ...};
|
||||
}
|
||||
|
||||
declare class http$IncomingMessage<
|
||||
SocketT = net$Socket,
|
||||
> extends stream$Readable {
|
||||
declare class http$IncomingMessage<SocketT = net$Socket>
|
||||
extends stream$Readable
|
||||
{
|
||||
headers: Object;
|
||||
rawHeaders: Array<string>;
|
||||
httpVersion: string;
|
||||
@@ -2569,9 +2578,9 @@ declare class http$IncomingMessage<
|
||||
rawTrailers: Array<string>;
|
||||
}
|
||||
|
||||
declare class http$ClientRequest<
|
||||
+SocketT = net$Socket,
|
||||
> extends stream$Writable {
|
||||
declare class http$ClientRequest<+SocketT = net$Socket>
|
||||
extends stream$Writable
|
||||
{
|
||||
abort(): void;
|
||||
aborted: boolean;
|
||||
+connection: SocketT | null;
|
||||
@@ -2869,7 +2878,10 @@ declare class net$Socket extends stream$Duplex {
|
||||
destroyed: boolean;
|
||||
end(
|
||||
chunkOrEncodingOrCallback?:
|
||||
Buffer | Uint8Array | string | ((data: any) => void),
|
||||
| Buffer
|
||||
| Uint8Array
|
||||
| string
|
||||
| ((data: any) => void),
|
||||
encodingOrCallback?: string | ((data: any) => void),
|
||||
callback?: (data: any) => void,
|
||||
): this;
|
||||
@@ -3199,9 +3211,9 @@ declare module 'perf_hooks' {
|
||||
+detail?: T;
|
||||
}
|
||||
|
||||
declare export class PerformanceMeasure<
|
||||
T = unknown,
|
||||
> extends PerformanceEntry {
|
||||
declare export class PerformanceMeasure<T = unknown>
|
||||
extends PerformanceEntry
|
||||
{
|
||||
+entryType: 'measure';
|
||||
+detail?: T;
|
||||
}
|
||||
@@ -3386,7 +3398,11 @@ declare module 'querystring' {
|
||||
*/
|
||||
declare module 'node:sqlite' {
|
||||
declare export type SupportedValueType =
|
||||
null | number | bigint | string | Uint8Array;
|
||||
| null
|
||||
| number
|
||||
| bigint
|
||||
| string
|
||||
| Uint8Array;
|
||||
|
||||
declare export type DatabaseSyncOptions = Readonly<{
|
||||
open?: boolean,
|
||||
@@ -5549,7 +5565,9 @@ declare module 'repl' {
|
||||
writer?: (object: any, options?: util$InspectOptions) => string,
|
||||
completer?: readline$InterfaceCompleter,
|
||||
replMode?:
|
||||
$SymbolReplModeMagic | $SymbolReplModeSloppy | $SymbolReplModeStrict,
|
||||
| $SymbolReplModeMagic
|
||||
| $SymbolReplModeSloppy
|
||||
| $SymbolReplModeStrict,
|
||||
breakEvalOnSigint?: boolean,
|
||||
...
|
||||
}): REPLServer;
|
||||
|
||||
+15
-3
@@ -246,7 +246,12 @@ declare module '@babel/traverse' {
|
||||
}
|
||||
|
||||
declare export type BindingKind =
|
||||
'var' | 'let' | 'const' | 'module' | 'hoisted' | 'unknown';
|
||||
| 'var'
|
||||
| 'let'
|
||||
| 'const'
|
||||
| 'module'
|
||||
| 'hoisted'
|
||||
| 'unknown';
|
||||
|
||||
declare export class Binding {
|
||||
constructor(opts: {
|
||||
@@ -430,7 +435,13 @@ declare module '@babel/traverse' {
|
||||
isBaseType(baseName: string, soft?: boolean): boolean;
|
||||
couldBeBaseType(
|
||||
name:
|
||||
'string' | 'number' | 'boolean' | 'any' | 'mixed' | 'empty' | 'void',
|
||||
| 'string'
|
||||
| 'number'
|
||||
| 'boolean'
|
||||
| 'any'
|
||||
| 'mixed'
|
||||
| 'empty'
|
||||
| 'void',
|
||||
): boolean;
|
||||
baseTypeStrictlyMatches(right: NodePath<>): ?boolean;
|
||||
isGenericType(genericName: string): boolean;
|
||||
@@ -1435,7 +1446,8 @@ declare module '@babel/traverse' {
|
||||
}>;
|
||||
|
||||
declare export type VisitNode<-TNode extends BabelNode, TState> =
|
||||
VisitNodeFunction<TNode, TState> | VisitNodeObject<TNode, TState>;
|
||||
| VisitNodeFunction<TNode, TState>
|
||||
| VisitNodeObject<TNode, TState>;
|
||||
|
||||
declare export type Visitor<TState = void> = Readonly<{
|
||||
enter?: VisitNodeFunction<BabelNode, TState>,
|
||||
|
||||
Vendored
+2
-1
@@ -1293,7 +1293,8 @@ declare module '@babel/template' {
|
||||
};
|
||||
|
||||
declare export type PublicReplacements =
|
||||
{[string]: ?BabelNode} | Array<?BabelNode>;
|
||||
| {[string]: ?BabelNode}
|
||||
| Array<?BabelNode>;
|
||||
|
||||
declare export type TemplateBuilder<T> = {
|
||||
// Build a new builder, merging the given options with the previous ones.
|
||||
|
||||
Vendored
+6
-2
@@ -15,7 +15,8 @@
|
||||
|
||||
declare module 'commander' {
|
||||
declare type LiteralUnion<LiteralType, BaseType: string | number> =
|
||||
LiteralType | {...BaseType, ...{[key: empty]: empty, ...}};
|
||||
| LiteralType
|
||||
| {...BaseType, ...{[key: empty]: empty, ...}};
|
||||
|
||||
declare export class CommanderError mixins Error {
|
||||
code: string;
|
||||
@@ -334,7 +335,10 @@ declare module 'commander' {
|
||||
outputError?: (str: string, write: (str: string) => void) => void;
|
||||
}
|
||||
export type AddHelpTextPosition =
|
||||
'beforeAll' | 'before' | 'after' | 'afterAll';
|
||||
| 'beforeAll'
|
||||
| 'before'
|
||||
| 'after'
|
||||
| 'afterAll';
|
||||
export type HookEvent = 'preSubcommand' | 'preAction' | 'postAction';
|
||||
export type OptionValueSource = LiteralUnion<
|
||||
'default' | 'config' | 'env' | 'cli' | 'implied',
|
||||
|
||||
+9
-2
@@ -49,14 +49,21 @@ declare module '@electron/packager' {
|
||||
ProductName?: string,
|
||||
InternalName?: string,
|
||||
'requested-execution-level'?:
|
||||
'asInvoker' | 'highestAvailable' | 'requireAdministrator',
|
||||
| 'asInvoker'
|
||||
| 'highestAvailable'
|
||||
| 'requireAdministrator',
|
||||
'application-manifest'?: string,
|
||||
}>;
|
||||
|
||||
declare export type WindowsSignOptions = $FlowFixMe;
|
||||
|
||||
declare export type OfficialArch =
|
||||
'ia32' | 'x64' | 'armv7l' | 'arm64' | 'mips64el' | 'universal';
|
||||
| 'ia32'
|
||||
| 'x64'
|
||||
| 'armv7l'
|
||||
| 'arm64'
|
||||
| 'mips64el'
|
||||
| 'universal';
|
||||
|
||||
declare export type OfficialPlatform = 'linux' | 'win32' | 'darwin' | 'mas';
|
||||
|
||||
|
||||
Vendored
+8
-2
@@ -13,7 +13,12 @@
|
||||
|
||||
declare module 'execa' {
|
||||
declare type StdIoOption =
|
||||
'pipe' | 'ipc' | 'ignore' | 'inherit' | stream$Stream | number;
|
||||
| 'pipe'
|
||||
| 'ipc'
|
||||
| 'ignore'
|
||||
| 'inherit'
|
||||
| stream$Stream
|
||||
| number;
|
||||
|
||||
declare type CommonOptions = {
|
||||
argv0?: string,
|
||||
@@ -69,7 +74,8 @@ declare module 'execa' {
|
||||
};
|
||||
|
||||
declare interface ExecaPromise
|
||||
extends Promise<Result>, child_process$ChildProcess {}
|
||||
extends Promise<Result>,
|
||||
child_process$ChildProcess {}
|
||||
|
||||
declare interface ExecaError extends ErrnoError {
|
||||
stdout: string;
|
||||
|
||||
Vendored
+4
-1
@@ -214,7 +214,10 @@ type FakeTimersConfig = {
|
||||
*/
|
||||
|
||||
type JestStyledComponentsMatcherValue =
|
||||
string | JestAsymmetricEqualityType | RegExp | void;
|
||||
| string
|
||||
| JestAsymmetricEqualityType
|
||||
| RegExp
|
||||
| void;
|
||||
|
||||
type JestStyledComponentsMatcherOptions = {
|
||||
media?: string,
|
||||
|
||||
+7
-1
@@ -155,7 +155,13 @@ declare module 'jsonc-parser' {
|
||||
| 'InvalidCharacter'
|
||||
| '<unknown ParseErrorCode>';
|
||||
export type NodeType =
|
||||
'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null';
|
||||
| 'object'
|
||||
| 'array'
|
||||
| 'property'
|
||||
| 'string'
|
||||
| 'number'
|
||||
| 'boolean'
|
||||
| 'null';
|
||||
export type Node = {
|
||||
type: NodeType,
|
||||
value?: any,
|
||||
|
||||
Vendored
+12
-2
@@ -157,7 +157,12 @@ declare module 'node-fetch' {
|
||||
}
|
||||
|
||||
declare type ResponseType =
|
||||
'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
|
||||
| 'basic'
|
||||
| 'cors'
|
||||
| 'default'
|
||||
| 'error'
|
||||
| 'opaque'
|
||||
| 'opaqueredirect';
|
||||
|
||||
declare interface ResponseInit {
|
||||
headers?: HeaderInit;
|
||||
@@ -167,7 +172,12 @@ declare module 'node-fetch' {
|
||||
|
||||
declare type HeaderInit = Headers | Array<string>;
|
||||
declare type BodyInit =
|
||||
string | null | Buffer | Blob | Readable | URLSearchParams;
|
||||
| string
|
||||
| null
|
||||
| Buffer
|
||||
| Blob
|
||||
| Readable
|
||||
| URLSearchParams;
|
||||
|
||||
declare function fetch(
|
||||
url: string | URL | Request,
|
||||
|
||||
+3
-1
@@ -37,7 +37,9 @@ declare type PrettyFormatPlugin =
|
||||
|
||||
declare module 'pretty-format' {
|
||||
declare export type CompareKeys =
|
||||
((a: string, b: string) => number) | null | void;
|
||||
| ((a: string, b: string) => number)
|
||||
| null
|
||||
| void;
|
||||
declare export function format(
|
||||
value: unknown,
|
||||
options?: ?{
|
||||
|
||||
Vendored
+15
-11
@@ -9,14 +9,11 @@
|
||||
declare interface rxjs$UnaryFunction<T, R> {
|
||||
(source: T): R;
|
||||
}
|
||||
declare interface rxjs$OperatorFunction<T, R> extends rxjs$UnaryFunction<
|
||||
rxjs$Observable<T>,
|
||||
rxjs$Observable<R>,
|
||||
> {}
|
||||
declare interface rxjs$OperatorFunction<T, R>
|
||||
extends rxjs$UnaryFunction<rxjs$Observable<T>, rxjs$Observable<R>> {}
|
||||
declare type rxjs$FactoryOrValue<T> = T | (() => T);
|
||||
declare interface rxjs$MonoTypeOperatorFunction<
|
||||
T,
|
||||
> extends rxjs$OperatorFunction<T, T> {}
|
||||
declare interface rxjs$MonoTypeOperatorFunction<T>
|
||||
extends rxjs$OperatorFunction<T, T> {}
|
||||
declare interface rxjs$Timestamp<T> {
|
||||
value: T;
|
||||
timestamp: number;
|
||||
@@ -50,7 +47,9 @@ declare interface rxjs$Subscribable<T> {
|
||||
): rxjs$Unsubscribable;
|
||||
}
|
||||
declare type rxjs$ObservableInput<T> =
|
||||
rxjs$SubscribableOrPromise<T> | Array<T> | Iterable<T>;
|
||||
| rxjs$SubscribableOrPromise<T>
|
||||
| Array<T>
|
||||
| Iterable<T>;
|
||||
|
||||
declare type rxjs$InteropObservable<T> = {
|
||||
[string | unknown]: () => rxjs$Subscribable<T>,
|
||||
@@ -589,7 +588,8 @@ declare module 'rxjs' {
|
||||
(<T>(...sources: rxjs$ObservableInput<T>[]) => rxjs$Observable<T[]>),
|
||||
from<T>(
|
||||
input:
|
||||
rxjs$ObservableInput<T> | rxjs$ObservableInput<rxjs$ObservableInput<T>>,
|
||||
| rxjs$ObservableInput<T>
|
||||
| rxjs$ObservableInput<rxjs$ObservableInput<T>>,
|
||||
scheduler?: rxjs$SchedulerLike,
|
||||
): rxjs$Observable<T>,
|
||||
ArgumentOutOfRangeError: ArgumentOutOfRangeError,
|
||||
@@ -630,7 +630,9 @@ declare module 'rxjs' {
|
||||
) => rxjs$Observable<T>) &
|
||||
(<T, R>(
|
||||
...observables: (
|
||||
rxjs$ObservableInput<any> | rxjs$SchedulerLike | number
|
||||
| rxjs$ObservableInput<any>
|
||||
| rxjs$SchedulerLike
|
||||
| number
|
||||
)[]
|
||||
) => rxjs$Observable<R>) &
|
||||
(<T>(
|
||||
@@ -3347,7 +3349,9 @@ declare module 'rxjs/webSocket' {
|
||||
_output: rxjs$Subject<T>;
|
||||
constructor(
|
||||
urlConfigOrSource:
|
||||
string | WebSocketSubjectConfig<T> | rxjs$Observable<T>,
|
||||
| string
|
||||
| WebSocketSubjectConfig<T>
|
||||
| rxjs$Observable<T>,
|
||||
destination?: rxjs$Observer<T>,
|
||||
): void;
|
||||
lift<R>(operator: rxjs$Operator<T, R>): WebSocketSubject<R>;
|
||||
|
||||
Vendored
+8
-1
@@ -48,7 +48,14 @@ declare type $npm$shelljs$GrepOpts = $npm$shelljs$OptionsPoly<'-l' | '-v'>;
|
||||
declare type $npm$shelljs$SedOpts = $npm$shelljs$OptionsPoly<'-i'>;
|
||||
declare type $npm$shelljs$SortOpts = $npm$shelljs$OptionsPoly<'-n' | '-r'>;
|
||||
declare type $npm$shelljs$TestOpts =
|
||||
'-b' | '-c' | '-d' | '-e' | '-f' | '-L' | '-p' | '-S';
|
||||
| '-b'
|
||||
| '-c'
|
||||
| '-d'
|
||||
| '-e'
|
||||
| '-f'
|
||||
| '-L'
|
||||
| '-p'
|
||||
| '-S';
|
||||
declare type $npm$shelljs$TouchOpts = {
|
||||
[key: '-a' | '-c' | '-m']: boolean,
|
||||
'-d'?: string,
|
||||
|
||||
Vendored
+3
-1
@@ -101,7 +101,9 @@ declare module 'tinybench' {
|
||||
// but we type it this way to avoid mistakes (we can make breaking changes
|
||||
// in our definition that they can't).
|
||||
export type Fn = () =>
|
||||
Promise<void | FnReturnedObject> | void | FnReturnedObject;
|
||||
| Promise<void | FnReturnedObject>
|
||||
| void
|
||||
| FnReturnedObject;
|
||||
|
||||
declare export class Bench extends EventTarget {
|
||||
concurrency: null | 'task' | 'bench';
|
||||
|
||||
@@ -21,7 +21,10 @@ const debugCDPMessages = require('debug')('Metro:InspectorProxyCDPMessages');
|
||||
const CDP_MESSAGES_BATCH_DEBUGGING_THROTTLE_MS = 5000;
|
||||
|
||||
export type CDPMessageDestination =
|
||||
'DebuggerToProxy' | 'ProxyToDebugger' | 'DeviceToProxy' | 'ProxyToDevice';
|
||||
| 'DebuggerToProxy'
|
||||
| 'ProxyToDebugger'
|
||||
| 'DeviceToProxy'
|
||||
| 'ProxyToDevice';
|
||||
|
||||
function getCDPLogPrefix(destination: CDPMessageDestination): string {
|
||||
return util.format(
|
||||
|
||||
@@ -107,11 +107,16 @@ export type GetPagesResponse = {
|
||||
|
||||
// Union type for all possible messages sent from device to Inspector Proxy.
|
||||
export type MessageFromDevice =
|
||||
GetPagesResponse | WrappedEventFromDevice | DisconnectRequest;
|
||||
| GetPagesResponse
|
||||
| WrappedEventFromDevice
|
||||
| DisconnectRequest;
|
||||
|
||||
// Union type for all possible messages sent from Inspector Proxy to device.
|
||||
export type MessageToDevice =
|
||||
GetPagesRequest | WrappedEventToDevice | ConnectRequest | DisconnectRequest;
|
||||
| GetPagesRequest
|
||||
| WrappedEventToDevice
|
||||
| ConnectRequest
|
||||
| DisconnectRequest;
|
||||
|
||||
// Page description object that is sent in response to /json HTTP request from debugger.
|
||||
export type PageDescription = Readonly<{
|
||||
|
||||
@@ -58,12 +58,14 @@ module.exports = {
|
||||
}
|
||||
const properties = args[0].properties;
|
||||
properties.forEach(property => {
|
||||
if (!(
|
||||
property.type === 'Property' &&
|
||||
(property.value.type === 'Literal' ||
|
||||
(property.value.type === 'CallExpression' &&
|
||||
property.value.callee.name === 'PlatformColor'))
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
property.type === 'Property' &&
|
||||
(property.value.type === 'Literal' ||
|
||||
(property.value.type === 'CallExpression' &&
|
||||
property.value.callee.name === 'PlatformColor'))
|
||||
)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'dynamicColorIOSValue',
|
||||
|
||||
+13
-9
@@ -91,18 +91,22 @@ function isModuleRequire(node) {
|
||||
}
|
||||
|
||||
const memberExpression = callExpression.callee;
|
||||
if (!(
|
||||
memberExpression.object.type === 'Identifier' &&
|
||||
memberExpression.object.name === 'TurboModuleRegistry'
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
memberExpression.object.type === 'Identifier' &&
|
||||
memberExpression.object.name === 'TurboModuleRegistry'
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(
|
||||
memberExpression.property.type === 'Identifier' &&
|
||||
(memberExpression.property.name === 'get' ||
|
||||
memberExpression.property.name === 'getEnforcing')
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
memberExpression.property.type === 'Identifier' &&
|
||||
(memberExpression.property.name === 'get' ||
|
||||
memberExpression.property.name === 'getEnforcing')
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -28,8 +28,9 @@ module.exports = {
|
||||
resolver: require.resolve('./jest/resolver.js'),
|
||||
transform: {
|
||||
'^.+\\.(js|ts|tsx)$': 'babel-jest',
|
||||
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$':
|
||||
require.resolve('./jest/assetFileTransformer.js'),
|
||||
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve(
|
||||
'./jest/assetFileTransformer.js',
|
||||
),
|
||||
},
|
||||
transformIgnorePatterns: [
|
||||
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)',
|
||||
|
||||
@@ -85,10 +85,12 @@ export function getDefaultConfig(projectRoot: string): ConfigT {
|
||||
transformer: {
|
||||
allowOptionalDependencies: true,
|
||||
assetRegistryPath: 'react-native/asset-registry',
|
||||
asyncRequireModulePath:
|
||||
require.resolve('metro-runtime/src/modules/asyncRequire'),
|
||||
babelTransformerPath:
|
||||
require.resolve('@react-native/metro-babel-transformer'),
|
||||
asyncRequireModulePath: require.resolve(
|
||||
'metro-runtime/src/modules/asyncRequire',
|
||||
),
|
||||
babelTransformerPath: require.resolve(
|
||||
'@react-native/metro-babel-transformer',
|
||||
),
|
||||
getTransformOptions: async () => ({
|
||||
transform: {
|
||||
experimentalImportSupport: false,
|
||||
|
||||
+10
-5
@@ -270,7 +270,8 @@ export type ReservedTypeAnnotation = Readonly<{
|
||||
* NativeModule Types
|
||||
*/
|
||||
export type Nullable<out T extends NativeModuleTypeAnnotation> =
|
||||
NullableTypeAnnotation<T> | T;
|
||||
| NullableTypeAnnotation<T>
|
||||
| T;
|
||||
|
||||
export type NullableTypeAnnotation<out T extends NativeModuleTypeAnnotation> =
|
||||
Readonly<{
|
||||
@@ -344,7 +345,8 @@ export type NativeModuleEnumMember = {
|
||||
};
|
||||
|
||||
export type NativeModuleEnumMemberType =
|
||||
'NumberTypeAnnotation' | 'StringTypeAnnotation';
|
||||
| 'NumberTypeAnnotation'
|
||||
| 'StringTypeAnnotation';
|
||||
|
||||
export type NativeModuleEnumDeclaration = Readonly<{
|
||||
name: string,
|
||||
@@ -434,10 +436,12 @@ export type NativeModuleBaseTypeAnnotation =
|
||||
| NativeModuleMixedTypeAnnotation;
|
||||
|
||||
export type NativeModuleParamTypeAnnotation =
|
||||
NativeModuleBaseTypeAnnotation | NativeModuleParamOnlyTypeAnnotation;
|
||||
| NativeModuleBaseTypeAnnotation
|
||||
| NativeModuleParamOnlyTypeAnnotation;
|
||||
|
||||
export type NativeModuleReturnTypeAnnotation =
|
||||
NativeModuleBaseTypeAnnotation | NativeModuleReturnOnlyTypeAnnotation;
|
||||
| NativeModuleBaseTypeAnnotation
|
||||
| NativeModuleReturnOnlyTypeAnnotation;
|
||||
|
||||
export type NativeModuleTypeAnnotation =
|
||||
| NativeModuleBaseTypeAnnotation
|
||||
@@ -448,7 +452,8 @@ export type NativeModuleTypeAnnotation =
|
||||
type NativeModuleParamOnlyTypeAnnotation = NativeModuleFunctionTypeAnnotation;
|
||||
|
||||
type NativeModuleReturnOnlyTypeAnnotation =
|
||||
NativeModulePromiseTypeAnnotation | VoidTypeAnnotation;
|
||||
| NativeModulePromiseTypeAnnotation
|
||||
| VoidTypeAnnotation;
|
||||
|
||||
// Add the allowed component reserved types to the native module union
|
||||
export type CompleteReservedTypeAnnotation =
|
||||
|
||||
@@ -49,12 +49,14 @@ function buildCommandSchema(
|
||||
|
||||
const firstParam = value.params[0].typeAnnotation;
|
||||
|
||||
if (!(
|
||||
firstParam.id != null &&
|
||||
firstParam.id.type === 'QualifiedTypeIdentifier' &&
|
||||
firstParam.id.qualification.name === 'React' &&
|
||||
firstParam.id.id.name === 'ElementRef'
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
firstParam.id != null &&
|
||||
firstParam.id.type === 'QualifiedTypeIdentifier' &&
|
||||
firstParam.id.qualification.name === 'React' &&
|
||||
firstParam.id.id.name === 'ElementRef'
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
`The first argument of method ${name} must be of type React.ElementRef<>`,
|
||||
);
|
||||
|
||||
+9
-7
@@ -33,13 +33,15 @@ function buildCommandSchemaInternal(
|
||||
parser: Parser,
|
||||
): NamedShape<CommandTypeAnnotation> {
|
||||
const firstParam = parameters[0].typeAnnotation;
|
||||
if (!(
|
||||
firstParam.typeAnnotation != null &&
|
||||
firstParam.typeAnnotation.type === 'TSTypeReference' &&
|
||||
firstParam.typeAnnotation.typeName.left?.name === 'React' &&
|
||||
(firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' ||
|
||||
firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef')
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
firstParam.typeAnnotation != null &&
|
||||
firstParam.typeAnnotation.type === 'TSTypeReference' &&
|
||||
firstParam.typeAnnotation.typeName.left?.name === 'React' &&
|
||||
(firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' ||
|
||||
firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef')
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
`The first argument of method ${name} must be of type React.ElementRef<> or React.ComponentRef<>`,
|
||||
);
|
||||
|
||||
+4
-2
@@ -354,7 +354,8 @@ function setDefaultValue(
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
(defaultValue === null ? null : defaultValue ? defaultValue : 0) as
|
||||
number | null;
|
||||
| number
|
||||
| null;
|
||||
break;
|
||||
case 'BooleanTypeAnnotation':
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
@@ -363,7 +364,8 @@ function setDefaultValue(
|
||||
break;
|
||||
case 'StringTypeAnnotation':
|
||||
common.default = (defaultValue === undefined ? null : defaultValue) as
|
||||
string | null;
|
||||
| string
|
||||
| null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-9
@@ -177,18 +177,22 @@ function isModuleRegistryCall(node: $FlowFixMe): boolean {
|
||||
}
|
||||
|
||||
const memberExpression = callExpression.callee;
|
||||
if (!(
|
||||
memberExpression.object.type === 'Identifier' &&
|
||||
memberExpression.object.name === 'TurboModuleRegistry'
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
memberExpression.object.type === 'Identifier' &&
|
||||
memberExpression.object.name === 'TurboModuleRegistry'
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(
|
||||
memberExpression.property.type === 'Identifier' &&
|
||||
(memberExpression.property.name === 'get' ||
|
||||
memberExpression.property.name === 'getEnforcing')
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
memberExpression.property.type === 'Identifier' &&
|
||||
(memberExpression.property.name === 'get' ||
|
||||
memberExpression.property.name === 'getEnforcing')
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,8 @@ export type UnionMembersComparisonResult = {
|
||||
}>,
|
||||
};
|
||||
export type MembersComparisonResult =
|
||||
EnumMembersComparisonResult | UnionMembersComparisonResult;
|
||||
| EnumMembersComparisonResult
|
||||
| UnionMembersComparisonResult;
|
||||
export type NullableComparisonResult = {
|
||||
/* Four possible cases of change:
|
||||
void goes to T? :: typeRefined !optionsReduced
|
||||
|
||||
@@ -87,7 +87,9 @@ type ExportableSchemaDiffers = {
|
||||
};
|
||||
export type SchemaDiffCategory = 'new' | 'deprecated' | SchemaDiffers;
|
||||
type ExportableSchemaDiffCategory =
|
||||
'new' | 'deprecated' | ExportableSchemaDiffers;
|
||||
| 'new'
|
||||
| 'deprecated'
|
||||
| ExportableSchemaDiffers;
|
||||
export type SchemaDiff = {
|
||||
name: string,
|
||||
framework: Framework,
|
||||
|
||||
+4
-1
@@ -17,7 +17,10 @@ import {alertWithArgs} from './RCTAlertManager';
|
||||
* @platform ios
|
||||
*/
|
||||
export type AlertType =
|
||||
'default' | 'plain-text' | 'secure-text' | 'login-password';
|
||||
| 'default'
|
||||
| 'plain-text'
|
||||
| 'secure-text'
|
||||
| 'login-password';
|
||||
|
||||
/**
|
||||
* @platform ios
|
||||
|
||||
@@ -21,7 +21,9 @@ import AnimatedValueXY from './nodes/AnimatedValueXY';
|
||||
import invariant from 'invariant';
|
||||
|
||||
export type Mapping =
|
||||
{[key: string]: Mapping, ...} | AnimatedValue | AnimatedValueXY;
|
||||
| {[key: string]: Mapping, ...}
|
||||
| AnimatedValue
|
||||
| AnimatedValueXY;
|
||||
export type EventConfig<T> = {
|
||||
listener?: ?(NativeSyntheticEvent<T>) => unknown,
|
||||
useNativeDriver: boolean,
|
||||
|
||||
@@ -34,19 +34,20 @@ type Builtin = (...ReadonlyArray<empty>) => unknown | Date | Error | RegExp;
|
||||
export type WithAnimatedValue<out T> = T extends Builtin | Nullable
|
||||
? T
|
||||
: T extends Primitive
|
||||
? | T
|
||||
| AnimatedNode
|
||||
| AnimatedAddition
|
||||
| AnimatedSubtraction
|
||||
| AnimatedDivision
|
||||
| AnimatedMultiplication
|
||||
| AnimatedModulo
|
||||
| AnimatedDiffClamp
|
||||
| AnimatedValue
|
||||
| AnimatedInterpolation<number | string>
|
||||
| AnimatedInterpolation<number>
|
||||
| AnimatedInterpolation<string>
|
||||
| AnimatedInterpolation<NativeColorValue>
|
||||
?
|
||||
| T
|
||||
| AnimatedNode
|
||||
| AnimatedAddition
|
||||
| AnimatedSubtraction
|
||||
| AnimatedDivision
|
||||
| AnimatedMultiplication
|
||||
| AnimatedModulo
|
||||
| AnimatedDiffClamp
|
||||
| AnimatedValue
|
||||
| AnimatedInterpolation<number | string>
|
||||
| AnimatedInterpolation<number>
|
||||
| AnimatedInterpolation<string>
|
||||
| AnimatedInterpolation<NativeColorValue>
|
||||
: T extends ReadonlyArray<infer P>
|
||||
? ReadonlyArray<WithAnimatedValue<P>>
|
||||
: T extends {...}
|
||||
|
||||
@@ -28,7 +28,9 @@ import invariant from 'invariant';
|
||||
type ExtrapolateType = 'extend' | 'identity' | 'clamp';
|
||||
|
||||
export type InterpolationConfigSupportedOutputType =
|
||||
number | string | NativeColorValue;
|
||||
| number
|
||||
| string
|
||||
| NativeColorValue;
|
||||
|
||||
export type InterpolationConfigType<
|
||||
OutputT extends InterpolationConfigSupportedOutputType,
|
||||
|
||||
+5
-1
@@ -29,7 +29,11 @@ import NativeAppState from './NativeAppState';
|
||||
* @platform ios `inactive`
|
||||
*/
|
||||
export type AppStateStatus =
|
||||
'inactive' | 'background' | 'active' | 'extension' | 'unknown';
|
||||
| 'inactive'
|
||||
| 'background'
|
||||
| 'active'
|
||||
| 'extension'
|
||||
| 'unknown';
|
||||
|
||||
/**
|
||||
* Events emitted by `AppState`.
|
||||
|
||||
@@ -130,7 +130,8 @@ class MessageQueue {
|
||||
}
|
||||
|
||||
flushedQueue():
|
||||
null | [Array<number>, Array<number>, Array<unknown>, number] {
|
||||
| null
|
||||
| [Array<number>, Array<number>, Array<unknown>, number] {
|
||||
this.__guard(() => {
|
||||
this.__callReactNativeMicrotasks();
|
||||
});
|
||||
|
||||
+4
-1
@@ -43,7 +43,10 @@ type AccessibilityEventDefinitions = {
|
||||
};
|
||||
|
||||
type AccessibilityEventTypes =
|
||||
'click' | 'focus' | 'viewHoverEnter' | 'windowStateChange';
|
||||
| 'click'
|
||||
| 'focus'
|
||||
| 'viewHoverEnter'
|
||||
| 'windowStateChange';
|
||||
|
||||
// Mapping of public event names to platform-specific event names.
|
||||
const EventNames: Map<keyof AccessibilityEventDefinitions, string> =
|
||||
|
||||
+2
-1
@@ -168,7 +168,8 @@ export type ButtonProps = Readonly<{
|
||||
}>;
|
||||
|
||||
const NativeTouchable:
|
||||
typeof TouchableNativeFeedback | typeof TouchableOpacity =
|
||||
| typeof TouchableNativeFeedback
|
||||
| typeof TouchableOpacity =
|
||||
Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
|
||||
|
||||
export type ButtonInstance = React.ElementRef<typeof NativeTouchable>;
|
||||
|
||||
@@ -19,7 +19,11 @@ import NativeKeyboardObserver from './NativeKeyboardObserver';
|
||||
export type KeyboardEventName = keyof KeyboardEventDefinitions;
|
||||
|
||||
export type KeyboardEventEasing =
|
||||
'easeIn' | 'easeInEaseOut' | 'easeOut' | 'linear' | 'keyboard';
|
||||
| 'easeIn'
|
||||
| 'easeInEaseOut'
|
||||
| 'easeOut'
|
||||
| 'linear'
|
||||
| 'keyboard';
|
||||
|
||||
export type KeyboardMetrics = Readonly<{
|
||||
screenX: number,
|
||||
|
||||
@@ -142,7 +142,8 @@ type PressableBaseProps = Readonly<{
|
||||
* the component is currently pressed and returns view styles.
|
||||
*/
|
||||
style?:
|
||||
ViewStyleProp | ((state: PressableStateCallbackType) => ViewStyleProp),
|
||||
| ViewStyleProp
|
||||
| ((state: PressableStateCallbackType) => ViewStyleProp),
|
||||
|
||||
/**
|
||||
* Identifier used to find this view in tests.
|
||||
|
||||
@@ -199,7 +199,8 @@ export type DecelerationRateType = 'fast' | 'normal' | number;
|
||||
export type ScrollResponderType = ScrollViewImperativeMethods;
|
||||
|
||||
export interface ScrollViewInstance
|
||||
extends HostInstance, ScrollViewImperativeMethods {}
|
||||
extends HostInstance,
|
||||
ScrollViewImperativeMethods {}
|
||||
|
||||
type InnerViewInstance = React.ElementRef<typeof View>;
|
||||
|
||||
@@ -393,7 +394,10 @@ export type ScrollViewPropsIOS = Readonly<{
|
||||
* @platform ios
|
||||
*/
|
||||
contentInsetAdjustmentBehavior?: ?(
|
||||
'automatic' | 'scrollableAxes' | 'never' | 'always'
|
||||
| 'automatic'
|
||||
| 'scrollableAxes'
|
||||
| 'never'
|
||||
| 'always'
|
||||
),
|
||||
}>;
|
||||
|
||||
@@ -565,11 +569,9 @@ type ScrollViewBaseProps = Readonly<{
|
||||
*
|
||||
* @default `'none'`
|
||||
*/
|
||||
keyboardDismissMode?: ?(
|
||||
// default
|
||||
// cross-platform
|
||||
'none' | 'on-drag' | 'interactive'
|
||||
), // ios only
|
||||
keyboardDismissMode?: ?// default
|
||||
// cross-platform
|
||||
('none' | 'on-drag' | 'interactive'), // ios only
|
||||
/**
|
||||
* Determines when the keyboard should stay visible after a tap.
|
||||
*
|
||||
|
||||
+4
-1
@@ -32,7 +32,10 @@ export type ScrollViewNativeProps = Readonly<{
|
||||
centerContent?: ?boolean,
|
||||
contentInset?: ?EdgeInsetsProp,
|
||||
contentInsetAdjustmentBehavior?: ?(
|
||||
'automatic' | 'scrollableAxes' | 'never' | 'always'
|
||||
| 'automatic'
|
||||
| 'scrollableAxes'
|
||||
| 'never'
|
||||
| 'always'
|
||||
),
|
||||
contentOffset?: ?PointProp,
|
||||
decelerationRate?: ?('fast' | 'normal' | number),
|
||||
|
||||
@@ -171,20 +171,36 @@ export type KeyboardTypeIOS =
|
||||
export type KeyboardTypeAndroid = 'visible-password';
|
||||
|
||||
export type KeyboardTypeOptions =
|
||||
KeyboardType | KeyboardTypeIOS | KeyboardTypeAndroid;
|
||||
| KeyboardType
|
||||
| KeyboardTypeIOS
|
||||
| KeyboardTypeAndroid;
|
||||
|
||||
export type InputModeOptions =
|
||||
'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
||||
| 'none'
|
||||
| 'text'
|
||||
| 'decimal'
|
||||
| 'numeric'
|
||||
| 'tel'
|
||||
| 'search'
|
||||
| 'email'
|
||||
| 'url';
|
||||
|
||||
export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send';
|
||||
|
||||
export type ReturnKeyTypeIOS =
|
||||
'default' | 'emergency-call' | 'google' | 'join' | 'route' | 'yahoo';
|
||||
| 'default'
|
||||
| 'emergency-call'
|
||||
| 'google'
|
||||
| 'join'
|
||||
| 'route'
|
||||
| 'yahoo';
|
||||
|
||||
export type ReturnKeyTypeAndroid = 'none' | 'previous';
|
||||
|
||||
export type ReturnKeyTypeOptions =
|
||||
ReturnKeyType | ReturnKeyTypeIOS | ReturnKeyTypeAndroid;
|
||||
| ReturnKeyType
|
||||
| ReturnKeyTypeIOS
|
||||
| ReturnKeyTypeAndroid;
|
||||
|
||||
export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
|
||||
|
||||
@@ -245,7 +261,9 @@ export type EnterKeyHintTypeIOS = 'enter';
|
||||
export type EnterKeyHintType = 'done' | 'go' | 'next' | 'search' | 'send';
|
||||
|
||||
export type EnterKeyHintTypeOptions =
|
||||
EnterKeyHintType | EnterKeyHintTypeAndroid | EnterKeyHintTypeIOS;
|
||||
| EnterKeyHintType
|
||||
| EnterKeyHintTypeAndroid
|
||||
| EnterKeyHintTypeIOS;
|
||||
|
||||
type PasswordRules = string;
|
||||
|
||||
@@ -288,7 +306,8 @@ export type TextInputIOSProps = Readonly<{
|
||||
* @platform ios
|
||||
*/
|
||||
dataDetectorTypes?:
|
||||
?DataDetectorTypesType | ReadonlyArray<DataDetectorTypesType>,
|
||||
| ?DataDetectorTypesType
|
||||
| ReadonlyArray<DataDetectorTypesType>,
|
||||
|
||||
/**
|
||||
* If `true`, the keyboard disables the return key when there is no text and
|
||||
@@ -366,7 +385,12 @@ export type TextInputIOSProps = Readonly<{
|
||||
* @platform ios
|
||||
*/
|
||||
lineBreakModeIOS?: ?(
|
||||
'wordWrapping' | 'char' | 'clip' | 'head' | 'middle' | 'tail'
|
||||
| 'wordWrapping'
|
||||
| 'char'
|
||||
| 'clip'
|
||||
| 'head'
|
||||
| 'middle'
|
||||
| 'tail'
|
||||
),
|
||||
|
||||
/**
|
||||
@@ -423,7 +447,11 @@ export type TextInputAndroidProps = Readonly<{
|
||||
* - `yesExcludeDescendants` - this view is important for autofill but its children aren't
|
||||
*/
|
||||
importantForAutofill?: ?(
|
||||
'auto' | 'no' | 'noExcludeDescendants' | 'yes' | 'yesExcludeDescendants'
|
||||
| 'auto'
|
||||
| 'no'
|
||||
| 'noExcludeDescendants'
|
||||
| 'yes'
|
||||
| 'yesExcludeDescendants'
|
||||
),
|
||||
|
||||
/**
|
||||
|
||||
@@ -641,54 +641,53 @@ function InternalTextInput(props: TextInputProps): React.Node {
|
||||
? selectionColor
|
||||
: selectionHandleColor,
|
||||
};
|
||||
textInput =
|
||||
(
|
||||
/* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match up
|
||||
* exactly with the props for TextInput. This will need to get fixed */
|
||||
/* $FlowFixMe[incompatible-type] the types for AndroidTextInput don't
|
||||
* match up exactly with the props for TextInput. This will need to get
|
||||
* fixed */
|
||||
/* $FlowFixMe[incompatible-type-arg] the types for AndroidTextInput don't
|
||||
* match up exactly with the props for TextInput. This will need to get
|
||||
* fixed */
|
||||
<AndroidTextInput
|
||||
// Figure out imperative + forward refs.
|
||||
ref={ref as $FlowFixMe}
|
||||
{...otherProps}
|
||||
{...colorProps}
|
||||
{...eventHandlers}
|
||||
accessibilityLabel={_accessibilityLabel}
|
||||
accessibilityLabelledBy={_accessibilityLabelledBy}
|
||||
accessibilityState={_accessibilityState}
|
||||
accessible={accessible}
|
||||
acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
|
||||
autoCapitalize={autoCapitalize}
|
||||
submitBehavior={submitBehavior}
|
||||
caretHidden={caretHidden}
|
||||
children={children}
|
||||
disableFullscreenUI={props.disableFullscreenUI}
|
||||
focusable={tabIndex !== undefined ? !tabIndex : focusable}
|
||||
importantForAccessibility={_importantForAccessibility}
|
||||
mostRecentEventCount={mostRecentEventCount}
|
||||
nativeID={id ?? props.nativeID}
|
||||
numberOfLines={props.rows ?? props.numberOfLines}
|
||||
onBlur={_onBlur}
|
||||
onChange={_onChange}
|
||||
onFocus={_onFocus}
|
||||
/* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match
|
||||
* up exactly with the props for TextInput. This will need to get fixed
|
||||
*/
|
||||
/* $FlowFixMe[incompatible-type] the types for AndroidTextInput
|
||||
* don't match up exactly with the props for TextInput. This will need
|
||||
* to get fixed */
|
||||
onScroll={_onScroll}
|
||||
onSelectionChange={_onSelectionChange}
|
||||
placeholder={placeholder}
|
||||
style={_style}
|
||||
text={text}
|
||||
textBreakStrategy={props.textBreakStrategy}
|
||||
/>
|
||||
);
|
||||
textInput = (
|
||||
/* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match up
|
||||
* exactly with the props for TextInput. This will need to get fixed */
|
||||
/* $FlowFixMe[incompatible-type] the types for AndroidTextInput don't
|
||||
* match up exactly with the props for TextInput. This will need to get
|
||||
* fixed */
|
||||
/* $FlowFixMe[incompatible-type-arg] the types for AndroidTextInput don't
|
||||
* match up exactly with the props for TextInput. This will need to get
|
||||
* fixed */
|
||||
<AndroidTextInput
|
||||
// Figure out imperative + forward refs.
|
||||
ref={ref as $FlowFixMe}
|
||||
{...otherProps}
|
||||
{...colorProps}
|
||||
{...eventHandlers}
|
||||
accessibilityLabel={_accessibilityLabel}
|
||||
accessibilityLabelledBy={_accessibilityLabelledBy}
|
||||
accessibilityState={_accessibilityState}
|
||||
accessible={accessible}
|
||||
acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
|
||||
autoCapitalize={autoCapitalize}
|
||||
submitBehavior={submitBehavior}
|
||||
caretHidden={caretHidden}
|
||||
children={children}
|
||||
disableFullscreenUI={props.disableFullscreenUI}
|
||||
focusable={tabIndex !== undefined ? !tabIndex : focusable}
|
||||
importantForAccessibility={_importantForAccessibility}
|
||||
mostRecentEventCount={mostRecentEventCount}
|
||||
nativeID={id ?? props.nativeID}
|
||||
numberOfLines={props.rows ?? props.numberOfLines}
|
||||
onBlur={_onBlur}
|
||||
onChange={_onChange}
|
||||
onFocus={_onFocus}
|
||||
/* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match
|
||||
* up exactly with the props for TextInput. This will need to get fixed
|
||||
*/
|
||||
/* $FlowFixMe[incompatible-type] the types for AndroidTextInput
|
||||
* don't match up exactly with the props for TextInput. This will need
|
||||
* to get fixed */
|
||||
onScroll={_onScroll}
|
||||
onSelectionChange={_onSelectionChange}
|
||||
placeholder={placeholder}
|
||||
style={_style}
|
||||
text={text}
|
||||
textBreakStrategy={props.textBreakStrategy}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return <TextAncestorContext value={true}>{textInput}</TextAncestorContext>;
|
||||
}
|
||||
|
||||
@@ -694,7 +694,7 @@ const TouchableMixinImpl = {
|
||||
curState +
|
||||
'` for Touchable responder `' +
|
||||
typeof this.state.touchable.responderID ===
|
||||
'number'
|
||||
'number'
|
||||
? this.state.touchable.responderID
|
||||
: 'host component' + '`',
|
||||
);
|
||||
@@ -707,7 +707,7 @@ const TouchableMixinImpl = {
|
||||
signal +
|
||||
'` for responder `' +
|
||||
typeof this.state.touchable.responderID ===
|
||||
'number'
|
||||
'number'
|
||||
? this.state.touchable.responderID
|
||||
: '<<host component>>' + '`',
|
||||
);
|
||||
|
||||
+2
-1
@@ -84,7 +84,8 @@ export type TouchableNativeFeedbackProps = Readonly<{
|
||||
| Readonly<{
|
||||
type: 'ThemeAttrAndroid',
|
||||
attribute:
|
||||
'selectableItemBackground' | 'selectableItemBackgroundBorderless',
|
||||
| 'selectableItemBackground'
|
||||
| 'selectableItemBackgroundBorderless',
|
||||
rippleRadius: ?number,
|
||||
}>
|
||||
| Readonly<{
|
||||
|
||||
+4
-1
@@ -74,7 +74,10 @@ export type TouchableWithoutFeedbackProps = Readonly<
|
||||
*/
|
||||
id?: string,
|
||||
importantForAccessibility?: ?(
|
||||
'auto' | 'yes' | 'no' | 'no-hide-descendants'
|
||||
| 'auto'
|
||||
| 'yes'
|
||||
| 'no'
|
||||
| 'no-hide-descendants'
|
||||
),
|
||||
nativeID?: ?string,
|
||||
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
|
||||
|
||||
@@ -62,7 +62,8 @@ export default class NativeEventEmitter<
|
||||
TEventToArgsMap extends Readonly<
|
||||
Record<string, ReadonlyArray<UnsafeNativeEventObject>>,
|
||||
> = Readonly<Record<string, ReadonlyArray<UnsafeNativeEventObject>>>,
|
||||
> implements IEventEmitter<TEventToArgsMap> {
|
||||
> implements IEventEmitter<TEventToArgsMap>
|
||||
{
|
||||
_nativeModule: ?NativeModule;
|
||||
|
||||
/**
|
||||
|
||||
+2
-1
@@ -20,7 +20,8 @@ import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter';
|
||||
*/
|
||||
export default class NativeEventEmitter<
|
||||
TEventToArgsMap extends Readonly<Record<string, ReadonlyArray<unknown>>>,
|
||||
> implements IEventEmitter<TEventToArgsMap> {
|
||||
> implements IEventEmitter<TEventToArgsMap>
|
||||
{
|
||||
addListener<TEvent extends keyof TEventToArgsMap>(
|
||||
eventType: TEvent,
|
||||
listener: (...args: TEventToArgsMap[TEvent]) => unknown,
|
||||
|
||||
+3
-1
@@ -85,7 +85,9 @@ export interface ImageURISource {
|
||||
export type ImageRequireSource = number;
|
||||
|
||||
export type ImageSource =
|
||||
ImageRequireSource | ImageURISource | ReadonlyArray<ImageURISource>;
|
||||
| ImageRequireSource
|
||||
| ImageURISource
|
||||
| ReadonlyArray<ImageURISource>;
|
||||
|
||||
type ImageSourceProperties = {
|
||||
body?: ?string,
|
||||
|
||||
+4
-1
@@ -117,7 +117,10 @@ export type ModalPropsIOS = {
|
||||
* @platform ios
|
||||
*/
|
||||
presentationStyle?: ?(
|
||||
'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen'
|
||||
| 'fullScreen'
|
||||
| 'pageSheet'
|
||||
| 'formSheet'
|
||||
| 'overFullScreen'
|
||||
),
|
||||
|
||||
/**
|
||||
|
||||
+13
-6
@@ -34,7 +34,12 @@ const DEBUG_NETWORK_SEND_DELAY: false = false; // Set to a number of millisecond
|
||||
|
||||
export type NativeResponseType = 'base64' | 'blob' | 'text';
|
||||
export type ResponseType =
|
||||
'' | 'arraybuffer' | 'blob' | 'document' | 'json' | 'text';
|
||||
| ''
|
||||
| 'arraybuffer'
|
||||
| 'blob'
|
||||
| 'document'
|
||||
| 'json'
|
||||
| 'text';
|
||||
export type Response = ?Object | string;
|
||||
|
||||
type XHRInterceptor = interface {
|
||||
@@ -653,11 +658,13 @@ class XMLHttpRequest extends EventTarget {
|
||||
}
|
||||
// only call onreadystatechange if there is something to abort,
|
||||
// below logic is per spec
|
||||
if (!(
|
||||
this.readyState === this.UNSENT ||
|
||||
(this.readyState === this.OPENED && !this._sent) ||
|
||||
this.readyState === this.DONE
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
this.readyState === this.UNSENT ||
|
||||
(this.readyState === this.OPENED && !this._sent) ||
|
||||
this.readyState === this.DONE
|
||||
)
|
||||
) {
|
||||
this._reset();
|
||||
this.setReadyState(this.DONE);
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ let isEnabled = false;
|
||||
if (Platform.OS === 'web') {
|
||||
const canUseDOM = Boolean(
|
||||
typeof window !== 'undefined' &&
|
||||
window.document &&
|
||||
// $FlowFixMe[method-unbinding]
|
||||
window.document.createElement,
|
||||
window.document &&
|
||||
// $FlowFixMe[method-unbinding]
|
||||
window.document.createElement,
|
||||
);
|
||||
|
||||
if (canUseDOM) {
|
||||
|
||||
@@ -540,7 +540,12 @@ type ____LayoutStyle_Internal = Readonly<{
|
||||
* for more details.
|
||||
*/
|
||||
alignSelf?:
|
||||
'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline',
|
||||
| 'auto'
|
||||
| 'flex-start'
|
||||
| 'flex-end'
|
||||
| 'center'
|
||||
| 'stretch'
|
||||
| 'baseline',
|
||||
|
||||
/** `alignContent` controls how rows align in the cross direction,
|
||||
* overriding the `alignContent` of the parent.
|
||||
@@ -731,7 +736,10 @@ type LinearGradientValue = {
|
||||
};
|
||||
|
||||
type RadialExtent =
|
||||
'closest-corner' | 'closest-side' | 'farthest-corner' | 'farthest-side';
|
||||
| 'closest-corner'
|
||||
| 'closest-side'
|
||||
| 'farthest-corner'
|
||||
| 'farthest-side';
|
||||
export type RadialGradientPosition =
|
||||
| {
|
||||
top: number | string,
|
||||
@@ -777,7 +785,10 @@ export type BackgroundSizeValue = {
|
||||
};
|
||||
|
||||
export type BackgroundRepeatKeyword =
|
||||
'repeat' | 'space' | 'round' | 'no-repeat';
|
||||
| 'repeat'
|
||||
| 'space'
|
||||
| 'round'
|
||||
| 'no-repeat';
|
||||
|
||||
export type BackgroundPositionValue =
|
||||
| {
|
||||
@@ -895,7 +906,8 @@ export type ____ViewStyle_InternalBase = Readonly<{
|
||||
experimental_backgroundImage?: ReadonlyArray<BackgroundImageValue> | string,
|
||||
experimental_backgroundSize?: ReadonlyArray<BackgroundSizeValue> | string,
|
||||
experimental_backgroundPosition?:
|
||||
ReadonlyArray<BackgroundPositionValue> | string,
|
||||
| ReadonlyArray<BackgroundPositionValue>
|
||||
| string,
|
||||
experimental_backgroundRepeat?: ReadonlyArray<BackgroundRepeatValue> | string,
|
||||
isolation?: 'auto' | 'isolate',
|
||||
}>;
|
||||
@@ -1020,11 +1032,20 @@ type ____TextStyle_InternalBase = Readonly<{
|
||||
letterSpacing?: number,
|
||||
lineHeight?: number,
|
||||
textAlign?:
|
||||
'auto' | 'left' | 'right' | 'center' | 'justify' | 'start' | 'end',
|
||||
| 'auto'
|
||||
| 'left'
|
||||
| 'right'
|
||||
| 'center'
|
||||
| 'justify'
|
||||
| 'start'
|
||||
| 'end',
|
||||
textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center',
|
||||
includeFontPadding?: boolean,
|
||||
textDecorationLine?:
|
||||
'none' | 'underline' | 'line-through' | 'underline line-through',
|
||||
| 'none'
|
||||
| 'underline'
|
||||
| 'line-through'
|
||||
| 'underline line-through',
|
||||
textDecorationStyle?: 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy',
|
||||
textDecorationColor?: ____ColorValue_Internal,
|
||||
textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase',
|
||||
@@ -1072,7 +1093,12 @@ export type ____DangerouslyImpreciseStyle_Internal = Readonly<{
|
||||
}>;
|
||||
|
||||
export type StyleProp<out T> =
|
||||
null | void | T | false | '' | ReadonlyArray<StyleProp<T>>;
|
||||
| null
|
||||
| void
|
||||
| T
|
||||
| false
|
||||
| ''
|
||||
| ReadonlyArray<StyleProp<T>>;
|
||||
|
||||
export type ____DangerouslyImpreciseStyleProp_Internal = StyleProp<
|
||||
Partial<____DangerouslyImpreciseStyle_Internal>,
|
||||
|
||||
@@ -74,7 +74,8 @@ export type ____TransformStyle_Internal = Readonly<{
|
||||
// TODO: what is the actual type it expects?
|
||||
| {
|
||||
readonly matrix:
|
||||
ReadonlyArray<number | AnimatedNode> | AnimatedNode,
|
||||
| ReadonlyArray<number | AnimatedNode>
|
||||
| AnimatedNode,
|
||||
},
|
||||
>,
|
||||
>,
|
||||
@@ -93,5 +94,6 @@ export type ____TransformStyle_Internal = Readonly<{
|
||||
* E.g. transformOrigin: '30% 80% 15px'
|
||||
*/
|
||||
transformOrigin?:
|
||||
[string | number, string | number, string | number] | string,
|
||||
| [string | number, string | number, string | number]
|
||||
| string,
|
||||
}>;
|
||||
@@ -39,7 +39,8 @@ const LINEAR_GRADIENT_DEFAULT_DIRECTION: LinearGradientDirection = {
|
||||
};
|
||||
|
||||
type LinearGradientDirection =
|
||||
{type: 'angle', value: number} | {type: 'keyword', value: string};
|
||||
| {type: 'angle', value: number}
|
||||
| {type: 'keyword', value: string};
|
||||
|
||||
type LinearGradientBackgroundImage = {
|
||||
type: 'linear-gradient',
|
||||
@@ -76,7 +77,8 @@ type ColorStopColor = ProcessedColorValue | null;
|
||||
type ColorStopPosition = number | string | null;
|
||||
|
||||
type ParsedBackgroundImageValue =
|
||||
LinearGradientBackgroundImage | RadialGradientBackgroundImage;
|
||||
| LinearGradientBackgroundImage
|
||||
| RadialGradientBackgroundImage;
|
||||
|
||||
export default function processBackgroundImage(
|
||||
backgroundImage: ?(ReadonlyArray<BackgroundImageValue> | string),
|
||||
|
||||
+11
-2
@@ -9,7 +9,12 @@
|
||||
*/
|
||||
|
||||
export type PlatformOSType =
|
||||
'ios' | 'android' | 'macos' | 'windows' | 'web' | 'native';
|
||||
| 'ios'
|
||||
| 'android'
|
||||
| 'macos'
|
||||
| 'windows'
|
||||
| 'web'
|
||||
| 'native';
|
||||
|
||||
type OptionalPlatformSelectSpec<T> = {
|
||||
[key in PlatformOSType]?: T, // eslint-disable-line no-unused-vars
|
||||
@@ -254,4 +259,8 @@ type WebPlatform = {
|
||||
};
|
||||
|
||||
export type PlatformType =
|
||||
IOSPlatform | AndroidPlatform | WindowsPlatform | MacOSPlatform | WebPlatform;
|
||||
| IOSPlatform
|
||||
| AndroidPlatform
|
||||
| WindowsPlatform
|
||||
| MacOSPlatform
|
||||
| WebPlatform;
|
||||
@@ -22,7 +22,8 @@ import {useEffect, useState} from 'react';
|
||||
* @see https://reactnative.dev/docs/usewindowdimensions
|
||||
*/
|
||||
export default function useWindowDimensions():
|
||||
DisplayMetrics | DisplayMetricsAndroid {
|
||||
| DisplayMetrics
|
||||
| DisplayMetricsAndroid {
|
||||
const [dimensions, setDimensions] = useState(() => Dimensions.get('window'));
|
||||
useEffect(() => {
|
||||
function handleChange({
|
||||
|
||||
@@ -81,6 +81,7 @@ declare var console: {
|
||||
|
||||
// Stack tagging
|
||||
createTask(label: string): ConsoleTask,
|
||||
|
||||
...
|
||||
};
|
||||
|
||||
@@ -514,7 +515,9 @@ declare class XMLHttpRequestEventTarget extends EventTarget {
|
||||
// this part of spec is not finished yet, apparently
|
||||
// https://stackoverflow.com/questions/35296664/can-fetch-get-object-as-headers
|
||||
type HeadersInit =
|
||||
Headers | Array<[string, string]> | {[key: string]: string, ...};
|
||||
| Headers
|
||||
| Array<[string, string]>
|
||||
| {[key: string]: string, ...};
|
||||
|
||||
// TODO Heades and URLSearchParams are almost the same thing.
|
||||
// Could it somehow be abstracted away?
|
||||
@@ -596,7 +599,12 @@ type ReferrerPolicyType =
|
||||
| 'unsafe-url';
|
||||
|
||||
type ResponseType =
|
||||
'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
|
||||
| 'basic'
|
||||
| 'cors'
|
||||
| 'default'
|
||||
| 'error'
|
||||
| 'opaque'
|
||||
| 'opaqueredirect';
|
||||
|
||||
type BodyInit =
|
||||
| string
|
||||
|
||||
@@ -409,7 +409,10 @@ type AnimationPlayState = 'idle' | 'running' | 'paused' | 'finished';
|
||||
type AnimationReplaceState = 'active' | 'removed' | 'persisted';
|
||||
type FillMode = 'none' | 'forwards' | 'backwards' | 'both' | 'auto';
|
||||
type PlaybackDirection =
|
||||
'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
|
||||
| 'normal'
|
||||
| 'reverse'
|
||||
| 'alternate'
|
||||
| 'alternate-reverse';
|
||||
type IterationCompositeOperation = 'replace' | 'accumulate';
|
||||
type CompositeOperation = 'replace' | 'add' | 'accumulate';
|
||||
type CompositeOperationOrAuto = CompositeOperation | 'auto';
|
||||
@@ -478,7 +481,12 @@ type PropertyIndexedKeyframes = {
|
||||
easing?: string | string[],
|
||||
offset?: number | (number | null)[],
|
||||
[property: string]:
|
||||
string | string[] | number | null | (number | null)[] | void,
|
||||
| string
|
||||
| string[]
|
||||
| number
|
||||
| null
|
||||
| (number | null)[]
|
||||
| void,
|
||||
...
|
||||
};
|
||||
|
||||
|
||||
@@ -172,52 +172,68 @@ type EventHandler = (event: Event) => unknown;
|
||||
type EventListener = {handleEvent: EventHandler, ...} | EventHandler;
|
||||
type MouseEventHandler = (event: MouseEvent) => unknown;
|
||||
type MouseEventListener =
|
||||
{handleEvent: MouseEventHandler, ...} | MouseEventHandler;
|
||||
| {handleEvent: MouseEventHandler, ...}
|
||||
| MouseEventHandler;
|
||||
type FocusEventHandler = (event: FocusEvent) => unknown;
|
||||
type FocusEventListener =
|
||||
{handleEvent: FocusEventHandler, ...} | FocusEventHandler;
|
||||
| {handleEvent: FocusEventHandler, ...}
|
||||
| FocusEventHandler;
|
||||
type KeyboardEventHandler = (event: KeyboardEvent) => unknown;
|
||||
type KeyboardEventListener =
|
||||
{handleEvent: KeyboardEventHandler, ...} | KeyboardEventHandler;
|
||||
| {handleEvent: KeyboardEventHandler, ...}
|
||||
| KeyboardEventHandler;
|
||||
type InputEventHandler = (event: InputEvent) => unknown;
|
||||
type InputEventListener =
|
||||
{handleEvent: InputEventHandler, ...} | InputEventHandler;
|
||||
| {handleEvent: InputEventHandler, ...}
|
||||
| InputEventHandler;
|
||||
type TouchEventHandler = (event: TouchEvent) => unknown;
|
||||
type TouchEventListener =
|
||||
{handleEvent: TouchEventHandler, ...} | TouchEventHandler;
|
||||
| {handleEvent: TouchEventHandler, ...}
|
||||
| TouchEventHandler;
|
||||
type WheelEventHandler = (event: WheelEvent) => unknown;
|
||||
type WheelEventListener =
|
||||
{handleEvent: WheelEventHandler, ...} | WheelEventHandler;
|
||||
| {handleEvent: WheelEventHandler, ...}
|
||||
| WheelEventHandler;
|
||||
type AbortProgressEventHandler = (event: ProgressEvent) => unknown;
|
||||
type AbortProgressEventListener =
|
||||
{handleEvent: AbortProgressEventHandler, ...} | AbortProgressEventHandler;
|
||||
| {handleEvent: AbortProgressEventHandler, ...}
|
||||
| AbortProgressEventHandler;
|
||||
type ProgressEventHandler = (event: ProgressEvent) => unknown;
|
||||
type ProgressEventListener =
|
||||
{handleEvent: ProgressEventHandler, ...} | ProgressEventHandler;
|
||||
| {handleEvent: ProgressEventHandler, ...}
|
||||
| ProgressEventHandler;
|
||||
type DragEventHandler = (event: DragEvent) => unknown;
|
||||
type DragEventListener =
|
||||
{handleEvent: DragEventHandler, ...} | DragEventHandler;
|
||||
| {handleEvent: DragEventHandler, ...}
|
||||
| DragEventHandler;
|
||||
type PointerEventHandler = (event: PointerEvent) => unknown;
|
||||
type PointerEventListener =
|
||||
{handleEvent: PointerEventHandler, ...} | PointerEventHandler;
|
||||
| {handleEvent: PointerEventHandler, ...}
|
||||
| PointerEventHandler;
|
||||
type AnimationEventHandler = (event: AnimationEvent) => unknown;
|
||||
type AnimationEventListener =
|
||||
{handleEvent: AnimationEventHandler, ...} | AnimationEventHandler;
|
||||
| {handleEvent: AnimationEventHandler, ...}
|
||||
| AnimationEventHandler;
|
||||
type ClipboardEventHandler = (event: ClipboardEvent) => unknown;
|
||||
type ClipboardEventListener =
|
||||
{handleEvent: ClipboardEventHandler, ...} | ClipboardEventHandler;
|
||||
| {handleEvent: ClipboardEventHandler, ...}
|
||||
| ClipboardEventHandler;
|
||||
type TransitionEventHandler = (event: TransitionEvent) => unknown;
|
||||
type TransitionEventListener =
|
||||
{handleEvent: TransitionEventHandler, ...} | TransitionEventHandler;
|
||||
| {handleEvent: TransitionEventHandler, ...}
|
||||
| TransitionEventHandler;
|
||||
type MessageEventHandler = (event: MessageEvent) => unknown;
|
||||
type MessageEventListener =
|
||||
{handleEvent: MessageEventHandler, ...} | MessageEventHandler;
|
||||
| {handleEvent: MessageEventHandler, ...}
|
||||
| MessageEventHandler;
|
||||
type BeforeUnloadEventHandler = (event: BeforeUnloadEvent) => unknown;
|
||||
type BeforeUnloadEventListener =
|
||||
{handleEvent: BeforeUnloadEventHandler, ...} | BeforeUnloadEventHandler;
|
||||
| {handleEvent: BeforeUnloadEventHandler, ...}
|
||||
| BeforeUnloadEventHandler;
|
||||
type StorageEventHandler = (event: StorageEvent) => unknown;
|
||||
type StorageEventListener =
|
||||
{handleEvent: StorageEventHandler, ...} | StorageEventHandler;
|
||||
| {handleEvent: StorageEventHandler, ...}
|
||||
| StorageEventHandler;
|
||||
type SecurityPolicyViolationEventHandler = (
|
||||
event: SecurityPolicyViolationEvent,
|
||||
) => unknown;
|
||||
@@ -226,7 +242,8 @@ type SecurityPolicyViolationEventListener =
|
||||
| SecurityPolicyViolationEventHandler;
|
||||
type USBConnectionEventHandler = (event: USBConnectionEvent) => unknown;
|
||||
type USBConnectionEventListener =
|
||||
{handleEvent: USBConnectionEventHandler, ...} | USBConnectionEventHandler;
|
||||
| {handleEvent: USBConnectionEventHandler, ...}
|
||||
| USBConnectionEventHandler;
|
||||
|
||||
type MediaKeySessionType = 'temporary' | 'persistent-license';
|
||||
type MediaKeyStatus =
|
||||
@@ -255,7 +272,13 @@ type TouchEventTypes = 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';
|
||||
type WheelEventTypes = 'wheel';
|
||||
type AbortProgressEventTypes = 'abort';
|
||||
type ProgressEventTypes =
|
||||
'abort' | 'error' | 'load' | 'loadend' | 'loadstart' | 'progress' | 'timeout';
|
||||
| 'abort'
|
||||
| 'error'
|
||||
| 'load'
|
||||
| 'loadend'
|
||||
| 'loadstart'
|
||||
| 'progress'
|
||||
| 'timeout';
|
||||
type DragEventTypes =
|
||||
| 'drag'
|
||||
| 'dragend'
|
||||
@@ -277,10 +300,15 @@ type PointerEventTypes =
|
||||
| 'gotpointercapture'
|
||||
| 'lostpointercapture';
|
||||
type AnimationEventTypes =
|
||||
'animationstart' | 'animationend' | 'animationiteration';
|
||||
| 'animationstart'
|
||||
| 'animationend'
|
||||
| 'animationiteration';
|
||||
type ClipboardEventTypes = 'clipboardchange' | 'cut' | 'copy' | 'paste';
|
||||
type TransitionEventTypes =
|
||||
'transitionrun' | 'transitionstart' | 'transitionend' | 'transitioncancel';
|
||||
| 'transitionrun'
|
||||
| 'transitionstart'
|
||||
| 'transitionend'
|
||||
| 'transitioncancel';
|
||||
type MessageEventTypes = string;
|
||||
type BeforeUnloadEventTypes = 'beforeunload';
|
||||
type StorageEventTypes = 'storage';
|
||||
@@ -6023,7 +6051,8 @@ type NodeFilterCallback = (
|
||||
| typeof NodeFilter.FILTER_SKIP;
|
||||
|
||||
type NodeFilterInterface =
|
||||
NodeFilterCallback | {acceptNode: NodeFilterCallback, ...};
|
||||
| NodeFilterCallback
|
||||
| {acceptNode: NodeFilterCallback, ...};
|
||||
|
||||
// TODO: window.NodeFilter exists at runtime and behaves as a constructor
|
||||
// as far as `instanceof` is concerned, but it is not callable.
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ const {composeSourceMaps} = require('metro-source-map');
|
||||
|
||||
const argv = process.argv.slice(2);
|
||||
let outputPath;
|
||||
for (let i = 0; i < argv.length;) {
|
||||
for (let i = 0; i < argv.length; ) {
|
||||
if (argv[i] === '-o') {
|
||||
outputPath = argv[i + 1];
|
||||
argv.splice(i, 2);
|
||||
|
||||
+4
-1
@@ -23,7 +23,10 @@ export type FeatureFlagDefinitions = Readonly<{
|
||||
* - stable: the value of the feature flag will be `expectedReleaseValue` on all releases.
|
||||
*/
|
||||
export type OSSReleaseStageValue =
|
||||
'none' | 'experimental' | 'canary' | 'stable';
|
||||
| 'none'
|
||||
| 'experimental'
|
||||
| 'canary'
|
||||
| 'stable';
|
||||
|
||||
export type CommonFeatureFlagConfig<
|
||||
TValue extends FeatureFlagValue = FeatureFlagValue,
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ export interface Spec extends TurboModule {
|
||||
};
|
||||
readonly findPseudoElementShadowNodeByTag: (
|
||||
reactTag: number,
|
||||
) => ?unknown; /* Node */
|
||||
) => ?unknown /* Node */;
|
||||
readonly waitForTransitionAnimation: (animationId: number) => void;
|
||||
readonly transitionAnimationFinished: (animationId: number) => void;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ export opaque type NativeElementReference = ShadowNode;
|
||||
export opaque type NativeTextReference = ShadowNode;
|
||||
|
||||
export type NativeNodeReference =
|
||||
NativeElementReference | NativeTextReference | RootTag;
|
||||
| NativeElementReference
|
||||
| NativeTextReference
|
||||
| RootTag;
|
||||
|
||||
export type MeasureInWindowOnSuccessCallback = (
|
||||
x: number,
|
||||
@@ -56,16 +58,16 @@ export interface Spec extends TurboModule {
|
||||
|
||||
readonly getChildNodes: (
|
||||
nativeNodeReference: unknown /* NativeNodeReference */,
|
||||
) => ReadonlyArray<unknown>; /* $ReadOnlyArray<InstanceHandle> */
|
||||
) => ReadonlyArray<unknown> /* $ReadOnlyArray<InstanceHandle> */;
|
||||
|
||||
readonly getElementById?: (
|
||||
nativeNodeReference: unknown /* NativeNodeReference */,
|
||||
id: string,
|
||||
) => unknown; /* ?InstanceHandle */
|
||||
) => unknown /* ?InstanceHandle */;
|
||||
|
||||
readonly getParentNode: (
|
||||
nativeNodeReference: unknown /* NativeNodeReference */,
|
||||
) => unknown; /* ?InstanceHandle */
|
||||
) => unknown /* ?InstanceHandle */;
|
||||
|
||||
readonly isConnected: (
|
||||
nativeNodeReference: unknown /* NativeNodeReference */,
|
||||
@@ -77,24 +79,24 @@ export interface Spec extends TurboModule {
|
||||
|
||||
readonly getBorderWidth: (
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => ReadonlyArray<number>; /* [topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number] */
|
||||
) => ReadonlyArray<number> /* [topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number] */;
|
||||
|
||||
readonly getBoundingClientRect: (
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
includeTransform: boolean,
|
||||
) => ReadonlyArray<number>; /* [x: number, y: number, width: number, height: number] */
|
||||
) => ReadonlyArray<number> /* [x: number, y: number, width: number, height: number] */;
|
||||
|
||||
readonly getInnerSize: (
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => ReadonlyArray<number>; /* [width: number, height: number] */
|
||||
) => ReadonlyArray<number> /* [width: number, height: number] */;
|
||||
|
||||
readonly getScrollPosition: (
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => ReadonlyArray<number>; /* [scrollLeft: number, scrollTop: number] */
|
||||
) => ReadonlyArray<number> /* [scrollLeft: number, scrollTop: number] */;
|
||||
|
||||
readonly getScrollSize: (
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => ReadonlyArray<number>; /* [scrollWidth: number, scrollHeight: number] */
|
||||
) => ReadonlyArray<number> /* [scrollWidth: number, scrollHeight: number] */;
|
||||
|
||||
readonly getTagName: (
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
@@ -125,7 +127,7 @@ export interface Spec extends TurboModule {
|
||||
|
||||
readonly getOffset: (
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => ReadonlyArray<unknown>; /* [offsetParent: ?InstanceHandle, top: number, left: number] */
|
||||
) => ReadonlyArray<unknown> /* [offsetParent: ?InstanceHandle, top: number, left: number] */;
|
||||
|
||||
/*
|
||||
* Special methods to handle the root node.
|
||||
@@ -134,7 +136,7 @@ export interface Spec extends TurboModule {
|
||||
readonly linkRootNode?: (
|
||||
rootTag: number /* RootTag */,
|
||||
instanceHandle: unknown /* InstanceHandle */,
|
||||
) => unknown; /* ?NativeElementReference */
|
||||
) => unknown /* ?NativeElementReference */;
|
||||
|
||||
/**
|
||||
* Legacy layout APIs (for `ReactNativeElement`).
|
||||
|
||||
+8
-6
@@ -38,12 +38,14 @@ export function expectRectEquals(
|
||||
expected: {x: number, y: number, width: number, height: number},
|
||||
): boolean {
|
||||
const {x, y, width, height} = expected;
|
||||
if (!(
|
||||
rect.x === x &&
|
||||
rect.y === y &&
|
||||
rect.width === width &&
|
||||
rect.height === height
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
rect.x === x &&
|
||||
rect.y === y &&
|
||||
rect.width === width &&
|
||||
rect.height === height
|
||||
)
|
||||
) {
|
||||
const received = {
|
||||
x: rect.x,
|
||||
y: rect.y,
|
||||
|
||||
@@ -14,7 +14,11 @@ import {setPlatformObject} from '../webidl/PlatformObjects';
|
||||
|
||||
export type DOMHighResTimeStamp = number;
|
||||
export type PerformanceEntryType =
|
||||
'mark' | 'measure' | 'event' | 'longtask' | 'resource';
|
||||
| 'mark'
|
||||
| 'measure'
|
||||
| 'event'
|
||||
| 'longtask'
|
||||
| 'resource';
|
||||
|
||||
export type PerformanceEntryJSON = {
|
||||
name: string,
|
||||
|
||||
+2
-1
@@ -25,7 +25,8 @@ export type FailingPlatformTestAssertionResult = Readonly<{
|
||||
}>;
|
||||
|
||||
export type PlatformTestAssertionResult =
|
||||
PassingPlatformTestAssertionResult | FailingPlatformTestAssertionResult;
|
||||
| PassingPlatformTestAssertionResult
|
||||
| FailingPlatformTestAssertionResult;
|
||||
|
||||
export type PlatformTestResultStatus = 'PASS' | 'FAIL' | 'ERROR' | 'SKIPPED';
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ const TextInputForm = () => {
|
||||
|
||||
const CloseButton = (
|
||||
props:
|
||||
{behavior: any, setModalOpen: any} | {behavior: string, setModalOpen: any},
|
||||
| {behavior: any, setModalOpen: any}
|
||||
| {behavior: string, setModalOpen: any},
|
||||
) => {
|
||||
return (
|
||||
<View
|
||||
|
||||
@@ -219,15 +219,17 @@ export function computeWindowedRenderLimits(
|
||||
last++;
|
||||
}
|
||||
}
|
||||
if (!(
|
||||
last >= first &&
|
||||
first >= 0 &&
|
||||
last < itemCount &&
|
||||
first >= overscanFirst &&
|
||||
last <= overscanLast &&
|
||||
first <= visible.first &&
|
||||
last >= visible.last
|
||||
)) {
|
||||
if (
|
||||
!(
|
||||
last >= first &&
|
||||
first >= 0 &&
|
||||
last < itemCount &&
|
||||
first >= overscanFirst &&
|
||||
last <= overscanLast &&
|
||||
first <= visible.first &&
|
||||
last >= visible.last
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
'Bad window calculation ' +
|
||||
JSON.stringify({
|
||||
|
||||
@@ -1973,9 +1973,9 @@ class VirtualizedList extends StateSafePureComponent<
|
||||
// Keep a viewport's worth of content around the last focused cell to allow
|
||||
// random navigation around it without any blanking. E.g. tabbing from one
|
||||
// focused item out of viewport to another.
|
||||
if (!(
|
||||
this._lastFocusedCellKey && this._cellRefs[this._lastFocusedCellKey]
|
||||
)) {
|
||||
if (
|
||||
!(this._lastFocusedCellKey && this._cellRefs[this._lastFocusedCellKey])
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
@@ -131,8 +131,10 @@ type State = {childProps: VirtualizedListProps, ...};
|
||||
*/
|
||||
class VirtualizedSectionList<
|
||||
ItemT,
|
||||
SectionT extends SectionBase<ItemT, DefaultVirtualizedSectionT> =
|
||||
SectionT extends SectionBase<
|
||||
ItemT,
|
||||
DefaultVirtualizedSectionT,
|
||||
> = DefaultVirtualizedSectionT,
|
||||
> extends React.PureComponent<
|
||||
VirtualizedSectionListProps<ItemT, SectionT>,
|
||||
State,
|
||||
@@ -641,8 +643,10 @@ function ItemWithSeparator<ItemT>(
|
||||
|
||||
const VirtualizedSectionListComponent = VirtualizedSectionList as component<
|
||||
ItemT,
|
||||
SectionT extends SectionBase<ItemT, DefaultVirtualizedSectionT> =
|
||||
SectionT extends SectionBase<
|
||||
ItemT,
|
||||
DefaultVirtualizedSectionT,
|
||||
> = DefaultVirtualizedSectionT,
|
||||
>(
|
||||
ref?: React.RefSetter<
|
||||
interface {
|
||||
|
||||
+2
-1
@@ -61,7 +61,8 @@ type SuiteResults = Array<Readonly<TaskResult>>;
|
||||
type TestWithArgName<TestArgType> = string | ((testArg: TestArgType) => string);
|
||||
|
||||
type TestWithArgOptions<TestArgType> =
|
||||
FnOptions | ((testArg: TestArgType) => FnOptions);
|
||||
| FnOptions
|
||||
| ((testArg: TestArgType) => FnOptions);
|
||||
|
||||
interface ParameterizedTestFunction {
|
||||
<TestArgType>(
|
||||
|
||||
Reference in new issue
Block a user