Skip to content

Commit

Permalink
Prettier autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
sebryu committed Oct 19, 2023
1 parent 7062271 commit cc4052c
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 93 deletions.
42 changes: 16 additions & 26 deletions src/components/Attachments/AttachmentCarousel/Pager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,35 +126,25 @@ function AttachmentCarouselPager({
scrollEnabled: shouldPagerScroll.value,
}));

const contextValue = useMemo(() => ({
canvasWidth: containerWidth,
canvasHeight: containerHeight,
isScrolling,
pagerRef,
shouldPagerScroll,
onPinchGestureChange,
onTap,
onSwipe,
onSwipeSuccess,
onSwipeDown,
}), [
containerWidth,
containerHeight,
isScrolling,
pagerRef,
shouldPagerScroll,
onPinchGestureChange,
onTap,
onSwipe,
onSwipeSuccess,
onSwipeDown,
]);
const contextValue = useMemo(
() => ({
canvasWidth: containerWidth,
canvasHeight: containerHeight,
isScrolling,
pagerRef,
shouldPagerScroll,
onPinchGestureChange,
onTap,
onSwipe,
onSwipeSuccess,
onSwipeDown,
}),
[containerWidth, containerHeight, isScrolling, pagerRef, shouldPagerScroll, onPinchGestureChange, onTap, onSwipe, onSwipeSuccess, onSwipeDown],
);

return (
<GestureHandlerRootView style={styles.flex1}>
<AttachmentCarouselPagerContext.Provider
value={contextValue}
>
<AttachmentCarouselPagerContext.Provider value={contextValue}>
<AnimatedPagerView
pageMargin={40}
offscreenPageLimit={1}
Expand Down
21 changes: 10 additions & 11 deletions src/components/PopoverProvider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,17 @@ function PopoverContextProvider(props) {
[closePopover],
);

const contextValue = React.useMemo(() => ({
onOpen,
close: closePopover,
popover: activePopoverRef.current,
isOpen,
}), [onOpen, closePopover, isOpen]);

return (
<PopoverContext.Provider value={contextValue}>
{props.children}
</PopoverContext.Provider>
const contextValue = React.useMemo(
() => ({
onOpen,
close: closePopover,
popover: activePopoverRef.current,
isOpen,
}),
[onOpen, closePopover, isOpen],
);

return <PopoverContext.Provider value={contextValue}>{props.children}</PopoverContext.Provider>;
}

PopoverContextProvider.defaultProps = defaultProps;
Expand Down
21 changes: 10 additions & 11 deletions src/components/PopoverProvider/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ const PopoverContext = React.createContext({
});

function PopoverContextProvider(props) {
const contextValue = React.useMemo(() => ({
onOpen: () => {},
close: () => {},
popover: {},
isOpen: false,
}), []);

return (
<PopoverContext.Provider value={contextValue}>
{props.children}
</PopoverContext.Provider>
const contextValue = React.useMemo(
() => ({
onOpen: () => {},
close: () => {},
popover: {},
isOpen: false,
}),
[],
);

return <PopoverContext.Provider value={contextValue}>{props.children}</PopoverContext.Provider>;
}

PopoverContextProvider.defaultProps = defaultProps;
Expand Down
17 changes: 8 additions & 9 deletions src/components/ScrollViewWithContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ function ScrollViewWithContext({onScroll, scrollEventThrottle, children, innerRe
setContentOffsetY(event.nativeEvent.contentOffset.y);
};

const contextValue = useMemo(() => ({
scrollViewRef,
contentOffsetY,
}), [scrollViewRef, contentOffsetY]);
const contextValue = useMemo(
() => ({
scrollViewRef,
contentOffsetY,
}),
[scrollViewRef, contentOffsetY],
);

return (
<ScrollView
Expand All @@ -40,11 +43,7 @@ function ScrollViewWithContext({onScroll, scrollEventThrottle, children, innerRe
onScroll={setContextScrollPosition}
scrollEventThrottle={scrollEventThrottle || MIN_SMOOTH_SCROLL_EVENT_THROTTLE}
>
<ScrollContext.Provider
value={contextValue}
>
{children}
</ScrollContext.Provider>
<ScrollContext.Provider value={contextValue}>{children}</ScrollContext.Provider>
</ScrollView>
);
}
Expand Down
9 changes: 6 additions & 3 deletions src/components/withKeyboardState.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ function KeyboardStateProvider(props) {
};
}, []);

const contextValue = useMemo(() => ({
isKeyboardShown,
}), [isKeyboardShown]);
const contextValue = useMemo(
() => ({
isKeyboardShown,
}),
[isKeyboardShown],
);
return <KeyboardStateContext.Provider value={contextValue}>{children}</KeyboardStateContext.Provider>;
}

Expand Down
8 changes: 1 addition & 7 deletions src/components/withWindowDimensions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ function WindowDimensionsProvider(props) {
isLargeScreenWidth,
};
}, [windowDimension.windowHeight, windowDimension.windowWidth, adjustment]);
return (
<WindowDimensionsContext.Provider
value={contextValue}
>
{props.children}
</WindowDimensionsContext.Provider>
);
return <WindowDimensionsContext.Provider value={contextValue}>{props.children}</WindowDimensionsContext.Provider>;
}

