Repository navigation
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
Noticed this after upgrading to 0.7.1 from 0.6.
Below is a simple example to reproduce. I noticed it when upgrading my app that has three separate list views inside a scrolling container. List views are set to show all rows, as they're not expected to be very long. But all three are large enough to go off page.
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
Component,
ListView,
StyleSheet,
Text,
ScrollView,
View,
} = React;
class TestScrollView extends Component {
constructor(props) {
super(props);
let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(["ALABAMA", "ALASKA", "AMERICAN SAMOA", "ARIZONA", "ARKANSAS", "CALIFORNIA", "COLORADO", "CONNECTICUT", "DELAWARE", "DISTRICT OF COLUMBIA", "FEDERATED STATES OF MICRONESIA", "FLORIDA", "GEORGIA", "GUAM GU", "HAWAII", "IDAHO", "ILLINOIS", "INDIANA", "IOWA", "KANSAS", "KENTUCKY", "LOUISIANA", "MAINE", "MARSHALL ISLANDS", "MARYLAND", "MASSACHUSETTS", "MICHIGAN", "MINNESOTA", "MISSISSIPPI", "MISSOURI", "MONTANA", "NEBRASKA", "NEVADA", "NEW HAMPSHIRE", "NEW JERSEY", "NEW MEXICO", "NEW YORK", "NORTH CAROLINA", "NORTH DAKOTA", "NORTHERN MARIANA ISLANDS", "OHIO", "OKLAHOMA", "OREGON", "PALAU", "PENNSYLVANIA", "PUERTO RICO", "RHODE ISLAND", "SOUTH CAROLINA", "SOUTH DAKOTA", "TENNESSEE", "TEXAS", "UTAH", "VERMONT", "VIRGIN ISLANDS", "VIRGINIA", "WASHINGTON", "WEST VIRGINIA", "WISCONSIN", "WYOMING"])
};
}
render() {
return (
<View style={styles.container}>
<ScrollView>
<ListView
dataSource={this.state.dataSource}
renderRow={(rowData) => <Text>{rowData}</Text>}
/>
</ScrollView>
</View>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
}
});
AppRegistry.registerComponent('TestScrollView', () => TestScrollView);
Reacted by Benzer1406
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Activity
osdio commentedon Jul 13, 2015
just see noder, I put five listView into a scrollView, it works well.
agmcleod commentedon Jul 13, 2015
Are you running version 0.7? I see you have
^0.6.0but if you haven't updated in a bit, it could be 0.6.x, which works fine.christopherdro commentedon Jul 13, 2015
Is it necessary to wrap your ListView with ScrollView?
Have you tried just using ListView?
agmcleod commentedon Jul 13, 2015
I have three separate list views that show all the items, as i don't want them scrolling. So I wrap all three in a single scroll view. My above example is a simple & short one to show the issue.
osdio commentedon Jul 15, 2015
I have update my project noder to 0.7.1, it works well,
agmcleod commentedon Jul 15, 2015
@soliury i wonder if it's because your PageScrollView component is horizontal as opposed to vertical.
agmcleod commentedon Jul 16, 2015
Doing some more experimentation with this. I seem to have scroll issues when it's a really long body of content. Do i need to manually set the height or add styling of some kind? I just have an app with a scroll view tag and 100+ components in it. I can't scroll down the page either.
agmcleod commentedon Jul 16, 2015
Realized a change along the way must have broke how i was using the scrollview. Updating to 0.8.0-rc, using the Dimensions package has helped me fix this. I set the height of my top level view in index.ios.js to that of the screen:
Then pass a flex 1 to the scrollview in my subcomponents. Though with this method, you'll need a scrollview in every component that requires scrolling.
DurgaManickam commentedon Mar 28, 2016
how to make scrollable ListView inside Modal ???
Modal
//need scrollable listview
/Modal
CodeLYQ commentedon Jul 25, 2016
@DurgaManickam I got the same issue, sloved by setting height of ListView.
sibelius commentedon Sep 9, 2016
@phoue should I get the height from Dimensions, to make the modal get the whole screen?
sadafk831 commentedon Mar 8, 2017
I had the same issue as I had the following component structure.
As wrapping the ListView inside the ScrollView the parent scroll action dominates the child scroll action which leads only ScrollView to scroll.
I resolved this issue by adding the following code as a prop to the parent View which wraps the ScrollView
Add
scrollEnabled={this.state.enableScrollViewScroll}prop to ScrollViewAnd Finally add following to the View which wraps the ListView( immediate parent )
this works very well on IOS and Android both, scrolls the ListView if the touch is on List and else it scrolls the ScrollView
kaberibasu commentedon May 19, 2017
@sadafk831 awesome solution. Saved my time and effort at crucial time.
JohnnyMa commentedon May 22, 2017
@sadafk831 thanks for your feedback. It helps.
Thanmai-C commentedon Oct 17, 2017
@sadafk831 what is scrollProperties.offset? it throws me an undefined is not an object error.
Does FlatList have it?
Angelk90 commentedon Jan 10, 2018
@sadafk831 : Could you post a complete code example? I get lost somewhere.
zhenghow93 commentedon Mar 19, 2018
@Thanmai-C I am using FlatList, not sure if this is the right way but I wrote this.refs.myList._listRef._scrollMetrics.offset instead.
ruchi1906 commentedon Jul 11, 2018
@sadafk831 I am using FlatList instead of listview. I am getting offset of undefined error message. Please give me someone solution