sghiassy / react-native-sglistview

SGListView is a memory minded implementation of React Native's ListView
MIT License
743 stars 72 forks source link

renderScrollComponent prop dose not work #58

Open freeljt opened 7 years ago

freeljt commented 7 years ago

SGListView's renderScrollComponent prop function was not called for me. Maybe the code should be as below? if (this.props.renderScrollComponent) { component = this.props.renderScrollComponent(props); } else { component = _react2.default.createElement(_reactNative.ScrollView, props); }

sghiassy commented 7 years ago

The method definition for renderScrollComponent is (props) => renderable from the RN Docs, referencing props via the method parameters vs this, is probably the right way to go.

Can you provide some sample code of what you're trying to accomplish with renderScrollComponent. I haven't use it much

freeljt commented 7 years ago

Thanks for the quick reply! I have code: SGListView style={styles.listStyle} initialListSize={10} scrollRenderAheadDistance={1000} onEndReachedThreshold={1000} stickyHeaderIndices={[]} pageSize={1} dataSource={this.state.data} renderRow={this.renderRow} renderScrollComponent={renderScrollComponent}

function renderScrollComponent(props) { return <InvertibleScrollView inverted {...props} />; } And the {InvertibleScrollView} never got engaged. When I breakpoint into file SGListView.js, it turned out that props.renderScrollComponent is undefined and it went to the 'else' block.