Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering same rows repeatedly on ios #60

Closed
iLevye opened this issue Oct 27, 2017 · 3 comments
Closed

Rendering same rows repeatedly on ios #60

iLevye opened this issue Oct 27, 2017 · 3 comments

Comments

@iLevye
Copy link

iLevye commented Oct 27, 2017

ReactEssentials is exactly what I need. But I faced with this interesting situation when I tested with real data. I have a long list. But all list rendering with the same items (first 13 item).

Working fine on android but I stuck on ios.

recyclerlistview: ^1.1.4
react-native: 0.49.3

class UserList extends Component {
    constructor(props){
        super(props);
        
        let dataProvider = new DataProvider((r1, r2) => {
            return r1 !== r2;
        });

        let { width } = Dimensions.get("window");

        this._layoutProvider = new LayoutProvider(
            index => {
                return ''
            },
            (type, dim) => {
                dim.width = width;
                dim.height = 84;
            }
        );

        this.renderRow = this.renderRow.bind(this);

        this.state = {
            dataProvider: dataProvider.cloneWithRows(props.rows)
        };
    }

    componentWillReceiveProps(nextProps){
        let dataProvider = new DataProvider((r1, r2) => {
            return r1 !== r2;
        });

        this.setState({ dataProvider: dataProvider.cloneWithRows(nextProps.rows)});
    }

    renderRow(type, { node }) {
        return (
            <UserRow user={ node } selectedAccount={this.props.selectedAccount} />
        );
    }

    render(){
        const { listKey } = this.props;
        return (
            <Content>
                <RecyclerListView key={listKey} style={{width: 400, height: 400 }} layoutProvider={this._layoutProvider} dataProvider={this.state.dataProvider} rowRenderer={this.renderRow} />
            </Content>
        )
    }
}

export default UserList;
@iLevye iLevye closed this as completed Oct 27, 2017
@naqvitalha
Copy link
Contributor

What was the issue here?

@iLevye
Copy link
Author

iLevye commented Oct 31, 2017

The UserRow component was connected redux. I unmounted redux and passed actions via prop. It's working nice, both ios and android.

@naqvitalha
Copy link
Contributor

Great :)

@sm2017 sm2017 mentioned this issue Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants