Skip to content

Commit

Permalink
feat(hippy-vue): rm compatible process for endReached & loadMore event
Browse files Browse the repository at this point in the history
  • Loading branch information
zoomchan-cxj committed May 27, 2022
1 parent 7a45c0e commit d320eb1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
6 changes: 3 additions & 3 deletions packages/hippy-vue/src/renderer/element-node.js
Expand Up @@ -474,10 +474,10 @@ class ElementNode extends ViewNode {
this.attributes.scrollEventThrottle = scrollEventThrottle;
}
}
this._emitter.addEventListener(eventNames, callback, options);
if (typeof this.polyfillNativeEvents === 'function') {
this.polyfillNativeEvents('addEventListener', eventNames, callback, options);
({ eventNames, callback, options } = this.polyfillNativeEvents('addEventListener', eventNames, callback, options));
}
this._emitter.addEventListener(eventNames, callback, options);
updateChild(this);
}

Expand All @@ -486,7 +486,7 @@ class ElementNode extends ViewNode {
return null;
}
if (typeof this.polyfillNativeEvents === 'function') {
this.polyfillNativeEvents('removeEventListener', eventNames, callback, options);
({ eventNames, callback, options } = this.polyfillNativeEvents('removeEventListener', eventNames, callback, options));
}
const observer = this._emitter.removeEventListener(eventNames, callback, options);
updateChild(this);
Expand Down
4 changes: 1 addition & 3 deletions packages/hippy-vue/src/renderer/list-item-node.js
Expand Up @@ -32,10 +32,8 @@ class ListItemNode extends ElementNode {
let name = eventNames;
if (eventNames === 'disappear' && Native.Platform === 'android') {
name = 'disAppear';
if (this.emitter && this.emitter[method]) {
this.emitter[method](name, callback, options);
}
}
return { eventNames: name, callback, options };
}
}

Expand Down
13 changes: 0 additions & 13 deletions packages/hippy-vue/src/renderer/list-node.js
Expand Up @@ -44,19 +44,6 @@ class ListNode extends ElementNode {
}
Native.callUIFunction(this, 'scrollToContentOffset', [posX, posY, needAnimation]);
}

/**
* Polyfill native event
*/
polyfillNativeEvents(method, eventNames, callback, options) {
let name = eventNames;
if (eventNames === 'loadMore') {
name = 'endReached';
if (this.emitter && this.emitter[method]) {
this.emitter[method](name, callback, options);
}
}
}
}

export default ListNode;

0 comments on commit d320eb1

Please sign in to comment.