Shopify / Shopify/flash-list

Loading another Flashlist causes a horizontal scroll bar to appear - IOS

Open
#1,828 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2 v2.0
Dominant language
TypeScript
Stars
7.2k
Forks
393
Avg merge
1d 3h
Merged PRs (30d)
1

Description

Expected behavior

Hey,

On iPhone 16 Pro (iOS 18.6), for unknown reasons, horizontal scrolling appears, even though all elements fit within the view.
For example:

  1. I load data from the API into FlashList associated with view = devices - no horizontal scrolling, everything fits**(!)**.
  2. I change view to notifications - a horizontal scroll bar appears (even when renderItem={() => {return <></>})
  3. I go back to view = devices and suddenly there is horizontal scrolling there too.

I tested this issue on Android and it does not occur. I also used an iPhone 8 with iOS 15 and the issue does not occur there either.

To Reproduce

  const [view, setView] = useState<'devices' | 'notifications'>('devices');
  return(
      <View style={{ flex: 1 }}>
        {/* Content */}
        {view === 'devices' ? (
          <FlashList
            ListEmptyComponent={loadingOrEmptyFlatListComponent({ isLoading: loading })}
            key={view}
            data={filteredDevices}
            renderItem={renderDeviceItem}
            keyExtractor={(item) => item.id.toString()}
            numColumns={2}
            onLayout={(event) => {
              const { width } = event.nativeEvent.layout;
              console.log('towers-list FlashList width:', width);
            }}
            contentContainerStyle={{
              paddingBottom: insets.bottom,
              paddingHorizontal: 20,
              paddingTop: headerHeight + insets.top,
            }}
            showsVerticalScrollIndicator={false}
          />
        ) : (
          <FlashList
            key={view}
            data={groupedPreferences}
            renderItem={renderItem}
            getItemType={(item) => (typeof item === 'string' ? `sectionHeader` : `item`)}
            keyExtractor={(item) =>
              typeof item === 'string' ? `sectionHeader-${item}` : `item-${item.notificationType}`
            }
            contentContainerStyle={{
              paddingBottom: insets.bottom,
              paddingHorizontal: 20,
              paddingTop: headerHeight + insets.top,
            }}
            showsVerticalScrollIndicator={false}
            }
          />
        )}
      </View>)

Platform:

  • iOS
  • Android

Environment

Flashlist Version: 2.0.1
Expo Go client version: 1017702

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction snippet in the issue and reproduce the switch between the keyed devices and notifications FlashLists on iOS, comparing the affected iPhone 16 Pro with Android or iPhone 8. Investigate the horizontal layout after changing views; done means switching between both lists no longer causes a horizontal scrollbar when the content fits.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.