Merge branch 'master' of C:\Code\Microsoft\react-native-tscodegen

This commit is contained in:
Zihan Chen (MSFT) 2019-09-06 03:02:28 -07:00
Родитель 1bb66f4595 bbe288d015
Коммит 6a84379773
291 изменённых файлов: 28562 добавлений и 309 удалений

14
.github/workflows/pr.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,14 @@
name: CI
on: [push, pull_request]
jobs:
PR:
name: Validation
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
with:
submodules: true
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test

357
.gitignore поставляемый
Просмотреть файл

@ -1,330 +1,71 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
# Logs
logs
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Chutzpah Test files
_Chutzpah*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Coverage directory used by tools like istanbul
coverage
# Visual Studio Trace Files
*.e2e
# nyc test coverage
.nyc_output
# TFS 2012 Local Workspace
$tf/
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Guidance Automation Toolkit
*.gpState
# Bower dependency directory (https://bower.io/)
bower_components
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# node-waf configuration
.lock-wscript
# JustCode is a .NET coding add-in
.JustCode
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Dependency directories
node_modules/
jspm_packages/
# Visual Studio 6 build log
*.plg
# TypeScript v1 declaration files
typings/
# Visual Studio 6 workspace options file
*.opt
# Optional npm cache directory
.npm
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Optional eslint cache
.eslintcache
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Optional REPL history
.node_repl_history
# Paket dependency manager
.paket/paket.exe
paket-files/
# Output of 'npm pack'
*.tgz
# FAKE - F# Make
.fake/
# Yarn Integrity file
.yarn-integrity
# JetBrains Rider
.idea/
*.sln.iml
# dotenv environment variables file
.env
# CodeRush
.cr/
# next.js build output
.next
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Generated JavaScript files
packages/*/lib/
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# package-lock.json
package-lock.json
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Unnecessary generated files
packages/RN-TSCodegen-Test/src/inputs/e2e_components/output/
packages/RN-TSCodegen-Test/src/inputs/e2e_modules/output/

3
.gitmodules поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
[submodule "react-native"]
path = react-native
url = https://github.com/facebook/react-native

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

@ -1,3 +1,5 @@
ts-parsec
MIT License
Copyright (c) Microsoft Corporation.

22
Note.md Normal file
Просмотреть файл

@ -0,0 +1,22 @@
# Sub module to https://github.com/facebook/react-native
- `git submodule add <url>`
- `git submodule init`
- `git submodule update`
- `git fetch` / `git merge origin/master` in `react-native` folder
## Files to consume
### Schema file
`.\react-native\packages\react-native-codegen\src\CodegenSchema.js`
### Component test cases
- good cases: `.\react-native\packages\react-native-codegen\src\parsers\flow\components\__test_fixtures__\fixtures.js`
- bad cases: `.\react-native\packages\react-native-codegen\src\parsers\flow\components\__test_fixtures__\failures.js`
- output: `.\react-native\packages\react-native-codegen\src\parsers\flow\components\__tests__\__snapshots__\component-parser-test.js.snap`
### Native Module test cases
- good cases: `.\react-native\packages\react-native-codegen\src\parsers\flow\modules\__test_fixtures__\fixtures.js`
- bad cases: `.\react-native\packages\react-native-codegen\src\parsers\flow\modules\__test_fixtures__\failures.js`
- output: `.\react-native\packages\react-native-codegen\src\parsers\flow\modules\__tests__\__snapshots__\module-parser-test.js.snap`

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

@ -1,5 +1,15 @@
# react-native-tscodegen
# Contributing
TypeScript Code Generation for React Native Turbo Module
- Index
- Contributing
- Building this repo
- Packages
- Deploying
- Development
## Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
@ -12,3 +22,89 @@ provided by the bot. You will only need to do this once across all repos using o
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## Building this repo
```cmd
yarn
yarn build
yarn test
```
## Packages
### tslint-shared
This is the shared tslint configuration for all other packages.
### RN-TSCodegen
This is the TypeScript code generation for TurboModule in react native.
In [facebook/react-native](https://github.com/facebook/react-native/), you are able to find following files in `packages/react-native-codegen/src`:
- [cli/parser/parser-cli.js](https://github.com/facebook/react-native/blob/master/packages/react-native-codegen/src/cli/parser/parser-cli.js): It calls `parseFiles` from
- [cli/parser/parser.js](https://github.com/facebook/react-native/blob/master/packages/react-native-codegen/src/cli/parser/parser.js): It calls `parseFile` from
- [parsers/flow/index.js](https://github.com/facebook/react-native/blob/master/packages/react-native-codegen/src/parsers/flow/index.js): It parse a Flow source file to `SchemaType`, which is defined in `CodegenSchema.js`
- [RNCodegen.js](https://github.com/facebook/react-native/blob/master/packages/react-native-codegen/src/generators/RNCodegen.js): It converts `parseFile` result to header files.
RN-TSCodegen provides [typeScriptToCodeSchema](https://github.com/microsoft/react-native-tscodegen/blob/master/packages/RN-TSCodegen/src/index.ts) for the TypeScript version of `parseFile`.
### RN-Codegen-Backend
Compile Facebook's code and export `generate` from `RNCodegen.js`
### RN-TSCodegen-Test
This package contains all test cases for RN-TSCodegen.
### ts-parsec
This is a [parser combinator](https://github.com/microsoft/react-native-tscodegen/tree/master/packages/ts-parsec) written in TypeScript. It allows you to create parsers very quickly. Please take a look at:
- [packages/ts-parsec/test/TestRecursiveParser.ts](https://github.com/microsoft/react-native-tscodegen/blob/master/packages/ts-parsec/test/TestRecursiveParser.ts)
- [packages/minimum-flow-parser/src/Parser.ts](https://github.com/microsoft/react-native-tscodegen/blob/master/packages/minimum-flow-parser/src/Parser.ts)
for deeper understanding of this library.
### minimum-flow-parser
This is a Flow parser, just enough to convert necessary files to TypeScript for this repo.
### update-test-files
I started this repo in the days when Facebook is actively updating their react native code generation for Flow. There is no document or specification at this moment.
I need to develop a TypeScript version working exactly as their Flow code generation, and to track and catch up their progress when they are changing their code generation parallelly.
So I started update-test files. Whenever I need to know what is changed in their code, I run this package, and then I can:
- Get the latest `CodegenSchema.js` converted to TypeScript automatically. RN-TSCodegen is written in TypeScript, so the definition of the intermediate format should be recognizable by TypeScript.
- Get latest test cases. Facebook has prepared a set of Flow source files, along with snapshots showing how a `SchemaType` object should be created for each file. All test cases are automatically converted to TypeScript to be my test cases. At the early stage of the development, if RN-TSCodegen produces exactly the same output as theirs, I consider my code generation is correct.
- Get the diff of generated files. In this way I can know how many features are added or removed. This is a very important guidance for the development of this project.
Since minimum-flow-parser is built just for converting test cases, so it is possible that it fails to parse a Flow program because Facebook uses more Flow features in their test cases then the last time. It will be updated then.
## Deploying
At this moment, no effort of integrating RN-TSCodegen to facebook/react-native has been made.
But I've got facebook's native code generator run successfully in RN-TSCodegen's [test cases](https://github.com/microsoft/react-native-tscodegen/blob/master/packages/RN-TSCodegen/test/TestE2ECases.ts).
You can follow these test cases to make it run in your repo. There is several things that need to do before running this code generation:
- Call `typeScriptToCodeSchema` from `RN-TSCodegen` followed by `generate` function from `RN-Codegen-Backend`.
- In [this folder](https://github.com/microsoft/react-native-tscodegen/tree/master/packages/RN-TSCodegen-Test/src/lib) you will see 3 files. You either use them directly, or merge them into third-party description files.
- [CodegenTypes.ts](https://github.com/microsoft/react-native-tscodegen/blob/master/packages/RN-TSCodegen-Test/src/lib/CodegenTypes.ts)
- [ImageSource.ts](https://github.com/microsoft/react-native-tscodegen/blob/master/packages/RN-TSCodegen-Test/src/lib/ImageSource.ts)
- [StyleSheetTypes.ts](https://github.com/microsoft/react-native-tscodegen/blob/master/packages/RN-TSCodegen-Test/src/lib/StyleSheetTypes.ts)
- `RNTag<T>` and `WithDefaultRNTag` that are used in above files are very important classes that help RN-TSCodegen recognize react native required features that TypeScript does not have. This approach may change in the future.
- `ReactNull | T` is used to represent nullable types. This approach may change in the future.
- When `--strictNullChecks` is off (by default), TypeScript compiler will ignore `null` and `undefined` in a union type, because they are subtype of all other types. The currently implementation uses `typeChecker` in TypeScript Compiler API to do type inference, necessary information will be lost when `--strictNullChecks` is off.
Today there is no npm package created for this repo. to use this source code, it is recommended to submodule and build this repo, and then import from the following packages directly:
- `RN-TSCodegen`
- `RN-Codegen-Backend`
## Development
(editing)

6
lerna.json Normal file
Просмотреть файл

@ -0,0 +1,6 @@
{
"packages": ["packages/*"],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.0.0"
}

24
package.json Normal file
Просмотреть файл

@ -0,0 +1,24 @@
{
"name": "react-native-tscodegen-repo",
"version": "0.0.1",
"private": true,
"scripts": {
"build": "lerna run build --stream",
"test": "lerna run test --stream",
"change": "node ./node_modules/beachball/bin/beachball.js change"
},
"repository": {
"type": "git",
"url": "git@github.com:microsoft/react-native-tscodegen.git"
},
"license": "MIT",
"workspaces": {
"packages": [
"packages/*"
]
},
"devDependencies": {
"beachball": "^1.11.5",
"lerna": "^3.16.1"
}
}

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

@ -0,0 +1,29 @@
{
"name": "rn-codegen-backend",
"version": "1.0.0",
"description": "React Native Turbo Module Code Generation Backend",
"main": "./lib/index.js",
"scripts": {
"build": "flow-remove-types ../../react-native/packages/react-native-codegen/ -q -d lib/rncodegen/ & tslint --project tsconfig.json & tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/microsoft/react-native-tscodegen.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/microsoft/react-native-tscodegen/issues"
},
"homepage": "https://github.com/microsoft/react-native-tscodegen#readme",
"devDependencies": {
"@types/jest": "^24.0.17",
"@types/node": "^12.6.9",
"flow-remove-types": "^2.106.2",
"jscodeshift": "0.6.4",
"nullthrows": "1.1.1",
"tslint": "^5.18.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "^3.5.3",
"tslint-shared": "^1.0.0"
}
}

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

@ -0,0 +1,301 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from react-native/packages/react-native-codegen/src/CodegenSchema.js
'use strict';
export type CommandsFunctionTypeAnnotation = Readonly<{
type: 'FunctionTypeAnnotation';
params: ReadonlyArray<CommandsFunctionTypeParamAnnotation>;
}>;
export type CommandsFunctionTypeParamAnnotation = Readonly<{
name: string;
typeAnnotation: CommandsTypeAnnotation;
}>;
export type CommandsTypeAnnotation =
| BooleanTypeAnnotation
| Int32TypeAnnotation
| DoubleTypeAnnotation
| FloatTypeAnnotation
| StringTypeAnnotation;
export type DoubleTypeAnnotation = Readonly<{
type: 'DoubleTypeAnnotation';
}>;
export type FloatTypeAnnotation = Readonly<{
type: 'FloatTypeAnnotation';
}>;
export type BooleanTypeAnnotation = Readonly<{
type: 'BooleanTypeAnnotation';
}>;
export type Int32TypeAnnotation = Readonly<{
type: 'Int32TypeAnnotation';
}>;
export type StringTypeAnnotation = Readonly<{
type: 'StringTypeAnnotation';
}>;
export type ObjectPropertyType =
| Readonly<{
type: 'BooleanTypeAnnotation';
name: string;
optional: boolean;
}>
| Readonly<{
type: 'StringTypeAnnotation';
name: string;
optional: boolean;
}>
| Readonly<{
type: 'DoubleTypeAnnotation';
name: string;
optional: boolean;
}>
| Readonly<{
type: 'FloatTypeAnnotation';
name: string;
optional: boolean;
}>
| Readonly<{
type: 'Int32TypeAnnotation';
name: string;
optional: boolean;
}>
| Readonly<{
type: 'StringEnumTypeAnnotation';
name: string;
optional: boolean;
options: ReadonlyArray<{
name: string;
}>;
}>
| Readonly<{
type: 'ObjectTypeAnnotation';
name: string;
optional: boolean;
properties: ReadonlyArray<ObjectPropertyType>;
}>;
export type PropTypeTypeAnnotation =
| Readonly<{
type: 'BooleanTypeAnnotation';
default: boolean;
}>
| Readonly<{
type: 'StringTypeAnnotation';
default:
| string
| null;
}>
| Readonly<{
type: 'DoubleTypeAnnotation';
default: number;
}>
| Readonly<{
type: 'FloatTypeAnnotation';
default: number;
}>
| Readonly<{
type: 'Int32TypeAnnotation';
default: number;
}>
| Readonly<{
type: 'StringEnumTypeAnnotation';
default: string;
options: ReadonlyArray<{
name: string;
}>;
}>
| Readonly<{
type: 'NativePrimitiveTypeAnnotation';
name:
| 'ColorPrimitive'
| 'ImageSourcePrimitive'
| 'PointPrimitive';
}>
| Readonly<{
type: 'ObjectTypeAnnotation';
properties: ReadonlyArray<PropTypeShape>;
}>
| Readonly<{
type: 'ArrayTypeAnnotation';
elementType:
| Readonly<{
type: 'BooleanTypeAnnotation';
}>
| Readonly<{
type: 'StringTypeAnnotation';
}>
| Readonly<{
type: 'DoubleTypeAnnotation';
}>
| Readonly<{
type: 'FloatTypeAnnotation';
}>
| Readonly<{
type: 'Int32TypeAnnotation';
}>
| Readonly<{
type: 'StringEnumTypeAnnotation';
default: string;
options: ReadonlyArray<{
name: string;
}>;
}>
| Readonly<{
type: 'ObjectTypeAnnotation';
properties: ReadonlyArray<PropTypeShape>;
}>
| Readonly<{
type: 'NativePrimitiveTypeAnnotation';
name:
| 'ColorPrimitive'
| 'ImageSourcePrimitive'
| 'PointPrimitive';
}>;
}>;
export type PropTypeShape = Readonly<{
name: string;
optional: boolean;
typeAnnotation: PropTypeTypeAnnotation;
}>;
export type PrimitiveTypeAnnotationType =
| 'StringTypeAnnotation'
| 'NumberTypeAnnotation'
| 'Int32TypeAnnotation'
| 'DoubleTypeAnnotation'
| 'FloatTypeAnnotation'
| 'BooleanTypeAnnotation'
| 'GenericObjectTypeAnnotation';
export type PrimitiveTypeAnnotation = Readonly<{
type: PrimitiveTypeAnnotationType;
}>;
export type FunctionTypeAnnotationParamTypeAnnotation =
| Readonly<{
type:
| 'AnyTypeAnnotation'
| 'FunctionTypeAnnotation'
| PrimitiveTypeAnnotationType;
}>
| Readonly<{
type: 'ArrayTypeAnnotation';
elementType: (undefined | FunctionTypeAnnotationParamTypeAnnotation);
}>
| Readonly<{
type: 'ObjectTypeAnnotation';
properties: (undefined | ReadonlyArray<ObjectParamTypeAnnotation>);
}>;
export type FunctionTypeAnnotationReturnArrayElementType = FunctionTypeAnnotationParamTypeAnnotation;
export type ObjectParamTypeAnnotation = Readonly<{
optional: boolean;
name: string;
typeAnnotation: FunctionTypeAnnotationParamTypeAnnotation;
}>;
export type FunctionTypeAnnotationReturn =
| Readonly<{
nullable: boolean;
type:
| PrimitiveTypeAnnotationType
| 'VoidTypeAnnotation'
| 'GenericPromiseTypeAnnotation';
}>
| Readonly<{
nullable: boolean;
type: 'ArrayTypeAnnotation';
elementType: (undefined | FunctionTypeAnnotationReturnArrayElementType);
}>
| Readonly<{
nullable: boolean;
type: 'ObjectTypeAnnotation';
properties: (undefined | ReadonlyArray<ObjectParamTypeAnnotation>);
}>;
export type FunctionTypeAnnotationParam = Readonly<{
nullable: boolean;
name: string;
typeAnnotation: FunctionTypeAnnotationParamTypeAnnotation;
}>;
export type FunctionTypeAnnotation = Readonly<{
type: 'FunctionTypeAnnotation';
params: ReadonlyArray<FunctionTypeAnnotationParam>;
returnTypeAnnotation: FunctionTypeAnnotationReturn;
optional: boolean;
}>;
export type MethodTypeShape = Readonly<{
name: string;
typeAnnotation: FunctionTypeAnnotation;
}>;
export type NativeModuleShape = Readonly<{
properties: ReadonlyArray<MethodTypeShape>;
}>;
export type EventTypeShape = Readonly<{
name: string;
bubblingType:
| 'direct'
| 'bubble';
optional: boolean;
paperTopLevelNameDeprecated?: string;
typeAnnotation: Readonly<{
type: 'EventTypeAnnotation';
argument?: Readonly<{
type: 'ObjectTypeAnnotation';
properties: ReadonlyArray<ObjectPropertyType>;
}>;
}>;
}>;
export type CommandTypeShape = Readonly<{
name: string;
optional: boolean;
typeAnnotation: CommandsFunctionTypeAnnotation;
}>;
export type OptionsShape = Readonly<{
interfaceOnly?: boolean;
paperComponentName?: string;
paperComponentNameDeprecated?: string;
}>;
export type ExtendsPropsShape = Readonly<{
type: 'ReactNativeBuiltInType';
knownTypeName: 'ReactNativeCoreViewProps';
}>;
export type ComponentShape = Readonly<OptionsShape & {
extendsProps: ReadonlyArray<ExtendsPropsShape>;
events: ReadonlyArray<EventTypeShape>;
props: ReadonlyArray<PropTypeShape>;
commands: ReadonlyArray<CommandTypeShape>;
}>;
export type SchemaType = Readonly<{
modules: Readonly<{
[module: string]: Readonly<{
components?: Readonly<{
[component: string]: ComponentShape;
}>;
nativeModules?: Readonly<{
[nativeModule: string]: NativeModuleShape;
}>;
}>;
}>;
}>;

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

@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// tslint:disable:no-unsafe-any
// tslint:disable:no-require-imports
import { SchemaType } from './CodegenSchema';
// Manually strong-typed from \react-native\packages\react-native-codegen\src\generators\RNCodegen.js
export type Options = Readonly<{
libraryName: string;
schema: SchemaType;
outputDirectory: string;
moduleSpecName: string;
}>;
export type Generators =
| 'descriptors'
| 'events'
| 'props'
| 'tests'
| 'shadow-nodes'
| 'modules'
;
export type Config = Readonly<{
generators: Generators[];
test?: boolean;
}>;
type GeneratePrototype = (options: Options, config: Config) => boolean;
export const generate = <GeneratePrototype>(require('./rncodegen/src/generators/RNCodegen.js').generate);

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

@ -0,0 +1,17 @@
{
"compilerOptions": {
"lib": ["es6"],
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"declaration": true,
"sourceMap": true,
"outDir": "./lib",
"noEmitOnError": true,
"noUnusedLocals": true,
"strictNullChecks": true,
},
"exclude": ["node_modules", "src/test", "lib", "lib-amd"]
}

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

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

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

@ -0,0 +1,26 @@
{
"name": "rn-tscodegen-test",
"version": "1.0.0",
"private": true,
"description": "Test files for RN-TSCodegen",
"main": "./lib/index.js",
"scripts": {
"build": "tslint --project tsconfig.json & tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/microsoft/react-native-tscodegen.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/microsoft/react-native-tscodegen/issues"
},
"homepage": "https://github.com/microsoft/react-native-tscodegen#readme",
"devDependencies": {
"@types/node": "^12.6.9",
"tslint": "^5.18.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "^3.5.3",
"tslint-shared": "^1.0.0"
}
}

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

@ -0,0 +1 @@
console.log('This is a test project!');

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

@ -0,0 +1,98 @@
{
"components": {
"success": [
"ALL_PROP_TYPES_NO_EVENTS",
"ARRAY_PROP_TYPES_NO_EVENTS",
"OBJECT_PROP_TYPES_NO_EVENTS",
"PROPS_ALIASED_LOCALLY",
"ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS",
"ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS_NO_CAST",
"NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION",
"EVENTS_DEFINED_INLINE_WITH_ALL_TYPES",
"EVENTS_DEFINED_AS_NULL_INLINE",
"PROPS_AND_EVENTS_TYPES_EXPORTED",
"COMMANDS_AND_EVENTS_TYPES_EXPORTED",
"COMMANDS_DEFINED_WITH_ALL_TYPES",
"PROPS_AS_EXTERNAL_TYPES",
"COMMANDS_WITH_EXTERNAL_TYPES"
],
"failure": [
"COMMANDS_DEFINED_INLINE",
"COMMANDS_DEFINED_MULTIPLE_TIMES",
"COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES",
"COMMANDS_DEFINED_WITHOUT_METHOD_NAMES",
"COMMANDS_DEFINED_WITHOUT_REF",
"COMMANDS_DEFINED_WITH_NULLABLE_REF",
"NULLABLE_WITH_DEFAULT",
"NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE",
"PROPS_CONFLICT_NAMES",
"PROPS_CONFLICT_WITH_SPREAD_PROPS",
"PROPS_SPREAD_CONFLICTS_WITH_PROPS",
"PROP_NUMBER_TYPE"
]
},
"modules": {
"success": [
"NATIVE_MODULE_WITH_OBJECT_WITH_OBJECT_DEIFNED_IN_FILE_AS_PROPERTY",
"NATIVE_MODULE_WITH_ARRAY_WITH_UNION_AND_TOUPLE",
"NATIVE_MODULE_WITH_WITH_FLOAT_AND_INT32",
"NATIVE_MODULE_WITH_WITH_ALIASES",
"NATIVE_MODULE_WITH_PROMISE",
"NATIVE_MODULE_WITH_COMPLEX_OBJECTS",
"NATIVE_MODULE_WITH_COMPLEX_OBJECTS_WITH_NULLABLE_KEY",
"NATIVE_MODULE_WITH_SIMPLE_OBJECT",
"NATIVE_MODULE_WITH_NULLABLE_PARAM",
"NATIVE_MODULE_WITH_BASIC_ARRAY",
"NATIVE_MODULE_WITH_COMPLEX_ARRAY",
"NATIVE_MODULE_WITH_ARRAY_WITH_ALIAS",
"NATIVE_MODULE_WITH_BASIC_PARAM_TYPES",
"NATIVE_MODULE_WITH_CALLBACK",
"EMPTY_NATIVE_MODULE"
],
"failure": [
"NATIVE_MODULES_WITH_READ_ONLY_OBJECT_NO_TYPE_FOR_CONTENT",
"NATIVE_MODULES_WITH_UNNAMED_PARAMS",
"NATIVE_MODULES_WITH_PROMISE_WITHOUT_TYPE",
"NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT_AS_PARAM",
"NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT",
"TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT",
"NATIVE_MODULES_WITH_NOT_ONLY_METHODS",
"TWO_NATIVE_EXTENDING_TURBO_MODULE"
]
},
"e2e_components": {
"success": [
"ArrayPropsNativeComponent",
"BooleanPropNativeComponent",
"ColorPropNativeComponent",
"EnumPropNativeComponent",
"EventNestedObjectPropsNativeComponent",
"EventPropsNativeComponent",
"FloatPropsNativeComponent",
"ImagePropNativeComponent",
"IntegerPropNativeComponent",
"InterfaceOnlyNativeComponent",
"MultiNativePropNativeComponent",
"NoPropsNoEventsNativeComponent",
"ObjectPropsNativeComponent",
"PointPropNativeComponent",
"StringPropNativeComponent"
],
"failure": []
},
"e2e_modules": {
"success": [
"NativeArrayTurboModule",
"NativeBooleanTurboModule",
"NativeCallbackTurboModule",
"NativeNullableTurboModule",
"NativeNumberTurboModule",
"NativeObjectTurboModule",
"NativeOptionalObjectTurboModule",
"NativePromiseTurboModule",
"NativeSampleTurboModule",
"NativeStringTurboModule"
],
"failure": []
}
}

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

@ -0,0 +1,37 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
export type ModuleProps = $ReadOnly<{|
...ViewProps,
// No props
|}>;
export const Commands = codegenNativeCommands<{
+hotspotUpdate: (ref: React.Ref<'RCTView'>, x: Int32, y: Int32) => void,
}>({
supportedCommands: ['hotspotUpdate'],
});
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "codegenNativeCommands doesn't support inline definitions. Specify a file local type alias"}

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

@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/COMMANDS_DEFINED_INLINE.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {Int32} from '../../lib/CodegenTypes';
import * as React from '../../lib/React';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import codegenNativeCommands from '../../lib/codegenNativeCommands';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
export type ModuleProps = Readonly<ViewProps & {
}>;
export const Commands = codegenNativeCommands<{
readonly hotspotUpdate: (ref: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
}>({
supportedCommands: ['hotspotUpdate']
});
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,42 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
interface NativeCommands {
+hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
// No props or events
|}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate'],
});
export const Commands2 = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate'],
});
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "codegenNativeCommands may only be called once in a file"}

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

@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/COMMANDS_DEFINED_MULTIPLE_TIMES.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {Int32} from '../../lib/CodegenTypes';
import * as React from '../../lib/React';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import codegenNativeCommands from '../../lib/codegenNativeCommands';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
interface NativeCommands {
hotspotUpdate(viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32): void;
}
export type ModuleProps = Readonly<ViewProps & {
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate']
});
export const Commands2 = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate']
});
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,42 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
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,
// No props or events
|}>;
export const Commands = codegenNativeCommands<NativeCommands>();
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "codegenNativeCommands must be passed options including the supported commands"}

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

@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/COMMANDS_DEFINED_WITHOUT_METHOD_NAMES.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {Int32} from '../../lib/CodegenTypes';
import * as React from '../../lib/React';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import codegenNativeCommands from '../../lib/codegenNativeCommands';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
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 const Commands = codegenNativeCommands<NativeCommands>();
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,39 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
interface NativeCommands {
+hotspotUpdate: (x: Int32, y: Int32) => void;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
// No props or events
|}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate'],
});
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "The first argument of method hotspotUpdate must be of type React.ElementRef<>"}

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

@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/COMMANDS_DEFINED_WITHOUT_REF.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {Int32} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import codegenNativeCommands from '../../lib/codegenNativeCommands';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
interface NativeCommands {
hotspotUpdate(x: Int32, y: Int32): void;
}
export type ModuleProps = Readonly<ViewProps & {
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate']
});
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,44 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
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,
// No props or events
|}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['scrollTo'],
});
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "codegenNativeCommands expected the same supportedCommands specified in the NativeCommands interface: hotspotUpdate, scrollTo"}

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

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {Int32} from '../../lib/CodegenTypes';
import * as React from '../../lib/React';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import codegenNativeCommands from '../../lib/codegenNativeCommands';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
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 const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['scrollTo']
});
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,39 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
interface NativeCommands {
+hotspotUpdate: (viewRef: ?React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
}
export type ModuleProps = $ReadOnly<{|
...ViewProps,
// No props or events
|}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate'],
});
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "The first argument of method hotspotUpdate must be of type React.ElementRef<>"}

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

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/COMMANDS_DEFINED_WITH_NULLABLE_REF.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {Int32} from '../../lib/CodegenTypes';
import {ReactNull} from '../../lib/CodegenTypes';
import * as React from '../../lib/React';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import codegenNativeCommands from '../../lib/codegenNativeCommands';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
interface NativeCommands {
hotspotUpdate(viewRef: (ReactNull | React.Ref<'RCTView'>), x: Int32, y: Int32): void;
}
export type ModuleProps = Readonly<ViewProps & {
}>;
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate']
});
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,30 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {WithDefault, Float} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
export type ModuleProps = $ReadOnly<{|
...ViewProps,
required_key_with_default: WithDefault<Float, 1.0>,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "key required_key_with_default must be optional if used with WithDefault<> annotation"}

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

@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {Float} from '../../lib/CodegenTypes';
import {WithDefault} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
export type ModuleProps = Readonly<ViewProps & {
required_key_with_default: WithDefault<Float, 1.0>;
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,30 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {WithDefault, Float} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
export type ModuleProps = $ReadOnly<{|
...ViewProps,
nullable_with_default: ?WithDefault<Float, 1.0>,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "WithDefault<> is optional and does not need to be marked as optional. Please remove the ? annotation in front of it."}

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

@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/NULLABLE_WITH_DEFAULT.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {Float} from '../../lib/CodegenTypes';
import {ReactNull} from '../../lib/CodegenTypes';
import {WithDefault} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
export type ModuleProps = Readonly<ViewProps & {
nullable_with_default: (ReactNull | WithDefault<Float, 1.0>);
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,31 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
const codegenNativeComponent = require('codegenNativeComponent');
export type ModuleProps = $ReadOnly<{|
...ViewProps,
isEnabled: string,
isEnabled: boolean,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "A prop was already defined with the name isEnabled"}

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

@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/PROPS_CONFLICT_NAMES.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
export type ModuleProps = Readonly<ViewProps & {
isEnabled: string;
isEnabled: boolean;
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,35 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
const codegenNativeComponent = require('codegenNativeComponent');
type PropsInFile = $ReadOnly<{|
isEnabled: boolean,
|}>;
export type ModuleProps = $ReadOnly<{|
...ViewProps,
...PropsInFile,
isEnabled: boolean,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "A prop was already defined with the name isEnabled"}

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

@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/PROPS_CONFLICT_WITH_SPREAD_PROPS.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type PropsInFile = Readonly<{
isEnabled: boolean;
}>;
export type ModuleProps = Readonly<ViewProps & PropsInFile & {
isEnabled: boolean;
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,35 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
const codegenNativeComponent = require('codegenNativeComponent');
type PropsInFile = $ReadOnly<{|
isEnabled: boolean,
|}>;
export type ModuleProps = $ReadOnly<{|
...ViewProps,
isEnabled: boolean,
...PropsInFile,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "A prop was already defined with the name isEnabled"}

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

@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/PROPS_SPREAD_CONFLICTS_WITH_PROPS.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type PropsInFile = Readonly<{
isEnabled: boolean;
}>;
export type ModuleProps = Readonly<ViewProps & PropsInFile & {
isEnabled: boolean;
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,30 @@
// Automatically copied from components/__test_fixtures__/failures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
const codegenNativeComponent = require('codegenNativeComponent');
export type ModuleProps = $ReadOnly<{|
...ViewProps,
someProp: number
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1 @@
{"error": "Cannot use \"NumberTypeAnnotation\" type annotation for \"someProp\": must use a specific numeric type like Int32, Double, or Float"}

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

@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_failure/PROP_NUMBER_TYPE.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js)
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
export type ModuleProps = Readonly<ViewProps & {
someProp: number;
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,102 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32, Double, Float, WithDefault} from 'CodegenTypes';
import type {ImageSource} from 'ImageSource';
import type {ColorValue, ColorArrayValue, PointValue} from 'StyleSheetTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
type ModuleProps = $ReadOnly<{|
...ViewProps,
// Props
// Boolean props
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 props, null default
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 props, null default
stringish_null_optional_key?: WithDefault<Stringish, null>,
stringish_null_optional_both?: WithDefault<Stringish, null>,
// Double props
double_required: Double,
double_optional_key?: WithDefault<Double, 1.1>,
double_optional_both?: WithDefault<Double, 1.1>,
// Float props
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>,
// String enum props
enum_optional_key?: WithDefault<'small' | 'large', 'small'>,
enum_optional_both?: WithDefault<'small' | 'large', 'small'>,
// Object props
object_optional_key?: $ReadOnly<{| prop: string |}>,
object_optional_both?: ?$ReadOnly<{| prop: string |}>,
object_optional_value: ?$ReadOnly<{| prop: string |}>,
// ImageSource props
image_required: ImageSource,
image_optional_value: ?ImageSource,
image_optional_both?: ?ImageSource,
// ColorValue props
color_required: ColorValue,
color_optional_key?: ColorValue,
color_optional_value: ?ColorValue,
color_optional_both?: ?ColorValue,
// ColorArrayValue props
color_array_required: ColorArrayValue,
color_array_optional_key?: ColorArrayValue,
color_array_optional_value: ?ColorArrayValue,
color_array_optional_both?: ?ColorArrayValue,
// PointValue props
point_required: PointValue,
point_optional_key?: PointValue,
point_optional_value: ?PointValue,
point_optional_both?: ?PointValue,
|}>;
export default (codegenNativeComponent<ModuleProps, Options>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1,411 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [],
"events": [],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"props": [
{
"name": "boolean_required",
"optional": false,
"typeAnnotation": {
"default": false,
"type": "BooleanTypeAnnotation"
}
},
{
"name": "boolean_optional_key",
"optional": true,
"typeAnnotation": {
"default": true,
"type": "BooleanTypeAnnotation"
}
},
{
"name": "boolean_optional_both",
"optional": true,
"typeAnnotation": {
"default": true,
"type": "BooleanTypeAnnotation"
}
},
{
"name": "string_required",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "string_optional_key",
"optional": true,
"typeAnnotation": {
"default": "",
"type": "StringTypeAnnotation"
}
},
{
"name": "string_optional_both",
"optional": true,
"typeAnnotation": {
"default": "",
"type": "StringTypeAnnotation"
}
},
{
"name": "string_null_optional_key",
"optional": true,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "string_null_optional_both",
"optional": true,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "stringish_required",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "stringish_optional_key",
"optional": true,
"typeAnnotation": {
"default": "",
"type": "StringTypeAnnotation"
}
},
{
"name": "stringish_optional_both",
"optional": true,
"typeAnnotation": {
"default": "",
"type": "StringTypeAnnotation"
}
},
{
"name": "stringish_null_optional_key",
"optional": true,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "stringish_null_optional_both",
"optional": true,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "double_required",
"optional": false,
"typeAnnotation": {
"default": 0,
"type": "DoubleTypeAnnotation"
}
},
{
"name": "double_optional_key",
"optional": true,
"typeAnnotation": {
"default": 1.1,
"type": "DoubleTypeAnnotation"
}
},
{
"name": "double_optional_both",
"optional": true,
"typeAnnotation": {
"default": 1.1,
"type": "DoubleTypeAnnotation"
}
},
{
"name": "float_required",
"optional": false,
"typeAnnotation": {
"default": 0,
"type": "FloatTypeAnnotation"
}
},
{
"name": "float_optional_key",
"optional": true,
"typeAnnotation": {
"default": 1.1,
"type": "FloatTypeAnnotation"
}
},
{
"name": "float_optional_both",
"optional": true,
"typeAnnotation": {
"default": 1.1,
"type": "FloatTypeAnnotation"
}
},
{
"name": "int32_required",
"optional": false,
"typeAnnotation": {
"default": 0,
"type": "Int32TypeAnnotation"
}
},
{
"name": "int32_optional_key",
"optional": true,
"typeAnnotation": {
"default": 1,
"type": "Int32TypeAnnotation"
}
},
{
"name": "int32_optional_both",
"optional": true,
"typeAnnotation": {
"default": 1,
"type": "Int32TypeAnnotation"
}
},
{
"name": "enum_optional_key",
"optional": true,
"typeAnnotation": {
"default": "small",
"options": [
{
"name": "small"
},
{
"name": "large"
}
],
"type": "StringEnumTypeAnnotation"
}
},
{
"name": "enum_optional_both",
"optional": true,
"typeAnnotation": {
"default": "small",
"options": [
{
"name": "small"
},
{
"name": "large"
}
],
"type": "StringEnumTypeAnnotation"
}
},
{
"name": "object_optional_key",
"optional": true,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "object_optional_both",
"optional": true,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "object_optional_value",
"optional": true,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "image_required",
"optional": false,
"typeAnnotation": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "image_optional_value",
"optional": true,
"typeAnnotation": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "image_optional_both",
"optional": true,
"typeAnnotation": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "color_required",
"optional": false,
"typeAnnotation": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "color_optional_key",
"optional": true,
"typeAnnotation": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "color_optional_value",
"optional": true,
"typeAnnotation": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "color_optional_both",
"optional": true,
"typeAnnotation": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "color_array_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "color_array_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "color_array_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "color_array_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "point_required",
"optional": false,
"typeAnnotation": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "point_optional_key",
"optional": true,
"typeAnnotation": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "point_optional_value",
"optional": true,
"typeAnnotation": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
},
{
"name": "point_optional_both",
"optional": true,
"typeAnnotation": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
]
}
}
}
}
}

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

@ -0,0 +1,75 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/ALL_PROP_TYPES_NO_EVENTS.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {Float} from '../../lib/CodegenTypes';
import {Double} from '../../lib/CodegenTypes';
import {Int32} from '../../lib/CodegenTypes';
import {Stringish} from '../../lib/CodegenTypes';
import {ReactNull} from '../../lib/CodegenTypes';
import {WithDefault} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ImageSource} from '../../lib/ImageSource';
import {ColorValue} from '../../lib/StyleSheetTypes';
import {ColorArrayValue} from '../../lib/StyleSheetTypes';
import {PointValue} from '../../lib/StyleSheetTypes';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type ModuleProps = Readonly<ViewProps & {
boolean_required: boolean;
boolean_optional_key?: WithDefault<boolean, true>;
boolean_optional_both?: WithDefault<boolean, true>;
string_required: string;
string_optional_key?: WithDefault<string, ''>;
string_optional_both?: WithDefault<string, ''>;
string_null_optional_key?: WithDefault<string, null>;
string_null_optional_both?: WithDefault<string, null>;
stringish_required: Stringish;
stringish_optional_key?: WithDefault<Stringish, ''>;
stringish_optional_both?: WithDefault<Stringish, ''>;
stringish_null_optional_key?: WithDefault<Stringish, null>;
stringish_null_optional_both?: WithDefault<Stringish, null>;
double_required: Double;
double_optional_key?: WithDefault<Double, 1.1>;
double_optional_both?: WithDefault<Double, 1.1>;
float_required: Float;
float_optional_key?: WithDefault<Float, 1.1>;
float_optional_both?: WithDefault<Float, 1.1>;
int32_required: Int32;
int32_optional_key?: WithDefault<Int32, 1>;
int32_optional_both?: WithDefault<Int32, 1>;
enum_optional_key?: WithDefault<'small' | 'large', 'small'>;
enum_optional_both?: WithDefault<'small' | 'large', 'small'>;
object_optional_key?: Readonly<{
prop: string;
}>;
object_optional_both?: (ReactNull | Readonly<{
prop: string;
}>);
object_optional_value: (ReactNull | Readonly<{
prop: string;
}>);
image_required: ImageSource;
image_optional_value: (ReactNull | ImageSource);
image_optional_both?: (ReactNull | ImageSource);
color_required: ColorValue;
color_optional_key?: ColorValue;
color_optional_value: (ReactNull | ColorValue);
color_optional_both?: (ReactNull | ColorValue);
color_array_required: ColorArrayValue;
color_array_optional_key?: ColorArrayValue;
color_array_optional_value: (ReactNull | ColorArrayValue);
color_array_optional_both?: (ReactNull | ColorArrayValue);
point_required: PointValue;
point_optional_key?: PointValue;
point_optional_value: (ReactNull | PointValue);
point_optional_both?: (ReactNull | PointValue);
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,125 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32, Double, Float, WithDefault} from 'CodegenTypes';
import type {ImageSource} from 'ImageSource';
import type {ColorValue, PointValue} from 'StyleSheetTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
type ObjectType = $ReadOnly<{| prop: string |}>;
type ArrayObjectType = $ReadOnlyArray<$ReadOnly<{| prop: string |}>>;
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>,
// 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>,
// Double props
array_double_required: $ReadOnlyArray<Double>,
array_double_optional_key?: $ReadOnlyArray<Double>,
array_double_optional_value: ?$ReadOnlyArray<Double>,
array_double_optional_both?: ?$ReadOnlyArray<Double>,
// 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>,
// 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>,
// String enum props
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>,
// 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>,
// 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>,
// Object props
array_object_required: $ReadOnlyArray<$ReadOnly<{| prop: string |}>>,
array_object_optional_key?: $ReadOnlyArray<$ReadOnly<{| prop: string |}>>,
array_object_optional_value: ?ArrayObjectType,
array_object_optional_both?: ?$ReadOnlyArray<ObjectType>,
// Nested array object types
array_of_array_object_required: $ReadOnlyArray<
$ReadOnly<{|
// This needs to be the same name as the top level array above
array_object_required: $ReadOnlyArray<$ReadOnly<{| prop: string |}>>,
|}>
>,
array_of_array_object_optional_key?: $ReadOnlyArray<
$ReadOnly<{|
// This needs to be the same name as the top level array above
array_object_optional_key: $ReadOnlyArray<$ReadOnly<{| prop?: string |}>>,
|}>
>,
array_of_array_object_optional_value: ?$ReadOnlyArray<
$ReadOnly<{|
// This needs to be the same name as the top level array above
array_object_optional_value: $ReadOnlyArray<$ReadOnly<{| prop: ?string |}>>,
|}>
>,
array_of_array_object_optional_both?: ?$ReadOnlyArray<
$ReadOnly<{|
// This needs to be the same name as the top level array above
array_object_optional_both: $ReadOnlyArray<$ReadOnly<{| prop?: ?string |}>>,
|}>
>,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1,598 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [],
"events": [],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"props": [
{
"name": "array_boolean_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"type": "BooleanTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_boolean_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "BooleanTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_boolean_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "BooleanTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_boolean_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "BooleanTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_string_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"type": "StringTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_string_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "StringTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_string_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "StringTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_string_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "StringTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_double_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"type": "DoubleTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_double_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "DoubleTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_double_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "DoubleTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_double_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "DoubleTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_float_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"type": "FloatTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_float_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "FloatTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_float_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "FloatTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_float_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "FloatTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_int32_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"type": "Int32TypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_int32_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "Int32TypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_int32_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "Int32TypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_int32_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"type": "Int32TypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_enum_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"default": "small",
"options": [
{
"name": "small"
},
{
"name": "large"
}
],
"type": "StringEnumTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_enum_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"default": "small",
"options": [
{
"name": "small"
},
{
"name": "large"
}
],
"type": "StringEnumTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_image_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_image_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_image_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_image_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_color_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_color_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_color_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_color_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_point_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_point_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_point_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_point_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_object_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_object_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_object_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_object_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_of_array_object_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "array_object_required",
"optional": false,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_of_array_object_optional_key",
"optional": true,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "array_object_optional_key",
"optional": false,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_of_array_object_optional_value",
"optional": true,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "array_object_optional_value",
"optional": false,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
},
{
"name": "array_of_array_object_optional_both",
"optional": true,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "array_object_optional_both",
"optional": false,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
}
]
}
}
}
}
}

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

@ -0,0 +1,95 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/ARRAY_PROP_TYPES_NO_EVENTS.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {Float} from '../../lib/CodegenTypes';
import {Double} from '../../lib/CodegenTypes';
import {Int32} from '../../lib/CodegenTypes';
import {ReactNull} from '../../lib/CodegenTypes';
import {WithDefault} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ImageSource} from '../../lib/ImageSource';
import {ColorValue} from '../../lib/StyleSheetTypes';
import {PointValue} from '../../lib/StyleSheetTypes';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type ObjectType = Readonly<{
prop: string;
}>;
type ArrayObjectType = ReadonlyArray<Readonly<{
prop: string;
}>>;
type ModuleProps = Readonly<ViewProps & {
array_boolean_required: ReadonlyArray<boolean>;
array_boolean_optional_key?: ReadonlyArray<boolean>;
array_boolean_optional_value: (ReactNull | ReadonlyArray<boolean>);
array_boolean_optional_both?: (ReactNull | ReadonlyArray<boolean>);
array_string_required: ReadonlyArray<string>;
array_string_optional_key?: ReadonlyArray<string>;
array_string_optional_value: (ReactNull | ReadonlyArray<string>);
array_string_optional_both?: (ReactNull | ReadonlyArray<string>);
array_double_required: ReadonlyArray<Double>;
array_double_optional_key?: ReadonlyArray<Double>;
array_double_optional_value: (ReactNull | ReadonlyArray<Double>);
array_double_optional_both?: (ReactNull | ReadonlyArray<Double>);
array_float_required: ReadonlyArray<Float>;
array_float_optional_key?: ReadonlyArray<Float>;
array_float_optional_value: (ReactNull | ReadonlyArray<Float>);
array_float_optional_both?: (ReactNull | ReadonlyArray<Float>);
array_int32_required: ReadonlyArray<Int32>;
array_int32_optional_key?: ReadonlyArray<Int32>;
array_int32_optional_value: (ReactNull | ReadonlyArray<Int32>);
array_int32_optional_both?: (ReactNull | ReadonlyArray<Int32>);
array_enum_optional_key?: WithDefault<ReadonlyArray<'small' | 'large'>, 'small'>;
array_enum_optional_both?: WithDefault<ReadonlyArray<'small' | 'large'>, 'small'>;
array_image_required: ReadonlyArray<ImageSource>;
array_image_optional_key?: ReadonlyArray<ImageSource>;
array_image_optional_value: (ReactNull | ReadonlyArray<ImageSource>);
array_image_optional_both?: (ReactNull | ReadonlyArray<ImageSource>);
array_color_required: ReadonlyArray<ColorValue>;
array_color_optional_key?: ReadonlyArray<ColorValue>;
array_color_optional_value: (ReactNull | ReadonlyArray<ColorValue>);
array_color_optional_both?: (ReactNull | ReadonlyArray<ColorValue>);
array_point_required: ReadonlyArray<PointValue>;
array_point_optional_key?: ReadonlyArray<PointValue>;
array_point_optional_value: (ReactNull | ReadonlyArray<PointValue>);
array_point_optional_both?: (ReactNull | ReadonlyArray<PointValue>);
array_object_required: ReadonlyArray<Readonly<{
prop: string;
}>>;
array_object_optional_key?: ReadonlyArray<Readonly<{
prop: string;
}>>;
array_object_optional_value: (ReactNull | ArrayObjectType);
array_object_optional_both?: (ReactNull | ReadonlyArray<ObjectType>);
array_of_array_object_required: ReadonlyArray<Readonly<{
array_object_required: ReadonlyArray<Readonly<{
prop: string;
}>>;
}>>;
array_of_array_object_optional_key?: ReadonlyArray<Readonly<{
array_object_optional_key: ReadonlyArray<Readonly<{
prop?: string;
}>>;
}>>;
array_of_array_object_optional_value: (ReactNull | ReadonlyArray<Readonly<{
array_object_optional_value: ReadonlyArray<Readonly<{
prop: (ReactNull | string);
}>>;
}>>);
array_of_array_object_optional_both?: (ReactNull | ReadonlyArray<Readonly<{
array_object_optional_both: ReadonlyArray<Readonly<{
prop?: (ReactNull | string);
}>>;
}>>);
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,116 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
const codegenNativeComponent = require('codegenNativeComponent');
export type EventInFile = $ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>;
export type Boolean = boolean;
export type Int = Int32;
export type Void = void;
export type ModuleProps = $ReadOnly<{|
...ViewProps,
// No props
// Events defined inline
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>,
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>,
onDirectEventDefinedInline: DirectEventHandler<EventInFile>,
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>,
|}>;
type NativeType = NativeComponent<ModuleProps>;
export type ScrollTo = (viewRef: React.ElementRef<NativeType>, y: Int, animated: Boolean) => Void
interface NativeCommands {
+scrollTo: ScrollTo;
}
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['scrollTo']
});
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeType);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,95 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/COMMANDS_AND_EVENTS_TYPES_EXPORTED.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {BubblingEventHandler} from '../../lib/CodegenTypes';
import {DirectEventHandler} from '../../lib/CodegenTypes';
import {Float} from '../../lib/CodegenTypes';
import {Double} from '../../lib/CodegenTypes';
import {Int32} from '../../lib/CodegenTypes';
import {ReactNull} from '../../lib/CodegenTypes';
import * as React from '../../lib/React';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import codegenNativeCommands from '../../lib/codegenNativeCommands';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
export type EventInFile = Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>;
export type Boolean = boolean;
export type Int = Int32;
export type Void = void;
export type ModuleProps = Readonly<ViewProps & {
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>;
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>;
onDirectEventDefinedInline: DirectEventHandler<EventInFile>;
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>;
}>;
type NativeType = NativeComponent<ModuleProps>;
export type ScrollTo = (viewRef: React.ElementRef<NativeType>, y: Int, animated: Boolean) => Void;
interface NativeCommands {
readonly scrollTo: ScrollTo;
}
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['scrollTo']
});
export default (codegenNativeComponent<ModuleProps>('Module') as NativeType);

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

@ -0,0 +1,49 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32, Double, Float} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
export type ModuleProps = $ReadOnly<{|
...ViewProps,
// No props or events
|}>;
type NativeType = NativeComponent<ModuleProps>;
interface NativeCommands {
+hotspotUpdate: (viewRef: React.ElementRef<NativeType>, x: Int32, y: Int32) => void;
+scrollTo: (
viewRef: React.ElementRef<NativeType>,
x: Float,
y: Int32,
z: Double,
animated: boolean,
) => void;
}
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate', 'scrollTo'],
});
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeType);

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

@ -0,0 +1,74 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [
{
"name": "hotspotUpdate",
"optional": false,
"typeAnnotation": {
"params": [
{
"name": "x",
"typeAnnotation": {
"type": "Int32TypeAnnotation"
}
},
{
"name": "y",
"typeAnnotation": {
"type": "Int32TypeAnnotation"
}
}
],
"type": "FunctionTypeAnnotation"
}
},
{
"name": "scrollTo",
"optional": false,
"typeAnnotation": {
"params": [
{
"name": "x",
"typeAnnotation": {
"type": "FloatTypeAnnotation"
}
},
{
"name": "y",
"typeAnnotation": {
"type": "Int32TypeAnnotation"
}
},
{
"name": "z",
"typeAnnotation": {
"type": "DoubleTypeAnnotation"
}
},
{
"name": "animated",
"typeAnnotation": {
"type": "BooleanTypeAnnotation"
}
}
],
"type": "FunctionTypeAnnotation"
}
}
],
"events": [],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"props": []
}
}
}
}
}

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

@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/COMMANDS_DEFINED_WITH_ALL_TYPES.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {Float} from '../../lib/CodegenTypes';
import {Double} from '../../lib/CodegenTypes';
import {Int32} from '../../lib/CodegenTypes';
import * as React from '../../lib/React';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import codegenNativeCommands from '../../lib/codegenNativeCommands';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
export type ModuleProps = Readonly<ViewProps & {
}>;
type NativeType = NativeComponent<ModuleProps>;
interface NativeCommands {
hotspotUpdate(viewRef: React.ElementRef<NativeType>, x: Int32, y: Int32): void;
scrollTo(viewRef: React.ElementRef<NativeType>, x: Float, y: Int32, z: Double, animated: boolean): void;
}
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate', 'scrollTo']
});
export default (codegenNativeComponent<ModuleProps>('Module') as NativeType);

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

@ -0,0 +1,51 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
export type Boolean = boolean;
export type Int = Int32;
export type Void = void;
export type ModuleProps = $ReadOnly<{|
...ViewProps,
// No props or events
|}>;
type NativeType = NativeComponent<ModuleProps>;
export type ScrollTo = (
viewRef: React.ElementRef<NativeType>,
y: Int,
animated: Boolean,
) => Void;
interface NativeCommands {
+scrollTo: ScrollTo;
}
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['scrollTo'],
});
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeType);

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

@ -0,0 +1,41 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [
{
"name": "scrollTo",
"optional": false,
"typeAnnotation": {
"params": [
{
"name": "y",
"typeAnnotation": {
"type": "Int32TypeAnnotation"
}
},
{
"name": "animated",
"typeAnnotation": {
"type": "BooleanTypeAnnotation"
}
}
],
"type": "FunctionTypeAnnotation"
}
}
],
"events": [],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"props": []
}
}
}
}
}

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

@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/COMMANDS_WITH_EXTERNAL_TYPES.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {Int32} from '../../lib/CodegenTypes';
import * as React from '../../lib/React';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import codegenNativeCommands from '../../lib/codegenNativeCommands';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
export type Boolean = boolean;
export type Int = Int32;
export type Void = void;
export type ModuleProps = Readonly<ViewProps & {
}>;
type NativeType = NativeComponent<ModuleProps>;
export type ScrollTo = (viewRef: React.ElementRef<NativeType>, y: Int, animated: Boolean) => Void;
interface NativeCommands {
readonly scrollTo: ScrollTo;
}
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['scrollTo']
});
export default (codegenNativeComponent<ModuleProps>('Module') as NativeType);

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

@ -0,0 +1,50 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {BubblingEventHandler, DirectEventHandler} from 'CodegenTypese';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
type ModuleProps = $ReadOnly<{|
...ViewProps,
// No props
// Events defined inline
onDirectEventDefinedInlineNull: DirectEventHandler<null>,
onDirectEventDefinedInlineNullOptionalKey?: DirectEventHandler<null>,
onDirectEventDefinedInlineNullOptionalValue: ?DirectEventHandler<null>,
onDirectEventDefinedInlineNullOptionalBoth?: DirectEventHandler<null>,
onDirectEventDefinedInlineNullWithPaperName?: ?DirectEventHandler<
null,
'paperDirectEventDefinedInlineNullWithPaperName',
>,
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
onBubblingEventDefinedInlineNullOptionalKey?: BubblingEventHandler<null>,
onBubblingEventDefinedInlineNullOptionalValue: ?BubblingEventHandler<null>,
onBubblingEventDefinedInlineNullOptionalBoth?: ?BubblingEventHandler<null>,
onBubblingEventDefinedInlineNullWithPaperName?: ?BubblingEventHandler<
null,
'paperBubblingEventDefinedInlineNullWithPaperName',
>,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1,142 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [],
"events": [
{
"bubblingType": "direct",
"name": "onDirectEventDefinedInlineNull",
"optional": false,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "direct",
"name": "onDirectEventDefinedInlineNullOptionalKey",
"optional": true,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "direct",
"name": "onDirectEventDefinedInlineNullOptionalValue",
"optional": true,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "direct",
"name": "onDirectEventDefinedInlineNullOptionalBoth",
"optional": true,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "direct",
"name": "onDirectEventDefinedInlineNullWithPaperName",
"optional": true,
"paperTopLevelNameDeprecated": "paperDirectEventDefinedInlineNullWithPaperName",
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "bubble",
"name": "onBubblingEventDefinedInlineNull",
"optional": false,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "bubble",
"name": "onBubblingEventDefinedInlineNullOptionalKey",
"optional": true,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "bubble",
"name": "onBubblingEventDefinedInlineNullOptionalValue",
"optional": true,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "bubble",
"name": "onBubblingEventDefinedInlineNullOptionalBoth",
"optional": true,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "bubble",
"name": "onBubblingEventDefinedInlineNullWithPaperName",
"optional": true,
"paperTopLevelNameDeprecated": "paperBubblingEventDefinedInlineNullWithPaperName",
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
}
],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"props": []
}
}
}
}
}

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

@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/EVENTS_DEFINED_AS_NULL_INLINE.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {BubblingEventHandler} from '../../lib/CodegenTypes';
import {DirectEventHandler} from '../../lib/CodegenTypes';
import {ReactNull} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type ModuleProps = Readonly<ViewProps & {
onDirectEventDefinedInlineNull: DirectEventHandler<null>;
onDirectEventDefinedInlineNullOptionalKey?: DirectEventHandler<null>;
onDirectEventDefinedInlineNullOptionalValue: (ReactNull | DirectEventHandler<null>);
onDirectEventDefinedInlineNullOptionalBoth?: DirectEventHandler<null>;
onDirectEventDefinedInlineNullWithPaperName?: (ReactNull | DirectEventHandler<null, 'paperDirectEventDefinedInlineNullWithPaperName'>);
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>;
onBubblingEventDefinedInlineNullOptionalKey?: BubblingEventHandler<null>;
onBubblingEventDefinedInlineNullOptionalValue: (ReactNull | BubblingEventHandler<null>);
onBubblingEventDefinedInlineNullOptionalBoth?: (ReactNull | BubblingEventHandler<null>);
onBubblingEventDefinedInlineNullWithPaperName?: (ReactNull | BubblingEventHandler<null, 'paperBubblingEventDefinedInlineNullWithPaperName'>);
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,670 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {NativeComponent} from 'codegenNativeComponent';
const codegenNativeComponent = require('codegenNativeComponent');
import type {
Int32,
Double,
Float,
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
type ModuleProps = $ReadOnly<{|
...ViewProps,
// No Props
// Events
onDirectEventDefinedInline:
DirectEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
>,
onDirectEventDefinedInlineOptionalKey?:
DirectEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
>,
onDirectEventDefinedInlineOptionalValue: ?
DirectEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
>,
onDirectEventDefinedInlineOptionalBoth?: ?
DirectEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
>,
onDirectEventDefinedInlineWithPaperName?: ?
DirectEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
'paperDirectEventDefinedInlineWithPaperName',
>,
onBubblingEventDefinedInline:
BubblingEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
>,
onBubblingEventDefinedInlineOptionalKey?:
BubblingEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
>,
onBubblingEventDefinedInlineOptionalValue: ?
BubblingEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
>,
onBubblingEventDefinedInlineOptionalBoth?: ?
BubblingEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
>,
onBubblingEventDefinedInlineWithPaperName?: ?
BubblingEventHandler<
$ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>,
'paperBubblingEventDefinedInlineWithPaperName'
>,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,493 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/EVENTS_DEFINED_INLINE_WITH_ALL_TYPES.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {BubblingEventHandler} from '../../lib/CodegenTypes';
import {DirectEventHandler} from '../../lib/CodegenTypes';
import {Float} from '../../lib/CodegenTypes';
import {Double} from '../../lib/CodegenTypes';
import {Int32} from '../../lib/CodegenTypes';
import {ReactNull} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type ModuleProps = Readonly<ViewProps & {
onDirectEventDefinedInline: DirectEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>>;
onDirectEventDefinedInlineOptionalKey?: DirectEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>>;
onDirectEventDefinedInlineOptionalValue: (ReactNull | DirectEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>>);
onDirectEventDefinedInlineOptionalBoth?: (ReactNull | DirectEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>>);
onDirectEventDefinedInlineWithPaperName?: (ReactNull | DirectEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>, 'paperDirectEventDefinedInlineWithPaperName'>);
onBubblingEventDefinedInline: BubblingEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>>;
onBubblingEventDefinedInlineOptionalKey?: BubblingEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>>;
onBubblingEventDefinedInlineOptionalValue: (ReactNull | BubblingEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>>);
onBubblingEventDefinedInlineOptionalBoth?: (ReactNull | BubblingEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>>);
onBubblingEventDefinedInlineWithPaperName?: (ReactNull | BubblingEventHandler<Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>, 'paperBubblingEventDefinedInlineWithPaperName'>);
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,28 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
type ModuleProps = $ReadOnly<{|
...ViewProps,
|}>;
export default (codegenNativeComponent<ModuleProps>('Module', {
deprecatedViewConfigName: 'DeprecateModuleName',
}): NativeComponent<ModuleProps>);

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

@ -0,0 +1,20 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [],
"deprecatedViewConfigName": "DeprecateModuleName",
"events": [],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"props": []
}
}
}
}
}

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

@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type ModuleProps = Readonly<ViewProps & {
}>;
export default (codegenNativeComponent<ModuleProps>('Module', {
deprecatedViewConfigName: 'DeprecateModuleName'
}) as NativeComponent<ModuleProps>);

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

@ -0,0 +1,81 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {Int32, Double, Float, WithDefault} from 'CodegenTypes';
import type {ImageSource} from 'ImageSource';
import type {ColorValue, PointValue} from 'StyleSheetTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
type ModuleProps = $ReadOnly<{|
...ViewProps,
// Props
// Boolean props
boolean_required: $ReadOnly<{|prop: boolean|}>,
boolean_optional: $ReadOnly<{|prop?: WithDefault<boolean, false>|}>,
// String props
string_required: $ReadOnly<{|prop: string|}>,
string_optional: $ReadOnly<{|prop?: WithDefault<string, ''>|}>,
// Double props
double_required: $ReadOnly<{|prop: Double|}>,
double_optional: $ReadOnly<{|prop?: WithDefault<Double, 0.0>|}>,
// Float props
float_required: $ReadOnly<{|prop: Float|}>,
float_optional: $ReadOnly<{|prop?: WithDefault<Float, 0.0>|}>,
// Int32 props
int_required: $ReadOnly<{|prop: Int32|}>,
int_optional: $ReadOnly<{|prop?: WithDefault<Int32, 0>|}>,
// String enum props
enum_optional: $ReadOnly<{|
prop?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>,
|}>,
// ImageSource props
image_required: $ReadOnly<{|prop: ImageSource|}>,
image_optional_key: $ReadOnly<{|prop?: ImageSource|}>,
image_optional_value: $ReadOnly<{|prop: ?ImageSource|}>,
image_optional_both: $ReadOnly<{|prop?: ?ImageSource|}>,
// ColorValue props
color_required: $ReadOnly<{|prop: ColorValue|}>,
color_optional_key: $ReadOnly<{|prop?: ColorValue|}>,
color_optional_value: $ReadOnly<{|prop: ?ColorValue|}>,
color_optional_both: $ReadOnly<{|prop?: ?ColorValue|}>,
// PointValue props
point_required: $ReadOnly<{|prop: PointValue|}>,
point_optional_key: $ReadOnly<{|prop?: PointValue|}>,
point_optional_value: $ReadOnly<{|prop: ?PointValue|}>,
point_optional_both: $ReadOnly<{|prop?: ?PointValue|}>,
// Nested object props
object_required: $ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>,
object_optional_key?: $ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>,
object_optional_value: ?$ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>,
object_optional_both?: ?$ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1,526 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [],
"events": [],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"props": [
{
"name": "boolean_required",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": false,
"type": "BooleanTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "boolean_optional",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"default": false,
"type": "BooleanTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "string_required",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "string_optional",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"default": "",
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "double_required",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": 0,
"type": "DoubleTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "double_optional",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"default": 0,
"type": "DoubleTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "float_required",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": 0,
"type": "FloatTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "float_optional",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"default": 0,
"type": "FloatTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "int_required",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"default": 0,
"type": "Int32TypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "int_optional",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"default": 0,
"type": "Int32TypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "enum_optional",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"elementType": {
"default": "small",
"options": [
{
"name": "small"
},
{
"name": "large"
}
],
"type": "StringEnumTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "image_required",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "image_optional_key",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "image_optional_value",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "image_optional_both",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"name": "ImageSourcePrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "color_required",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "color_optional_key",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "color_optional_value",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "color_optional_both",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"name": "ColorPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "point_required",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "point_optional_key",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "point_optional_value",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "point_optional_both",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": true,
"typeAnnotation": {
"name": "PointPrimitive",
"type": "NativePrimitiveTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "object_required",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "nestedProp",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "object_optional_key",
"optional": true,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "nestedProp",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "object_optional_value",
"optional": true,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "nestedProp",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "object_optional_both",
"optional": true,
"typeAnnotation": {
"properties": [
{
"name": "prop",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "nestedProp",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
}
]
}
}
}
}
}

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

@ -0,0 +1,114 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/OBJECT_PROP_TYPES_NO_EVENTS.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {Float} from '../../lib/CodegenTypes';
import {Double} from '../../lib/CodegenTypes';
import {Int32} from '../../lib/CodegenTypes';
import {ReactNull} from '../../lib/CodegenTypes';
import {WithDefault} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ImageSource} from '../../lib/ImageSource';
import {ColorValue} from '../../lib/StyleSheetTypes';
import {PointValue} from '../../lib/StyleSheetTypes';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type ModuleProps = Readonly<ViewProps & {
boolean_required: Readonly<{
prop: boolean;
}>;
boolean_optional: Readonly<{
prop?: WithDefault<boolean, false>;
}>;
string_required: Readonly<{
prop: string;
}>;
string_optional: Readonly<{
prop?: WithDefault<string, ''>;
}>;
double_required: Readonly<{
prop: Double;
}>;
double_optional: Readonly<{
prop?: WithDefault<Double, 0.0>;
}>;
float_required: Readonly<{
prop: Float;
}>;
float_optional: Readonly<{
prop?: WithDefault<Float, 0.0>;
}>;
int_required: Readonly<{
prop: Int32;
}>;
int_optional: Readonly<{
prop?: WithDefault<Int32, 0>;
}>;
enum_optional: Readonly<{
prop?: WithDefault<ReadonlyArray<'small' | 'large'>, 'small'>;
}>;
image_required: Readonly<{
prop: ImageSource;
}>;
image_optional_key: Readonly<{
prop?: ImageSource;
}>;
image_optional_value: Readonly<{
prop: (ReactNull | ImageSource);
}>;
image_optional_both: Readonly<{
prop?: (ReactNull | ImageSource);
}>;
color_required: Readonly<{
prop: ColorValue;
}>;
color_optional_key: Readonly<{
prop?: ColorValue;
}>;
color_optional_value: Readonly<{
prop: (ReactNull | ColorValue);
}>;
color_optional_both: Readonly<{
prop?: (ReactNull | ColorValue);
}>;
point_required: Readonly<{
prop: PointValue;
}>;
point_optional_key: Readonly<{
prop?: PointValue;
}>;
point_optional_value: Readonly<{
prop: (ReactNull | PointValue);
}>;
point_optional_both: Readonly<{
prop?: (ReactNull | PointValue);
}>;
object_required: Readonly<{
prop: Readonly<{
nestedProp: string;
}>;
}>;
object_optional_key?: Readonly<{
prop: Readonly<{
nestedProp: string;
}>;
}>;
object_optional_value: (ReactNull | Readonly<{
prop: Readonly<{
nestedProp: string;
}>;
}>);
object_optional_both?: (ReactNull | Readonly<{
prop: Readonly<{
nestedProp: string;
}>;
}>);
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,41 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {
BubblingEventHandler,
DirectEventHandler,
WithDefault,
} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
type ModuleProps = $ReadOnly<{|
...ViewProps,
// Props
boolean_default_true_optional_both?: WithDefault<boolean, true>,
// Events
onDirectEventDefinedInlineNull: DirectEventHandler<null>,
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
|}>;
export default (codegenNativeComponent<ModuleProps>('Module', {
interfaceOnly: true,
paperComponentName: 'RCTModule',
}): NativeComponent<ModuleProps>);

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

@ -0,0 +1,55 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [],
"events": [
{
"bubblingType": "direct",
"name": "onDirectEventDefinedInlineNull",
"optional": false,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "bubble",
"name": "onBubblingEventDefinedInlineNull",
"optional": false,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
}
],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"interfaceOnly": true,
"paperComponentName": "RCTModule",
"props": [
{
"name": "boolean_default_true_optional_both",
"optional": true,
"typeAnnotation": {
"default": true,
"type": "BooleanTypeAnnotation"
}
}
]
}
}
}
}
}

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

@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {BubblingEventHandler} from '../../lib/CodegenTypes';
import {DirectEventHandler} from '../../lib/CodegenTypes';
import {WithDefault} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type ModuleProps = Readonly<ViewProps & {
boolean_default_true_optional_both?: WithDefault<boolean, true>;
onDirectEventDefinedInlineNull: DirectEventHandler<null>;
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>;
}>;
export default (codegenNativeComponent<ModuleProps>('Module', {
interfaceOnly: true,
paperComponentName: 'RCTModule'
}) as NativeComponent<ModuleProps>);

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

@ -0,0 +1,41 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {
BubblingEventHandler,
DirectEventHandler,
WithDefault,
} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
type ModuleProps = $ReadOnly<{|
...ViewProps,
// Props
boolean_default_true_optional_both?: WithDefault<boolean, true>,
// Events
onDirectEventDefinedInlineNull: DirectEventHandler<null>,
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
|}>;
export default codegenNativeComponent<ModuleProps>('Module', {
interfaceOnly: true,
paperComponentName: 'RCTModule',
});

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

@ -0,0 +1,55 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [],
"events": [
{
"bubblingType": "direct",
"name": "onDirectEventDefinedInlineNull",
"optional": false,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
},
{
"bubblingType": "bubble",
"name": "onBubblingEventDefinedInlineNull",
"optional": false,
"typeAnnotation": {
"argument": {
"properties": [],
"type": "ObjectTypeAnnotation"
},
"type": "EventTypeAnnotation"
}
}
],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"interfaceOnly": true,
"paperComponentName": "RCTModule",
"props": [
{
"name": "boolean_default_true_optional_both",
"optional": true,
"typeAnnotation": {
"default": true,
"type": "BooleanTypeAnnotation"
}
}
]
}
}
}
}
}

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

@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS_NO_CAST.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {BubblingEventHandler} from '../../lib/CodegenTypes';
import {DirectEventHandler} from '../../lib/CodegenTypes';
import {WithDefault} from '../../lib/CodegenTypes';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type ModuleProps = Readonly<ViewProps & {
boolean_default_true_optional_both?: WithDefault<boolean, true>;
onDirectEventDefinedInlineNull: DirectEventHandler<null>;
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>;
}>;
export default codegenNativeComponent<ModuleProps>('Module', {
interfaceOnly: true,
paperComponentName: 'RCTModule'
});

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

@ -0,0 +1,46 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
const codegenNativeComponent = require('codegenNativeComponent');
type DeepSpread = $ReadOnly<{|
otherStringProp: string,
|}>
export type PropsInFile = $ReadOnly<{|
...DeepSpread,
isEnabled: boolean,
label: string,
|}>;
export type ModuleProps = $ReadOnly<{|
...ViewProps,
...PropsInFile
localType: $ReadOnly<{|
...PropsInFile
|}>
localArr: $ReadOnlyArray<PropsInFile>
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1,113 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [],
"events": [],
"extendsProps": [
{
"knownTypeName": "ReactNativeCoreViewProps",
"type": "ReactNativeBuiltInType"
}
],
"props": [
{
"name": "otherStringProp",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "isEnabled",
"optional": false,
"typeAnnotation": {
"default": false,
"type": "BooleanTypeAnnotation"
}
},
{
"name": "label",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "localType",
"optional": false,
"typeAnnotation": {
"properties": [
{
"name": "otherStringProp",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "isEnabled",
"optional": false,
"typeAnnotation": {
"default": false,
"type": "BooleanTypeAnnotation"
}
},
{
"name": "label",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
}
},
{
"name": "localArr",
"optional": false,
"typeAnnotation": {
"elementType": {
"properties": [
{
"name": "otherStringProp",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "isEnabled",
"optional": false,
"typeAnnotation": {
"default": false,
"type": "BooleanTypeAnnotation"
}
},
{
"name": "label",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
}
],
"type": "ObjectTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
}
]
}
}
}
}
}

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

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/PROPS_ALIASED_LOCALLY.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type DeepSpread = Readonly<{
otherStringProp: string;
}>;
export type PropsInFile = Readonly<DeepSpread & {
isEnabled: boolean;
label: string;
}>;
export type ModuleProps = Readonly<ViewProps & PropsInFile & {
localType: Readonly<PropsInFile & {
}>;
localArr: ReadonlyArray<PropsInFile>;
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,100 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {
BubblingEventHandler,
DirectEventHandler,
} from 'CodegenTypes';
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'codegenNativeComponent';
const codegenNativeComponent = require('codegenNativeComponent');
export type EventInFile = $ReadOnly<{|
boolean_required: boolean,
boolean_optional_key?: boolean,
boolean_optional_value: ?boolean,
boolean_optional_both?: ?boolean,
string_required: string,
string_optional_key?: string,
string_optional_value: ?string,
string_optional_both?: ?string,
double_required: Double,
double_optional_key?: Double,
double_optional_value: ?Double,
double_optional_both?: ?Double,
float_required: Float,
float_optional_key?: Float,
float_optional_value: ?Float,
float_optional_both?: ?Float,
int32_required: Int32,
int32_optional_key?: Int32,
int32_optional_value: ?Int32,
int32_optional_both?: ?Int32,
enum_required: ('small' | 'large'),
enum_optional_key?: ('small' | 'large'),
enum_optional_value: ?('small' | 'large'),
enum_optional_both?: ?('small' | 'large'),
object_required: {
boolean_required: boolean,
}
object_optional_key?: {
string_optional_key?: string,
}
object_optional_value: ?{
float_optional_value: ?Float,
}
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
boolean_required: Int32,
string_optional_key?: string,
double_optional_value: ?Double,
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
|}>;
export type ModuleProps = $ReadOnly<{|
...ViewProps,
// No props
// Events defined inline
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>,
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>,
onDirectEventDefinedInline: DirectEventHandler<EventInFile>,
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,75 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/PROPS_AND_EVENTS_TYPES_EXPORTED.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {BubblingEventHandler} from '../../lib/CodegenTypes';
import {DirectEventHandler} from '../../lib/CodegenTypes';
import {Float} from '../../lib/CodegenTypes';
import {Double} from '../../lib/CodegenTypes';
import {Int32} from '../../lib/CodegenTypes';
import {ReactNull} from '../../lib/CodegenTypes';
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
export type EventInFile = Readonly<{
boolean_required: boolean;
boolean_optional_key?: boolean;
boolean_optional_value: (ReactNull | boolean);
boolean_optional_both?: (ReactNull | boolean);
string_required: string;
string_optional_key?: string;
string_optional_value: (ReactNull | string);
string_optional_both?: (ReactNull | string);
double_required: Double;
double_optional_key?: Double;
double_optional_value: (ReactNull | Double);
double_optional_both?: (ReactNull | Double);
float_required: Float;
float_optional_key?: Float;
float_optional_value: (ReactNull | Float);
float_optional_both?: (ReactNull | Float);
int32_required: Int32;
int32_optional_key?: Int32;
int32_optional_value: (ReactNull | Int32);
int32_optional_both?: (ReactNull | Int32);
enum_required: ('small' | 'large');
enum_optional_key?: ('small' | 'large');
enum_optional_value: (ReactNull | ('small' | 'large'));
enum_optional_both?: (ReactNull | ('small' | 'large'));
object_required: {
boolean_required: boolean;
};
object_optional_key?: {
string_optional_key?: string;
};
object_optional_value: (ReactNull | {
float_optional_value: (ReactNull | Float);
});
object_optional_both?: (ReactNull | {
int32_optional_both?: (ReactNull | Int32);
});
object_required_nested_2_layers: {
object_optional_nested_1_layer?: (ReactNull | {
boolean_required: Int32;
string_optional_key?: string;
double_optional_value: (ReactNull | Double);
float_optional_value: (ReactNull | Float);
int32_optional_both?: (ReactNull | Int32);
});
};
}>;
export type ModuleProps = Readonly<ViewProps & {
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>;
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>;
onDirectEventDefinedInline: DirectEventHandler<EventInFile>;
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>;
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,31 @@
// Automatically copied from components/__test_fixtures__/fixtures.js
// (/react-native/packages/react-native-codegen/src/parsers/flow)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const codegenNativeComponent = require('codegenNativeComponent');
import type {NativeComponent} from 'codegenNativeComponent';
export type String = string;
export type AnotherArray = $ReadOnlyArray<String>;
export type ModuleProps = $ReadOnly<{|
disable: String,
array: AnotherArray,
|}>;
export default (codegenNativeComponent<ModuleProps>(
'Module',
): NativeComponent<ModuleProps>);

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

@ -0,0 +1,33 @@
{
"modules": {
"Module": {
"components": {
"Module": {
"commands": [],
"events": [],
"extendsProps": [],
"props": [
{
"name": "disable",
"optional": false,
"typeAnnotation": {
"default": null,
"type": "StringTypeAnnotation"
}
},
{
"name": "array",
"optional": false,
"typeAnnotation": {
"elementType": {
"type": "StringTypeAnnotation"
},
"type": "ArrayTypeAnnotation"
}
}
]
}
}
}
}
}

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

@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from components_success/PROPS_AS_EXTERNAL_TYPES.flow.js
// (/react-native/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js)
import {NativeComponent} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
'use strict';
export type String = string;
export type AnotherArray = ReadonlyArray<String>;
export type ModuleProps = Readonly<{
disable: String;
array: AnotherArray;
}>;
export default (codegenNativeComponent<ModuleProps>('Module') as NativeComponent<ModuleProps>);

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

@ -0,0 +1,47 @@
// Automatically copied from ArrayPropsNativeComponent.js
// (/react-native/packages/react-native-codegen/e2e/__test_fixtures__)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {
PointValue,
ColorValue,
} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
import type {ImageSource} from '../../../../../Libraries/Image/ImageSource';
import type {
Int32,
Float,
WithDefault,
} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
...ViewProps,
// Props
names?: $ReadOnlyArray<string>,
disableds?: $ReadOnlyArray<boolean>,
progress?: $ReadOnlyArray<Int32>,
radii?: $ReadOnlyArray<Float>,
colors?: $ReadOnlyArray<ColorValue>,
srcs?: $ReadOnlyArray<ImageSource>,
points?: $ReadOnlyArray<PointValue>,
sizes?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>,
object?: $ReadOnlyArray<$ReadOnly<{|prop: string|}>>,
|}>;
export default (codegenNativeComponent<NativeProps>(
'ArrayPropsNativeComponentView',
): NativeComponentType<NativeProps>);

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

@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from ArrayPropsNativeComponent.js
// (/react-native/packages/react-native-codegen/e2e/__test_fixtures__)
import {Float} from '../../lib/CodegenTypes';
import {Int32} from '../../lib/CodegenTypes';
import {WithDefault} from '../../lib/CodegenTypes';
import {NativeComponentType} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ImageSource} from '../../lib/ImageSource';
import {ColorValue} from '../../lib/StyleSheetTypes';
import {PointValue} from '../../lib/StyleSheetTypes';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type NativeProps = Readonly<ViewProps & {
names?: ReadonlyArray<string>;
disableds?: ReadonlyArray<boolean>;
progress?: ReadonlyArray<Int32>;
radii?: ReadonlyArray<Float>;
colors?: ReadonlyArray<ColorValue>;
srcs?: ReadonlyArray<ImageSource>;
points?: ReadonlyArray<PointValue>;
sizes?: WithDefault<ReadonlyArray<'small' | 'large'>, 'small'>;
object?: ReadonlyArray<Readonly<{
prop: string;
}>>;
}>;
export default (codegenNativeComponent<NativeProps>('ArrayPropsNativeComponentView') as NativeComponentType<NativeProps>);

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

@ -0,0 +1,30 @@
// Automatically copied from BooleanPropNativeComponent.js
// (/react-native/packages/react-native-codegen/e2e/__test_fixtures__)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
...ViewProps,
// Props
disabled?: WithDefault<boolean, false>,
|}>;
export default (codegenNativeComponent<NativeProps>(
'BooleanPropNativeComponentView',
): NativeComponentType<NativeProps>);

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

@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from BooleanPropNativeComponent.js
// (/react-native/packages/react-native-codegen/e2e/__test_fixtures__)
import {WithDefault} from '../../lib/CodegenTypes';
import {NativeComponentType} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type NativeProps = Readonly<ViewProps & {
disabled?: WithDefault<boolean, false>;
}>;
export default (codegenNativeComponent<NativeProps>('BooleanPropNativeComponentView') as NativeComponentType<NativeProps>);

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

@ -0,0 +1,30 @@
// Automatically copied from ColorPropNativeComponent.js
// (/react-native/packages/react-native-codegen/e2e/__test_fixtures__)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import type {ColorValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
...ViewProps,
// Props
tintColor?: ColorValue,
|}>;
export default (codegenNativeComponent<NativeProps>(
'ColorPropNativeComponentView',
): NativeComponentType<NativeProps>);

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

@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Automatically generated from ColorPropNativeComponent.js
// (/react-native/packages/react-native-codegen/e2e/__test_fixtures__)
import {NativeComponentType} from '../../lib/codegenNativeComponent';
import codegenNativeComponent from '../../lib/codegenNativeComponent';
import {ColorValue} from '../../lib/StyleSheetTypes';
import {ViewProps} from '../../lib/ViewPropTypes';
'use strict';
type NativeProps = Readonly<ViewProps & {
tintColor?: ColorValue;
}>;
export default (codegenNativeComponent<NativeProps>('ColorPropNativeComponentView') as NativeComponentType<NativeProps>);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше