-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
17047 migrate PressableWithSecondaryInteraction to PressableWithFeedback component #20251
Changes from 13 commits
33bfa83
ef0dc5a
b901d25
014eb8b
5cd97a3
07e40d1
a453a84
cac624c
e94aa5b
88bde68
bd7c23d
42fb09d
b9d38f5
235b5fc
4572235
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,10 +1,10 @@ | ||||||||||||||
import _ from 'underscore'; | ||||||||||||||
import React, {Component} from 'react'; | ||||||||||||||
import {Pressable} from 'react-native'; | ||||||||||||||
import * as pressableWithSecondaryInteractionPropTypes from './pressableWithSecondaryInteractionPropTypes'; | ||||||||||||||
import styles from '../../styles/styles'; | ||||||||||||||
import * as DeviceCapabilities from '../../libs/DeviceCapabilities'; | ||||||||||||||
import * as StyleUtils from '../../styles/StyleUtils'; | ||||||||||||||
import PressableWithFeedback from '../Pressable/PressableWithFeedback'; | ||||||||||||||
|
||||||||||||||
/** | ||||||||||||||
* This is a special Pressable that calls onSecondaryInteraction when LongPressed, or right-clicked. | ||||||||||||||
|
@@ -76,19 +76,20 @@ class PressableWithSecondaryInteraction extends Component { | |||||||||||||
|
||||||||||||||
// On Web, Text does not support LongPress events thus manage inline mode with styling instead of using Text. | ||||||||||||||
return ( | ||||||||||||||
<Pressable | ||||||||||||||
<PressableWithFeedback | ||||||||||||||
style={StyleUtils.combineStyles(this.props.inline ? styles.dInline : this.props.style)} | ||||||||||||||
wrapperStyle={StyleUtils.combineStyles(DeviceCapabilities.canUseTouchScreen() ? [styles.userSelectNone, styles.noSelect] : [])} | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be consistent with others. They're using ControlSelection to prevent selection on long-click. App/src/components/MenuItem.js Lines 113 to 114 in e6c4b4e
App/src/components/AnchorForAttachmentsOnly/index.js Lines 12 to 13 in e6c4b4e
App/src/pages/home/report/ReportActionItem.js Lines 450 to 451 in e6c4b4e
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can generalize this. How about introducing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyway, this is not a blocker for this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If More details about the root cause: #22362 (comment) |
||||||||||||||
onPressIn={this.props.onPressIn} | ||||||||||||||
onLongPress={this.props.onSecondaryInteraction ? this.executeSecondaryInteraction : undefined} | ||||||||||||||
activeOpacity={this.props.activeOpacity} | ||||||||||||||
pressDimmingValue={this.props.activeOpacity} | ||||||||||||||
onPressOut={this.props.onPressOut} | ||||||||||||||
onPress={this.props.onPress} | ||||||||||||||
ref={(el) => (this.pressableRef = el)} | ||||||||||||||
// eslint-disable-next-line react/jsx-props-no-spreading | ||||||||||||||
{...defaultPressableProps} | ||||||||||||||
> | ||||||||||||||
{this.props.children} | ||||||||||||||
</Pressable> | ||||||||||||||
</PressableWithFeedback> | ||||||||||||||
); | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
props.title
was of number0
in some cases which caused app crash as mentioned here #25451 (comment).We should make sure the values we pass are string.