Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
eb27821
Add new method to get the static header positions
stitesExpensify Jan 24, 2023
cbadcc7
Add new method to scroll to headers
stitesExpensify Jan 24, 2023
61abba6
Remove unused import
stitesExpensify Jan 24, 2023
22e3e00
Pass the index instead of setting the highlighted index
stitesExpensify Jan 24, 2023
95d0392
Add new button component for category shortcuts
stitesExpensify Jan 24, 2023
a8245d2
Dynamically generate the category buttons using a map
stitesExpensify Jan 24, 2023
d623618
Add new style to fix width
stitesExpensify Jan 24, 2023
f9656fe
Remove unused prop and import
stitesExpensify Jan 24, 2023
ba19359
Remove unused import
stitesExpensify Jan 24, 2023
3747de0
Add category shortcuts to mobile
stitesExpensify Jan 24, 2023
49fda6e
Merge branch 'main' of github.com:Expensify/App into stites-emojiCate…
stitesExpensify Jan 24, 2023
00cfdd2
Always set the numHeaders because there is no filtering on native
stitesExpensify Jan 24, 2023
5acbb38
Style
stitesExpensify Jan 25, 2023
7256918
Add getItemLayout to prevent laggy scrolling when using category picker
stitesExpensify Jan 25, 2023
3833b85
Add emoji category icons
stitesExpensify Jan 25, 2023
e3bf8a4
Remove people and body header to combine the sections
stitesExpensify Jan 25, 2023
cc8bf96
Add new category shortcut bar component
stitesExpensify Jan 26, 2023
27ae4e8
Use image so that we can display svg
stitesExpensify Jan 26, 2023
2fbf3f7
Add new style so the icon fills its container and has the correct color
stitesExpensify Jan 26, 2023
a6d65da
Use report history icon for recent emojis
stitesExpensify Jan 26, 2023
37e583b
Use CategoryShortcutBar instead of directly mapping
stitesExpensify Jan 26, 2023
0fa8c72
Use icon instead of image to render svg
stitesExpensify Jan 26, 2023
eee5a59
Update width for 9 icons instead of 10
stitesExpensify Jan 26, 2023
d5721c4
Fix icon size and styles
stitesExpensify Jan 26, 2023
2d786e4
Fix gap between search bar and categories
stitesExpensify Jan 26, 2023
5379373
Style and removing unused imports
stitesExpensify Jan 26, 2023
61604b8
Update style to have padding on search bar instead of button to fix h…
stitesExpensify Jan 26, 2023
e2716fd
Refactor CategoryShortcutButton to have state
stitesExpensify Jan 26, 2023
51e665e
Use CategoryShortcutBar instead of manually mapping
stitesExpensify Jan 26, 2023
22801a1
Fix lint issues
stitesExpensify Jan 27, 2023
818ce37
Use scrollToIndex and show scrollbar
stitesExpensify Jan 27, 2023
e27c4d6
Try offset using release build
stitesExpensify Jan 30, 2023
275f8ea
Try release build with animation off
stitesExpensify Jan 30, 2023
8a09768
Merge branch 'main' of github.com:Expensify/App into stites-emojiCate…
stitesExpensify Jan 30, 2023
1e78bd4
Clean up test variables
stitesExpensify Jan 31, 2023
3bdb62c
Further simplify scroll logic
stitesExpensify Jan 31, 2023
f97ef7d
Chagne label styles
stitesExpensify Jan 31, 2023
a5a55bb
Use TextInput instead of Composer
stitesExpensify Jan 31, 2023
83a3a7a
Simplify scroll logic since all elements are the same size
stitesExpensify Jan 31, 2023
338477a
Change size to account for only showing 8 rows of emojis instead of 9…
stitesExpensify Jan 31, 2023
0e26ea1
Remove unused import
stitesExpensify Jan 31, 2023
aefc70e
Remove getDynamicHeaderIndices since it was confusing and can ge calc…
stitesExpensify Jan 31, 2023
f988963
Remove this.numColumns since it is just copying a const
stitesExpensify Jan 31, 2023
e962675
Add underscore import to prevent crash
stitesExpensify Jan 31, 2023
ee08bff
remove old unused header style
stitesExpensify Jan 31, 2023
f2c9f90
Merge branch 'main' of github.com:Expensify/App into stites-emojiCate…
stitesExpensify Jan 31, 2023
6e9fa29
Style
stitesExpensify Jan 31, 2023
db31731
Don't use .mjs
stitesExpensify Feb 1, 2023
ed4acf9
Change icons to gray
stitesExpensify Feb 1, 2023
91b2190
Merge branch 'main' of github.com:Expensify/App into stites-emojiCate…
stitesExpensify Feb 2, 2023
5724fbe
Only show the correct 8 icons when there is no frequently used category
stitesExpensify Feb 2, 2023
d7510d2
Use flex instead of static widths
stitesExpensify Feb 3, 2023
c928c37
Style
stitesExpensify Feb 3, 2023
7c59ca1
Update color to match other icons
stitesExpensify Feb 10, 2023
8f35302
Use reanimated to fix momentum scroll issue
stitesExpensify Feb 10, 2023
06e150b
Animate scrolling to match native
stitesExpensify Feb 10, 2023
29fc3a9
Style
stitesExpensify Feb 10, 2023
31f4838
Merge branch 'main' of github.com:Expensify/App into stites-emojiCate…
stitesExpensify Feb 10, 2023
cf8ae6a
Style
stitesExpensify Feb 10, 2023
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
4 changes: 0 additions & 4 deletions assets/emojis.js
Original file line number Diff line number Diff line change
Expand Up @@ -1728,10 +1728,6 @@ const emojis = [
'sleep',
],
},
{
code: 'peopleAndBody',
header: true,
},
{
name: 'wave',
code: '👋',
Expand Down
25 changes: 25 additions & 0 deletions assets/images/emojiCategoryIcons/add-emoji.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions assets/images/emojiCategoryIcons/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions assets/images/emojiCategoryIcons/car.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions assets/images/emojiCategoryIcons/flag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions assets/images/emojiCategoryIcons/hamburger.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions assets/images/emojiCategoryIcons/heart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions assets/images/emojiCategoryIcons/light-bulb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions assets/images/emojiCategoryIcons/peace-sign.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions assets/images/emojiCategoryIcons/plane.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions assets/images/emojiCategoryIcons/plant.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions assets/images/emojiCategoryIcons/soccer-ball.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,11 @@ const CONST = {

EMOJI_SPACER: 'SPACER',

// This is the number of columns in each row of the picker.
// Because of how flatList implements these rows, each row is an index rather than each element
// For this reason to make headers work, we need to have the header be the only rendered element in its row
// If this number is changed, emojis.js will need to be updated to have the proper number of spacer elements
// around each header.
EMOJI_NUM_PER_ROW: 8,

EMOJI_FREQUENT_ROW_COUNT: 3,
Expand Down Expand Up @@ -531,9 +536,9 @@ const CONST = {
ADD_PAYMENT_MENU_POSITION_X: 356,
EMOJI_PICKER_SIZE: {
WIDTH: 320,
HEIGHT: 390,
HEIGHT: 392,
},
NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT: 288,
NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT: 256,
EMOJI_PICKER_ITEM_HEIGHT: 32,
EMOJI_PICKER_HEADER_HEIGHT: 32,
COMPOSER_MAX_HEIGHT: 125,
Expand Down
48 changes: 48 additions & 0 deletions src/components/EmojiPicker/CategoryShortcutBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import _ from 'underscore';
import styles from '../../styles/styles';
import FrequentlyUsed from '../../../assets/images/history.svg';
import Smiley from '../../../assets/images/emoji.svg';
import AnimalsAndNature from '../../../assets/images/emojiCategoryIcons/plant.svg';
import FoodAndDrink from '../../../assets/images/emojiCategoryIcons/hamburger.svg';
import TravelAndPlaces from '../../../assets/images/emojiCategoryIcons/plane.svg';
import Activities from '../../../assets/images/emojiCategoryIcons/soccer-ball.svg';
import Objects from '../../../assets/images/emojiCategoryIcons/light-bulb.svg';
import Symbols from '../../../assets/images/emojiCategoryIcons/peace-sign.svg';
import Flags from '../../../assets/images/emojiCategoryIcons/flag.svg';
import CategoryShortcutButton from './CategoryShortcutButton';

const propTypes = {
/** The function to call when an emoji is selected */
onPress: PropTypes.func.isRequired,

/** The indices that the icons should link to */
headerIndices: PropTypes.arrayOf(PropTypes.number).isRequired,
};

const CategoryShortcutBar = (props) => {
const icons = [Smiley, AnimalsAndNature, FoodAndDrink, TravelAndPlaces, Activities, Objects, Symbols, Flags];

// If the user has frequently used emojis, there will be 9 headers, otherwise there will be 8
if (props.headerIndices.length === 9) {
icons.unshift(FrequentlyUsed);
}

return (
<View style={[styles.pt2, styles.ph4, styles.flexRow]}>
{_.map(props.headerIndices, (headerIndex, i) => (
<CategoryShortcutButton
icon={icons[i]}
onPress={() => props.onPress(headerIndex)}
key={`categoryShortcut${i}`}
/>
))}
</View>
);
};
CategoryShortcutBar.propTypes = propTypes;
CategoryShortcutBar.displayName = 'CategoryShortcutBar';

export default CategoryShortcutBar;
53 changes: 53 additions & 0 deletions src/components/EmojiPicker/CategoryShortcutButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Pressable, View} from 'react-native';
import Icon from '../Icon';
import variables from '../../styles/variables';
import styles from '../../styles/styles';
import * as StyleUtils from '../../styles/StyleUtils';
import getButtonState from '../../libs/getButtonState';
import themeColors from '../../styles/themes/default';

const propTypes = {
/** The icon representation of the category that this button links to */
icon: PropTypes.func.isRequired,

/** The function to call when an emoji is selected */
onPress: PropTypes.func.isRequired,
};

class CategoryShortcutButton extends PureComponent {
constructor(props) {
super(props);
this.state = {
isHighlighted: false,
};
}

render() {
return (
<Pressable
onPress={this.props.onPress}
onHoverIn={() => this.setState({isHighlighted: true})}
onHoverOut={() => this.setState({isHighlighted: false})}
style={({pressed}) => ([
StyleUtils.getButtonBackgroundColorStyle(getButtonState(false, pressed)),
styles.categoryShortcutButton,
this.state.isHighlighted && styles.emojiItemHighlighted,
])}
>
<View style={styles.alignSelfCenter}>
<Icon
fill={themeColors.icon}
src={this.props.icon}
height={variables.iconSizeNormal}
width={variables.iconSizeNormal}
/>
</View>
</Pressable>
);
}
}
CategoryShortcutButton.propTypes = propTypes;

export default CategoryShortcutButton;
Loading