feat(hippy-react): added Text displayName

This commit is contained in:
zoomchan-cxj
2021-01-13 18:25:01 +08:00
parent 1dd97839a9
commit f5912066a5
+10 -4
View File
@@ -49,7 +49,11 @@ interface TextProps extends LayoutableProps, ClickableProps {
* `Text` doesn't support nesting.
* @noInheritDoc
*/
const Text = React.forwardRef(({ style, ...nativeProps }: TextProps, ref) => {
function forwardRef(
{ style, ...nativeProps }: TextProps,
// eslint-disable-next-line max-len
ref: string | ((instance: HTMLParagraphElement | null) => void) | React.RefObject<HTMLParagraphElement> | null | undefined,
) {
const nativeStyle: undefined | Style | Style[] = style;
// Fill default color
@@ -83,9 +87,11 @@ const Text = React.forwardRef(({ style, ...nativeProps }: TextProps, ref) => {
}
return (
// @ts-ignore
// @ts-ignore
<p ref={ref} nativeName="Text" style={nativeStyle} {...nativeProps} />
);
});
}
forwardRef.displayName = 'Text';
const Text = React.forwardRef(forwardRef);
Text.displayName = 'Text';
export default Text;