RCTScrollableProtocol.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import <React/RCTComponent.h>
  8. #import <UIKit/UIKit.h>
  9. /**
  10. * Contains any methods related to scrolling. Any `RCTView` that has scrolling
  11. * features should implement these methods.
  12. */
  13. @protocol RCTScrollableProtocol
  14. @property (nonatomic, readonly) CGSize contentSize;
  15. - (void)scrollToOffset:(CGPoint)offset;
  16. - (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated;
  17. /**
  18. * If this is a vertical scroll view, scrolls to the bottom.
  19. * If this is a horizontal scroll view, scrolls to the right.
  20. */
  21. - (void)scrollToEnd:(BOOL)animated;
  22. - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated;
  23. - (void)addScrollListener:(NSObject<UIScrollViewDelegate> *)scrollListener;
  24. - (void)removeScrollListener:(NSObject<UIScrollViewDelegate> *)scrollListener;
  25. @end
  26. /**
  27. * Denotes a view which implements custom pull to refresh functionality.
  28. */
  29. @protocol RCTCustomRefreshContolProtocol
  30. @property (nonatomic, copy) RCTDirectEventBlock onRefresh;
  31. @property (nonatomic, readonly, getter=isRefreshing) BOOL refreshing;
  32. @end