Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Expensify/App into feat/#Ex…
Browse files Browse the repository at this point in the history
…pensify#23220-bidirectional-pagination
  • Loading branch information
perunt committed Sep 22, 2023
2 parents a4f6834 + 7bebfd3 commit 1829ade
Show file tree
Hide file tree
Showing 35 changed files with 701 additions and 346 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001037210
versionName "1.3.72-10"
versionCode 1001037300
versionName "1.3.73-0"
}

flavorDimensions "default"
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.72</string>
<string>1.3.73</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.72.10</string>
<string>1.3.73.0</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.72</string>
<string>1.3.73</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.72.10</string>
<string>1.3.73.0</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions 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": "new.expensify",
"version": "1.3.72-10",
"version": "1.3.73-0",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
23 changes: 20 additions & 3 deletions src/components/ContextMenuItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {forwardRef, useImperativeHandle} from 'react';
import PropTypes from 'prop-types';
import MenuItem from './MenuItem';
import Icon from './Icon';
Expand Down Expand Up @@ -34,6 +34,12 @@ const propTypes = {

/** The action accept for anonymous user or not */
isAnonymousAction: PropTypes.bool,

/** Whether the menu item is focused or not */
isFocused: PropTypes.bool,

/** Forwarded ref to ContextMenuItem */
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
};

