This commit is contained in:
Zihan Chen 2019-08-05 23:33:11 -07:00
Родитель f02c741c4f
Коммит 15ed645f34
48 изменённых файлов: 772 добавлений и 732 удалений

Просмотреть файл

@ -1,7 +1,7 @@
# Sub module to https://github.com/facebook/react-native
- `git submodule add <url>`
- `git submouule init`
- `git submodule init`
- `git submodule update`
- `git fetch` / `git merge origin/master` in `react-native` folder

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,21 +12,20 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
const codegenNativeCommands = require('codegenNativeCommands');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import codegenNativeCommands = require('../lib/codegenNativeCommands');
import type {
import {
Int32,
BubblingEvent,
DirectEvent,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props
|}>;
}>;
export const Commands = codegenNativeCommands<{
+hotspotUpdate: (ref: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,25 +12,24 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
const codegenNativeCommands = require('codegenNativeCommands');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import codegenNativeCommands = require('../lib/codegenNativeCommands');
import type {
import {
Int32,
BubblingEvent,
DirectEvent,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
interface NativeCommands {
+hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props or events
|}>;
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate']

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,26 +12,25 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
const codegenNativeCommands = require('codegenNativeCommands');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import codegenNativeCommands = require('../lib/codegenNativeCommands');
import type {
import {
Int32,
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
interface NativeCommands {
+hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
+scrollTo: (viewRef: React.Ref<'RCTView'>, y: Int32, animated: boolean) => void;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props or events
|}>;
}>;
export const Commands = codegenNativeCommands<NativeCommands>();

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,25 +12,24 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
const codegenNativeCommands = require('codegenNativeCommands');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import codegenNativeCommands = require('../lib/codegenNativeCommands');
import type {
import {
Int32,
BubblingEvent,
DirectEvent,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
interface NativeCommands {
+hotspotUpdate: (x: Int32, y: Int32) => void;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props or events
|}>;
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate']

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,26 +12,25 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
const codegenNativeCommands = require('codegenNativeCommands');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import codegenNativeCommands = require('../lib/codegenNativeCommands');
import type {
import {
Int32,
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
interface NativeCommands {
+hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
+scrollTo: (viewRef: React.Ref<'RCTView'>, y: Int32, animated: boolean) => void;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props or events
|}>;
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['scrollTo']

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,25 +12,24 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
const codegenNativeCommands = require('codegenNativeCommands');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import codegenNativeCommands = require('../lib/codegenNativeCommands');
import type {
import {
Int32,
BubblingEvent,
DirectEvent,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
interface NativeCommands {
+hotspotUpdate: (viewRef: ?React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
+hotspotUpdate: (viewRef: null | undefined | React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props or events
|}>;
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate']

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,19 +12,18 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import type {
import {
WithDefault,
Float,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
export type ModuleProps = $ReadOnly<{|
...ViewProps,
required_key_with_default: WithDefault<Float, 1.0>,
|}>;
export type ModuleProps = Readonly<ViewProps & {
required_key_with_default: WithDefault<Float, 1.0>;
}>;
export default codegenNativeComponent<ModuleProps>('Module');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,19 +12,18 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import type {
import {
WithDefault,
Float,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
export type ModuleProps = $ReadOnly<{|
...ViewProps,
nullable_with_default: ?WithDefault<Float, 1.0>,
|}>;
export type ModuleProps = Readonly<ViewProps & {
nullable_with_default: null | undefined | WithDefault<Float, 1.0>;
}>;
export default codegenNativeComponent<ModuleProps>('Module');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,81 +12,80 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import type {
import {
Int32,
Float,
WithDefault,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ColorValue, ColorArrayValue, PointValue} from 'StyleSheetTypes';
import type {ImageSource} from 'ImageSource';
import type {ViewProps} from 'ViewPropTypes';
import {ColorValue, ColorArrayValue, PointValue} from '../lib/StyleSheetTypes';
import {ImageSource} from '../lib/ImageSource';
import {ViewProps} from '../lib/ViewPropTypes';
type ModuleProps = $ReadOnly<{|
...ViewProps,
type ModuleProps = Readonly<ViewProps & {
// Props
// Boolean props
boolean_required: boolean,
boolean_optional_key?: WithDefault<boolean, true>,
boolean_optional_both?: WithDefault<boolean, true>,
boolean_required: boolean;
boolean_optional_key?: WithDefault<boolean, true>;
boolean_optional_both?: WithDefault<boolean, true>;
// String props
string_required: string,
string_optional_key?: WithDefault<string, ''>,
string_optional_both?: WithDefault<string, ''>,
string_required: string;
string_optional_key?: WithDefault<string, ''>;
string_optional_both?: WithDefault<string, ''>;
// String props, null default
string_null_optional_key?: WithDefault<string, null>,
string_null_optional_both?: WithDefault<string, null>,
string_null_optional_key?: WithDefault<string, null>;
string_null_optional_both?: WithDefault<string, null>;
// Stringish props
stringish_required: Stringish,
stringish_optional_key?: WithDefault<Stringish, ''>,
stringish_optional_both?: WithDefault<Stringish, ''>,
stringish_required: Stringish;
stringish_optional_key?: WithDefault<Stringish, ''>;
stringish_optional_both?: WithDefault<Stringish, ''>;
// Stringish props, null default
stringish_null_optional_key?: WithDefault<Stringish, null>,
stringish_null_optional_both?: WithDefault<Stringish, null>,
stringish_null_optional_key?: WithDefault<Stringish, null>;
stringish_null_optional_both?: WithDefault<Stringish, null>;
// Float props
float_required: Float,
float_optional_key?: WithDefault<Float, 1.1>,
float_optional_both?: WithDefault<Float, 1.1>,
float_required: Float;
float_optional_key?: WithDefault<Float, 1.1>;
float_optional_both?: WithDefault<Float, 1.1>;
// Int32 props
int32_required: Int32,
int32_optional_key?: WithDefault<Int32, 1>,
int32_optional_both?: WithDefault<Int32, 1>,
int32_required: Int32;
int32_optional_key?: WithDefault<Int32, 1>;
int32_optional_both?: WithDefault<Int32, 1>;
// String enum props
enum_optional_key?: WithDefault<('small' | 'large'), 'small'>,
enum_optional_both?: WithDefault<('small' | 'large'), 'small'>,
enum_optional_key?: WithDefault<('small' | 'large'), 'small'>;
enum_optional_both?: WithDefault<('small' | 'large'), 'small'>;
// ImageSource props
image_required: ImageSource,
image_optional_value: ?ImageSource,
image_optional_both?: ?ImageSource,
image_required: ImageSource;
image_optional_value: null | undefined | ImageSource;
image_optional_both?: null | undefined | ImageSource;
// ColorValue props
color_required: ColorValue,
color_optional_key?: ColorValue,
color_optional_value: ?ColorValue,
color_optional_both?: ?ColorValue,
color_required: ColorValue;
color_optional_key?: ColorValue;
color_optional_value: null | undefined | ColorValue;
color_optional_both?: null | undefined | ColorValue;
// ColorArrayValue props
color_array_required: ColorArrayValue,
color_array_optional_key?: ColorArrayValue,
color_array_optional_value: ?ColorArrayValue,
color_array_optional_both?: ?ColorArrayValue,
color_array_required: ColorArrayValue;
color_array_optional_key?: ColorArrayValue;
color_array_optional_value: null | undefined | ColorArrayValue;
color_array_optional_both?: null | undefined | ColorArrayValue;
// PointValue props
point_required: PointValue,
point_optional_key?: PointValue,
point_optional_value: ?PointValue,
point_optional_both?: ?PointValue,
|}>;
point_required: PointValue;
point_optional_key?: PointValue;
point_optional_value: null | undefined | PointValue;
point_optional_both?: null | undefined | PointValue;
}>;
export default codegenNativeComponent<ModuleProps, Options>('Module');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,67 +12,66 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import type {
import {
Int32,
Float,
WithDefault,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ColorValue, PointValue} from 'StyleSheetTypes';
import type {ImageSource} from 'ImageSource';
import type {ViewProps} from 'ViewPropTypes';
import {ColorValue, PointValue} from '../lib/StyleSheetTypes';
import {ImageSource} from '../lib/ImageSource';
import {ViewProps} from '../lib/ViewPropTypes';
type ModuleProps = $ReadOnly<{|
...ViewProps,
type ModuleProps = Readonly<ViewProps & {
// Props
// Boolean props
array_boolean_required: $ReadOnlyArray<boolean>,
array_boolean_optional_key?: $ReadOnlyArray<boolean>,
array_boolean_optional_value: ?$ReadOnlyArray<boolean>,
array_boolean_optional_both?: ?$ReadOnlyArray<boolean>,
array_boolean_required: ReadonlyArray<boolean>;
array_boolean_optional_key?: ReadonlyArray<boolean>;
array_boolean_optional_value: null | undefined | ReadonlyArray<boolean>;
array_boolean_optional_both?: null | undefined | ReadonlyArray<boolean>;
// String props
array_string_required: $ReadOnlyArray<string>,
array_string_optional_key?: $ReadOnlyArray<string>,
array_string_optional_value: ?$ReadOnlyArray<string>,
array_string_optional_both?: ?$ReadOnlyArray<string>,
array_string_required: ReadonlyArray<string>;
array_string_optional_key?: ReadonlyArray<string>;
array_string_optional_value: null | undefined | ReadonlyArray<string>;
array_string_optional_both?: null | undefined | ReadonlyArray<string>;
// Float props
array_float_required: $ReadOnlyArray<Float>,
array_float_optional_key?: $ReadOnlyArray<Float>,
array_float_optional_value: ?$ReadOnlyArray<Float>,
array_float_optional_both?: ?$ReadOnlyArray<Float>,
array_float_required: ReadonlyArray<Float>;
array_float_optional_key?: ReadonlyArray<Float>;
array_float_optional_value: null | undefined | ReadonlyArray<Float>;
array_float_optional_both?: null | undefined | ReadonlyArray<Float>;
// Int32 props
array_int32_required: $ReadOnlyArray<Int32>,
array_int32_optional_key?: $ReadOnlyArray<Int32>,
array_int32_optional_value: ?$ReadOnlyArray<Int32>,
array_int32_optional_both?: ?$ReadOnlyArray<Int32>,
array_int32_required: ReadonlyArray<Int32>;
array_int32_optional_key?: ReadonlyArray<Int32>;
array_int32_optional_value: null | undefined | ReadonlyArray<Int32>;
array_int32_optional_both?: null | undefined | ReadonlyArray<Int32>;
// String enum props
array_enum_optional_key?: WithDefault<$ReadOnlyArray<('small' | 'large')>, 'small'>,
array_enum_optional_both?: WithDefault<$ReadOnlyArray<('small' | 'large')>, 'small'>,
array_enum_optional_key?: WithDefault<ReadonlyArray<('small' | 'large')>, 'small'>;
array_enum_optional_both?: WithDefault<ReadonlyArray<('small' | 'large')>, 'small'>;
// ImageSource props
array_image_required: $ReadOnlyArray<ImageSource>,
array_image_optional_key?: $ReadOnlyArray<ImageSource>,
array_image_optional_value: ?$ReadOnlyArray<ImageSource>,
array_image_optional_both?: ?$ReadOnlyArray<ImageSource>,
array_image_required: ReadonlyArray<ImageSource>;
array_image_optional_key?: ReadonlyArray<ImageSource>;
array_image_optional_value: null | undefined | ReadonlyArray<ImageSource>;
array_image_optional_both?: null | undefined | ReadonlyArray<ImageSource>;
// ColorValue props
array_color_required: $ReadOnlyArray<ColorValue>,
array_color_optional_key?: $ReadOnlyArray<ColorValue>,
array_color_optional_value: ?$ReadOnlyArray<ColorValue>,
array_color_optional_both?: ?$ReadOnlyArray<ColorValue>,
array_color_required: ReadonlyArray<ColorValue>;
array_color_optional_key?: ReadonlyArray<ColorValue>;
array_color_optional_value: null | undefined | ReadonlyArray<ColorValue>;
array_color_optional_both?: null | undefined | ReadonlyArray<ColorValue>;
// PointValue props
array_point_required: $ReadOnlyArray<PointValue>,
array_point_optional_key?: $ReadOnlyArray<PointValue>,
array_point_optional_value: ?$ReadOnlyArray<PointValue>,
array_point_optional_both?: ?$ReadOnlyArray<PointValue>,
|}>;
array_point_required: ReadonlyArray<PointValue>;
array_point_optional_key?: ReadonlyArray<PointValue>;
array_point_optional_value: null | undefined | ReadonlyArray<PointValue>;
array_point_optional_both?: null | undefined | ReadonlyArray<PointValue>;
}>;
export default codegenNativeComponent<ModuleProps>('Module');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,68 +12,68 @@
'use strict';
import type {
import {
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
export type EventInFile = $ReadOnly<{|
export type EventInFile = Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>;
}>;
export type Boolean = boolean;
export type Int = Int32;
@ -84,17 +85,16 @@ interface NativeCommands {
+scrollTo: ScrollTo;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props
// Events defined inline
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>,
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>,
onDirectEventDefinedInline: DirectEventHandler<EventInFile>,
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>,
|}>;
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>;
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>;
onDirectEventDefinedInline: DirectEventHandler<EventInFile>;
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>;
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['scrollTo']

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,26 +12,25 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
const codegenNativeCommands = require('codegenNativeCommands');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import codegenNativeCommands = require('../lib/codegenNativeCommands');
import type {
import {
Int32,
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
interface NativeCommands {
+hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
+scrollTo: (viewRef: React.Ref<'RCTView'>, y: Int32, animated: boolean) => void;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props or events
|}>;
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate', 'scrollTo']

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,16 +12,16 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
const codegenNativeCommands = require('codegenNativeCommands');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import codegenNativeCommands = require('../lib/codegenNativeCommands');
import type {
import {
Int32,
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
export type Boolean = boolean;
export type Int = Int32;
@ -32,10 +33,9 @@ interface NativeCommands {
+scrollTo: ScrollTo;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props or events
|}>;
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['scrollTo']

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,42 +12,41 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import type {
import {
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypese';
} from '../lib/CodegenTypese';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
type ModuleProps = $ReadOnly<{|
...ViewProps,
type ModuleProps = Readonly<ViewProps & {
// No props
// Events defined inline
onDirectEventDefinedInlineNull:DirectEventHandler<null>,
onDirectEventDefinedInlineNullOptionalKey?: DirectEventHandler<null>,
onDirectEventDefinedInlineNullOptionalValue: ?DirectEventHandler<null>,
onDirectEventDefinedInlineNullOptionalBoth?: DirectEventHandler<null>,
onDirectEventDefinedInlineNullWithPaperName?: ?
onDirectEventDefinedInlineNullOptionalKey?: DirectEventHandler<null>;
onDirectEventDefinedInlineNullOptionalValue: null | undefined | DirectEventHandler<null>;
onDirectEventDefinedInlineNullOptionalBoth?: DirectEventHandler<null>;
onDirectEventDefinedInlineNullWithPaperName?: null | undefined |
DirectEventHandler<
null,
null;
'paperDirectEventDefinedInlineNullWithPaperName',
>,
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
onBubblingEventDefinedInlineNullOptionalKey?: BubblingEventHandler<null>,
onBubblingEventDefinedInlineNullOptionalValue: ?BubblingEventHandler<null>,
onBubblingEventDefinedInlineNullOptionalBoth?: ?BubblingEventHandler<null>,
onBubblingEventDefinedInlineNullWithPaperName?: ?
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>;
onBubblingEventDefinedInlineNullOptionalKey?: BubblingEventHandler<null>;
onBubblingEventDefinedInlineNullOptionalValue: null | undefined | BubblingEventHandler<null>;
onBubblingEventDefinedInlineNullOptionalBoth?: null | undefined | BubblingEventHandler<null>;
onBubblingEventDefinedInlineNullWithPaperName?: null | undefined |
BubblingEventHandler<
null,
null;
'paperBubblingEventDefinedInlineNullWithPaperName',
>,
|}>;
}>;
export default codegenNativeComponent<ModuleProps>('Module');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,594 +12,593 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import type {
import {
Int32,
Float,
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
type ModuleProps = $ReadOnly<{|
...ViewProps,
type ModuleProps = Readonly<ViewProps & {
// No Props
// Events
onDirectEventDefinedInline:
DirectEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
>,
onDirectEventDefinedInlineOptionalKey?:
DirectEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
>,
onDirectEventDefinedInlineOptionalValue: ?
onDirectEventDefinedInlineOptionalValue: null | undefined |
DirectEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
>,
onDirectEventDefinedInlineOptionalBoth?: ?
onDirectEventDefinedInlineOptionalBoth?: null | undefined |
DirectEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
>,
onDirectEventDefinedInlineWithPaperName?: ?
onDirectEventDefinedInlineWithPaperName?: null | undefined |
DirectEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
'paperDirectEventDefinedInlineWithPaperName',
>,
onBubblingEventDefinedInline:
BubblingEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
>,
onBubblingEventDefinedInlineOptionalKey?:
BubblingEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
>,
onBubblingEventDefinedInlineOptionalValue: ?
onBubblingEventDefinedInlineOptionalValue: null | undefined |
BubblingEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
>,
onBubblingEventDefinedInlineOptionalBoth?: ?
onBubblingEventDefinedInlineOptionalBoth?: null | undefined |
BubblingEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
>,
onBubblingEventDefinedInlineWithPaperName?: ?
onBubblingEventDefinedInlineWithPaperName?: null | undefined |
BubblingEventHandler<
$ReadOnly<{|
Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>,
}>;
'paperBubblingEventDefinedInlineWithPaperName'
>,
|}>;
}>;
export default codegenNativeComponent<ModuleProps>('Module');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,14 +12,13 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
type ModuleProps = $ReadOnly<{|
...ViewProps,
|}>;
type ModuleProps = Readonly<ViewProps & {
}>;
export default codegenNativeComponent<ModuleProps>('Module', {
deprecatedViewConfigName: 'DeprecateModuleName',
deprecatedViewConfigName: 'DeprecateModuleName';
});

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,28 +12,27 @@
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
import type {
import {
BubblingEventHandler,
DirectEventHandler,
WithDefault,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
type ModuleProps = $ReadOnly<{|
...ViewProps,
type ModuleProps = Readonly<ViewProps & {
// Props
boolean_default_true_optional_both?: WithDefault<boolean, true>,
boolean_default_true_optional_both?: WithDefault<boolean, true>;
// Events
onDirectEventDefinedInlineNull: DirectEventHandler<null>,
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
|}>;
onDirectEventDefinedInlineNull: DirectEventHandler<null>;
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>;
}>;
export default codegenNativeComponent<ModuleProps>('Module', {
interfaceOnly: true,
paperComponentName: 'RCTModule',
interfaceOnly: true;
paperComponentName: 'RCTModule';
});

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,79 +12,78 @@
'use strict';
import type {
import {
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
} from '../lib/CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import {ViewProps} from '../lib/ViewPropTypes';
const codegenNativeComponent = require('codegenNativeComponent');
import codegenNativeComponent = require('../lib/codegenNativeComponent');
export type EventInFile = $ReadOnly<{|
export type EventInFile = Readonly<{
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: null | undefined | boolean;
boolean_optional_both?: null | undefined | boolean;
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
string_required: string;
string_optional_key?: string;
string_optional_value: null | undefined | string;
string_optional_both?: null | undefined | string;
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
float_required: Float;
float_optional_key?: Float;
float_optional_value: null | undefined | Float;
float_optional_both?: null | undefined | Float;
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: null | undefined | Int32;
int32_optional_both?: null | undefined | Int32;
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: null | undefined | ('small' | 'large');
enum_optional_both?: null | undefined | ('small' | 'large');
object_required: {
boolean_required: boolean,
boolean_required: boolean;
}
object_optional_key?: {
string_optional_key?: string,
string_optional_key?: string;
}
object_optional_value: ?{
float_optional_value: ?Float,
object_optional_value: null | undefined | {
float_optional_value: null | undefined | Float;
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
object_optional_both?: null | undefined | {
int32_optional_both?: null | undefined | Int32;
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
object_optional_nested_1_layer?: null | undefined | {
boolean_required: Int32;
string_optional_key?: string;
float_optional_value: null | undefined | Float;
int32_optional_both?: null | undefined | Int32;
}
}
|}>;
}>;
export type ModuleProps = $ReadOnly<{|
...ViewProps,
export type ModuleProps = Readonly<ViewProps & {
// No props
// Events defined inline
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>,
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>,
onDirectEventDefinedInline: DirectEventHandler<EventInFile>,
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>,
|}>;
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>;
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>;
onDirectEventDefinedInline: DirectEventHandler<EventInFile>;
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>;
}>;
export default codegenNativeComponent<ModuleProps>('Module');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -12,11 +13,11 @@
'use strict';
export type String = string;
export type AnotherArray = $ReadOnlyArray<String>;
export type AnotherArray = ReadonlyArray<String>;
export type ModuleProps = $ReadOnly<{|
disable: String,
array: AnotherArray,
|}>;
export type ModuleProps = Readonly<{
disable: String;
array: AnotherArray;
}>;
export default codegenNativeComponent<ModuleProps>('Module');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
getString: (arg: string) => Array;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
getString: (arg : Array) => string;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
getString: (arg: NotString) => string;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
getString: (arg: NotString) => string;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,14 +12,14 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getBool: (arg: boolean) => boolean;
+getNumber: (arg: number) => number;
+getString: (arg: string) => string;
sampleBool: boolean,
sampleBool: boolean;
}

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getBool: (arg: boolean) => Promise;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,15 +12,15 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getSth(a : ?number) => void
+getSth(a : null | undefined | number) => void
}
export interface Spec2 extends TurboModule {
+getSth(a : ?number) => void
+getSth(a : null | undefined | number) => void
}

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export default TurboModuleRegistry.getEnforcing<Spec1>('SampleTurboModule1');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
// mo methods

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export type SomeString = string;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getArray: (arg: Array<[string, string]>) => Array<string | number | boolean>;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getArray: (arg: Array<string>) => Array<string>;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
+passBool?: (arg: boolean) => void;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
// Exported methods.

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getArray: (arg: Array<Array<Array<Array<Array<any>>>>>) => Array<Array<Array<string>>>;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,20 +12,20 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export type String = string
export interface Spec extends TurboModule {
// Exported methods.
+getObject: (arg: {|const1: {|const1: boolean|}|}) => {|
const1: {|const1: boolean|},
|};
+getObject: (arg: {const1: {const1: boolean}}) => {
const1: {const1: boolean};
};
+getObject2: (arg: { a: String }) => Object;
+getObjectInArray: (arg: {const1: {|const1: boolean|}}) => Array<{|
const1: {const1: boolean},
|}>;
+getObjectInArray: (arg: {const1: {const1: boolean}}) => Array<{
const1: {const1: boolean};
}>;
}
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,23 +12,23 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getConstants: () => {|
isTesting: boolean,
reactNativeVersion: {|
major: number,
minor: number,
patch: number,
prerelease: ?number,
|},
forceTouchAvailable: boolean,
osVersion: string,
systemName: string,
interfaceIdiom: string,
|};
+getConstants: () => {
isTesting: boolean;
reactNativeVersion: {
major: number;
minor: number;
patch: number;
prerelease: null | undefined | number;
},
forceTouchAvailable: boolean;
osVersion: string;
systemName: string;
interfaceIdiom: string;
};
}
export default TurboModuleRegistry.getEnforcing<Spec>('PlatformConstants');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,12 +12,12 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
// Exported methods.
+voidFunc: (arg: ?string) => void;
+voidFunc: (arg: null | undefined | string) => void;
}
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,19 +12,19 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
type DisplayMetricsAndroid = {|
width: number,
|};
type DisplayMetricsAndroid = {
width: number;
};
export interface Spec extends TurboModule {
+getConstants: () => {|
+Dimensions: {
windowPhysicalPixels: DisplayMetricsAndroid,
+getConstants: () => {
Dimensions: {
windowPhysicalPixels: DisplayMetricsAndroid;
},
|};
};
}
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');

Просмотреть файл

@ -1,3 +1,4 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -10,11 +11,11 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export type String = string
export type SomeObj = {| a: string |};
export type SomeObj = { a: string };
export interface Spec extends TurboModule {
+getValueWithPromise: () => Promise<string>;

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getObject(o : Object) => Object,

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,8 +12,8 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
type NumNum = number;
export type Num = (arg: NumNum) => void;
@ -25,7 +26,7 @@ export interface Spec extends TurboModule {
// Exported methods.
+getNumber: Num2;
+getVoid: () => Void;
+getArray: (a : Array<A>) => {| a: B |};
+getArray: (a : Array<A>) => { a: B };
}
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');

Просмотреть файл

@ -1,4 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@ -11,9 +12,9 @@
'use strict';
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
import type {Int32, Float} from 'react-native/Libraries/Types/CodegenTypes';
import {TurboModule} from '../lib/RCTExport';
import * as TurboModuleRegistry from '../lib/TurboModuleRegistry';
import {Int32, Float} from '../lib/react-native/Libraries/Types/CodegenTypes';
export interface Spec extends TurboModule {
+getInt: (arg: Int32) => Int32;

Просмотреть файл

@ -1,5 +1,10 @@
{
"extends": [
"tslint-shared"
]
],
"linterOptions": {
"exclude": [
"src/inputs/*.ts"
]
}
}

Просмотреть файл

@ -1,5 +1,4 @@
// tslint:disable:no-reserved-keywords
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*

Просмотреть файл

@ -1,5 +1,10 @@
{
"extends": [
"tslint-shared"
]
}
],
"linterOptions": {
"exclude": [
"src/CodegenSchema.ts"
]
}
}

Просмотреть файл

@ -3,6 +3,7 @@
"tslint-microsoft-contrib"
],
"rules": {
"interface-name": false,
"linebreak-style": false,
"newline-per-chained-call": false,
"no-console": [

Просмотреть файл

@ -1,18 +1,23 @@
// tslint:disable:max-line-length
import * as fs from 'fs';
import * as path from 'path';
function flowToTs(flowSourceCode: string): string {
return `
// tslint:disable:no-reserved-keywords
${flowSourceCode
.replace(/\$ReadOnly</g, `Readonly<`) // $ReadOnly<T> -> Readonly<T>
.replace(/\$ReadOnlyArray</g, `ReadonlyArray<`) // $ReadOnlyArray<T> -> ReadonlyArray<T>
.replace(/\{\|/g, `{`) // {| ... |} -> { ... }
.replace(/\|\}/g, `}`)
.replace(/: \?/g, `: null | undefined | `) // ?T -> null | undefined | T
.replace(/([a-zA-Z_0-9$]+\??): ([^,]+),/g, '$1: $2;') // {a,b,c} -> {a; b; c;}
.replace(/\}>,/g, `}>;`)
.replace(/\{(\s+)\.\.\.(\w+),/g, '$2 & {') // {...a, b; c;} -> a & {b; c;}
.replace(/\$ReadOnly</g, `Readonly<`) // $ReadOnly<T> -> Readonly<T>
.replace(/\$ReadOnlyArray</g, `ReadonlyArray<`) // $ReadOnlyArray<T> -> ReadonlyArray<T>
.replace(/\{\|/g, `{`) // {| ... |} -> { ... }
.replace(/\|\}/g, `}`) //
.replace(/: \?/g, `: null | undefined | `) // ?T -> null | undefined | T
.replace(/\+?([a-zA-Z_0-9$]+\??): ([^=]*?),$/gm, '$1: $2;') // {+a,b,c} -> {a; b; c;}
.replace(/\}>,/g, `}>;`) //
//.replace(/^(\s*)\+(\w+):/gm, '$1$2:') // {+a:b;} -> {a:b;}
.replace(/\{(\s+)\.\.\.(\w+),/g, '$2 & {') // {...a, b; c;} -> a & {b; c;}
.replace(/const (\w+) = require\('(\.\.\/)?([^']+)'\);/g, `import $1 = require('../lib/$3');`) // const NAME = require('MODULE'); -> import NAME = require('../lib/MODULE');
.replace(/import type \{/g, 'import {') // import type {x} from 'MODULE'; -> import {x} from '../lib/MODULE';
.replace(/from '(\.\.\/)?([^']+)';/g, `from '../lib/$2';`) //
}`;
}
@ -35,7 +40,8 @@ function convertTestInput(inputJsPath: string, outputFolder: string, prefix: str
Object.keys(testCases).forEach((key: string) => {
const outputPath = path.join(outputFolder, `${prefix}${key}.ts`);
const flowSourceCode = testCases[key];
fs.writeFileSync(outputPath, flowSourceCode, { encoding: 'utf-8' });
const tsSourceCode = flowToTs(flowSourceCode);
fs.writeFileSync(outputPath, tsSourceCode, { encoding: 'utf-8' });
});
return testCases;