From 485e9d2ef864c826e6f664cc11b572a179beedea Mon Sep 17 00:00:00 2001 From: wwwcg Date: Wed, 30 Oct 2024 11:26:50 +0800 Subject: [PATCH] feat(ios): waterfall component support footer view refactor waterfall component --- .../src/components/WaterfallView/index.jsx | 23 +++- .../native-demos/demo-waterfall.vue | 17 ++- .../components/native-demo/demo-waterfall.vue | 14 +- .../src/components/waterfall-view.tsx | 30 ++++- .../waterfalllist/HippyShadowWaterfallItem.h | 6 + .../HippyWaterfallItemViewManager.m | 3 + .../waterfalllist/HippyWaterfallView.h | 12 +- .../waterfalllist/HippyWaterfallView.mm | 101 +++++++++----- .../HippyWaterfallViewDataSource.h | 26 +++- .../HippyWaterfallViewDataSource.m | 126 ++++++------------ .../waterfalllist/HippyWaterfallViewManager.m | 2 + 11 files changed, 230 insertions(+), 130 deletions(-) diff --git a/driver/js/examples/hippy-react-demo/src/components/WaterfallView/index.jsx b/driver/js/examples/hippy-react-demo/src/components/WaterfallView/index.jsx index 4fd51526e5b..7368992b183 100644 --- a/driver/js/examples/hippy-react-demo/src/components/WaterfallView/index.jsx +++ b/driver/js/examples/hippy-react-demo/src/components/WaterfallView/index.jsx @@ -74,6 +74,7 @@ export default class ListExample extends React.Component { this.onHeaderPulling = this.onHeaderPulling.bind(this); this.onFooterPulling = this.onFooterPulling.bind(this); this.renderBanner = this.renderBanner.bind(this); + this.renderFooter = this.renderFooter.bind(this); this.getItemStyle = this.getItemStyle.bind(this); this.getHeaderStyle = this.getHeaderStyle.bind(this); this.onScroll = this.onScroll.bind(this); @@ -239,7 +240,7 @@ export default class ListExample extends React.Component { } - // render banner(it is not supported on Android yet) + // render banner renderBanner() { if (this.state.dataSource.length === 0) return null; return (); } + // render footer (currently only iOS support) + renderFooter() { + if (this.state.dataSource.length === 0) return null; + return ( + Footer View + ); + } + renderItem(index) { const { dataSource } = this.state; let styleUI = null; @@ -362,7 +381,9 @@ export default class ListExample extends React.Component { style={{ flex: 1 }} onScroll={this.onScroll} renderBanner={this.renderBanner} + renderFooter={this.renderFooter} renderPullHeader={this.renderPullHeader} + renderPullFooter={this.renderPullFooter} onEndReached={this.onEndReached} onFooterReleased={this.onEndReached} onHeaderReleased={this.onHeaderReleased} diff --git a/driver/js/examples/hippy-vue-demo/src/components/native-demos/demo-waterfall.vue b/driver/js/examples/hippy-vue-demo/src/components/native-demos/demo-waterfall.vue index a95b59a450a..5e2df5c8c41 100644 --- a/driver/js/examples/hippy-vue-demo/src/components/native-demos/demo-waterfall.vue +++ b/driver/js/examples/hippy-vue-demo/src/components/native-demos/demo-waterfall.vue @@ -25,17 +25,18 @@

+ +