我在 ExpoKit 下的 RNGestureHandler.h 文件中生成了构建错误。未知类型名称“RNGestureHandlerState”。这个问题是在我将 expo 从项目中分离出来之后发生的。
我尝试了修复,我看到将 #import <XXX.h> 更改为 import "XXX.h" 但错误仍然存在。
#import <RNGestureHandlerState.h>
#import <RNGestureHandlerDirection.h>
#import <RNGestureHandlerEvents.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <React/RCTConvert.h>
#define VEC_LEN_SQ(pt) (pt.x * pt.x + pt.y * pt.y)
#define TEST_MIN_IF_NOT_NAN(value, limit) \
(!isnan(limit) && ((limit < 0 && value <= limit) || (limit >= 0 && value >= limit)))
#define TEST_MAX_IF_NOT_NAN(value, max) \
(!isnan(max) && ((max < 0 && value < max) || (max >= 0 && value > max)))
#define APPLY_PROP(recognizer, config, type, prop, propName) do { \
id value = config[propName]; \
if (value != nil) recognizer.prop = [RCTConvert type:value]; \
} while(0)
#define APPLY_FLOAT_PROP(prop) do { APPLY_PROP(recognizer, config, CGFloat, prop, @#prop); } while(0)
#define APPLY_INT_PROP(prop) do { APPLY_PROP(recognizer, config, NSInteger, prop, @#prop); } while(0)
#define APPLY_NAMED_INT_PROP(prop, propName) do { APPLY_PROP(recognizer, config, NSInteger, prop, propName); } while(0)
@protocol RNGestureHandlerEventEmitter
- (void)sendTouchEvent:(nonnull RNGestureHandlerEvent *)event;
- (void)sendStateChangeEvent:(nonnull RNGestureHandlerStateChange *)event;
@end
@protocol RNRootViewGestureRecognizerDelegate <UIGestureRecognizerDelegate>
- (void)gestureRecognizer:(nullable UIGestureRecognizer *)gestureRecognizer
didActivateInRootView:(nullable UIView *)rootView;
@end
@interface RNGestureHandler : NSObject <UIGestureRecognizerDelegate> {
@protected UIGestureRecognizer *_recognizer;
@protected RNGestureHandlerState _lastState; //Error in this line: Unknown type name 'RNGestureHandlerState'
}
+ (nullable RNGestureHandler *)findGestureHandlerByRecognizer:(nonnull UIGestureRecognizer *)recognizer;
- (nonnull instancetype)initWithTag:(nonnull NSNumber *)tag;
@property (nonatomic, readonly, nonnull) NSNumber *tag;
@property (nonatomic, weak, nullable) id<RNGestureHandlerEventEmitter> emitter;
@property (nonatomic, readonly, nullable) UIGestureRecognizer *recognizer;
@property (nonatomic) BOOL enabled;
@property(nonatomic) BOOL shouldCancelWhenOutside;
- (void)bindToView:(nonnull UIView *)view;
- (void)unbindFromView;
- (void)configure:(nullable NSDictionary *)config NS_REQUIRES_SUPER;
- (void)handleGesture:(nonnull id)recognizer;
- (BOOL)containsPointInView;
- (RNGestureHandlerState)state; //Error in this line: Expected a type
- (nullable RNGestureHandlerEventExtraData *)eventExtraData:(nonnull id)recognizer;
- (void)reset;
- (void)sendEventsInState:(RNGestureHandlerState)state //Error in this line: Expected a type
forViewWithTag:(nonnull NSNumber *)reactTag
withExtraData:(RNGestureHandlerEventExtraData *)extraData;
@end