Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version to 1.0.68-5 on staging #3592

Merged
merged 121 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
4e8d8dd
first iteration of component
anthony-hull May 25, 2021
cefc4c2
change user error UX and wire component into setPassword page
anthony-hull May 27, 2021
486571a
clean up imports
anthony-hull May 27, 2021
58901ec
button styling fixed
parasharrajat May 27, 2021
291cce0
fixed styling for many pages
parasharrajat May 27, 2021
b767480
Pull latest changes
parasharrajat Jun 2, 2021
a8927aa
fix: overlapping keyboard spacer on group page
parasharrajat Jun 2, 2021
1f1da23
Merge branch 'main' of github.com:Expensify/Expensify.cash into fixed…
parasharrajat Jun 4, 2021
09f4cb6
tweak password error logic
anthony-hull Jun 4, 2021
cf63e81
localized text
parasharrajat Jun 4, 2021
778f974
tweaks
parasharrajat Jun 5, 2021
ad3fcd0
fix indentation
parasharrajat Jun 8, 2021
1f13dd8
pull latest changes
parasharrajat Jun 8, 2021
6f0a021
tidy up code
anthony-hull Jun 8, 2021
c4bfc7f
Merge remote-tracking branch 'origin' into setPassword
anthony-hull Jun 8, 2021
a5cf2ce
project cleanup 2
anthony-hull Jun 8, 2021
8737fb4
set the focus on the Edit ox on edit action
parasharrajat Jun 8, 2021
b607356
pull latest changes
parasharrajat Jun 8, 2021
0a62b81
fix: callback needs to reset for each action
parasharrajat Jun 8, 2021
43c2cae
Add info about internationalization / localization
iwiznia Jun 8, 2021
2fd3093
Add blurb about the HOC
iwiznia Jun 8, 2021
a551642
Add User_IsFromPublicDomain api command
roryabraham Jun 9, 2021
f5589e3
Create onyx action to fetch public domain info
roryabraham Jun 9, 2021
9b499fe
Call user action in AuthScreens::componentDidMount
roryabraham Jun 9, 2021
539cf49
makes PDF attachment modals scrollable
rdjuric Jun 9, 2021
91f6422
uses the correct modal type
rdjuric Jun 9, 2021
f944970
rename objects and add proptype comments
anthony-hull Jun 9, 2021
1910616
Merge branch 'main' of github.com:Expensify/Expensify.cash into edit-box
parasharrajat Jun 9, 2021
f60fdf9
added a new composer focus strategy
parasharrajat Jun 9, 2021
713dfb0
fix: bug transItionEnd does not fire on IOS
parasharrajat Jun 9, 2021
379b104
Add NewWorkspace page
HorusGoul Jun 9, 2021
c23a17e
Add requireClearbitResponse parameter
roryabraham Jun 9, 2021
af77302
correctly passes the propateSwipe prop
rdjuric Jun 9, 2021
689cf93
Change requireClearbitResponse to requireCertainty
roryabraham Jun 9, 2021
11a9d2f
Merge branch 'main' into Rory-IsUserPublicDomain
roryabraham Jun 9, 2021
d6920b9
Add the layout for the new workspace modal
HorusGoul Jun 9, 2021
c574127
fix style
rdjuric Jun 9, 2021
fecc303
Merge branch 'main' of github.com:Expensify/Expensify.cash into edit-box
parasharrajat Jun 9, 2021
43bf806
tweaks
parasharrajat Jun 9, 2021
fda1967
typo
parasharrajat Jun 9, 2021
0bb46ed
Merge branch 'main' into Rory-IsUserPublicDomain
roryabraham Jun 9, 2021
7c34570
rename NewPassword.js
anthony-hull Jun 10, 2021
5919dc7
improving style 👗
anthony-hull Jun 10, 2021
66cbd4b
increasing style exponentially 👗✨😎
anthony-hull Jun 10, 2021
65662dd
fix: prop name
parasharrajat Jun 10, 2021
4de2896
feat: Crate ErrorBoundary component
kidroca Jun 10, 2021
52102f0
feat: wrap the root component with an error boundary
kidroca Jun 10, 2021
5100744
refactor: extract platform specific implementation due to crashlytics…
kidroca Jun 10, 2021
48eb85d
refactor: use Log.alert instead of Log.info
kidroca Jun 10, 2021
c021123
test: fix failing "loginTest"
kidroca Jun 10, 2021
80d5309
refactor: update parameters because the error message is not logging
kidroca Jun 10, 2021
6052430
Add beta for default rooms
yuwenmemon Jun 10, 2021
570845a
refactor: remove stack trace and set captured messages
kidroca Jun 10, 2021
fce8f14
Fix infinite spinner when signing into an account after signing out
Jun 10, 2021
d01196e
refactor: address PR comments
kidroca Jun 11, 2021
4ad470f
Add AttachmentPicker and use the workspace default avatar
HorusGoul Jun 11, 2021
1fe8daa
Merge remote-tracking branch 'origin/main' into horus-modal-screen-ne…
HorusGoul Jun 11, 2021
b314b0c
Add request a call switch
HorusGoul Jun 11, 2021
9d83c54
Update onyx hash for next tick fix
Jun 11, 2021
19ad75e
Merge pull request #3444 from Expensify/ionatan_i18nreadme
iwiznia Jun 11, 2021
b72a204
fix: scrolling when focusing on the edit box for old message
parasharrajat Jun 11, 2021
5086502
Upgrade react-native-document-picker to 5.1.0
roryabraham Jun 11, 2021
d50520e
fix: invalid prop for drawer
parasharrajat Jun 11, 2021
b5646d8
Merge pull request #3534 from Expensify/yuwen-betaDefaultRooms
yuwenmemon Jun 11, 2021
24c466a
Bump onyx version
Jun 11, 2021
3e2f266
Merge pull request #3550 from Expensify/Rory-Upgrade-react-native-doc…
roryabraham Jun 11, 2021
2e12883
Update version to 1.0.68-1
Jun 11, 2021
76648bc
Merge pull request #3553 from Expensify/version-BUILD-3e2f266c5399022…
OSBotify Jun 11, 2021
47e8258
Add capturing event listeners to the KeyboardShortcut library
roryabraham Jun 11, 2021
584183f
Merge pull request #3555 from Expensify/Rory-FixHotkeys
marcaaron Jun 11, 2021
2ac717f
Update version to 1.0.68-2
Jun 11, 2021
a0e0ad4
Merge pull request #3556 from Expensify/version-BUILD-584183f77615d2e…
OSBotify Jun 11, 2021
239d6eb
take out redundant index.native.js
Jun 11, 2021
fad0d88
Merge pull request #3535 from Expensify/amechler-fix-signout
marcaaron Jun 11, 2021
be7fee0
Merge pull request #3527 from kidroca/kidroca/critical-error-handling
Jag96 Jun 11, 2021
f909192
Update version to 1.0.68-3
Jun 11, 2021
1ceed16
Merge pull request #3563 from Expensify/version-BUILD-be7fee0ddc56a53…
OSBotify Jun 11, 2021
34612d7
Merge pull request #3441 from parasharrajat/edit-box
roryabraham Jun 11, 2021
bef3548
Pull latest changes
parasharrajat Jun 11, 2021
bbc09c7
merge focuse manager
parasharrajat Jun 11, 2021
d0c316f
Pulled latest changes
parasharrajat Jun 11, 2021
c5e6da2
Merge pull request #3193 from parasharrajat/fixed-button
roryabraham Jun 11, 2021
05aedfe
Merge pull request #3190 from anthony-hull/setPassword
thienlnam Jun 12, 2021
aa37953
Create StatusBar lib and suppress warnings in settings page
roryabraham Jun 12, 2021
8fa840f
Fix more random displayName and list-key bugs
roryabraham Jun 12, 2021
a09c39e
#3272 add current date updater
dklymenk Jun 12, 2021
bb4d136
Remove unnecessary arrow function
roryabraham Jun 12, 2021
5cf0091
Move reproduction steps above expected/actual results in issue template
roryabraham Jun 12, 2021
348f412
#3272 add date updater to desktop
dklymenk Jun 13, 2021
1a13dc6
#3272 remove extra linebreak
dklymenk Jun 13, 2021
85b22bf
Merge pull request #3570 from Expensify/Rory-ChangeIssueTemplate
MonilBhavsar Jun 14, 2021
7a21fbc
Apply PR suggestions
HorusGoul Jun 14, 2021
5c1003f
Add Navigation.DismissModal component
HorusGoul Jun 14, 2021
eea9c9d
Fix example in Navigation.js
HorusGoul Jun 14, 2021
9872661
Use this.props.translate instead of destructuring
HorusGoul Jun 14, 2021
981419c
typo
parasharrajat Jun 14, 2021
bdf2144
Merge pull request #3547 from Expensify/horus-modal-screen-new-workspace
marcaaron Jun 14, 2021
592b9b1
Merge instead of set session data after signin
Beamanator Jun 14, 2021
ebcdc7e
New public workspace/new route + redirect
Beamanator Jun 14, 2021
268d05d
Merge branch 'main' of github.com:Expensify/Expensify.cash into beama…
Beamanator Jun 14, 2021
f8691d1
Remove SMS domains from tooltips
Jun 14, 2021
84c4b58
Remove old test logs
Beamanator Jun 14, 2021
8f4b69e
Convert placeholder component to class for CDM
Beamanator Jun 14, 2021
659509d
Remove duplicate new workspace route
Beamanator Jun 14, 2021
27592ac
lint
Jun 14, 2021
faeb794
fix: Document Picker crash on IOS
parasharrajat Jun 14, 2021
d0e5fb1
Merge pull request #3579 from Expensify/Rory-FixRandomWarnings
roryabraham Jun 14, 2021
892b546
Merge pull request #3573 from dklymenk/3272-update-message-date-overn…
francoisl Jun 14, 2021
7186caf
Merge pull request #3578 from Expensify/beaman-handle-new-workspace-f…
marcaaron Jun 14, 2021
35d0848
Merge pull request #3551 from parasharrajat/actionList
Jun 14, 2021
53b1596
Merge pull request #3460 from Expensify/Rory-IsUserPublicDomain
Jun 14, 2021
5a04371
Merge pull request #3581 from parasharrajat/attachment-picker
ctkochan22 Jun 14, 2021
4b4d035
Update version to 1.0.68-4
Jun 14, 2021
11b7815
Merge pull request #3583 from Expensify/version-BUILD-5a043715a7d670b…
OSBotify Jun 14, 2021
a722ceb
Merge pull request #3487 from rdjuric/modalFix
ctkochan22 Jun 15, 2021
384aa5e
Merge pull request #3552 from parasharrajat/navigation
MariaHCD Jun 15, 2021
7a521b9
Merge pull request #3580 from Expensify/amechler-sms-tooltip
HorusGoul Jun 15, 2021
6a1ca62
Merge pull request #3558 from Expensify/luke-refactor-and-fix-popover…
HorusGoul Jun 15, 2021
53696e2
Update version to 1.0.68-5
Jun 15, 2021
08f909c
Merge pull request #3591 from Expensify/version-BUILD-6a1ca62acb93a20…
OSBotify Jun 15, 2021
d982352
Merge branch 'main' into update-staging-from-main
Jun 15, 2021
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
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/Standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ labels: AutoAssignerTriage
If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/CONTRIBUTING.md) for onboarding and email contributors@expensify.com to request to join our Slack channel!
___