WindowDimensionsProvider.propTypes = windowDimensionsProviderPropTypes;
Expand Down
8 changes: 1 addition & 7 deletions src/components/withWindowDimensions/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@ function WindowDimensionsProvider(props) {
isLargeScreenWidth: false,
};
}, [windowDimension.windowHeight, windowDimension.windowWidth, adjustment]);
return (
<WindowDimensionsContext.Provider
value={contextValue}
>
{props.children}
</WindowDimensionsContext.Provider>
);
return <WindowDimensionsContext.Provider value={contextValue}>{props.children}</WindowDimensionsContext.Provider>;
}

WindowDimensionsProvider.propTypes = windowDimensionsProviderPropTypes;
Expand Down
23 changes: 11 additions & 12 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,15 @@ function ReportActionItem(props) {
[props.report, props.action, props.emojiReactions],
);

const contextValue = useMemo(() => ({
anchor: popoverAnchorRef,
report: props.report,
action: props.action,
checkIfContextMenuActive: toggleContextMenuFromActiveReportAction,
}), [props.report, props.action, toggleContextMenuFromActiveReportAction]);
const contextValue = useMemo(
() => ({
anchor: popoverAnchorRef,
report: props.report,
action: props.action,
checkIfContextMenuActive: toggleContextMenuFromActiveReportAction,
}),
[props.report, props.action, toggleContextMenuFromActiveReportAction],
);

/**
* Get the content of ReportActionItem
Expand Down Expand Up @@ -373,9 +376,7 @@ function ReportActionItem(props) {
} else {
const hasBeenFlagged = !_.contains([CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING], moderationDecision);
children = (
<ShowContextMenuContext.Provider
value={contextValue}
>
<ShowContextMenuContext.Provider value={contextValue}>
{!props.draftMessage ? (
<View style={props.displayAsGroup && hasBeenFlagged ? styles.blockquote : {}}>
<ReportActionItemMessage
Expand Down Expand Up @@ -522,9 +523,7 @@ function ReportActionItem(props) {
const parentReportAction = ReportActionsUtils.getParentReportAction(props.report);
if (ReportActionsUtils.isTransactionThread(parentReportAction)) {
content = (
<ShowContextMenuContext.Provider
value={contextValue}
>
<ShowContextMenuContext.Provider value={contextValue}>
<MoneyRequestView
report={props.report}
shouldShowHorizontalRule={!props.shouldHideThreadDividerLine}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ function TwoFactorAuthSteps({account = defaultAccount}) {
}
};

return (
<TwoFactorAuthContext.Provider
value={contextValue}
>
{renderStep()}
</TwoFactorAuthContext.Provider>
);
return <TwoFactorAuthContext.Provider value={contextValue}>{renderStep()}</TwoFactorAuthContext.Provider>;
}

TwoFactorAuthSteps.propTypes = TwoFactorAuthPropTypes;
Expand Down

0 comments on commit cc4052c

Please sign in to comment.