Skip to content

chore: remove automatic cursor pointer #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2024
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 number Diff line number Diff 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 Down Expand 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 number Diff line number Diff 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 Down Expand 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 Down Expand 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 Down Expand 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 Down Expand 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 Down Expand 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 Down Expand 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 Down Expand 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 Down Expand 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 Down Expand 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 number Diff line number Diff 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 Down Expand 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 number Diff line number Diff 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 Down Expand 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 Down Expand 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 number Diff line number Diff 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 Down Expand 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 Down Expand 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 Down Expand 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 Down Expand 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 Down Expand 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 number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ exports[`TouchableOpacity renders correctly 1`] = `
onStartShouldSetResponder={[Function]}
style={
Object {
"cursor": "pointer",
"opacity": 1,
}
}
Expand Down Expand 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 Down Expand 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
Loading