{"action":"created","issue":{"url":"https://api.github.com/repos/jemise111/react-native-swipe-list-view/issues/49","repository_url":"https://api.github.com/repos/jemise111/react-native-swipe-list-view","labels_url":"https://api.github.com/repos/jemise111/react-native-swipe-list-view/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/jemise111/react-native-swipe-list-view/issues/49/comments","events_url":"https://api.github.com/repos/jemise111/react-native-swipe-list-view/issues/49/events","html_url":"https://github.com/jemise111/react-native-swipe-list-view/issues/49","id":169452077,"number":49,"title":"Expose \"open\" or \"close\" state to renderRow or renderHiddenRow","user":{"login":"chandlervdw","id":332278,"avatar_url":"https://avatars.githubusercontent.com/u/332278?v=3","gravatar_id":"","url":"https://api.github.com/users/chandlervdw","html_url":"https://github.com/chandlervdw","followers_url":"https://api.github.com/users/chandlervdw/followers","following_url":"https://api.github.com/users/chandlervdw/following{/other_user}","gists_url":"https://api.github.com/users/chandlervdw/gists{/gist_id}","starred_url":"https://api.github.com/users/chandlervdw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chandlervdw/subscriptions","organizations_url":"https://api.github.com/users/chandlervdw/orgs","repos_url":"https://api.github.com/users/chandlervdw/repos","events_url":"https://api.github.com/users/chandlervdw/events{/privacy}","received_events_url":"https://api.github.com/users/chandlervdw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-04T19:17:09Z","updated_at":"2016-08-05T13:13:42Z","closed_at":null,"body":"If I wanted my SwipeRow to do one thing when tapped while the row is closed and another while it's open (say, close the row), is that possible with how things stand? "},"comment":{"url":"https://api.github.com/repos/jemise111/react-native-swipe-list-view/issues/comments/237846758","html_url":"https://github.com/jemise111/react-native-swipe-list-view/issues/49#issuecomment-237846758","issue_url":"https://api.github.com/repos/jemise111/react-native-swipe-list-view/issues/49","id":237846758,"user":{"login":"jemise111","id":4265163,"avatar_url":"https://avatars.githubusercontent.com/u/4265163?v=3","gravatar_id":"","url":"https://api.github.com/users/jemise111","html_url":"https://github.com/jemise111","followers_url":"https://api.github.com/users/jemise111/followers","following_url":"https://api.github.com/users/jemise111/following{/other_user}","gists_url":"https://api.github.com/users/jemise111/gists{/gist_id}","starred_url":"https://api.github.com/users/jemise111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jemise111/subscriptions","organizations_url":"https://api.github.com/users/jemise111/orgs","repos_url":"https://api.github.com/users/jemise111/repos","events_url":"https://api.github.com/users/jemise111/events{/privacy}","received_events_url":"https://api.github.com/users/jemise111/received_events","type":"User","site_admin":false},"created_at":"2016-08-05T13:13:42Z","updated_at":"2016-08-05T13:13:42Z","body":"Exposing methods to check row state is a great idea! (and a PR is always appreciated :) but as it stands that doesn't exist. However I think you could achieve this with the onRowOpen / onRowClosed props. If you're using a SwipeListView something like this should do the trick:\r\n\r\n```javascript\r\nonPress(data, rowId, secId, rowMap) {\r\n\tconst rowRef = rowMap[`${secId}${rowId}`];\r\n\tif (this.openRowId && this.openRowId === rowId) {\r\n\t\trowRef.closeRow();\r\n\t} else {\r\n\t\tthis.doSomeOtherOnPressAction();\r\n\t}\r\n}\r\n\r\nrender() {\r\n\treturn (\r\n\t\t<SwipeListView\r\n\t\t\trenderRow={ (data, rowId, secId, rowMap) => (\r\n\t\t\t\t<Touchable onPress={ _ => this.onPress(data, rowId, secId, rowMap) }>\r\n\t\t\t\t</Touchable>\r\n\t\t\t)}\r\n\t\t\tonRowOpen={ (rowId, secId, rowMap) => { this.openRowId = rowId } }\r\n\t\t\tonRowClose={ (rowId, secId, rowMap) => { this.openRowId = null } }\r\n\t\t\tcloseOnRowPress={false} // we're managing this manually\r\n\t\t/>\r\n\t);\r\n}\r\n```\r\n\r\nIf it's just a plain SwipeRow (without the ListView) you may have to manage the open rowId differently but the approach should be similar.\r\n\r\nLet me know if this works for you!\r\n\r\nAlso will definitely look into adding open / close states to individual rows."}}
{"actor":{"display_login":"jemise111"}}