mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
RN: Fix registerGeneratedViewConfig Types
Summary: Fixes types in `registerGeneratedViewConfig` and also removes some unnecessary hacks for the `ReactNativeViewViewConfig` type. Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D25076608 fbshipit-source-id: 5cb2060e11db598b42fbb7f2f8aecfd7f4b262ef
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e136aa3fc4
commit
5b527fefcb
@@ -9,15 +9,17 @@
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import {type ViewConfig} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import ReactNativeViewViewConfigAndroid from './ReactNativeViewViewConfigAndroid';
|
||||
import {Platform} from 'react-native';
|
||||
|
||||
const ReactNativeViewConfig = {
|
||||
const ReactNativeViewConfig: ViewConfig = {
|
||||
uiViewClassName: 'RCTView',
|
||||
baseModuleName: null,
|
||||
Manager: 'ViewManager',
|
||||
Commands: ({}: {...}),
|
||||
Constants: ({}: {...}),
|
||||
Commands: {},
|
||||
Constants: {},
|
||||
bubblingEventTypes: {
|
||||
...ReactNativeViewViewConfigAndroid.bubblingEventTypes,
|
||||
topBlur: {
|
||||
@@ -171,7 +173,7 @@ const ReactNativeViewConfig = {
|
||||
flexShrink: true,
|
||||
flexWrap: true,
|
||||
height: true,
|
||||
hitSlop: {diff: (require('../../Utilities/differ/insetsDiffer'): any)},
|
||||
hitSlop: {diff: require('../../Utilities/differ/insetsDiffer')},
|
||||
importantForAccessibility: true,
|
||||
justifyContent: true,
|
||||
left: true,
|
||||
@@ -322,9 +324,10 @@ const ReactNativeViewConfig = {
|
||||
textTransform: true,
|
||||
tintColor: {process: require('../../StyleSheet/processColor')},
|
||||
top: true,
|
||||
transform: ((Platform.OS === 'ios'
|
||||
? {diff: require('../../Utilities/differ/matricesDiffer')}
|
||||
: {process: require('../../StyleSheet/processTransform')}): any),
|
||||
transform:
|
||||
Platform.OS === 'ios'
|
||||
? {diff: require('../../Utilities/differ/matricesDiffer')}
|
||||
: {process: require('../../StyleSheet/processTransform')},
|
||||
transformMatrix: true,
|
||||
translateX: true,
|
||||
translateY: true,
|
||||
@@ -334,9 +337,10 @@ const ReactNativeViewConfig = {
|
||||
},
|
||||
testID: true,
|
||||
top: true,
|
||||
transform: ((Platform.OS === 'ios'
|
||||
? {diff: require('../../Utilities/differ/matricesDiffer')}
|
||||
: {process: require('../../StyleSheet/processTransform')}): any),
|
||||
transform:
|
||||
Platform.OS === 'ios'
|
||||
? {diff: require('../../Utilities/differ/matricesDiffer')}
|
||||
: {process: require('../../StyleSheet/processTransform')},
|
||||
translateX: true,
|
||||
translateY: true,
|
||||
width: true,
|
||||
|
||||
@@ -51,8 +51,10 @@ export type AttributeConfiguration<
|
||||
|
||||
export type ViewConfig = $ReadOnly<{
|
||||
Commands?: $ReadOnly<{[commandName: string]: number, ...}>,
|
||||
Constants?: $ReadOnly<{[name: string]: mixed, ...}>,
|
||||
Manager?: string,
|
||||
NativeProps?: $ReadOnly<{[propName: string]: string, ...}>,
|
||||
baseModuleName?: string,
|
||||
baseModuleName?: ?string,
|
||||
bubblingEventTypes?: $ReadOnly<{
|
||||
[eventName: string]: $ReadOnly<{
|
||||
phasedRegistrationNames: $ReadOnly<{
|
||||
|
||||
@@ -23,26 +23,26 @@ function registerGeneratedViewConfig(
|
||||
const staticViewConfig = {
|
||||
uiViewClassName: componentName,
|
||||
Commands: {},
|
||||
/* $FlowFixMe(>=0.122.0 site=react_native_fb) This comment suppresses an
|
||||
* error found when Flow v0.122.0 was deployed. To see the error, delete
|
||||
* this comment and run Flow. */
|
||||
// $FlowFixMe[cannot-spread-indexer] Properties can be overridden.
|
||||
bubblingEventTypes: {
|
||||
...ReactNativeViewViewConfig.bubblingEventTypes,
|
||||
...(viewConfig.bubblingEventTypes || {}),
|
||||
...(viewConfig.bubblingEventTypes ?? {}: $NonMaybeType<
|
||||
$PropertyType<PartialViewConfig, 'bubblingEventTypes'>,
|
||||
>),
|
||||
},
|
||||
/* $FlowFixMe(>=0.122.0 site=react_native_fb) This comment suppresses an
|
||||
* error found when Flow v0.122.0 was deployed. To see the error, delete
|
||||
* this comment and run Flow. */
|
||||
// $FlowFixMe[cannot-spread-indexer] Properties can be overridden.
|
||||
directEventTypes: {
|
||||
...ReactNativeViewViewConfig.directEventTypes,
|
||||
...(viewConfig.directEventTypes || {}),
|
||||
...(viewConfig.directEventTypes ?? {}: $NonMaybeType<
|
||||
$PropertyType<PartialViewConfig, 'directEventTypes'>,
|
||||
>),
|
||||
},
|
||||
/* $FlowFixMe(>=0.122.0 site=react_native_fb) This comment suppresses an
|
||||
* error found when Flow v0.122.0 was deployed. To see the error, delete
|
||||
* this comment and run Flow. */
|
||||
// $FlowFixMe[cannot-spread-indexer] Properties can be overridden.
|
||||
validAttributes: {
|
||||
...ReactNativeViewViewConfig.validAttributes,
|
||||
...(viewConfig.validAttributes || {}),
|
||||
...(viewConfig.validAttributes ?? {}: $NonMaybeType<
|
||||
$PropertyType<PartialViewConfig, 'validAttributes'>,
|
||||
>),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user