## Action Performed:
Break down in numbered steps

## Expected Result:
Describe what you think should've happened

## Actual Result:
Describe what actually happened

## Action Performed:
Break down in numbered steps

## Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* [Debugging](#debugging)
* [Structure of the app](#structure-of-the-app)
* [Philosophy](#Philosophy)
* [Internationalization](#Internationalization)
* [Deploying](#deploying)

#### Additional Reading
Expand Down Expand Up @@ -236,6 +237,32 @@ This application is built with the following principles.

----

# Internationalization
This application is built with Internationalization (I18n) / Localization (L10n) support, so it's important to always
localize the following types of data when presented to the user (even accessibility texts that are not rendered):

- Texts: See [translate method](https://github.com/Expensify/Expensify.cash/blob/655ba416d552d5c88e57977a6e0165fb7eb7ab58/src/libs/translate.js#L15)
- Date/time: see [DateUtils](https://github.com/Expensify/Expensify.cash/blob/f579946fbfbdc62acc5bd281dc75cabb803d9af0/src/libs/DateUtils.js)
- Numbers and amounts: see [numberFormat](https://github.com/Expensify/Expensify.cash/tree/965f92fc2a5a2a0d01e6114bf5aa8755b9d9fd1a/src/libs/numberFormat)
- Phones: see [LocalPhoneNumber](https://github.com/Expensify/Expensify.cash/blob/bdfbafe18ee2d60f766c697744f23fad64b62cad/src/libs/LocalePhoneNumber.js#L51-L52)

In most cases, you will be needing to localize data used in a component, if that's the case, there's a HOC [withLocalize](https://github.com/Expensify/Expensify.cash/blob/37465dbd07da1feab8347835d82ed3d2302cde4c/src/components/withLocalize.js).
It will abstract most of the logic you need (mostly subscribe to the [PREFERRED_LOCALE](https://github.com/Expensify/Expensify.cash/blob/6cf1a56df670a11bf61aa67eeb64c1f87161dea1/src/ONYXKEYS.js#L88) Onyx key)
and is the preferred way of localizing things inside components.

Some pointers:

- All translations are stored in language files in [src/languages](https://github.com/Expensify/Expensify.cash/tree/b114bc86ff38e3feca764e75b3f5bf4f60fcd6fe/src/languages).
- We try to group translations by their pages/components
- A common rule of thumb is to move a common word/phrase to be shared when it's in 3 places
- Always prefer longer and more complex strings in the translation files. For example
if you need to generate the text `User has sent $20.00 to you on Oct 25th at 10:05am`, add just one
key to the translation file and use the arrow function version, like so:
`nameOfTheKey: ({amount, dateTime}) => "User has sent " + amount + " to you on " + dateTime,`.
This is because the order of the phrases might vary from one language to another.

----

# Deploying
## QA and deploy cycles
We utilize a CI/CD deployment system built using [GitHub Actions](https://github.com/features/actions) to ensure that new code is automatically deployed to our users as fast as possible. As part of this process, all code is first deployed to our staging environments, where it undergoes quality assurance (QA) testing before it is deployed to production. Typically, pull requests are deployed to staging immediately after they are merged.
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001006804
versionName "1.0.68-4"
versionCode 1001006805
versionName "1.0.68-5"
}
splits {
abi {
Expand Down
1 change: 1 addition & 0 deletions assets/images/workspace-default-avatar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0.68.4</string>
<string>1.0.68.5</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ExpensifyCashTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.68.4</string>
<string>1.0.68.5</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expensify.cash",
"version": "1.0.68-4",
"version": "1.0.68-5",
"author": "Expensify, Inc.",
"homepage": "https://expensify.cash",
"description": "Expensify.cash is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
5 changes: 4 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React from 'react';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import CustomStatusBar from './components/CustomStatusBar';
import ErrorBoundary from './components/ErrorBoundary';
import Expensify from './Expensify';

const App = () => (
<SafeAreaProvider>
<CustomStatusBar />
<Expensify />
<ErrorBoundary errorMessage="E.cash crash caught by error boundary">
<Expensify />
</ErrorBoundary>
</SafeAreaProvider>
);

Expand Down
2 changes: 2 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const CONST = {
IOU: 'IOU',
PAY_WITH_EXPENSIFY: 'payWithExpensify',
FREE_PLAN: 'freePlan',
DEFAULT_ROOMS: 'defaultRooms',
},
BUTTON_STATES: {
DEFAULT: 'default',
Expand Down Expand Up @@ -80,6 +81,7 @@ const CONST = {
MODAL_TYPE: {
CONFIRM: 'confirm',
CENTERED: 'centered',
CENTERED_UNSWIPEABLE: 'centered_unswipeable',
BOTTOM_DOCKED: 'bottom_docked',
POPOVER: 'popover',
RIGHT_DOCKED: 'right_docked',
Expand Down
12 changes: 11 additions & 1 deletion src/Expensify.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
import {View, StatusBar, AppState} from 'react-native';
import {View, AppState} from 'react-native';
import Onyx, {withOnyx} from 'react-native-onyx';

import BootSplash from './libs/BootSplash';
import StatusBar from './libs/StatusBar';
import listenToStorageEvents from './libs/listenToStorageEvents';
import * as ActiveClientManager from './libs/ActiveClientManager';
import ONYXKEYS from './ONYXKEYS';
Expand All @@ -18,6 +19,8 @@ import UpdateAppModal from './components/UpdateAppModal';
import Visibility from './libs/Visibility';
import GrowlNotification from './components/GrowlNotification';
import {growlRef} from './libs/Growl';
import Navigation from './libs/Navigation/Navigation';
import ROUTES from './ROUTES';

// Initialize the store when the app loads for the first time
Onyx.init({
Expand Down Expand Up @@ -54,6 +57,9 @@ const propTypes = {

/** Currently logged in user accountID */
accountID: PropTypes.number,

/** Should app immediately redirect to new workspace route once authenticated */
redirectToWorkspaceNewAfterSignIn: PropTypes.bool,
}),

/** Whether a new update is available and ready to install. */
Expand All @@ -67,6 +73,7 @@ const defaultProps = {
session: {
authToken: null,
accountID: null,
redirectToWorkspaceNewAfterSignIn: false,
},
updateAvailable: false,
initialReportDataLoaded: false,
Expand Down Expand Up @@ -113,6 +120,9 @@ class Expensify extends PureComponent {
const previousAuthToken = lodashGet(prevProps, 'session.authToken', null);
if (this.getAuthToken() && !previousAuthToken) {
BootSplash.show({fade: true});
if (lodashGet(this.props, 'session.redirectToWorkspaceNewAfterSignIn', false)) {
Navigation.navigate(ROUTES.WORKSPACE_NEW);
}
}

if (this.getAuthToken() && this.props.initialReportDataLoaded) {
Expand Down
3 changes: 3 additions & 0 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export default {
// What the active route is for our navigator. Global route that determines what views to display.
CURRENT_URL: 'currentURL',

// Stores current date
CURRENT_DATE: 'currentDate',

// Currently viewed reportID
CURRENTLY_VIEWED_REPORTID: 'currentlyViewedReportID',

Expand Down
1 change: 1 addition & 0 deletions src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default {
VALIDATE_LOGIN: 'v',
VALIDATE_LOGIN_WITH_VALIDATE_CODE: 'v/:accountID/:validateCode',
ENABLE_PAYMENTS: 'enable-payments',
WORKSPACE_NEW: 'workspace/new',

/**
* @param {String} route
Expand Down
10 changes: 9 additions & 1 deletion src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import Str from 'expensify-common/lib/str';
import {withOnyx} from 'react-native-onyx';
import CONST from '../CONST';
import Modal from './Modal';
Expand Down Expand Up @@ -97,10 +98,17 @@ class AttachmentModal extends PureComponent {
const attachmentViewStyles = this.props.isSmallScreenWidth
? [styles.imageModalImageCenterContainer]
: [styles.imageModalImageCenterContainer, styles.p5];

// If our attachment is a PDF, make the Modal unswipeable
const modalType = (this.state.sourceURL
&& (Str.isPDF(this.state.sourceURL) || (this.state.file
&& Str.isPDF(this.state.file.name || this.props.translate('attachmentView.unknownFilename')))))
? CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE
: CONST.MODAL.MODAL_TYPE.CENTERED;
return (
<>
<Modal
type={CONST.MODAL.MODAL_TYPE.CENTERED}
type={modalType}
onSubmit={this.submitAndClose}
onClose={() => this.setState({isModalOpen: false})}
isVisible={this.state.isModalOpen}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import OpacityView from './OpacityView';

const propTypes = {
/** The text for the button label */
text: PropTypes.string.isRequired,
text: PropTypes.string,

/** Indicates whether the button should be disabled and in the loading state */
isLoading: PropTypes.bool,
Expand Down Expand Up @@ -44,6 +44,7 @@ const propTypes = {
};

const defaultProps = {
text: '',
isLoading: false,
isDisabled: false,
onPress: () => {},
Expand Down
52 changes: 52 additions & 0 deletions src/components/ErrorBoundary/BaseErrorBoundary.js
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;
9 changes: 9 additions & 0 deletions src/components/ErrorBoundary/index.js
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;
16 changes: 16 additions & 0 deletions src/components/ErrorBoundary/index.native.js
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;
27 changes: 27 additions & 0 deletions src/components/FixedFooter.js
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;
Loading