Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/components/FullscreenLoadingIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,37 @@ type FullScreenLoadingIndicatorProps = {
/** Size of the icon */
iconSize?: FullScreenLoadingIndicatorIconSize;

/** Whether the "Go Back" button appears after a timeout. */
shouldUseGoBackButton?: boolean;

/** The ID of the test to be used for testing */
testID?: string;

/** Extra loading context to be passed to the logAppStateOnLongLoading function */
extraLoadingContext?: ExtraLoadingContext;
};

function FullScreenLoadingIndicator({style, iconSize = CONST.ACTIVITY_INDICATOR_SIZE.LARGE, testID = '', extraLoadingContext}: FullScreenLoadingIndicatorProps) {
function FullScreenLoadingIndicator({
style,
iconSize = CONST.ACTIVITY_INDICATOR_SIZE.LARGE,
shouldUseGoBackButton = false,
testID = '',
extraLoadingContext,
}: FullScreenLoadingIndicatorProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const [showGoBackButton, setShowGoBackButton] = useState(false);

useEffect(() => {
if (!shouldUseGoBackButton) {
return;
}

const timeoutId = setTimeout(() => {
setShowGoBackButton(true);
}, CONST.TIMING.ACTIVITY_INDICATOR_TIMEOUT);
return () => clearTimeout(timeoutId);
}, []);
}, [shouldUseGoBackButton]);

return (
<View style={[StyleSheet.absoluteFillObject, styles.fullScreenLoading, styles.w100, style]}>
Expand Down
Loading