question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BottomSheetFlatList is scrollable only when the bottomSheet is on the top level

See original GitHub issue

Bug

Environment info

Library Version
@gorhom/bottom-sheet ^1.4.1
react-native https://github.com/expo/react-native/archive/sdk-39.0.0.tar.gz
react-native-gesture-handler ~1.7.0

Steps To Reproduce

1.scrolling up the bottomSheet
2.scroll horizontally images 3. scroll down 50% the bottomSheet
4.scroll horizontally images -> cannot.

Describe what you expected to happen:

1.i would like to be able to scroll the images horizontally also when the bottomSheet is not on the top level.

Reproducible sample code

import { BottomSheetFlatList } from '@gorhom/bottom-sheet'
import React from 'react'
import {View, Text, TouchableOpacity, Image, StyleSheet } from 'react-native'
import { ImagesSliderProps } from './ImagesSlider.d'

const ImagesSlider: React.FC<ImagesSliderProps> = ({title, images}) => {
  
 const renderImage = (itemData:any) => {  
  return (
      <TouchableOpacity activeOpacity={0.8} onPress={()=> console.log(itemData.item)}>
        <Image style={styles.image} source={{uri:itemData.item.key}}/>
      </TouchableOpacity>
    )
  }

  return (
   <View style={{flex:1}}>
    <Text>{title}</Text>
    <BottomSheetFlatList 
            showsHorizontalScrollIndicator={true} 
            initialNumToRender={2} 
            keyExtractor={(item, index) => index.toString()} 
            horizontal={true} 
            data={images} 
            renderItem={renderImage}/>
   </View>
 )
}

const styles = StyleSheet.create({
  image: {
    marginHorizontal: 5,
    width:200,
    height:150,
    resizeMode: 'stretch'
  }
})

export default ImagesSlider;

cannotscroll scrollable

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

15reactions
gorhomcommented, Oct 14, 2020

you should use FlatList from react-native-gesture-handler

import { FlatList } from 'react-native-gesture-handler';
9reactions
gorhomcommented, Oct 14, 2020

BottomSheetFlatList meant to be for vertical sheet content. I think I’ll need to update docs to mention this clearly

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native Flatlist does not scroll inside the custom ...
Inside my bottom sheet, I have used flatList where I fetched the data and render the items as a card. Up-till now everything...
Read more >
Scrollables | React Native Bottom Sheet - GitHub Pages
These lists I called them Scrollables and they are: BottomSheetFlatList; BottomSheetSectionList; BottomSheetScrollView; BottomSheetView. BottomSheetFlatList​.
Read more >
react-native-scroll-bottom-sheet - npm package - Snyk
react-native-scroll-bottom-sheet. v0.7.0. Cross platform scrollable bottom sheet with virtualization support, running at 60 FPS and fully implemented in JS land ...
Read more >
A React Native Bottom Sheet with Fully Configurable Options
Extracting scrollable content to allow developers customize the sheet content, like integrate React Navigation as the sheet content. Both libraries are great!
Read more >
How to scroll your bottom sheet differently with Flutter?
Some time ago I had to implement a bottom sheet that should be possible to expand or ... margin: EdgeInsets.only(top: mediaQueryData.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found