mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Implementaion of RCTScrollableProtocol for RCTScrollViewComponentView
Summary: We need this only until Fabric has own command-execution pipeline. Reviewed By: mdvacca Differential Revision: D15501202 fbshipit-source-id: aad77660ada43e429722b13d1da2f998a1726c73
This commit is contained in:
committed by
Facebook Github Bot
parent
94dfc153a4
commit
ba627f4970
@@ -7,6 +7,7 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <React/RCTScrollableProtocol.h>
|
||||
#import <React/RCTViewComponentView.h>
|
||||
#import <React/RNGenericDelegateSplitter.h>
|
||||
|
||||
@@ -46,4 +47,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@end
|
||||
|
||||
/*
|
||||
* RCTScrollableProtocol is a protocol which RCTScrollViewManager uses to communicate with all kinds of `UIScrollView`s.
|
||||
* Until Fabric has own command-execution pipeline we have to support that to some extent. The implementation shouldn't
|
||||
* be perfect though because very soon we will migrate that to the new commands infra and get rid of this.
|
||||
*/
|
||||
@interface RCTScrollViewComponentView (ScrollableProtocol) <RCTScrollableProtocol>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -218,3 +218,42 @@ using namespace facebook::react;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTScrollViewComponentView (ScrollableProtocol)
|
||||
|
||||
- (CGSize)contentSize
|
||||
{
|
||||
return _contentSize;
|
||||
}
|
||||
|
||||
- (void)scrollToOffset:(CGPoint)offset
|
||||
{
|
||||
[self scrollToOffset:offset animated:YES];
|
||||
}
|
||||
|
||||
- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
|
||||
{
|
||||
[self.scrollView setContentOffset:offset animated:animated];
|
||||
}
|
||||
|
||||
- (void)scrollToEnd:(BOOL)animated
|
||||
{
|
||||
// Not implemented.
|
||||
}
|
||||
|
||||
- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated
|
||||
{
|
||||
// Not implemented.
|
||||
}
|
||||
|
||||
- (void)addScrollListener:(NSObject<UIScrollViewDelegate> *)scrollListener
|
||||
{
|
||||
[self.scrollViewDelegateSplitter addDelegate:scrollListener];
|
||||
}
|
||||
|
||||
- (void)removeScrollListener:(NSObject<UIScrollViewDelegate> *)scrollListener
|
||||
{
|
||||
[self.scrollViewDelegateSplitter removeDelegate:scrollListener];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user