brh55 / react-native-masonry

:raised_hands: A pure JS react-native component to render a masonry~ish layout for images with support for dynamic columns, progressive image loading, device rotation, on-press handlers, and headers/captions.
MIT License
1.32k stars 157 forks source link

Masonry fails to render all columns (except the last) on reload on Android only #93

Open maboelsoud opened 6 years ago

maboelsoud commented 6 years ago

Expected Behavior

the expected behaviour should be that the masonry is rendered correctly image

Current Behavior

when you refresh the app, the masonry fails to render all but the last column image

Possible Solution

inspecting the code, it seems that all the bricks are given a width and height of 'Nan', but only the bricks in the last column get called with "_setParentDimensions" in Mansonry.js.

Steps to Reproduce

Link to the expo repo: https://snack.expo.io/BJITHeTm7 Make sure the preview is activated and the phone used for the preview is an android.

  1. click "tap to play", the masonry should behave as expected
  2. go in the code, just press space at an empty area in the code to trigger a refresh
  3. look at the phone preview, the masonry should look buggy

    Context (Environment)

Detailed Description

Possible Implementation

Dhanraj-bidchat commented 6 years ago

Did you resolved it ? I am also facing the same issue

novalain commented 6 years ago

Any progress on this? Having troubles with this issue as well

vijaychouhan-rails commented 6 years ago

temporary solution

constructor(props) {
    super(props);
    this.state = {
      data,
      columns: 3,
    };
  }

componentDidMount() {
    setTimeout(() => {
      this.setState({ columns: 2, padding: 5 });
    }, 500);

  }
Jose4gg commented 5 years ago

The same thing happens to me but @vijaychouhan-rails solutions do not work for me :/, any help?

pramodxyle commented 5 years ago

See the same issue on iOS. Need help ! Setting the columns to 3 and then back to 2 is not the correct way to handle this...

borgogelli commented 5 years ago

+1