Skip to content

Commit

Permalink
Merge pull request #42333 from bernhardoj/fix/42103-pdf-blinks
Browse files Browse the repository at this point in the history
Fix pdf blinks when open it
  • Loading branch information
chiragsalian authored May 23, 2024
2 parents eda2f17 + c62bd40 commit d2e6445
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/PDFView/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,10 @@ function PDFView({onToggleKeyboard, onLoadComplete, fileName, onPress, isFocused
);
}

return onPress && !successToLoadPDF ? (
return onPress ? (
<PressableWithoutFeedback
onPress={onPress}
fullDisabled={successToLoadPDF}
style={[themeStyles.flex1, themeStyles.alignSelfStretch, !failedToLoadPDF && themeStyles.flexRow]}
accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON}
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function GenericPressable(
onPressIn,
onPressOut,
accessible = true,
fullDisabled = false,
...rest
}: PressableProps,
ref: PressableRef,
Expand Down Expand Up @@ -136,6 +137,7 @@ function GenericPressable(
hitSlop={shouldUseAutoHitSlop ? hitSlop : undefined}
onLayout={shouldUseAutoHitSlop ? onLayout : undefined}
ref={ref as ForwardedRef<View>}
disabled={fullDisabled}
onPress={!isDisabled ? singleExecution(onPressHandler) : undefined}
onLongPress={!isDisabled && onLongPress ? onLongPressHandler : undefined}
onKeyDown={!isDisabled ? onKeyDown : undefined}
Expand Down
5 changes: 5 additions & 0 deletions src/components/Pressable/GenericPressable/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ type PressableProps = RNPressableProps &

/** Turns off drag area for the component */
noDragArea?: boolean;

/**
* Specifies if the pressable responder should be disabled
*/
fullDisabled?: boolean;
};

type PressableRef = ForwardedRef<HTMLDivElement | View | RNText | undefined>;
Expand Down

0 comments on commit d2e6445

Please sign in to comment.