Skip to content

Commit b0730a0

Browse files
borisyankovgnprice
authored andcommitted
Fix a performance issue with some lists
Closes #3103 Both FlatList and SectionList offer as the main performance benefit rendering a 'window' and not their whole contents. Sometimes in the past, by mistake, we have rendered one of these in full height but scrollable thanks to the ScrollView they are inside. By analyzing all of our usage, I pinpointed the only major problem we have, that resulted in a performance issues in the Emoji picker and the `UsersScreen` (when one searches the 'all users' list), which manifested as the list updating too infrequently during search. Our default `Screen` behavior is to be 'scrollable' by default. We should consider changing the default behavior. In the meantime any screen that has a `FlatList` or `SectionList` directly inside should switch to `contentScrollable={false}`.
1 parent 04aafbf commit b0730a0

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

src/chat/GroupDetailsScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class GroupDetailsScreen extends PureComponent<Props> {
3333
const { recipients } = navigation.state.params;
3434

3535
return (
36-
<Screen title="Recipients">
36+
<Screen title="Recipients" scrollEnabled={false}>
3737
<FlatList
3838
initialNumToRender={10}
3939
data={recipients}

src/diagnostics/NotificationDiagScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class NotificationDiagScreen extends PureComponent<Props> {
2525
'Initial notification': JSON.stringify(config.startup.notification),
2626
};
2727
return (
28-
<Screen title="Notification Diagnostics">
28+
<Screen title="Notification Diagnostics" scrollEnabled={false}>
2929
<FlatList
3030
data={Object.keys(variables)}
3131
keyExtractor={item => item}

src/diagnostics/StorageScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class StorageScreen extends PureComponent<Props> {
2828
const storageSizes = calculateKeyStorageSizes(state);
2929

3030
return (
31-
<Screen title="Storage">
31+
<Screen title="Storage" scrollEnabled={false}>
3232
<FlatList
3333
data={storageSizes}
3434
keyExtractor={item => item.key}

src/diagnostics/TimingScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import timing from '../utils/timing';
99
export default class TimingScreen extends PureComponent<{}> {
1010
render() {
1111
return (
12-
<Screen title="Timing">
12+
<Screen title="Timing" scrollEnabled={false}>
1313
<FlatList
1414
data={timing.log}
1515
keyExtractor={(item, index) => index.toString()}

src/diagnostics/VariablesScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class VariablesScreen extends PureComponent<{}> {
1717
};
1818

1919
return (
20-
<Screen title="Variables">
20+
<Screen title="Variables" scrollEnabled={false}>
2121
<FlatList
2222
data={Object.keys(variables)}
2323
keyExtractor={item => item}

src/emoji/EmojiPickerScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class EmojiPickerScreen extends PureComponent<Props, State> {
5959
const emojis = getFilteredEmojiList(filter, realmEmoji);
6060

6161
return (
62-
<Screen search searchBarOnChange={this.handleInputChange}>
62+
<Screen search scrollEnabled={false} searchBarOnChange={this.handleInputChange}>
6363
<FlatList
6464
keyboardShouldPersistTaps="always"
6565
initialNumToRender={20}

src/settings/LanguageScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class LanguageScreen extends PureComponent<Props> {
2626
const { locale } = this.props;
2727

2828
return (
29-
<Screen title="Language">
29+
<Screen title="Language" scrollEnabled={false}>
3030
<LanguagePicker value={locale} onValueChange={this.handleLocaleChange} />
3131
</Screen>
3232
);

src/users/UsersScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class UsersScreen extends PureComponent<Props, State> {
2121
const { filter } = this.state;
2222

2323
return (
24-
<Screen search autoFocus searchBarOnChange={this.handleFilterChange}>
24+
<Screen search autoFocus scrollEnabled={false} searchBarOnChange={this.handleFilterChange}>
2525
<UsersCard filter={filter} />
2626
</Screen>
2727
);

0 commit comments

Comments
 (0)