mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
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:
committed by
facebook-github-bot-4
parent
3e0631af7f
commit
180ead05e9
@@ -139,14 +139,15 @@ RCT_EXPORT_METHOD(endRefreshing:(nonnull NSNumber *)reactTag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(scrollTo:(nonnull NSNumber *)reactTag
|
RCT_EXPORT_METHOD(scrollTo:(nonnull NSNumber *)reactTag
|
||||||
withOffset:(CGPoint)offset
|
offsetX:(CGFloat)x
|
||||||
|
offsetY:(CGFloat)y
|
||||||
animated:(BOOL)animated)
|
animated:(BOOL)animated)
|
||||||
{
|
{
|
||||||
[self.bridge.uiManager addUIBlock:
|
[self.bridge.uiManager addUIBlock:
|
||||||
^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
|
^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
|
||||||
UIView *view = viewRegistry[reactTag];
|
UIView *view = viewRegistry[reactTag];
|
||||||
if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) {
|
if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) {
|
||||||
[(id<RCTScrollableProtocol>)view scrollToOffset:offset animated:animated];
|
[(id<RCTScrollableProtocol>)view scrollToOffset:(CGPoint){x, y} animated:animated];
|
||||||
} else {
|
} else {
|
||||||
RCTLogError(@"tried to scrollTo: on non-RCTScrollableProtocol view %@ "
|
RCTLogError(@"tried to scrollTo: on non-RCTScrollableProtocol view %@ "
|
||||||
"with tag #%@", view, reactTag);
|
"with tag #%@", view, reactTag);
|
||||||
|
|||||||
Reference in New Issue
Block a user