Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[WEEX-98][iOS]bug-fix addEvent lead to generate a new view while it h…
Browse files Browse the repository at this point in the history
…as been recycled

  In most case , element in cell will be re-use for memory especially in very
long list, but if add event for this element, here will generate a new view for
this element,if it's nil due to a  getter method whether it is off-screen.

  For instance, image element in cell will re-use if it is disappear in vision area,
loaded again while it back to visual area. In this case , when it disappear, just
add event such as click, touch and so on , it will then create a new view,
and load image again, although it is off-screen.

  If the view is not loaded, so won't add gesture or call this view getter to create
any view until the view is loaded, then it will init events according to record in
component.

Bug: 98
  • Loading branch information
acton393 committed Nov 7, 2017
1 parent 30716b6 commit 62677d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ - (void)_initPseudoEvents:(BOOL)isListenPseudoTouch

- (void)_addEventOnMainThread:(NSString *)addEventName
{
if (![self isViewLoaded]) {
//This action will be ignored While the view is loaded,
//then it will initEvent according to the records in _events
return;
}
WX_ADD_EVENT(appear, addAppearEvent)
WX_ADD_EVENT(disappear, addDisappearEvent)

Expand Down

0 comments on commit 62677d7

Please sign in to comment.