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
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
*/

import type * as React from 'react';
import {Constructor} from '../../../types/private/Utilities';
import {TimerMixin} from '../../../types/private/TimerMixin';
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
import {TouchableMixin} from './Touchable';
import {View} from '../../Components/View/View';
import {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';

/**
Expand Down Expand Up @@ -60,9 +57,6 @@ export interface TouchableHighlightProps extends TouchableWithoutFeedbackProps {
*
* @see https://reactnative.dev/docs/touchablehighlight
*/
declare class TouchableHighlightComponent extends React.Component<TouchableHighlightProps> {}
declare const TouchableHighlightBase: Constructor<NativeMethods> &
Constructor<TimerMixin> &
Constructor<TouchableMixin> &
typeof TouchableHighlightComponent;
export class TouchableHighlight extends TouchableHighlightBase {}
export const TouchableHighlight: React.ForwardRefExoticComponent<
React.PropsWithoutRef<TouchableHighlightProps> & React.RefAttributes<View>
>;
27 changes: 27 additions & 0 deletions packages/react-native/types/__typetests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import {
TextStyle,
TouchableNativeFeedback,
TouchableOpacity,
TouchableHighlight,
TouchableWithoutFeedback,
UIManager,
View,
Expand Down Expand Up @@ -484,6 +485,32 @@ function TouchableTest() {
}
}

export class TouchableHighlightTest extends React.Component {
buttonRef = React.createRef<React.ElementRef<typeof TouchableHighlight>>();

render() {
return (
<>
<TouchableHighlight ref={this.buttonRef} />
<TouchableHighlight
ref={ref => {
ref?.focus();
ref?.blur();
ref?.measure(
(x, y, width, height, pageX, pageY): number =>
x + y + width + height + pageX + pageY,
);
ref?.measureInWindow(
(x, y, width, height): number => x + y + width + height,
);
ref?.setNativeProps({focusable: false});
}}
/>
</>
);
}
}

export class TouchableOpacityTest extends React.Component {
render() {
return (
Expand Down