mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: This diff removes an option from the codegen and replaces it with two new options Removes: - `isDeprecatedPaperComponentNameRCT` Adds: - `paperComponentName`: a better version of the removed option that allows more than just adding RCT - `paperComponentNameDeprecated`: a new option that allows migrating native code to a new name ``` // Use for components with no current paper rename in progress // Does not check for new name paperComponentName?: string, // Use for components currently being renamed in paper // Will use new name if it is available and fallback to this name paperComponentNameDeprecated?: string, ``` For example, Slider uses `paperComponentName: 'RCTSlider'` because it has a different name in fabric but is not currently being migrated to a new name. Because of other work in progress, we don't want to use UIManager check if we don't need to Reviewed By: shergin Differential Revision: D15857629 fbshipit-source-id: ca0d3b7dc4a75e00d136ae1f5c84f7423960399d
157 lines
3.7 KiB
JavaScript
157 lines
3.7 KiB
JavaScript
/**
|
|
* 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.
|
|
*
|
|
* @flow strict
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
export type ObjectPropertyType =
|
|
| $ReadOnly<{|
|
|
type: 'BooleanTypeAnnotation',
|
|
name: string,
|
|
optional: boolean,
|
|
|}>
|
|
| $ReadOnly<{|
|
|
type: 'StringTypeAnnotation',
|
|
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>,
|
|
|}>;
|
|
|
|
type PropTypeTypeAnnotation =
|
|
| $ReadOnly<{|
|
|
type: 'BooleanTypeAnnotation',
|
|
default: boolean,
|
|
|}>
|
|
| $ReadOnly<{|
|
|
type: 'StringTypeAnnotation',
|
|
default: string | null,
|
|
|}>
|
|
| $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: 'ArrayTypeAnnotation',
|
|
elementType:
|
|
| $ReadOnly<{|
|
|
type: 'BooleanTypeAnnotation',
|
|
|}>
|
|
| $ReadOnly<{|
|
|
type: 'StringTypeAnnotation',
|
|
|}>
|
|
| $ReadOnly<{|
|
|
type: 'FloatTypeAnnotation',
|
|
|}>
|
|
| $ReadOnly<{|
|
|
type: 'Int32TypeAnnotation',
|
|
|}>
|
|
| $ReadOnly<{|
|
|
type: 'StringEnumTypeAnnotation',
|
|
default: string,
|
|
options: $ReadOnlyArray<{|
|
|
name: string,
|
|
|}>,
|
|
|}>
|
|
| $ReadOnly<{|
|
|
type: 'NativePrimitiveTypeAnnotation',
|
|
name: 'ColorPrimitive' | 'ImageSourcePrimitive' | 'PointPrimitive',
|
|
|}>,
|
|
|}>;
|
|
|
|
export type PropTypeShape = $ReadOnly<{|
|
|
name: string,
|
|
optional: boolean,
|
|
typeAnnotation: PropTypeTypeAnnotation,
|
|
|}>;
|
|
|
|
export type EventTypeShape = $ReadOnly<{|
|
|
name: string,
|
|
bubblingType: 'direct' | 'bubble',
|
|
optional: boolean,
|
|
typeAnnotation: $ReadOnly<{|
|
|
type: 'EventTypeAnnotation',
|
|
argument?: $ReadOnly<{|
|
|
type: 'ObjectTypeAnnotation',
|
|
properties: $ReadOnlyArray<ObjectPropertyType>,
|
|
|}>,
|
|
|}>,
|
|
|}>;
|
|
|
|
export type OptionsShape = $ReadOnly<{|
|
|
interfaceOnly?: boolean,
|
|
|
|
// Use for components with no current paper rename in progress
|
|
// Does not check for new name
|
|
paperComponentName?: string,
|
|
|
|
// Use for components currently being renamed in paper
|
|
// Will use new name if it is available and fallback to this name
|
|
paperComponentNameDeprecated?: string,
|
|
|}>;
|
|
|
|
export type ExtendsPropsShape = $ReadOnly<{|
|
|
type: 'ReactNativeBuiltInType',
|
|
knownTypeName: 'ReactNativeCoreViewProps',
|
|
|}>;
|
|
|
|
export type ComponentShape = $ReadOnly<{|
|
|
...OptionsShape,
|
|
extendsProps: $ReadOnlyArray<ExtendsPropsShape>,
|
|
events: $ReadOnlyArray<EventTypeShape>,
|
|
props: $ReadOnlyArray<PropTypeShape>,
|
|
|}>;
|
|
|
|
export type SchemaType = $ReadOnly<{|
|
|
modules: $ReadOnly<{
|
|
[module: string]: $ReadOnly<{|
|
|
components?: $ReadOnly<{
|
|
[component: string]: ComponentShape,
|
|
}>,
|
|
|}>,
|
|
}>,
|
|
|}>;
|