Skip to content

Commit

Permalink
Cleanup imports and types (#44862)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #44862

Clean up:
* type imports to be consistent
* Remove long since deprecated `{| ... |}` exact object style.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D58381905

fbshipit-source-id: 4c061385a987a2bc7dd8339183533084f1efd699
  • Loading branch information
pieterv authored and facebook-github-bot committed Jun 11, 2024
1 parent 32c3cd3 commit c9d7774
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
9 changes: 5 additions & 4 deletions packages/react-native/Libraries/Text/TextNativeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
* @format
*/

import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
import type {ProcessedColorValue} from '../StyleSheet/processColor';
import type {PressEvent} from '../Types/CoreEventTypes';
import type {TextProps} from './TextProps';

import {createViewConfig} from '../NativeComponent/ViewConfig';
import UIManager from '../ReactNative/UIManager';
import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
import {type HostComponent} from '../Renderer/shims/ReactNativeTypes';
import {type ProcessedColorValue} from '../StyleSheet/processColor';
import {type PressEvent} from '../Types/CoreEventTypes';
import {type TextProps} from './TextProps';

type NativeTextProps = $ReadOnly<{
...TextProps,
Expand Down
12 changes: 6 additions & 6 deletions packages/react-native/Libraries/Text/TextProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ import type {
} from '../Types/CoreEventTypes';
import type {Node} from 'react';

export type PressRetentionOffset = $ReadOnly<{|
export type PressRetentionOffset = $ReadOnly<{
top: number,
left: number,
bottom: number,
right: number,
|}>;
}>;

type PointerEventProps = $ReadOnly<{|
type PointerEventProps = $ReadOnly<{
onPointerEnter?: (event: PointerEvent) => void,
onPointerLeave?: (event: PointerEvent) => void,
onPointerMove?: (event: PointerEvent) => void,
|}>;
}>;

/**
* @see https://reactnative.dev/docs/text#reference
*/
export type TextProps = $ReadOnly<{|
export type TextProps = $ReadOnly<{
...PointerEventProps,

/**
Expand Down Expand Up @@ -265,4 +265,4 @@ export type TextProps = $ReadOnly<{|
* See https://reactnative.dev/docs/text.html#linebreakstrategyios
*/
lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
|}>;
}>;
Original file line number Diff line number Diff line change
Expand Up @@ -8018,18 +8018,18 @@ declare export const NativeVirtualText: HostComponent<NativeTextProps>;
`;

exports[`public API should not change unintentionally Libraries/Text/TextProps.js 1`] = `
"export type PressRetentionOffset = $ReadOnly<{|
"export type PressRetentionOffset = $ReadOnly<{
top: number,
left: number,
bottom: number,
right: number,
|}>;
type PointerEventProps = $ReadOnly<{|
}>;
type PointerEventProps = $ReadOnly<{
onPointerEnter?: (event: PointerEvent) => void,
onPointerLeave?: (event: PointerEvent) => void,
onPointerMove?: (event: PointerEvent) => void,
|}>;
export type TextProps = $ReadOnly<{|
}>;
export type TextProps = $ReadOnly<{
...PointerEventProps,
accessible?: ?boolean,
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
Expand Down Expand Up @@ -8094,7 +8094,7 @@ export type TextProps = $ReadOnly<{|
minimumFontScale?: ?number,
suppressHighlighting?: ?boolean,
lineBreakStrategyIOS?: ?(\\"none\\" | \\"standard\\" | \\"hangul-word\\" | \\"push-out\\"),
|}>;
}>;
"
`;

Expand Down

0 comments on commit c9d7774

Please sign in to comment.