From cc4052cdbc6efa1f0da2c4f14ad7563e85c73817 Mon Sep 17 00:00:00 2001 From: Sebastian Szewczyk Date: Thu, 19 Oct 2023 14:11:26 +0200 Subject: [PATCH] Prettier autofix --- .../AttachmentCarousel/Pager/index.js | 42 +++++++------------ src/components/PopoverProvider/index.js | 21 +++++----- .../PopoverProvider/index.native.js | 21 +++++----- src/components/ScrollViewWithContext.js | 17 ++++---- src/components/withKeyboardState.js | 9 ++-- src/components/withWindowDimensions/index.js | 8 +--- .../withWindowDimensions/index.native.js | 8 +--- src/pages/home/report/ReportActionItem.js | 23 +++++----- .../TwoFactorAuth/TwoFactorAuthSteps.js | 8 +--- 9 files changed, 64 insertions(+), 93 deletions(-) diff --git a/src/components/Attachments/AttachmentCarousel/Pager/index.js b/src/components/Attachments/AttachmentCarousel/Pager/index.js index 4ca4e77e5136..d10a5abad6b7 100644 --- a/src/components/Attachments/AttachmentCarousel/Pager/index.js +++ b/src/components/Attachments/AttachmentCarousel/Pager/index.js @@ -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 ( - + ({ - onOpen, - close: closePopover, - popover: activePopoverRef.current, - isOpen, - }), [onOpen, closePopover, isOpen]); - - return ( - - {props.children} - + const contextValue = React.useMemo( + () => ({ + onOpen, + close: closePopover, + popover: activePopoverRef.current, + isOpen, + }), + [onOpen, closePopover, isOpen], ); + + return {props.children}; } PopoverContextProvider.defaultProps = defaultProps; diff --git a/src/components/PopoverProvider/index.native.js b/src/components/PopoverProvider/index.native.js index aa22bc7cd605..e4da13752b6d 100644 --- a/src/components/PopoverProvider/index.native.js +++ b/src/components/PopoverProvider/index.native.js @@ -15,18 +15,17 @@ const PopoverContext = React.createContext({ }); function PopoverContextProvider(props) { - const contextValue = React.useMemo(() => ({ - onOpen: () => {}, - close: () => {}, - popover: {}, - isOpen: false, - }), []); - - return ( - - {props.children} - + const contextValue = React.useMemo( + () => ({ + onOpen: () => {}, + close: () => {}, + popover: {}, + isOpen: false, + }), + [], ); + + return {props.children}; } PopoverContextProvider.defaultProps = defaultProps; diff --git a/src/components/ScrollViewWithContext.js b/src/components/ScrollViewWithContext.js index b858f741f1fe..1d183e250767 100644 --- a/src/components/ScrollViewWithContext.js +++ b/src/components/ScrollViewWithContext.js @@ -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 ( - - {children} - + {children} ); } diff --git a/src/components/withKeyboardState.js b/src/components/withKeyboardState.js index dbd90af19b03..3154f7e98d67 100755 --- a/src/components/withKeyboardState.js +++ b/src/components/withKeyboardState.js @@ -31,9 +31,12 @@ function KeyboardStateProvider(props) { }; }, []); - const contextValue = useMemo(() => ({ - isKeyboardShown, - }), [isKeyboardShown]); + const contextValue = useMemo( + () => ({ + isKeyboardShown, + }), + [isKeyboardShown], + ); return {children}; } diff --git a/src/components/withWindowDimensions/index.js b/src/components/withWindowDimensions/index.js index bd08fb673c2a..16e5985e0985 100644 --- a/src/components/withWindowDimensions/index.js +++ b/src/components/withWindowDimensions/index.js @@ -78,13 +78,7 @@ function WindowDimensionsProvider(props) { isLargeScreenWidth, }; }, [windowDimension.windowHeight, windowDimension.windowWidth, adjustment]); - return ( - - {props.children} - - ); + return {props.children}; } WindowDimensionsProvider.propTypes = windowDimensionsProviderPropTypes; diff --git a/src/components/withWindowDimensions/index.native.js b/src/components/withWindowDimensions/index.native.js index bd0b6574ddf4..363196b3fd4d 100644 --- a/src/components/withWindowDimensions/index.native.js +++ b/src/components/withWindowDimensions/index.native.js @@ -73,13 +73,7 @@ function WindowDimensionsProvider(props) { isLargeScreenWidth: false, }; }, [windowDimension.windowHeight, windowDimension.windowWidth, adjustment]); - return ( - - {props.children} - - ); + return {props.children}; } WindowDimensionsProvider.propTypes = windowDimensionsProviderPropTypes; diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 0d3d2021e3d3..db5ac43d9d34 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -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 @@ -373,9 +376,7 @@ function ReportActionItem(props) { } else { const hasBeenFlagged = !_.contains([CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING], moderationDecision); children = ( - + {!props.draftMessage ? ( + - {renderStep()} - - ); + return {renderStep()}; } TwoFactorAuthSteps.propTypes = TwoFactorAuthPropTypes;