const defaultProps = {
Expand All @@ -42,9 +48,11 @@ const defaultProps = {
successText: '',
description: '',
isAnonymousAction: false,
isFocused: false,
innerRef: null,
};

function ContextMenuItem({onPress, successIcon, successText, icon, text, isMini, description, isAnonymousAction}) {
function ContextMenuItem({onPress, successIcon, successText, icon, text, isMini, description, isAnonymousAction, isFocused, innerRef}) {
const {windowWidth} = useWindowDimensions();
const [isThrottledButtonActive, setThrottledButtonInactive] = useThrottledButtonState();

Expand All @@ -61,6 +69,8 @@ function ContextMenuItem({onPress, successIcon, successText, icon, text, isMini,
}
};

useImperativeHandle(innerRef, () => ({triggerPressAndUpdateSuccess}));

const itemIcon = !isThrottledButtonActive && successIcon ? successIcon : icon;
const itemText = !isThrottledButtonActive && successText ? successText : text;

Expand Down Expand Up @@ -89,6 +99,7 @@ function ContextMenuItem({onPress, successIcon, successText, icon, text, isMini,
descriptionTextStyle={styles.breakAll}
style={getContextMenuItemStyles(windowWidth)}
isAnonymousAction={isAnonymousAction}
focused={isFocused}
/>
);
}
Expand All @@ -97,4 +108,10 @@ ContextMenuItem.propTypes = propTypes;
ContextMenuItem.defaultProps = defaultProps;
ContextMenuItem.displayName = 'ContextMenuItem';

export default ContextMenuItem;
export default forwardRef((props, ref) => (
<ContextMenuItem
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
innerRef={ref}
/>
));
5 changes: 4 additions & 1 deletion src/components/ReportActionItem/MoneyRequestPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import * as DeviceCapabilities from '../../libs/DeviceCapabilities';
import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes';
import {showContextMenuForReport} from '../ShowContextMenuContext';
import * as OptionsListUtils from '../../libs/OptionsListUtils';
import * as ReportActionsUtils from '../../libs/ReportActionsUtils';
import * as CurrencyUtils from '../../libs/CurrencyUtils';
import * as IOUUtils from '../../libs/IOUUtils';
import * as ReportUtils from '../../libs/ReportUtils';
Expand Down Expand Up @@ -239,7 +240,9 @@ function MoneyRequestPreview(props) {
isHovered={isScanning}
/>
)}
{_.isEmpty(props.transaction) ? (
{_.isEmpty(props.transaction) &&
!ReportActionsUtils.isMessageDeleted(props.action) &&
lodashGet(props.action, 'pendingAction') !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ? (
<MoneyRequestSkeletonView />
) : (
<View style={styles.moneyRequestPreviewBoxText}>
Expand Down
1 change: 1 addition & 0 deletions src/components/SelectionList/BaseSelectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ function BaseSelectionList({
<SectionList
ref={listRef}
sections={sections}
stickySectionHeadersEnabled={false}
renderSectionHeader={renderSectionHeader}
renderItem={renderItem}
getItemLayout={getItemLayout}
Expand Down
20 changes: 1 addition & 19 deletions src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'underscore';
import React, {useState, useRef, useEffect, useCallback} from 'react';
import {Animated, View, AppState, Keyboard, StyleSheet} from 'react-native';
import {Animated, View, StyleSheet} from 'react-native';
import Str from 'expensify-common/lib/str';
import RNTextInput from '../RNTextInput';
import TextInputLabel from './TextInputLabel';
Expand Down Expand Up @@ -38,24 +38,6 @@ function BaseTextInput(props) {
const input = useRef(null);
const isLabelActive = useRef(initialActiveLabel);

useEffect(() => {
if (!props.disableKeyboard) {
return;
}

const appStateSubscription = AppState.addEventListener('change', (nextAppState) => {
if (!nextAppState.match(/inactive|background/)) {
return;
}

Keyboard.dismiss();
});

return () => {
appStateSubscription.remove();
};
}, [props.disableKeyboard]);

// AutoFocus which only works on mount:
useEffect(() => {
// We are manually managing focus to prevent this issue: https://github.com/Expensify/App/issues/4514
Expand Down
45 changes: 33 additions & 12 deletions src/components/TextInput/index.native.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
import React, {forwardRef} from 'react';
import React, {forwardRef, useEffect} from 'react';
import {AppState, Keyboard} from 'react-native';
import styles from '../../styles/styles';
import BaseTextInput from './BaseTextInput';
import * as baseTextInputPropTypes from './baseTextInputPropTypes';

const TextInput = forwardRef((props, ref) => (
<BaseTextInput
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
// Setting autoCompleteType to new-password throws an error on Android/iOS, so fall back to password in that case
// eslint-disable-next-line react/jsx-props-no-multi-spaces
autoCompleteType={props.autoCompleteType === 'new-password' ? 'password' : props.autoCompleteType}
innerRef={ref}
inputStyle={[styles.baseTextInput, ...props.inputStyle]}
/>
));
const TextInput = forwardRef((props, ref) => {
useEffect(() => {
if (!props.disableKeyboard) {
return;
}

const appStateSubscription = AppState.addEventListener('change', (nextAppState) => {
if (!nextAppState.match(/inactive|background/)) {
return;
}

Keyboard.dismiss();
});

return () => {
appStateSubscription.remove();
};
}, [props.disableKeyboard]);

return (
<BaseTextInput
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
// Setting autoCompleteType to new-password throws an error on Android/iOS, so fall back to password in that case
// eslint-disable-next-line react/jsx-props-no-multi-spaces
autoCompleteType={props.autoCompleteType === 'new-password' ? 'password' : props.autoCompleteType}
innerRef={ref}
inputStyle={[styles.baseTextInput, ...props.inputStyle]}
/>
);
});

TextInput.propTypes = baseTextInputPropTypes.propTypes;
TextInput.defaultProps = baseTextInputPropTypes.defaultProps;
Expand Down
1 change: 0 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,6 @@ export default {
reimburse: {
captureReceipts: 'Capture receipts',
fastReimbursementsHappyMembers: 'Fast reimbursements = happy members!',
kilometers: 'Kilometers',
viewAllReceipts: 'View all receipts',
reimburseReceipts: 'Reimburse receipts',
trackDistance: 'Track distance',
Expand Down
1 change: 0 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,6 @@ export default {
reimburse: {
captureReceipts: 'Captura recibos',
fastReimbursementsHappyMembers: '¡Reembolsos rápidos = miembros felices!',
kilometers: 'Kilómetros',
viewAllReceipts: 'Ver todos los recibos',
reimburseReceipts: 'Reembolsar recibos',
trackDistance: 'Medir distancia',
Expand Down
6 changes: 0 additions & 6 deletions src/libs/Firebase/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
/* eslint-disable no-unused-vars */
import perf from '@react-native-firebase/perf';
import lodashGet from 'lodash/get';
import * as Environment from '../Environment/Environment';
import Log from '../Log';
import {StartTrace, StopTrace, TraceMap} from './types';

const traceMap = {};
const traceMap: TraceMap = {};

/**
* @param {String} customEventName
*/
function startTrace(customEventName) {
const startTrace: StartTrace = (customEventName) => {
const start = global.performance.now();
if (Environment.isDevelopment()) {
return;
Expand All @@ -27,18 +23,16 @@ function startTrace(customEventName) {
start,
};
});
}
};

/**
* @param {String} customEventName
*/
function stopTrace(customEventName) {
const stop = global.performance.now();
const stopTrace: StopTrace = (customEventName) => {
// Uncomment to inspect logs on release builds
// const stop = global.performance.now();
if (Environment.isDevelopment()) {
return;
}

const trace = lodashGet(traceMap, [customEventName, 'trace']);
const trace = traceMap[customEventName].trace;
if (!trace) {
return;
}
Expand All @@ -50,7 +44,7 @@ function stopTrace(customEventName) {
// Log.info(`sidebar_loaded: ${stop - start} ms`, true);

delete traceMap[customEventName];
}
};

export default {
startTrace,
Expand Down
10 changes: 10 additions & 0 deletions src/libs/Firebase/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {StartTrace, StopTrace} from './types';

/** Web does not use Firebase for performance tracing */
const startTrace: StartTrace = () => {};
const stopTrace: StopTrace = () => {};

export default {
startTrace,
stopTrace,
};
11 changes: 11 additions & 0 deletions src/libs/Firebase/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {FirebasePerformanceTypes} from '@react-native-firebase/perf';

type Trace = {
trace: FirebasePerformanceTypes.Trace;
start: number;
};
type TraceMap = Record<string, Trace>;
type StartTrace = (customEventName: string) => void;
type StopTrace = (customEventName: string) => void;

export type {StartTrace, StopTrace, TraceMap};
23 changes: 23 additions & 0 deletions src/libs/UpdateMultilineInputRange/index.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Place the cursor at the end of the value (if there is a value in the input).
*
* When a multiline input contains a text value that goes beyond the scroll height, the cursor will be placed
* at the end of the text value, and automatically scroll the input field to this position after the field gains
* focus. This provides a better user experience in cases where the text in the field has to be edited. The auto-
* scroll behaviour works on all platforms except iOS native.
* See https://github.com/Expensify/App/issues/20836 for more details.
*
* @param {Object} input the input element
*/
export default function updateMultilineInputRange(input) {
if (!input) {
return;
}

/*
* Adding this iOS specific patch because of the scroll issue in native iOS
* Issue: does not scroll multiline input when text exceeds the maximum number of lines
* For more details: https://github.com/Expensify/App/pull/27702#issuecomment-1728651132
*/
input.focus();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Focus a multiline text input and place the cursor at the end of the value (if there is a value in the input).
* Place the cursor at the end of the value (if there is a value in the input).
*
* When a multiline input contains a text value that goes beyond the scroll height, the cursor will be placed
* at the end of the text value, and automatically scroll the input field to this position after the field gains
Expand All @@ -9,12 +9,11 @@
*
* @param {Object} input the input element
*/
export default function focusAndUpdateMultilineInputRange(input) {
export default function updateMultilineInputRange(input) {
if (!input) {
return;
}

input.focus();
if (input.value && input.setSelectionRange) {
const length = input.value.length;
input.setSelectionRange(length, length);
Expand Down
Loading

0 comments on commit 1829ade

Please sign in to comment.