Git Product home page Git Product logo

Comments (6)

JonathanZWhite avatar JonathanZWhite commented on July 4, 2024 1

@albertfdp so after a bit of experimenting with @aksonov's suggestion, the before and after code below shows how you use InteractionManager.runAfterInteractions.

Before I had code like this which was dispatching an action and causing the setState on a unmounted component warning.

onPress: () => {
  this.props.handleDeletePress(this.props.key)
}

By wrapping the function with InteractionManager's runAfterInteraction the warning should go away.

onPress: () => {
  InteractionManager.runAfterInteractions(() => {
    this.props.handleDeletePress(this.props.key)
  });
}

Issue facebook/react-native#2248 provides an example of how to use InteractionManager.runAfterInteractions if you need further examples.

from react-native-swipeout.

aksonov avatar aksonov commented on July 4, 2024

Solved it by using InteractionManager.runAfterInteractions, maybe you could mention it that onPress actions should be wrapped to avoid setting state on unmounted component during 'closing' cell..

from react-native-swipeout.

albertfdp avatar albertfdp commented on July 4, 2024

@aksonov Can you give a small example on how would you do that using InteractionManager.runAfterInteractions? I'm having this same issue. Thank you

from react-native-swipeout.

aaroncrawford avatar aaroncrawford commented on July 4, 2024

@JonathanZWhite Thank you for this. Ran into it and had no idea why it was happening.

from react-native-swipeout.

JonathanZWhite avatar JonathanZWhite commented on July 4, 2024

@aaroncrawford No problem. Glad I was able to help 💯

from react-native-swipeout.

jonathandion avatar jonathandion commented on July 4, 2024

Thanks allot @JonathanZWhite. You save me a lot of time.

from react-native-swipeout.

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.