From aa379537da4d72b7e42b52bb55f6f372cf0145e9 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Fri, 11 Jun 2021 22:59:19 -0700 Subject: [PATCH 1/3] Create StatusBar lib and suppress warnings in settings page --- src/Expensify.js | 3 ++- src/libs/StatusBar/index.android.js | 4 ++++ src/libs/StatusBar/index.js | 6 ++++++ src/pages/settings/InitialPage.js | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 src/libs/StatusBar/index.android.js create mode 100644 src/libs/StatusBar/index.js diff --git a/src/Expensify.js b/src/Expensify.js index 431db2e8d9a1..eca2fb130a37 100644 --- a/src/Expensify.js +++ b/src/Expensify.js @@ -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'; diff --git a/src/libs/StatusBar/index.android.js b/src/libs/StatusBar/index.android.js new file mode 100644 index 000000000000..0ea4480dc928 --- /dev/null +++ b/src/libs/StatusBar/index.android.js @@ -0,0 +1,4 @@ +import {StatusBar} from 'react-native'; + +// Just export StatusBar – no changes. +export default StatusBar; diff --git a/src/libs/StatusBar/index.js b/src/libs/StatusBar/index.js new file mode 100644 index 000000000000..4aea200cab00 --- /dev/null +++ b/src/libs/StatusBar/index.js @@ -0,0 +1,6 @@ +import {StatusBar} from 'react-native'; + +// Overwrite setTranslucent to suppress a warning on iOS +StatusBar.setTranslucent = () => {}; + +export default StatusBar; diff --git a/src/pages/settings/InitialPage.js b/src/pages/settings/InitialPage.js index 15eb4e485beb..6117efcc6d79 100755 --- a/src/pages/settings/InitialPage.js +++ b/src/pages/settings/InitialPage.js @@ -135,7 +135,7 @@ const InitialSettingsPage = ({ {menuItems.map(item => ( item.action()} From 8fa840f6e56c987f1fac0eef009dcd3035e68a87 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Fri, 11 Jun 2021 23:19:07 -0700 Subject: [PATCH 2/3] Fix more random displayName and list-key bugs --- src/components/Button.js | 3 ++- src/pages/settings/AboutPage.js | 4 ++-- src/pages/settings/AppDownloadLinks.js | 4 ++-- src/pages/settings/Profile/ProfilePage.js | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/Button.js b/src/components/Button.js index a5854151e748..c170e64eb3a1 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -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, @@ -44,6 +44,7 @@ const propTypes = { }; const defaultProps = { + text: '', isLoading: false, isDisabled: false, onPress: () => {}, diff --git a/src/pages/settings/AboutPage.js b/src/pages/settings/AboutPage.js index c273ae70ca27..f337c2bae552 100644 --- a/src/pages/settings/AboutPage.js +++ b/src/pages/settings/AboutPage.js @@ -108,7 +108,7 @@ const AboutPage = ({translate, session}) => { {menuItems.map(item => ( { }; AboutPage.propTypes = propTypes; -AboutPage.displayName = 'PreferencesPage'; +AboutPage.displayName = 'AboutPage'; export default compose( withLocalize, diff --git a/src/pages/settings/AppDownloadLinks.js b/src/pages/settings/AppDownloadLinks.js index 4d0543b2718b..faa7b0d0b3ea 100644 --- a/src/pages/settings/AppDownloadLinks.js +++ b/src/pages/settings/AppDownloadLinks.js @@ -49,7 +49,7 @@ const AppDownloadLinksPage = ({translate}) => { {menuItems.map(item => ( { }; AppDownloadLinksPage.propTypes = propTypes; -AppDownloadLinksPage.displayName = 'PreferencesPage'; +AppDownloadLinksPage.displayName = 'AppDownloadLinksPage'; export default compose( withLocalize, diff --git a/src/pages/settings/Profile/ProfilePage.js b/src/pages/settings/Profile/ProfilePage.js index abd03e9cb62c..2cce3b772dbb 100755 --- a/src/pages/settings/Profile/ProfilePage.js +++ b/src/pages/settings/Profile/ProfilePage.js @@ -384,7 +384,7 @@ class ProfilePage extends Component { From bb4d1364116c45f0f0f35804b6d3ff9e2df1e161 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Sat, 12 Jun 2021 10:04:23 -0700 Subject: [PATCH 3/3] Remove unnecessary arrow function --- src/pages/settings/InitialPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/InitialPage.js b/src/pages/settings/InitialPage.js index 6117efcc6d79..3bc32dcf846a 100755 --- a/src/pages/settings/InitialPage.js +++ b/src/pages/settings/InitialPage.js @@ -138,7 +138,7 @@ const InitialSettingsPage = ({ key={item.translationKey} title={translate(item.translationKey)} icon={item.icon} - onPress={() => item.action()} + onPress={item.action} shouldShowRightIcon /> ))}