2015-03-23 20:28:42 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
#import <UIKit/UIScrollView.h>
|
|
|
|
|
2016-11-23 15:47:52 +00:00
|
|
|
#import <React/RCTAutoInsetsProtocol.h>
|
|
|
|
#import <React/RCTEventDispatcher.h>
|
|
|
|
#import <React/RCTScrollableProtocol.h>
|
|
|
|
#import <React/RCTView.h>
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
@protocol UIScrollViewDelegate;
|
|
|
|
|
|
|
|
@interface RCTScrollView : RCTView <UIScrollViewDelegate, RCTScrollableProtocol, RCTAutoInsetsProtocol>
|
|
|
|
|
2015-03-01 23:33:55 +00:00
|
|
|
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER;
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
/**
|
|
|
|
* The `RCTScrollView` may have at most one single subview. This will ensure
|
|
|
|
* that the scroll view's `contentSize` will be efficiently set to the size of
|
|
|
|
* the single subview's frame. That frame size will be determined somewhat
|
|
|
|
* efficiently since it will have already been computed by the off-main-thread
|
|
|
|
* layout system.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, readonly) UIView *contentView;
|
|
|
|
|
2015-03-25 22:01:00 +00:00
|
|
|
/**
|
|
|
|
* If the `contentSize` is not specified (or is specified as {0, 0}, then the
|
|
|
|
* `contentSize` will automatically be determined by the size of the subview.
|
|
|
|
*/
|
2015-02-20 04:10:52 +00:00
|
|
|
@property (nonatomic, assign) CGSize contentSize;
|
2015-03-25 22:01:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The underlying scrollView (TODO: can we remove this?)
|
|
|
|
*/
|
|
|
|
@property (nonatomic, readonly) UIScrollView *scrollView;
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
@property (nonatomic, assign) UIEdgeInsets contentInset;
|
|
|
|
@property (nonatomic, assign) BOOL automaticallyAdjustContentInsets;
|
2015-03-30 11:58:02 +00:00
|
|
|
@property (nonatomic, assign) NSTimeInterval scrollEventThrottle;
|
2015-02-20 04:10:52 +00:00
|
|
|
@property (nonatomic, assign) BOOL centerContent;
|
2015-09-23 18:43:57 +00:00
|
|
|
@property (nonatomic, assign) int snapToInterval;
|
|
|
|
@property (nonatomic, copy) NSString *snapToAlignment;
|
2015-05-06 17:46:45 +00:00
|
|
|
@property (nonatomic, copy) NSIndexSet *stickyHeaderIndices;
|
2015-11-19 19:13:42 +00:00
|
|
|
|
2016-04-28 14:43:24 +00:00
|
|
|
// NOTE: currently these event props are only declared so we can export the
|
|
|
|
// event names to JS - we don't call the blocks directly because scroll events
|
|
|
|
// need to be coalesced before sending, for performance reasons.
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onScrollBeginDrag;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onScroll;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onScrollEndDrag;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollBegin;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollEnd;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onScrollAnimationEnd;
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
@end
|
2015-05-28 03:15:33 +00:00
|
|
|
|
|
|
|
@interface RCTEventDispatcher (RCTScrollView)
|
|
|
|
|
|
|
|
/**
|
2016-04-01 13:53:13 +00:00
|
|
|
* Send a fake scroll event.
|
2015-05-28 03:15:33 +00:00
|
|
|
*/
|
2016-04-01 13:53:13 +00:00
|
|
|
- (void)sendFakeScrollEvent:(NSNumber *)reactTag;
|
2015-05-28 03:15:33 +00:00
|
|
|
|
|
|
|
@end
|