-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5787 from Expensify/marcaaron-fixLoading
Only show fancy loading page when we are submitting verifications
- Loading branch information
Showing
7 changed files
with
90 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,44 @@ | ||
import _ from 'underscore'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {ActivityIndicator, StyleSheet, View} from 'react-native'; | ||
import styles from '../styles/styles'; | ||
import themeColors from '../styles/themes/default'; | ||
import stylePropTypes from '../styles/stylePropTypes'; | ||
|
||
const propTypes = { | ||
/** Controls whether the loader is mounted and displayed */ | ||
visible: PropTypes.bool, | ||
|
||
/** Additional style props */ | ||
style: stylePropTypes, | ||
}; | ||
|
||
const defaultProps = { | ||
visible: true, | ||
style: [], | ||
}; | ||
|
||
/** | ||
* Loading indication component intended to cover the whole page, while the page prepares for initial render | ||
* | ||
* @returns {JSX.Element} | ||
*/ | ||
const FullScreenLoadingIndicator = ({visible}) => visible && ( | ||
<View style={[StyleSheet.absoluteFillObject, styles.fullScreenLoading]}> | ||
<ActivityIndicator color={themeColors.spinner} size="large" /> | ||
</View> | ||
); | ||
const FullScreenLoadingIndicator = ({visible, style}) => { | ||
if (!visible) { | ||
return null; | ||
} | ||
|
||
const additionalStyles = _.isArray(style) ? style : [style]; | ||
return ( | ||
<View style={[StyleSheet.absoluteFillObject, styles.fullScreenLoading, ...additionalStyles]}> | ||
<ActivityIndicator color={themeColors.spinner} size="large" /> | ||
</View> | ||
); | ||
}; | ||
|
||
FullScreenLoadingIndicator.propTypes = propTypes; | ||
FullScreenLoadingIndicator.defaultProps = defaultProps; | ||
FullScreenLoadingIndicator.displayName = 'FullScreenLoadingIndicator'; | ||
|
||
export default FullScreenLoadingIndicator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import {Image, StyleSheet, View} from 'react-native'; | ||
import PropTypes from 'prop-types'; | ||
import styles from '../styles/styles'; | ||
import CONST from '../CONST'; | ||
import withLocalize, {withLocalizePropTypes} from './withLocalize'; | ||
import Text from './Text'; | ||
import HeaderWithCloseButton from './HeaderWithCloseButton'; | ||
import Navigation from '../libs/Navigation/Navigation'; | ||
import ScreenWrapper from './ScreenWrapper'; | ||
import FullScreenLoadingIndicator from './FullscreenLoadingIndicator'; | ||
|
||
const propTypes = { | ||
/** Whether the user is submitting verifications data */ | ||
isSubmittingVerificationsData: PropTypes.bool.isRequired, | ||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
const ReimbursementAccountLoadingIndicator = ({translate, isSubmittingVerificationsData}) => ( | ||
<ScreenWrapper style={[StyleSheet.absoluteFillObject, styles.reimbursementAccountFullScreenLoading]}> | ||
<HeaderWithCloseButton | ||
title={translate('reimbursementAccountLoadingAnimation.oneMoment')} | ||
onCloseButtonPress={Navigation.dismissModal} | ||
/> | ||
{isSubmittingVerificationsData ? ( | ||
<View style={[styles.pageWrapper]}> | ||
<Image | ||
source={{uri: `${CONST.CLOUDFRONT_URL}/images/icons/emptystates/emptystate_reviewing.gif`}} | ||
style={[ | ||
styles.loadingVBAAnimation, | ||
]} | ||
/> | ||
<View style={[styles.ph6]}> | ||
<Text style={[styles.textAlignCenter]}> | ||
{translate('reimbursementAccountLoadingAnimation.explanationLine')} | ||
</Text> | ||
</View> | ||
</View> | ||
) : ( | ||
<FullScreenLoadingIndicator style={[styles.flex1, styles.pRelative]} /> | ||
)} | ||
</ScreenWrapper> | ||
); | ||
|
||
ReimbursementAccountLoadingIndicator.propTypes = propTypes; | ||
ReimbursementAccountLoadingIndicator.displayName = 'ReimbursementAccountLoadingIndicator'; | ||
|
||
export default withLocalize(ReimbursementAccountLoadingIndicator); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters