Skip to content
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

fix: send message - user navigates to Room tab when dragging to select e-mail from Chat tab #28240

Merged
merged 4 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
9 changes: 2 additions & 7 deletions src/components/MapView/responder/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import {PanResponder} from 'react-native';
import SwipeInterceptPanResponder from '../../SwipeInterceptPanResponder';

const responder = PanResponder.create({
onMoveShouldSetPanResponder: () => true,
onPanResponderTerminationRequest: () => false,
});

export default responder;
export default SwipeInterceptPanResponder;
1 change: 1 addition & 0 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ class BaseOptionsSelector extends Component {
selectTextOnFocus
blurOnSubmit={Boolean(this.state.allOptions.length)}
spellCheck={false}
canInterceptSwipe
/>
);
const optionsList = (
Expand Down
1 change: 1 addition & 0 deletions src/components/RoomNameInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function RoomNameInput({isFocused, autoFocus, disabled, errorText, forwardedRef,
autoFocus={isFocused && autoFocus}
maxLength={CONST.REPORT.MAX_ROOM_NAME_LENGTH}
spellCheck={false}
canInterceptSwipe
/>
);
}
Expand Down
8 changes: 8 additions & 0 deletions src/components/SwipeInterceptPanResponder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {PanResponder} from 'react-native';

const SwipeInterceptPanResponder = PanResponder.create({
onMoveShouldSetPanResponder: () => true,
onPanResponderTerminationRequest: () => false,
});

export default SwipeInterceptPanResponder;
7 changes: 6 additions & 1 deletion src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import PressableWithoutFeedback from '../Pressable/PressableWithoutFeedback';
import withLocalize from '../withLocalize';
import useNativeDriver from '../../libs/useNativeDriver';
import * as Browser from '../../libs/Browser';
import SwipeInterceptPanResponder from '../SwipeInterceptPanResponder';

function BaseTextInput(props) {
const inputValue = props.value || props.defaultValue || '';
Expand Down Expand Up @@ -257,7 +258,11 @@ function BaseTextInput(props) {

return (
<>
<View style={styles.pointerEventsNone}>
<View
style={styles.pointerEventsNone}
// eslint-disable-next-line react/jsx-props-no-spreading
{...(props.canInterceptSwipe && SwipeInterceptPanResponder.panHandlers)}
>
<PressableWithoutFeedback
onPress={onPress}
focusable={false}
Expand Down
4 changes: 4 additions & 0 deletions src/components/TextInput/baseTextInputPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ const propTypes = {

/** Set the default value to the input if there is a valid saved value */
shouldUseDefaultValue: PropTypes.bool,

/** Indicate whether or not the input should prevent swipe actions in tabs */
canInterceptSwipe: PropTypes.bool,
};

const defaultProps = {
Expand Down Expand Up @@ -129,6 +132,7 @@ const defaultProps = {
icon: null,
shouldUseDefaultValue: false,
multiline: false,
canInterceptSwipe: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boolean props should be prefixed with should or is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Pushed a new commit.

};

export {propTypes, defaultProps};
Loading