feat(ios): enable swipe to delete in UITableView (#935)

* feat(ios): enable swipe to delete in UITableView

* docs(hippy-react): fix conflicts

* feat(vue): support swipe to delete

* docs(vue): typo fix

* docs(vue): markdownlint fint

* docs(listview): add min support ver

* feat(listview): add demo case

* feat(reactdemo): add a line

* revert(vuedemo): del yarn.lock

* revert(reactdemo): del yarn.lock

* feat(reactdemo): eslint fix

* docs(react): change function type

* feat(reactdemo): trigger build
This commit is contained in:
Box Tsang
2021-09-10 18:30:17 +08:00
committed by zoomchan-cxj
parent 036de77144
commit ebcf138c71
8 changed files with 56 additions and 0 deletions
@@ -95,12 +95,22 @@ export default class ListExample extends React.Component {
fetchingDataFlag: false,
};
this.fetchTimes = 0;
this.delText = 'Delete';
this.mockFetchData = this.mockFetchData.bind(this);
this.getRenderRow = this.getRenderRow.bind(this);
this.onEndReached = this.onEndReached.bind(this);
this.getRowType = this.getRowType.bind(this);
this.getRowKey = this.getRowKey.bind(this);
this.getRowStyle = this.getRowStyle.bind(this);
this.onDelete = this.onDelete.bind(this);
}
onDelete({ index }) {
const { dataSource } = this.state;
const newData = dataSource.filter((item, i) => index !== i);
this.setState({
dataSource: newData,
});
}
async onEndReached() {
@@ -224,6 +234,9 @@ export default class ListExample extends React.Component {
renderRow={this.getRenderRow}
onEndReached={this.onEndReached}
getRowType={this.getRowType}
onDelete={this.onDelete}
delText={this.delText}
editable={true}
// getRowStyle={this.getRowStyle}
getRowKey={this.getRowKey}
initialListSize={15}
@@ -32,8 +32,11 @@
:horizontal="undefined"
:numberOfRows="dataSource.length"
:exposureEventEnabled="true"
:delText="delText"
:editable="true"
@endReached="onEndReached"
@scroll="onScroll"
@delete="onDelete"
>
<!--
li 有两个参数是一定要加上的。
@@ -96,6 +99,7 @@ export default {
top: 0,
left: 0,
},
delText: 'Delete',
Vue,
STYLE_LOADING,
};
@@ -145,6 +149,9 @@ export default {
}, 300);
});
},
onDelete(event) {
this.dataSource.splice(event.index, 1);
},
async onEndReached() {
const { dataSource } = this;