Fixed ScrollView.scrollTo() on iOS

Summary:
public
My refactor to unify the scrollTo() apis on iOS + Android broke iOS. Oops.

Reviewed By: jingc

Differential Revision: D2886305

fb-gh-sync-id: de287cba8df7cf14c8049d91621cd7f86aa4e92c
This commit is contained in:
Nick Lockwood 2016-02-01 11:04:43 -08:00 committed by facebook-github-bot-4
parent 3e0631af7f
commit 180ead05e9
1 changed files with 3 additions and 2 deletions

View File

@ -139,14 +139,15 @@ RCT_EXPORT_METHOD(endRefreshing:(nonnull NSNumber *)reactTag)
}
RCT_EXPORT_METHOD(scrollTo:(nonnull NSNumber *)reactTag
withOffset:(CGPoint)offset
offsetX:(CGFloat)x
offsetY:(CGFloat)y
animated:(BOOL)animated)
{
[self.bridge.uiManager addUIBlock:
^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
UIView *view = viewRegistry[reactTag];
if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) {
[(id<RCTScrollableProtocol>)view scrollToOffset:offset animated:animated];
[(id<RCTScrollableProtocol>)view scrollToOffset:(CGPoint){x, y} animated:animated];
} else {
RCTLogError(@"tried to scrollTo: on non-RCTScrollableProtocol view %@ "
"with tag #%@", view, reactTag);