Skip to content
Merged
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 numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,6 @@ import type {
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
import usePressability from '../../Pressability/usePressability';
import {type RectOrSize} from '../../StyleSheet/Rect';
import StyleSheet from '../../StyleSheet/StyleSheet';
import useMergeRefs from '../../Utilities/useMergeRefs';
import View from '../View/View';
import useAndroidRippleForView, {
Expand DownExpand Up@@ -348,23 +347,14 @@ function Pressable(
{...restPropsWithDefaults}
{...eventHandlers}
ref={mergedRef}
style={[
styles.pressable,
typeof style === 'function' ? style({pressed}) : style,
]}
style={typeof style === 'function' ? style({pressed}) : style}
collapsable={false}>
{typeof children === 'function' ? children({pressed}) : children}
{__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
</View>
);
}

const styles = StyleSheet.create({
pressable: {
cursor: 'pointer',
},
});

function usePressState(forcePressed: boolean): [boolean, (boolean) => void] {
const [pressed, setPressed] = useState(false);
return [pressed || forcePressed, setPressed];
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,14 +31,6 @@ exports[`<Pressable /> should render as expected: should deep render when mocked
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -75,14 +67,6 @@ exports[`<Pressable /> should render as expected: should deep render when not mo
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -119,14 +103,6 @@ exports[`<Pressable disabled={true} /> should be disabled when disabled is true:
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -163,14 +139,6 @@ exports[`<Pressable disabled={true} /> should be disabled when disabled is true:
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -207,14 +175,6 @@ exports[`<Pressable disabled={true} accessibilityState={{}} /> should be disable
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -251,14 +211,6 @@ exports[`<Pressable disabled={true} accessibilityState={{}} /> should be disable
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -295,14 +247,6 @@ exports[`<Pressable disabled={true} accessibilityState={{checked: true}} /> shou
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -339,14 +283,6 @@ exports[`<Pressable disabled={true} accessibilityState={{checked: true}} /> shou
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -383,14 +319,6 @@ exports[`<Pressable disabled={true} accessibilityState={{disabled: false}} /> sh
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -427,14 +355,6 @@ exports[`<Pressable disabled={true} accessibilityState={{disabled: false}} /> sh
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -329,13 +329,10 @@ class TouchableHighlight extends React.Component<Props, State> {
accessibilityElementsHidden={
this.props['aria-hidden'] ?? this.props.accessibilityElementsHidden
}
style={[
styles.touchable,
StyleSheet.compose(
this.props.style,
this.state.extraStyles?.underlay,
),
]}
style={StyleSheet.compose(
this.props.style,
this.state.extraStyles?.underlay,
)}
onLayout={this.props.onLayout}
hitSlop={this.props.hitSlop}
hasTVPreferredFocus={this.props.hasTVPreferredFocus}
Expand DownExpand Up@@ -384,12 +381,6 @@ class TouchableHighlight extends React.Component<Props, State> {
}
}

const styles = StyleSheet.create({
touchable: {
cursor: 'pointer',
},
});

const Touchable: React.AbstractComponent<
$ReadOnly<$Diff<Props, {|+hostRef: mixed|}>>,
React.ElementRef<typeof View>,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@ import Pressability, {
} from '../../Pressability/Pressability';
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
import flattenStyle from '../../StyleSheet/flattenStyle';
import StyleSheet from '../../StyleSheet/StyleSheet';
import Platform from '../../Utilities/Platform';
import * as React from 'react';

Expand DownExpand Up@@ -276,7 +275,7 @@ class TouchableOpacity extends React.Component<Props, State> {
accessibilityElementsHidden={
this.props['aria-hidden'] ?? this.props.accessibilityElementsHidden
}
style={[styles.touchable, this.props.style, {opacity: this.state.anim}]}
style={[this.props.style, {opacity: this.state.anim}]}
nativeID={this.props.id ?? this.props.nativeID}
testID={this.props.testID}
onLayout={this.props.onLayout}
Expand DownExpand Up@@ -327,12 +326,6 @@ class TouchableOpacity extends React.Component<Props, State> {
}
}

const styles = StyleSheet.create({
touchable: {
cursor: 'pointer',
},
});

const Touchable: React.AbstractComponent<
Props,
React.ElementRef<typeof Animated.View>,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,14 +19,7 @@ exports[`TouchableHighlight renders correctly 1`] = `
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
Object {},
]
}
style={Object {}}
>
<Text>
Touchable
Expand DownExpand Up@@ -58,14 +51,6 @@ exports[`TouchableHighlight with disabled state should be disabled when disabled
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -95,14 +80,6 @@ exports[`TouchableHighlight with disabled state should be disabled when disabled
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -132,14 +109,6 @@ exports[`TouchableHighlight with disabled state should disable button when acces
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -170,14 +139,6 @@ exports[`TouchableHighlight with disabled state should keep accessibilityState w
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand DownExpand Up@@ -207,14 +168,6 @@ exports[`TouchableHighlight with disabled state should overwrite accessibilitySt
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"cursor": "pointer",
},
undefined,
]
}
>
<View />
</View>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ exports[`TouchableOpacity renders correctly 1`] = `
onStartShouldSetResponder={[Function]}
style={
Object {
"cursor": "pointer",
"opacity": 1,
}
}
Expand DownExpand Up@@ -73,7 +72,6 @@ exports[`TouchableOpacity renders in disabled state when a disabled prop is pass
onStartShouldSetResponder={[Function]}
style={
Object {
"cursor": "pointer",
"opacity": 1,
}
}
Expand DownExpand Up@@ -115,7 +113,6 @@ exports[`TouchableOpacity renders in disabled state when a key disabled in acces
onStartShouldSetResponder={[Function]}
style={
Object {
"cursor": "pointer",
"opacity": 1,
}
}
Expand Down
Loading