Skip to content

Commit

Permalink
Merge pull request #14829 from Expensify/OSBotify-cherry-pick-staging…
Browse files Browse the repository at this point in the history
…-14826

🍒 Cherry pick PR #14826 to staging 🍒
  • Loading branch information
OSBotify authored Feb 3, 2023
2 parents 970da9d + 77a897f commit 0d0a79d
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 54 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001026406
versionName "1.2.64-6"
versionCode 1001026407
versionName "1.2.64-7"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/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.2.64.6</string>
<string>1.2.64.7</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/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.2.64.6</string>
<string>1.2.64.7</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.2.64-6",
"version": "1.2.64-7",
"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
9 changes: 3 additions & 6 deletions src/components/OptionsList/BaseOptionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class BaseOptionsList extends Component {
* @returns {Array<Object>}
*/
buildFlatSectionArray() {
const optionHeight = variables.optionRowHeight;
let offset = 0;

// Start with just an empty list header
Expand All @@ -120,12 +121,8 @@ class BaseOptionsList extends Component {

// Add section items
for (let i = 0; i < section.data.length; i++) {
let fullOptionHeight = variables.optionRowHeight;
if (i > 0 && this.props.shouldHaveOptionSeparator) {
fullOptionHeight += variables.borderTopWidth;
}
flatArray.push({length: fullOptionHeight, offset});
offset += fullOptionHeight;
flatArray.push({length: optionHeight, offset});
offset += optionHeight;
}

// Add the section footer
Expand Down
37 changes: 4 additions & 33 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ class BaseOptionsSelector extends Component {
this.relatedTarget = null;

const allOptions = this.flattenSections();
const focusedIndex = this.getInitiallyFocusedIndex(allOptions);

this.state = {
allOptions,
focusedIndex,
focusedIndex: this.props.shouldTextInputAppearBelowOptions ? allOptions.length : 0,
};
}

Expand Down Expand Up @@ -86,8 +85,6 @@ class BaseOptionsSelector extends Component {
true,
);

this.scrollToIndex(this.state.focusedIndex, false);

if (!this.props.autoFocus) {
return;
}
Expand Down Expand Up @@ -139,25 +136,6 @@ class BaseOptionsSelector extends Component {
}
}

/**
* @param {Array<Object>} allOptions
* @returns {Number}
*/
getInitiallyFocusedIndex(allOptions) {
const defaultIndex = this.props.shouldTextInputAppearBelowOptions ? allOptions.length : 0;
if (_.isUndefined(this.props.initiallyFocusedOptionKey)) {
return defaultIndex;
}

const indexOfInitiallyFocusedOption = _.findIndex(allOptions, option => option.keyForList === this.props.initiallyFocusedOptionKey);

if (indexOfInitiallyFocusedOption >= 0) {
return indexOfInitiallyFocusedOption;
}

return defaultIndex;
}

/**
* Flattens the sections into a single array of options.
* Each object in this array is enhanced to have:
Expand Down Expand Up @@ -198,9 +176,8 @@ class BaseOptionsSelector extends Component {
* Scrolls to the focused index within the SectionList
*
* @param {Number} index
* @param {Boolean} animated
*/
scrollToIndex(index, animated = true) {
scrollToIndex(index) {
const option = this.state.allOptions[index];
if (!this.list || !option) {
return;
Expand All @@ -219,7 +196,7 @@ class BaseOptionsSelector extends Component {
}
}

this.list.scrollToLocation({sectionIndex: adjustedSectionIndex, itemIndex, animated});
this.list.scrollToLocation({sectionIndex: adjustedSectionIndex, itemIndex});
}

/**
Expand Down Expand Up @@ -293,13 +270,7 @@ class BaseOptionsSelector extends Component {
showTitleTooltip={this.props.showTitleTooltip}
isDisabled={this.props.isDisabled}
shouldHaveOptionSeparator={this.props.shouldHaveOptionSeparator}
onLayout={() => {
this.scrollToIndex(this.state.focusedIndex, false);

if (this.props.onLayout) {
this.props.onLayout();
}
}}
onLayout={this.props.onLayout}
/>
) : <FullScreenLoadingIndicator />;
return (
Expand Down
4 changes: 0 additions & 4 deletions src/components/OptionsSelector/optionsSelectorPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ const propTypes = {

/** Whether to show a line separating options in list */
shouldHaveOptionSeparator: PropTypes.bool,

/** Key of the option that we should focus on when first opening the options list */
initiallyFocusedOptionKey: PropTypes.string,
};

const defaultProps = {
Expand All @@ -116,7 +113,6 @@ const defaultProps = {
disableArrowKeysActions: false,
isDisabled: false,
shouldHaveOptionSeparator: false,
initiallyFocusedOptionKey: undefined,
};

export {propTypes, defaultProps};
3 changes: 1 addition & 2 deletions src/pages/settings/Profile/TimezoneSelectPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ class TimezoneSelectPage extends Component {
onChangeText={this.filterShownTimezones}
onSelectRow={this.saveSelectedTimezone}
optionHoveredStyle={styles.hoveredComponentBG}
sections={[{data: this.state.timezoneOptions, indexOffset: 0}]}
sections={[{data: this.state.timezoneOptions}]}
shouldHaveOptionSeparator
initiallyFocusedOptionKey={this.currentSelectedTimezone}
/>
</ScreenWrapper>
);
Expand Down
2 changes: 1 addition & 1 deletion src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,7 @@ const styles = {
},

borderTop: {
borderTopWidth: variables.borderTopWidth,
borderTopWidth: 1,
borderColor: themeColors.border,
},

Expand Down
1 change: 0 additions & 1 deletion src/styles/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,4 @@ export default {
checkboxLabelActiveOpacity: 0.7,
avatarChatSpacing: 12,
chatInputSpacing: 52, // 40 + avatarChatSpacing
borderTopWidth: 1,
};

0 comments on commit 0d0a79d

Please sign in to comment.