From 3e410ef9deebf3ee700f0f98d30989abf1a859e8 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Wed, 27 Jul 2022 11:22:47 -0700 Subject: [PATCH 01/27] undo patch --- ios/NewExpensify.xcodeproj/project.pbxproj | 4 +- ios/Podfile.lock | 6 +- src/components/ScreenWrapper.js | 60 +++- src/pages/AddPersonalBankAccountPage.js | 117 ++++--- .../EnablePayments/AdditionalDetailsStep.js | 250 +++++++------- .../EnablePayments/EnablePaymentsPage.js | 15 +- src/pages/GetAssistancePage.js | 59 ++-- src/pages/NewChatPage.js | 5 +- .../ReimbursementAccountPage.js | 55 ++- src/pages/RequestCallPage.js | 157 +++++---- src/pages/SearchPage.js | 1 - src/pages/home/ReportScreen.js | 87 +++-- src/pages/home/report/ReportActionCompose.js | 2 +- src/pages/iou/IOUCurrencySelection.js | 29 +- src/pages/iou/IOUModal.js | 7 +- src/pages/settings/AddSecondaryLoginPage.js | 109 +++--- src/pages/settings/PasswordPage.js | 155 +++++---- .../settings/Payments/AddDebitCardPage.js | 159 +++++---- .../settings/Payments/AddPayPalMePage.js | 73 ++-- .../Payments/ChooseTransferAccountPage.js | 45 ++- .../Payments/PaymentsPage/BasePaymentsPage.js | 312 +++++++++--------- .../settings/Payments/TransferBalancePage.js | 179 +++++----- src/pages/settings/Profile/ProfilePage.js | 179 +++++----- .../settings/Security/CloseAccountPage.js | 145 ++++---- src/pages/workspace/WorkspaceInvitePage.js | 5 +- src/pages/workspace/WorkspaceNewRoomPage.js | 89 +++-- .../workspace/WorkspacePageWithSections.js | 57 ++-- 27 files changed, 1163 insertions(+), 1198 deletions(-) diff --git a/ios/NewExpensify.xcodeproj/project.pbxproj b/ios/NewExpensify.xcodeproj/project.pbxproj index a9fad31433f7..abfa05936a94 100644 --- a/ios/NewExpensify.xcodeproj/project.pbxproj +++ b/ios/NewExpensify.xcodeproj/project.pbxproj @@ -940,7 +940,7 @@ COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386"; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -1001,7 +1001,7 @@ COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386"; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1aea6abedf1a..b7874402dac1 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -443,7 +443,7 @@ PODS: - React-Core - react-native-document-picker (8.0.0): - React-Core - - react-native-flipper (0.117.0): + - react-native-flipper (0.146.1): - React-Core - react-native-image-picker (4.7.3): - React-Core @@ -938,7 +938,7 @@ SPEC CHECKSUMS: react-native-cameraroll: 60ac50a5209777cbccfe8d7a62d0743a9da87060 react-native-config: 6502b1879f97ed5ac570a029961fc35ea606cd14 react-native-document-picker: 772d04a4bc5c35da9abe27b08ac271420ae3f9ef - react-native-flipper: cd9eabd8917104c1bbdca2621717cdca3b2addef + react-native-flipper: 4bfe0a324e663f1ae2f76ad0da75673de6895efe react-native-image-picker: ae1202414bd5c37c00b2a701daa5b6194a06b7d9 react-native-netinfo: ebbcd8fbe1a0ce7035e43cd18c5a545dcb93dd08 react-native-pdf: 4b5a9e4465a6a3b399e91dc4838eb44ddf716d1f @@ -985,4 +985,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 431123d7514c52fa4516724b89c20d02c87ad8c8 -COCOAPODS: 1.11.2 +COCOAPODS: 1.11.3 diff --git a/src/components/ScreenWrapper.js b/src/components/ScreenWrapper.js index bc6a416dbd01..9167c7cc2dd7 100644 --- a/src/components/ScreenWrapper.js +++ b/src/components/ScreenWrapper.js @@ -1,7 +1,7 @@ import _ from 'underscore'; import React from 'react'; import PropTypes from 'prop-types'; -import {View} from 'react-native'; +import {View, KeyboardAvoidingView} from 'react-native'; import {SafeAreaInsetsContext} from 'react-native-safe-area-context'; import {withOnyx} from 'react-native-onyx'; import styles from '../styles/styles'; @@ -15,6 +15,10 @@ import compose from '../libs/compose'; import ONYXKEYS from '../ONYXKEYS'; import CONST from '../CONST'; import withNavigation from './withNavigation'; +import withWindowDimensions from './withWindowDimensions'; +import OfflineIndicator from './OfflineIndicator'; +import {withNetwork} from './OnyxProvider'; +import networkPropTypes from './networkPropTypes'; const propTypes = { /** Array of additional styles to add */ @@ -35,6 +39,13 @@ const propTypes = { // Called when navigated Screen's transition is finished. onTransitionEnd: PropTypes.func, + /** Is the window width narrow, like on a mobile device */ + isSmallScreenWidth: PropTypes.bool.isRequired, + + /** The behavior to pass to the KeyboardAvoidingView, requires some trial and error depending on the layout/devices used. + * Search 'switch(behavior)' in ./node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js for more context */ + keyboardAvoidingViewBehavior: PropTypes.oneOf(['padding', 'height', 'position']), + // react-navigation navigation object available to screen components navigation: PropTypes.shape({ // Method to attach listener to Navigation state. @@ -47,6 +58,9 @@ const propTypes = { willAlertModalBecomeVisible: PropTypes.bool, }), + /** Information about the network */ + network: networkPropTypes.isRequired, + }; const defaultProps = { @@ -58,6 +72,7 @@ const defaultProps = { addListener: () => {}, }, modal: {}, + keyboardAvoidingViewBehavior: 'padding', }; class ScreenWrapper extends React.Component { @@ -105,27 +120,36 @@ class ScreenWrapper extends React.Component { paddingStyle.paddingTop = paddingTop; } - if (this.props.includePaddingBottom) { + // We always need the safe area padding bottom if we're showing the offline indicator since it is bottom-docked. + if (this.props.includePaddingBottom || this.props.network.isOffline) { paddingStyle.paddingBottom = paddingBottom; } return ( - - - {// If props.children is a function, call it to provide the insets to the children. - _.isFunction(this.props.children) - ? this.props.children({ - insets, - didScreenTransitionEnd: this.state.didScreenTransitionEnd, - }) - : this.props.children - } - + + + {// If props.children is a function, call it to provide the insets to the children. + _.isFunction(this.props.children) + ? this.props.children({ + insets, + didScreenTransitionEnd: this.state.didScreenTransitionEnd, + }) + : this.props.children + } + + {this.props.isSmallScreenWidth && this.props.network.isOffline && ( + + + + )} + ); }} @@ -139,9 +163,11 @@ ScreenWrapper.defaultProps = defaultProps; export default compose( withNavigation, + withWindowDimensions, withOnyx({ modal: { key: ONYXKEYS.MODAL, }, }), + withNetwork(), )(ScreenWrapper); diff --git a/src/pages/AddPersonalBankAccountPage.js b/src/pages/AddPersonalBankAccountPage.js index 5a14ed6f7f45..6d6586fa1f0e 100644 --- a/src/pages/AddPersonalBankAccountPage.js +++ b/src/pages/AddPersonalBankAccountPage.js @@ -13,7 +13,6 @@ import AddPlaidBankAccount from '../components/AddPlaidBankAccount'; import getPlaidOAuthReceivedRedirectURI from '../libs/getPlaidOAuthReceivedRedirectURI'; import compose from '../libs/compose'; import ONYXKEYS from '../ONYXKEYS'; -import KeyboardAvoidingView from '../components/KeyboardAvoidingView'; import Text from '../components/Text'; import styles from '../styles/styles'; import Button from '../components/Button'; @@ -125,67 +124,65 @@ class AddPersonalBankAccountPage extends React.Component { return ( - - - {success ? ( - <> - - {success} - - -