mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
0176ac488e
Summary:New prop `hitSlop` allows extending the touch area of Touchable components. This makes it easier to touch small buttons without needing to change your styles. It takes `top`, `bottom`, `left`, and `right` same as the `pressRetentionOffset` prop. When a touch is moved, `hitSlop` is combined with `pressRetentionOffset` to determine how far the touch can move off the button before deactivating the button. On Android I had to add a new file `ids.xml` to generate a unique ID to use for the tag where I store the `hitSlop` state. The iOS side is more straightforward. terribleben worked on the iOS and JS parts of this diff. Fixes #110 Closes https://github.com/facebook/react-native/pull/5720 Differential Revision: D2941671 Pulled By: androidtrunkagent fb-gh-sync-id: 07e3eb8b6a36eebf76968fdaac3c6ac335603194 shipit-source-id: 07e3eb8b6a36eebf76968fdaac3c6ac335603194
99 lines
2.9 KiB
Objective-C
99 lines
2.9 KiB
Objective-C
/**
|
|
* 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.
|
|
*/
|
|
|
|
#import "RCTView.h"
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import "RCTBorderStyle.h"
|
|
#import "RCTComponent.h"
|
|
#import "RCTPointerEvents.h"
|
|
|
|
@protocol RCTAutoInsetsProtocol;
|
|
|
|
@class RCTView;
|
|
|
|
@interface RCTView : UIView
|
|
|
|
/**
|
|
* Accessibility event handlers
|
|
*/
|
|
@property (nonatomic, copy) RCTDirectEventBlock onAccessibilityTap;
|
|
@property (nonatomic, copy) RCTDirectEventBlock onMagicTap;
|
|
|
|
/**
|
|
* Used to control how touch events are processed.
|
|
*/
|
|
@property (nonatomic, assign) RCTPointerEvents pointerEvents;
|
|
|
|
+ (void)autoAdjustInsetsForView:(UIView<RCTAutoInsetsProtocol> *)parentView
|
|
withScrollView:(UIScrollView *)scrollView
|
|
updateOffset:(BOOL)updateOffset;
|
|
|
|
/**
|
|
* Find the first view controller whose view, or any subview is the specified view.
|
|
*/
|
|
+ (UIEdgeInsets)contentInsetsForView:(UIView *)curView;
|
|
|
|
/**
|
|
* This is an optimization used to improve performance
|
|
* for large scrolling views with many subviews, such as a
|
|
* list or table. If set to YES, any clipped subviews will
|
|
* be removed from the view hierarchy whenever -updateClippedSubviews
|
|
* is called. This would typically be triggered by a scroll event
|
|
*/
|
|
@property (nonatomic, assign) BOOL removeClippedSubviews;
|
|
|
|
/**
|
|
* Hide subviews if they are outside the view bounds.
|
|
* This is an optimisation used predominantly with RKScrollViews
|
|
* but it is applied recursively to all subviews that have
|
|
* removeClippedSubviews set to YES
|
|
*/
|
|
- (void)updateClippedSubviews;
|
|
|
|
/**
|
|
* Border radii.
|
|
*/
|
|
@property (nonatomic, assign) CGFloat borderRadius;
|
|
@property (nonatomic, assign) CGFloat borderTopLeftRadius;
|
|
@property (nonatomic, assign) CGFloat borderTopRightRadius;
|
|
@property (nonatomic, assign) CGFloat borderBottomLeftRadius;
|
|
@property (nonatomic, assign) CGFloat borderBottomRightRadius;
|
|
|
|
/**
|
|
* Border colors (actually retained).
|
|
*/
|
|
@property (nonatomic, assign) CGColorRef borderTopColor;
|
|
@property (nonatomic, assign) CGColorRef borderRightColor;
|
|
@property (nonatomic, assign) CGColorRef borderBottomColor;
|
|
@property (nonatomic, assign) CGColorRef borderLeftColor;
|
|
@property (nonatomic, assign) CGColorRef borderColor;
|
|
|
|
/**
|
|
* Border widths.
|
|
*/
|
|
@property (nonatomic, assign) CGFloat borderTopWidth;
|
|
@property (nonatomic, assign) CGFloat borderRightWidth;
|
|
@property (nonatomic, assign) CGFloat borderBottomWidth;
|
|
@property (nonatomic, assign) CGFloat borderLeftWidth;
|
|
@property (nonatomic, assign) CGFloat borderWidth;
|
|
|
|
/**
|
|
* Border styles.
|
|
*/
|
|
@property (nonatomic, assign) RCTBorderStyle borderStyle;
|
|
|
|
/**
|
|
* Insets used when hit testing inside this view.
|
|
*/
|
|
@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
|
|
|
|
@end
|