Comments (7)
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.
@jemise111 This is awesome. It did work. Thanks for helping out.
from react-native-swipe-list-view.
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.
Np, glad it worked!
from react-native-swipe-list-view.
@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.
@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.
It does, thank you!
from react-native-swipe-list-view.
Related Issues (20)
- rowMap returns me all the props instead of the actual rowMap. React Native 0.69.3 HOT 1
- Hidden row prevent re-render
- Vertical scroll not working on android but works on ios. v3.2.9
- Question: Change SwipeRow style when swiping started
- SwipeListView actions pass incorrect item in rowMap when using SectionList
- shouldItemUpdate does not seem to work in version 3.2.9
- example how to close rows automatically or by some function when use SwipeRow? HOT 2
- No overload matches this call HOT 7
- Not working with scrollview
- delete button in renderHiddenItem components covers the first button when clicked HOT 1
- Make it harder to start the swipe HOT 1
- SwipeRow : Unable to close row programatically. HOT 3
- react-native-swipe-list-view is not fabric(New Architecture of react-native) compatible yet HOT 2
- ScrollToOffset can't scroll pass through {initialNumToRender}-th row. HOT 2
- Front-view is under the back/hidden-view HOT 4
- Facing issue while implimenting Swipe to Delete feature
- closeOpenAllRows not working on Android HOT 2
- Any way to open a row with a button?
- Question, are you no longer doing library management? HOT 1
- RenderItem, RenderHiddenItem, RenderRow, RenderHiddenRow
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-swipe-list-view.