-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 #3592 from Expensify/update-staging-from-main
- Loading branch information
Showing
70 changed files
with
1,250 additions
and
484 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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,52 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const propTypes = { | ||
/* A message posted to `logError` (along with error data) when this component intercepts an error */ | ||
errorMessage: PropTypes.string.isRequired, | ||
|
||
/* A function to perform the actual logging since different platforms support different tools */ | ||
logError: PropTypes.func, | ||
|
||
/* Actual content wrapped by this error boundary */ | ||
children: PropTypes.node.isRequired, | ||
}; | ||
|
||
const defaultProps = { | ||
logError: () => {}, | ||
}; | ||
|
||
/** | ||
* This component captures an error in the child component tree and logs it to the server | ||
* It can be used to wrap the entire app as well as to wrap specific parts for more granularity | ||
* @see {@link https://reactjs.org/docs/error-boundaries.html#where-to-place-error-boundaries} | ||
*/ | ||
class BaseErrorBoundary extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = {hasError: false}; | ||
} | ||
|
||
static getDerivedStateFromError() { | ||
// Update state so the next render will show the fallback UI. | ||
return {hasError: true}; | ||
} | ||
|
||
componentDidCatch(error, errorInfo) { | ||
this.props.logError(this.props.errorMessage, error, errorInfo); | ||
} | ||
|
||
render() { | ||
if (this.state.hasError) { | ||
// For the moment we've decided not to render any fallback UI | ||
return null; | ||
} | ||
|
||
return this.props.children; | ||
} | ||
} | ||
|
||
BaseErrorBoundary.propTypes = propTypes; | ||
BaseErrorBoundary.defaultProps = defaultProps; | ||
|
||
export default BaseErrorBoundary; |
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,9 @@ | ||
import BaseErrorBoundary from './BaseErrorBoundary'; | ||
import Log from '../../libs/Log'; | ||
|
||
BaseErrorBoundary.defaultProps.logError = (errorMessage, error, errorInfo) => { | ||
// Log the error to the server | ||
Log.alert(errorMessage, 0, {error: error.message, errorInfo}, false); | ||
}; | ||
|
||
export default BaseErrorBoundary; |
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,16 @@ | ||
import crashlytics from '@react-native-firebase/crashlytics'; | ||
|
||
import BaseErrorBoundary from './BaseErrorBoundary'; | ||
import Log from '../../libs/Log'; | ||
|
||
BaseErrorBoundary.defaultProps.logError = (errorMessage, error, errorInfo) => { | ||
// Log the error to the server | ||
Log.alert(errorMessage, 0, {error: error.message, errorInfo}, false); | ||
|
||
/* On native we also log the error to crashlytics | ||
* Since the error was handled we need to manually tell crashlytics about it */ | ||
crashlytics().log(`errorInfo: ${JSON.stringify(errorInfo)}`); | ||
crashlytics().recordError(error); | ||
}; | ||
|
||
export default BaseErrorBoundary; |
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,27 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import PropTypes from 'prop-types'; | ||
import styles from '../styles/styles'; | ||
|
||
const propTypes = { | ||
/** Children to wrap in FixedFooter. */ | ||
children: PropTypes.node.isRequired, | ||
|
||
/** Styles to be assigned to Container */ | ||
style: PropTypes.arrayOf(PropTypes.object), | ||
}; | ||
|
||
const defaultProps = { | ||
style: [], | ||
}; | ||
|
||
const FixedFooter = props => ( | ||
<View style={[styles.ph5, styles.pb5, ...props.style]}> | ||
{props.children} | ||
</View> | ||
); | ||
|
||
FixedFooter.propTypes = propTypes; | ||
FixedFooter.defaultProps = defaultProps; | ||
FixedFooter.displayName = 'FixedFooter'; | ||
export default FixedFooter; |
Oops, something went wrong.