Code Monkey home page Code Monkey logo

Comments (9)

idibidiart avatar idibidiart commented on May 10, 2024 1

Sorry, I misunderstood your report.

You're saying that you're seeing this warning:

Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op.

I thought you were getting an error generated by the grid due to a Row in Row or Col in Col situation, which is why I didn't re-open this issue.

I've made a breaking change that will fix this and simplify the grid's code (as well as giving us better performance by eliminating unnecessary re-rendering) and v0.35.0 should fix this for you. What was happening is that the Row was growing in height since it had to no fixed height specified and it was invoking onLayout due to changes in height as more cols were added, which re-renders the row. One way to solve it would have been to keep track of all the re-render requests then cancel all of them in a synchronous loop but that's just a sign of a bad design decision, so instead I've opted to make a breaking change and require use of Grid component at the top of the view hierarchy for any responsive effect to do with orientation changes. To react to changes that don't affect the Grid's frame we would use Flexbox constraints to re-layout without having to manage that from JS. I'll have some example to demonstrate that in the next minor update.

0.35.0 is now up on NPM.

@danhardman

from react-native-responsive-grid.

idibidiart avatar idibidiart commented on May 10, 2024

Hi @luosong

I believe I fixed it for FlatList

See this example:

code: https://github.com/idibidiart/react-native-responsive-grid#example-4
video: https://www.youtube.com/watch?v=qLqxat3wX_8

Thank you for letting me know.

Please let me know if the issue persists on your end.

The latest is v0.28.0, so please update to that and let me know. I'll close this in the next couple of days if I don't hear back.

Thanks again.

from react-native-responsive-grid.

idibidiart avatar idibidiart commented on May 10, 2024

Closing.

from react-native-responsive-grid.

danhardman avatar danhardman commented on May 10, 2024

I've just received this error on v0.34.2. The Row component is a child (albeit nested a bit) of a KeyboardAwareScrollView component from https://github.com/APSL/react-native-keyboard-aware-scroll-view.

Can replicate the issue by scrolling a bunch

from react-native-responsive-grid.

idibidiart avatar idibidiart commented on May 10, 2024

This is a different kind of error than the one for this resolved issue. So I'll keep this one closed.

Could you please share the JSX snippet including the parent Row (and your scrollview down to the first Row descendant) ?

from react-native-responsive-grid.

idibidiart avatar idibidiart commented on May 10, 2024

So I looked at Row.js and there is no way for the error to happen unless the direct descendant (child) of a Row component is another Row component.

Maybe what happens is that the keyboard-aware scrollview component is cloning its children and returning them (to the parent row) ? I haven't looked at the code for it.

I will start another issue to produce warnings instead of an error state when rows are children of other rows or columns are children of other columns. This way you'll get a warning in DEV mode but it should work fine as long as you realize that you're doing something that you should not be doing in general...

from react-native-responsive-grid.

idibidiart avatar idibidiart commented on May 10, 2024

#12

from react-native-responsive-grid.

danhardman avatar danhardman commented on May 10, 2024

I'll look into keyboard-aware-scroll-view to see if that is the case, but I'm not sure how it could happen. The current JSX is:

<KeyboardAwareScrollView>
  <View>
    <Row>
      { this.props.foos.map((bar, index) => (
        <Col key={index}>
           //
        </Col> ))
      }
    </Row>
  </View>
</KeyboardAwareScrollView>

from react-native-responsive-grid.

danhardman avatar danhardman commented on May 10, 2024

Appreciate it! My fault on the initial report, I should have been clearer. I will look to implement the new changes as soon as possible to give feedback :)

Really appreciate the quick responses

from react-native-responsive-grid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.