Skip to content

Commit

Permalink
prettier fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotrfj committed Sep 28, 2023
1 parent 66ded3b commit ae3fab6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/hooks/useFrozenScroll.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useContext} from 'react';
import {ReportActionListFrozenScrollContext} from "../pages/home/report/ReportActionListFrozenScrollContext";
import {ReportActionListFrozenScrollContext} from '../pages/home/report/ReportActionListFrozenScrollContext';

/**
* Hook for getting current state of scroll freeze and a function to set whether the scroll should be frozen
Expand Down
7 changes: 3 additions & 4 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import DragAndDropProvider from '../../components/DragAndDrop/Provider';
import usePrevious from '../../hooks/usePrevious';
import CONST from '../../CONST';
import withCurrentReportID, {withCurrentReportIDPropTypes, withCurrentReportIDDefaultProps} from '../../components/withCurrentReportID';
import {ReportActionListFrozenScrollContextProvider} from "./report/ReportActionListFrozenScrollContext";
import {ReportActionListFrozenScrollContextProvider} from './report/ReportActionListFrozenScrollContext';

const propTypes = {
/** Navigation route context info provided by react navigation */
Expand Down Expand Up @@ -382,7 +382,7 @@ function ReportScreen({
<View style={[styles.borderBottom]}>
<View style={[styles.appBG, styles.pl0]}>
<View style={[styles.ph5, styles.pb3]}>
<TaskHeaderActionButton report={report}/>
<TaskHeaderActionButton report={report} />
</View>
</View>
</View>
Expand Down Expand Up @@ -425,8 +425,7 @@ function ReportScreen({

{/* Note: The report should be allowed to mount even if the initial report actions are not loaded. If we prevent rendering the report while they are loading then
we'll unnecessarily unmount the ReportActionsView which will clear the new marker lines initial state. */}
{(!isReportReadyForDisplay || isLoadingInitialReportActions || isLoading) &&
<ReportActionsSkeletonView containerHeight={skeletonViewContainerHeight}/>}
{(!isReportReadyForDisplay || isLoadingInitialReportActions || isLoading) && <ReportActionsSkeletonView containerHeight={skeletonViewContainerHeight} />}

{isReportReadyForDisplay && (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import * as EmojiPickerAction from '../../../libs/actions/EmojiPickerAction';
import focusWithDelay from '../../../libs/focusWithDelay';
import ONYXKEYS from '../../../ONYXKEYS';
import * as Browser from '../../../libs/Browser';
import useFrozenScroll from "../../../hooks/useFrozenScroll";
import useFrozenScroll from '../../../hooks/useFrozenScroll';

const propTypes = {
/** All the data of the action */
Expand Down
37 changes: 14 additions & 23 deletions src/pages/home/report/ReportActionListFrozenScrollContext.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, {createContext, forwardRef, useMemo, useState} from "react";
import PropTypes from "prop-types";
import getComponentDisplayName from "../../../libs/getComponentDisplayName";

import React, {createContext, forwardRef, useMemo, useState} from 'react';
import PropTypes from 'prop-types';
import getComponentDisplayName from '../../../libs/getComponentDisplayName';

const withScrollFrozenPropTypes = {
/** flag determining if we should freeze the scroll */
Expand All @@ -13,7 +12,6 @@ const withScrollFrozenPropTypes = {

const ReportActionListFrozenScrollContext = createContext(null);


function ReportActionListFrozenScrollContextProvider(props) {
const [shouldFreezeScroll, setShouldFreezeScroll] = useState(false);

Expand All @@ -29,8 +27,7 @@ function ReportActionListFrozenScrollContextProvider(props) {
[shouldFreezeScroll, setShouldFreezeScroll],
);

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

ReportActionListFrozenScrollContextProvider.displayName = 'ReportActionListFrozenScrollContextProvider';
Expand All @@ -42,26 +39,20 @@ ReportActionListFrozenScrollContextProvider.propTypes = {
function withScrollFrozen(WrappedComponent) {
const WithScrollFrozenState = forwardRef((props, ref) => (
<ReportActionListFrozenScrollContext.Consumer>
{(scrollFrozenProps) =>
<WrappedComponent
// eslint-disable-next-line react/jsx-props-no-spreading
{...scrollFrozenProps}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
ref={ref}
/>
}
{(scrollFrozenProps) => (
<WrappedComponent
// eslint-disable-next-line react/jsx-props-no-spreading
{...scrollFrozenProps}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
ref={ref}
/>
)}
</ReportActionListFrozenScrollContext.Consumer>
));

WithScrollFrozenState.displayName = `WithScrollFrozenState(${getComponentDisplayName(WrappedComponent)})`;
return WithScrollFrozenState;
}


export {
ReportActionListFrozenScrollContext,
ReportActionListFrozenScrollContextProvider,
withScrollFrozenPropTypes,
withScrollFrozen
};
export {ReportActionListFrozenScrollContext, ReportActionListFrozenScrollContextProvider, withScrollFrozenPropTypes, withScrollFrozen};
4 changes: 2 additions & 2 deletions src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import reportPropTypes from '../../reportPropTypes';
import FloatingMessageCounter from './FloatingMessageCounter';
import ReportActionsListItemRenderer from './ReportActionsListItemRenderer';
import reportActionPropTypes from './reportActionPropTypes';
import useFrozenScroll from "../../../hooks/useFrozenScroll";
import useFrozenScroll from '../../../hooks/useFrozenScroll';

const propTypes = {
/** The report currently being looked at */
Expand Down Expand Up @@ -93,7 +93,7 @@ function keyExtractor(item) {

const maintainVisibleContentPositionOptions = {
minIndexForVisible: 1,
}
};

function isMessageUnread(message, lastReadTime) {
return Boolean(message && lastReadTime && message.created && lastReadTime < message.created);
Expand Down

0 comments on commit ae3fab6

Please sign in to comment.