mirror of
https://github.com/status-im/react-native.git
synced 2025-01-12 10:34:57 +00:00
Add onTextLayout to TextProps
Summary: Splitting this into a separate diff for OSS Reviewed By: yungsters Differential Revision: D9551085 fbshipit-source-id: 8ca08351c6b89cd0011aab3c47ef6cc28b763450
This commit is contained in:
parent
b8f6adf654
commit
1736be5811
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import type {LayoutEvent, PressEvent} from 'CoreEventTypes';
|
import type {LayoutEvent, PressEvent, TextLayoutEvent} from 'CoreEventTypes';
|
||||||
import type React from 'React';
|
import type React from 'React';
|
||||||
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
|
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
|
||||||
import type {
|
import type {
|
||||||
@ -48,6 +48,7 @@ export type TextProps = $ReadOnly<{
|
|||||||
onResponderTerminate?: ?Function,
|
onResponderTerminate?: ?Function,
|
||||||
onResponderTerminationRequest?: ?Function,
|
onResponderTerminationRequest?: ?Function,
|
||||||
onStartShouldSetResponder?: ?Function,
|
onStartShouldSetResponder?: ?Function,
|
||||||
|
onTextLayout?: ?(event: TextLayoutEvent) => mixed,
|
||||||
pressRetentionOffset?: ?PressRetentionOffset,
|
pressRetentionOffset?: ?PressRetentionOffset,
|
||||||
selectable?: ?boolean,
|
selectable?: ?boolean,
|
||||||
style?: ?DangerouslyImpreciseStyleProp,
|
style?: ?DangerouslyImpreciseStyleProp,
|
||||||
|
@ -36,12 +36,27 @@ export type Layout = $ReadOnly<{|
|
|||||||
height: number,
|
height: number,
|
||||||
|}>;
|
|}>;
|
||||||
|
|
||||||
|
export type TextLayout = $ReadOnly<{|
|
||||||
|
...Layout,
|
||||||
|
ascender: number,
|
||||||
|
capHeight: number,
|
||||||
|
descender: number,
|
||||||
|
text: string,
|
||||||
|
xHeight: number,
|
||||||
|
|}>;
|
||||||
|
|
||||||
export type LayoutEvent = SyntheticEvent<
|
export type LayoutEvent = SyntheticEvent<
|
||||||
$ReadOnly<{|
|
$ReadOnly<{|
|
||||||
layout: Layout,
|
layout: Layout,
|
||||||
|}>,
|
|}>,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
export type TextLayoutEvent = SyntheticEvent<
|
||||||
|
$ReadOnly<{|
|
||||||
|
lines: Array<TextLayout>,
|
||||||
|
|}>,
|
||||||
|
>;
|
||||||
|
|
||||||
export type PressEvent = SyntheticEvent<
|
export type PressEvent = SyntheticEvent<
|
||||||
$ReadOnly<{|
|
$ReadOnly<{|
|
||||||
changedTouches: $ReadOnlyArray<$PropertyType<PressEvent, 'nativeEvent'>>,
|
changedTouches: $ReadOnlyArray<$PropertyType<PressEvent, 'nativeEvent'>>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user