// include react-native-swipeout
import Swipeout from 'react-native-swipeout';
// example row data (see for json structure)
import rows from './data';
// example styles
import styles from './styles';
import React, {Component} from 'react';
import {AppRegistry, StyleSheet, ListView, Text, View, TouchableWithoutFeedback} from 'react-native';
// example swipout app
class SwipeoutExample extends Component {
constructor() {
super();
// datasource rerendered when change is made (used to set swipeout to active)
var ds = new ListView.DataSource({rowHasChanged: (row1, row2) => true});
this.state = {
dataSource: ds.cloneWithRows(rows),
sectionID: null,
rowID: null,
};
}
_renderRow(rowData: string, sectionID: number, rowID: number) {
return (
{
this.setState({
sectionID,
rowID,
})
}}
onClose={() => console.log('===close') }
scroll={event => console.log('scroll event') }
>
console.log('press children')}>
{rowData.text}
);
}
render() {
return (
Swipeout
);
}
}
export default SwipeoutExample;