diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index 681922ea13fdde..a3aa9dfad067aa 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -21,7 +21,6 @@ const nullthrows = require('nullthrows'); const processColor = require('../StyleSheet/processColor'); import type {PressEvent} from '../Types/CoreEventTypes'; -import type {HostComponent} from '../Renderer/shims/ReactNativeTypes'; import type {PressRetentionOffset, TextProps} from './TextProps'; type ResponseHandlers = $ReadOnly<{| @@ -231,27 +230,30 @@ const isTouchable = (props: Props): boolean => props.onLongPress != null || props.onStartShouldSetResponder != null; -const Text = ( - props: TextProps, - forwardedRef: ?React.Ref, -) => { - return ; -}; -const TextToExport = React.forwardRef(Text); -TextToExport.displayName = 'Text'; +const Text: React.AbstractComponent< + TextProps, + React.ElementRef, +> = React.forwardRef( + ( + props: TextProps, + forwardedRef: ?React.Ref, + ) => { + return ; + }, +); +Text.displayName = 'Text'; // TODO: Deprecate this. /* $FlowFixMe(>=0.89.0 site=react_native_fb) This comment suppresses an error * found when Flow v0.89 was deployed. To see the error, delete this comment * and run Flow. */ -TextToExport.propTypes = DeprecatedTextPropTypes; +Text.propTypes = DeprecatedTextPropTypes; -type TextStatics = $ReadOnly<{| - propTypes: typeof DeprecatedTextPropTypes, -|}>; +const TextToExport: typeof Text & + $ReadOnly<{| + propTypes: typeof DeprecatedTextPropTypes, + |}> = + // $FlowFixMe[incompatible-type] - No good way to type a React.AbstractComponent with statics. + Text; -module.exports = ((TextToExport: any): React.AbstractComponent< - TextProps, - React.ElementRef>, -> & - TextStatics); +module.exports = TextToExport;