Giter VIP home page Giter VIP logo

Comments (7)

jemise111 avatar jemise111 commented on August 23, 2024 1

Yep! Definitely possible but sort of a private feature so it's not documented. Something like this should do the trick:

class Component {

  onRowPress(rowRef) {
    if (this.rowIsOpen) {
      this.rowIsOpen = false;
      rowRef.closeRow();
    } else {
      this.rowIsOpen = true;
      rowRef.manuallySwipeRow(RIGHT_OPEN_VALUE);
    }
  }

  render() {
    <SwipeListView
      renderRow={ (rowData, secId, rowId, rowMap) => (
        <TouchableOpacity
          activeOpacity={1}
          onPress={ _ => this.onRowPress(rowMap[`${secId}${rowId}`]) }
        >
          <Row />
        </TouchableOpacity>
      )}
    />
  }

}

Also since you're maintaining taps on your own you may want to ensure closeOnRowPress={false}

from react-native-swipe-list-view.

sances15 avatar sances15 commented on August 23, 2024 1

@jemise111 This is awesome. It did work. Thanks for helping out.

from react-native-swipe-list-view.

jemise111 avatar jemise111 commented on August 23, 2024

Please let me know if that does the trick for you and feel free to close this issue if it does, thanks!

from react-native-swipe-list-view.

jemise111 avatar jemise111 commented on August 23, 2024

Np, glad it worked!

from react-native-swipe-list-view.

NerdDiffer avatar NerdDiffer commented on August 23, 2024

@jemise111, I'm looking at your example code. What's the reasoning behind storing the rowIsOpen value directly on the component instance rather than in state?

from react-native-swipe-list-view.

jemise111 avatar jemise111 commented on August 23, 2024

@NerdDiffer You don't really want to be changing state properties unless your UI depends on them because calling setState() will trigger a re-render. Since no UI depends on rowIsOpen I don't want it in state. Does that make sense?

from react-native-swipe-list-view.

NerdDiffer avatar NerdDiffer commented on August 23, 2024

It does, thank you!

from react-native-swipe-list-view.

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.