Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions types/react-native/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,11 @@ export interface TextProps extends TextPropsIOS, TextPropsAndroid, Accessibility
*/
ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip' | undefined;

/**
* Used to reference react managed views from native code.
*/
id?: string | undefined;

/**
* Line Break mode. Works only with numberOfLines.
* clip is working only for iOS
Expand Down Expand Up @@ -2398,6 +2403,11 @@ export interface ViewProps
*/
hitSlop?: Insets | undefined;

/**
* Used to reference react managed views from native code.
*/
id?: string | undefined;

/**
* Invoked on mount and layout changes with
*
Expand Down Expand Up @@ -3646,6 +3656,11 @@ export interface ImagePropsBase extends ImagePropsIOS, ImagePropsAndroid, Access

borderBottomRightRadius?: number | undefined;

/**
* Used to reference react managed images from native code.
*/
id?: string | undefined;

/**
* Determines how to resize the image when the frame doesn't match the raw
* image dimensions.
Expand Down Expand Up @@ -4906,6 +4921,11 @@ export interface TouchableWithoutFeedbackProps
*/
hitSlop?: Insets | undefined;

/**
* Used to reference react managed views from native code.
*/
id?: string | undefined;

/**
* When `accessible` is true (which is the default) this may be called when
* the OS-specific concept of "blur" occurs, meaning the element lost focus.
Expand Down
13 changes: 13 additions & 0 deletions types/react-native/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ import {
ToastAndroid,
Touchable,
LayoutAnimation,
TouchableWithoutFeedback,
} from 'react-native';

declare module 'react-native' {
Expand Down Expand Up @@ -1439,6 +1440,18 @@ const NativeIDTest = () => (
</ScrollView>
);

const IdTest = () => (
<View id={'id'}>
<TouchableWithoutFeedback id={'id'} onPress={() => {}} />
<Text id={'id'}>Text</Text>
<TextInput id={'id'} value="text" />
<Image
source={{ uri: 'https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png' }}
id={'id'}
/>
</View>
);

const ScrollViewMaintainVisibleContentPositionTest = () => (
<ScrollView maintainVisibleContentPosition={{ autoscrollToTopThreshold: 1, minIndexForVisible: 10 }}></ScrollView>
);
Expand Down