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.

react native ListView with scrollable content in both vertical AND horizontal doesn't seem to work anymore with react-native 0.28 (react 15.1.0)

See original GitHub issue

react native ListView with scrollable content in both vertical AND horizontal doesn’t seem to work anymore with react-native 0.28 (react 15.1.0)

Since the react-native last release 0.27 > 0.28 (and React 15.0.2 > 15.1.0) a ListView that contain a scrollable content in both vertical and horizontal can now only be scrolled in only one direction:

  • if the listView is defined with a flexDirection = “row”, the listView can be scrolled horizontally but rebound back to a fix height position preventing to see what the listView contain down vertically.
  • if the listView is defined with a flexDirection = “column”, the listView can be scrolled vertically but rebound back to a fix width position preventing to see what the listView contain horizontally further left. sample:
export default React.createClass({
 ...

 render():View {
  return(
    <ListView
      decelerationRate                  = "fast"
      snapToAlignment                   = "start"
      dataSource                        = {this.state.dataSource}
      style                             = {styles.listView}
      renderRow                         = {this._getColumn}
      initialListSize                   = {100}
      scrollEnabled                     = {true}
      horizontal                        = {true}
      pagingEnabled                     = {false}
      showsHorizontalScrollIndicator    = {false}
      showsVerticalScrollIndicator      = {false}
      removeClippedSubviews             = {true}
      automaticallyAdjustContentInsets  = {true}
      alwaysBounceVertical              = {true}
      alwaysBounceHorizontal            = {true}
      bouncesZoom                       = {false}
      canCancelContentTouches           = {true}
      centerContent                     = {false}
      directionalLockEnabled            = {true}
     />
   );
 },

 ...

 _getColumn(el:Array<Object>, sectionID:string, rowID:string):View {
   return(
     <View
        key    = {"row-`$(sectionID)`:`$(rowID)`"}
        style  = {styles.column}
      >
        ...
      </View>
   );
 },

 ...

});

const styles:StyleSheet = StyleSheet.create({
   listView: {
     position          : "relative",
     flexDirection     : "row", // <---------- 'row' || 'column'
     flexWrap          : "wrap",
     alignSelf         : "stretch",
     top               : 0,
     width             : 380,
     height            : 600,
     backgroundColor   : "transparent",
     overflow          : "hidden",
   },
   column: {
     flex              : 1,
     flexDirection     : "row",
     alignSelf         : "stretch",
     alignItems        : "flex-start",
     justifyContent    : "flex-start",
     backgroundColor   : "red",
     position          : "relative",
     width             : 380/3,
     height            : 1250,
   },


});

Before, with React 15.0.2 and react-native 0.26 it worked as expected: it was possible to navigate horizontally and vertically in the columns that appeared within the listView.

Is there anything wrong in my way of setting the StyleSheet? I’ve tested a lot of combination so some extra (maybe not necessary) StyleSheet arguments are still in used in styles.listView and styles.column…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:10

github_iconTop GitHub Comments

3reactions
faisalilcommented, Jun 23, 2016

+1. My example is a bit simpler. I have a scrollview around an image and I am trying to make it scroll in all directions. Before moving to react-native 0.28, it was working fine. Now, its not working. <ScrollView ref={(scrollView) => { this._scrollView = scrollView; } } directionalLockEnabled={false} horizontal={true} style={{ backgroundColor: '#FFF', flex: 1 }}> <View style={{ marginVertical: 50 }}> <Image source={require('../image.png') }> </Image> </View> </ScrollView>

1reaction
7kmscommented, Jun 26, 2016

I’m new to react-native ,meet the same problem,my ScrollView can’t work!

<ScrollView
        contentContainerStyle={{paddingVertical: 20}}
      style={[styles.twitterPostContainer]}
      automaticallyAdjustContentInsets={false}
      refreshControl={
          <RefreshControl
            refreshing={this.state.isRefreshing}
            onRefresh={()=>this._onRefresh()}
            title="refreshing"
            tintColor="#53cac3"/>}>
            <View style={{position:'absolute',top:0,width:Util.size.width}}>
              <Image
                resizeMode="stretch"
                source={{uri:'day3'}}
                style={{width:Util.size.width, height:Util.size.height}}></Image>
            </View>
      </ScrollView>

I’m very depressed! Should I resolve it by revert it to 0.27

Read more comments on GitHub >

github_iconTop Results From Across the Web

react native ListView with scrollable content ... - Stack Overflow
react native ListView with scrollable content in both vertical AND horizontal doesn't seem to work anymore with react-native 0.28 (react 15.1.0).
Read more >
Common bugs in React Native ScrollView and how to fix them
After putting all those elements inside the ScrollView component, you can use it to scroll through them vertically (the default) or horizontally ......
Read more >
ListView - React Native
ListView - A core component designed for efficient display of vertically scrolling lists of changing data. The minimal API is to create a ......
Read more >
How to use the FlatList Component — React Native Basics
There have been a quite a few ways to create a scrolling list in React Native, most notably they have been the ScrollView...
Read more >
Displaying a List in React Native: Map Method or FlatList ...
FlatList is a React Native component that provides scrolling features by default. The FlatList component comes with: Header, Footer, Horizontal scrolling, ...
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