[go: nahoru, domu]

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

Commit

Permalink
* [iOS] fix scrollTo wrong position when no virtalElementInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
doumafang authored and YorkShen committed Aug 2, 2018
1 parent 53a9e02 commit 70da769
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ - (void)scrollTo:(NSString *)virtalElementInfo options:(NSDictionary *)options
}
else
{
if (virtalElementInfo.length == 0) {
return;
}
position = [self _positionForVirtalElementInfo:virtalElementInfo];
}
NSIndexPath *toIndexPath = [NSIndexPath indexPathForItem:position inSection:0];
Expand All @@ -408,13 +411,19 @@ - (void)queryElementAll:(NSString *)virtalElementInfo cssSelector:(NSString *)cs
- (NSString *)_refForVirtalElementInfo:(NSString *)virtalElementInfo
{
NSArray *stringArray = [virtalElementInfo componentsSeparatedByString:@"@"];
return stringArray[0];
if (stringArray.count == 2) {
return stringArray[0];
}
return nil;
}

- (NSUInteger )_positionForVirtalElementInfo:(NSString *)virtalElementInfo
{
NSArray *stringArray = [virtalElementInfo componentsSeparatedByString:@"@"];
return [stringArray[1] integerValue];
if (stringArray.count == 2) {
return [stringArray[1] integerValue];
}
return 0;
}

- (void)closest:(NSString *)virtalElementInfo cssSelector:(NSString *)cssSelector callback:(WXModuleCallback)callback
Expand Down

0 comments on commit 70da769

Please sign in to comment.