Repository navigation
Optimization of mobile startup time #31776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a19fcb2
78ef9ae
3b0858a
e28a632
9cc08a0
6f5fcf4
cfb5b6a
bc1c7e0
bffe6f7
4e7f09a
1c75def
9a958eb
b3d0a63
dad435b
fa945da
a83117b
e962db8
1e9d3af
33c787d
f72c49c
61a6701
b87507a
9f2c4ef
1108301
706dd00
8141e50
c35d737
25f5b00
c034e71
a0ab476
6166f2b
cdfb6d7
e6d7779
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ import {Emoji, HeaderEmoji, PickerEmojis} from '@assets/emojis/types'; | |
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import {FrequentlyUsedEmoji} from '@src/types/onyx'; | ||
| import emojisTrie from './EmojiTrie'; | ||
| import {SupportedLanguage} from './EmojiTrie'; | ||
|
|
||
| type HeaderIndice = {code: string; index: number; icon: React.FC<SvgProps>}; | ||
| type EmojiSpacer = {code: string; spacer: boolean}; | ||
|
|
@@ -322,6 +322,9 @@ function getAddedEmojis(currentEmojis: Emoji[], formerEmojis: Emoji[]): Emoji[] | |
| * If we're on mobile, we also add a space after the emoji granted there's no text after it. | ||
| */ | ||
| function replaceEmojis(text: string, preferredSkinTone = CONST.EMOJI_DEFAULT_SKIN_TONE, lang: 'en' | 'es' = CONST.LOCALES.DEFAULT): ReplacedEmoji { | ||
| // emojisTrie is importing the emoji JSON file on the app starting and we want to avoid it | ||
| const emojisTrie = require('./EmojiTrie').default; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here, does it mean that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we do not change the required path, it will return the same reference cached in the first load. At least, that's how I understand this after additional research and testing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's cool, thanks! |
||
|
|
||
| const trie = emojisTrie[lang]; | ||
| if (!trie) { | ||
| return {text, emojis: []}; | ||
|
|
@@ -396,7 +399,10 @@ function replaceAndExtractEmojis(text: string, preferredSkinTone = CONST.EMOJI_D | |
| * Suggest emojis when typing emojis prefix after colon | ||
| * @param [limit] - matching emojis limit | ||
| */ | ||
| function suggestEmojis(text: string, lang: keyof typeof emojisTrie, limit = CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_SUGGESTIONS): Emoji[] | undefined { | ||
| function suggestEmojis(text: string, lang: keyof SupportedLanguage, limit = CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_SUGGESTIONS): Emoji[] | undefined { | ||
| // emojisTrie is importing the emoji JSON file on the app starting and we want to avoid it | ||
| const emojisTrie = require('./EmojiTrie').default; | ||
|
|
||
| const trie = emojisTrie[lang]; | ||
| if (!trie) { | ||
| return []; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import {CSSProperties} from 'react'; | ||
| import {ViewStyle} from 'react-native'; | ||
| import {SvgProps} from 'react-native-svg'; | ||
| import {ValueOf} from 'type-fest'; | ||
| import CONST from '@src/CONST'; | ||
|
|
||
| type BankIcon = { | ||
| icon: React.FC<SvgProps>; | ||
| iconSize?: number; | ||
| iconHeight?: number; | ||
| iconWidth?: number; | ||
| iconStyles?: Array<ViewStyle | CSSProperties>; | ||
| }; | ||
|
|
||
| type BankName = ValueOf<typeof CONST.BANK_NAMES>; | ||
| type BankNameKey = keyof typeof CONST.BANK_NAMES; | ||
|
|
||
| export type {BankIcon, BankName, BankNameKey}; |
Uh oh!
There was an error while loading. Please reload this page.