ListView with section headers not scrolling from bottom
Hi,
I've noticed that my sectioned List doesn't scroll when swiping up from the last row in the list (item 13 and most of item 12 in the screenshot below). When I remove the renderSectionHeader property then it works fine.
react-native, react and native-base version
"native-base": "^2.3.2", "react": "16.0.0-alpha.12", "react-native": "^0.48.4"
Expected behaviour
I'd expect the list to scroll when you swipe up to scroll down from the bottom (by touching item 13 and most of item 12 in the screenshot below)
Actual behaviour
The list doesn't scroll when you touch from the last row or most of the second to last row
Steps to reproduce (code snippet or screenshot)
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import {ListView} from "react-native";
import {Body, List, ListItem, Separator} from "native-base";
const dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2,
sectionHeaderHasChanged : (s1, s2) => s1 !== s2
});
const dataBlob = {
"List1": [{'id': '1'}, {'id': '2'}, {'id': '3'}, {'id': '3'}, {'id': '4'}, {'id': '5'}, {'id': '6'}],
"List2": [{'id': '7'}, {'id': '8'}, {'id': '9'}, {'id': '10'}, {'id': '11'}, {'id': '12'}, {'id': '13'},
{'id': '14'}, {'id': '15'}, {'id': '16'}, {'id': '17'}, {'id': '18'}, {'id': '19'}, {'id': '20'}, {'id': '21'}]
};
export default class App extends React.Component {
render() {
const listData = dataSource.cloneWithRowsAndSections(
dataBlob,
Object.keys(dataBlob)
);
return (
<View>
<List
dataSource={listData}
renderSectionHeader={(sectionData, sectionId) => <Separator bordered><Text>{sectionId}</Text></Separator>}
renderRow={(item) =>
<ListItem key={item.id}>
<Body>
<Text>{`item ${item.id}`}</Text>
</Body>
</ListItem>}
renderLeftHiddenRow={item => null}
renderRightHiddenRow={(item) => null}
/>
</View>
);
}
}
Is the bug present in both ios and android or in any one of them?
both
Screenshot of emulator/device
Any other additional info which would help us debug the issue quicker.
if you comment out the line "renderSectionHeader" then the list scrolls as expected
Any ideas?
@gazgeek I tried to reproduce issue with your code. But was behaving as expected. Attaching a gif

Hi,
Thanks for taking a look.
Your simulator fits more of the list on the screen than mine does.
Please can you try scrolling from the bottom two rows when you first start (with renderSectionHeader not commented out) - I think it's 14 and 15 for you.
Thanks
p.s. how do you create the gifs? do you use a tool?
@gazgeek attaching a gif
we use LICEcap to create a gif
Thanks for trying to reproduce this. I've attached a gif that shows what I see. The problem is actually much worse in my app but I have headers, tabs and footer etc. I tried to create this as a minimal example of the problem. Do you know why my iphone X simulator appears to have a top and bottom border and yours doesn't?

@gazgeek iPhoneX is having a Safe area. Probably the touch outside this area may not be detected. See iPhoneX developer guidelines
I have a problem similar to yours.
React-Native: 0.41
React: 15.4.2
Native-Base: 2.1.3
and testing on Android 7.0
And looking for your code and it's the same "estrucure" of mine. My Last Item does not show on my screen, only a little part of the item, so I put it to ScrollView on my List and solved this problem.
render() {
return (
<Container style={{ backgroundColor: '#363a40' }}>
<CardItem style={{ backgroundColor: '#363a3f' }}>
<View style={{ flex: 1 }}>
<Item style={{ marginHorizontal: 0 }}>
<Input
placeholder="Procurar pelo nome da atração..."
placeholderTextColor="rgb(164, 166, 170)"
style={{ color: '#fff', height: 44, flex: 1 }}
onChangeText={this.onSearchChange.bind(this)}
/>
</Item>
</View>
</CardItem>
{!this.props.attractions.isFetching ? (
<ScrollView>
<View>
<List
dataArray={this.state.list}
renderRow={this._renderRow.bind(this)}
onEndReachedThreshold={200}
onEndReached={this._retrieveNextPage.bind(this)}
/>
</View>
</ScrollView>
) : (
<Content showsVerticalScrollIndicator={false} style={{ marginBottom: Platform.OS === 'ios' ? -50 : -10 }}>
<View>
<ActivityIndicator animating={this.props.attractions.isFetching} style={{ height: 80 }} size="large" />
</View>
</Content>
)}
</Container>
);
}
}

@gazgeek Did you find out why this was happening and how to solve it in the end?