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

Duplicate images loaded #81

Open
vvavepacket opened this issue Mar 19, 2018 · 12 comments
Open

Duplicate images loaded #81

vvavepacket opened this issue Mar 19, 2018 · 12 comments
Labels

Comments

@vvavepacket
Copy link

Version: 0.4.5

Expected Behavior

Images should be unique, no duplicate images should appear

Current Behavior

Currently, my bricks data only contains 2 unique images. I first initialize the bricks data to be an empty array, and then in the componentDidMount, I put 2 elements inside the array

constructor() {
        super();
        this.state = {
            tyu: []
        };
    }
componentDidMount() {
this.setState({
            tyu: [
                {
                    key: Math.floor((Math.random() * 100000000) + 1),
                    id: 0,
                    uri: 'https://img.purch.com/w/660/aHR0cDovL3d3dy5saXZlc2NpZW5jZS5jb20vaW1hZ2VzL2kvMDAwLzA5Ny85NTkvb3JpZ2luYWwvc2h1dHRlcnN0b2NrXzYzOTcxNjY1LmpwZw=='
                },
                {
                    key: Math.floor((Math.random() * 100000000) + 1),
                    id: 1,
                    uri: 'https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/Cat-eating-prey.jpg/220px-Cat-eating-prey.jpg'
                },
            ]
        })
}

image

Possible Solution

Steps to Reproduce

Sample code

<Masonry
                                            sorted={false} // optional - Default: false
                                            columns={2} // optional - Default: 2
                                            bricks={this.state.tyu}
                                            spacing={1}
                                            imageContainerStyle={{
                                                backgroundColor: '#DCDCDC'
                                            }}
                                        />

Context (Environment)

Detailed Description

Possible Implementation

@justinsayone
Copy link

I'm having this issue too.

@brh55
Copy link
Owner

brh55 commented Mar 28, 2018

@vvavepacket Just ran the exact code within the example repo, no issues on duplications. From the looks of the warning notifications it appears the parent component maybe rendering multiple times, which would make me believe there is some configuration issues with the navigators or tabs.

Maybe want to console within the components and react-native-masonry to make sure nothing funky is going on.

@mpyw
Copy link

mpyw commented Apr 16, 2018

Confirmed on React Native v0.54.

@brh55 Why don't you test on recent versions? v0.46 looks pretty old.

@lc3t35
Copy link

lc3t35 commented Jun 4, 2018

Hi, is 0.5.0 branch valid enough for using it / merging soon in master ?

@brh55
Copy link
Owner

brh55 commented Jun 4, 2018

@lc3t35 It is valid enough, I just been a bit busy with a start up to add some additional features I've been wanting to include with the release.

@quasimodo1660
Copy link

I'm having this issue too.

@ahmedjamshed
Copy link

@brh55 when are you planning to merge version 0.5.0 in master. I am having duplicate images issue, single column render issue when images are cached (only first time works as expected) and sometimes images are left biased. Can you present some solution for now?

@brh55
Copy link
Owner

brh55 commented Jun 10, 2018

Just published current state of v0.5.0 as an alpha prerelease (v0.5.0-alpha.1). I haven't properly tested this, so feel free to test this and report any issues.

An npm install should default to this pre-release.

@ahmedjamshed
Copy link

@brh55 Duplicate image issue has been resolved on my side, but other two issues still persist. Although, single column render issue is not consistent on ios but consistent on android. I am attaching an image as a reference. Is there any quick fix for this?
screen shot 2018-06-12 at 2 14 29 am

@brh55
Copy link
Owner

brh55 commented Jun 12, 2018

@ahmedjamshed let's move this to a new thread for v0.5.0

@brh55 brh55 mentioned this issue Jun 12, 2018
6 tasks
@quasimodo1660
Copy link

quasimodo1660 commented Jun 12, 2018

@brh55 I fetch the data from my website api, then display them. My issue is after onPress into a details screen, the duplicate warning will appear. I am attaching some images to show the problem.
at first
simulator screen shot - iphone x - 2018-06-12 at 10 30 08
Press one negative to another screen
simulator screen shot - iphone x - 2018-06-12 at 10 48 33
go back to home page
simulator screen shot - iphone x - 2018-06-12 at 10 36 18

@brh55
Copy link
Owner

brh55 commented Jun 12, 2018

There is a known issue if all bricks haven't resolved completely, and there is a state change, a duplicated request will be made for the bricks that have not been placed. Haven't seemed to find a good way to get around this, while preventing a full reload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants