Skip to content

Commit

Permalink
Commit prettier diff
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed May 13, 2023
1 parent 5cdbe16 commit a7646ef
Showing 1 changed file with 46 additions and 37 deletions.
83 changes: 46 additions & 37 deletions src/components/Pressable/GenericPressable/BaseGenericPressable.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,45 +63,54 @@ const GenericPressable = forwardRef((props, ref) => {
return props.disabled || shouldBeDisabledByScreenReader;
}, [isScreenReaderActive, enableInScreenReaderStates, props.disabled]);

const onLongPressHandler = useCallback((event) => {
if (isDisabled) {
return;
}
if (!onLongPress) {
return;
}
if (shouldUseHapticsOnLongPress) {
HapticFeedback.longPress();
}
if (ref && ref.current) {
ref.current.blur();
}
onLongPress(event);

Accessibility.moveAccessibilityFocus(nextFocusRef);
}, [shouldUseHapticsOnLongPress, onLongPress, nextFocusRef, ref, isDisabled]);

const onPressHandler = useCallback((event) => {
if (isDisabled) {
return;
}
if (shouldUseHapticsOnPress) {
HapticFeedback.press();
}
if (ref && ref.current) {
ref.current.blur();
}
onPress(event);
const onLongPressHandler = useCallback(
(event) => {
if (isDisabled) {
return;
}
if (!onLongPress) {
return;
}
if (shouldUseHapticsOnLongPress) {
HapticFeedback.longPress();
}
if (ref && ref.current) {
ref.current.blur();
}
onLongPress(event);

Accessibility.moveAccessibilityFocus(nextFocusRef);
},
[shouldUseHapticsOnLongPress, onLongPress, nextFocusRef, ref, isDisabled],
);

Accessibility.moveAccessibilityFocus(nextFocusRef);
}, [shouldUseHapticsOnPress, onPress, nextFocusRef, ref, isDisabled]);
const onPressHandler = useCallback(
(event) => {
if (isDisabled) {
return;
}
if (shouldUseHapticsOnPress) {
HapticFeedback.press();
}
if (ref && ref.current) {
ref.current.blur();
}
onPress(event);

Accessibility.moveAccessibilityFocus(nextFocusRef);
},
[shouldUseHapticsOnPress, onPress, nextFocusRef, ref, isDisabled],
);

const onKeyPressHandler = useCallback((event) => {
if (event.key !== 'Enter') {
return;
}
onPressHandler(event);
}, [onPressHandler]);
const onKeyPressHandler = useCallback(
(event) => {
if (event.key !== 'Enter') {
return;
}
onPressHandler(event);
},
[onPressHandler],
);

useEffect(() => {
if (!keyboardShortcut) {
Expand Down

0 comments on commit a7646ef

Please sign in to comment.