在我的应用程序中,我使用一个 package ,它需要 AppDelegate 文件中的一些本机配置,并且它与 RCTAppDelegate 不兼容,因此我必须手动复制该方法的定义和实现。这样做会禁止我使用 documentation 中提到的 EXAppDelegateWrapper。
这是我的 AppDelegate.h 文件:
#import <RCTAppDelegate.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>
#import <ExponeaRNAppDelegate.h>
@class RCTBridge;
@protocol RCTBridgeDelegate;
@protocol RCTComponentViewProtocol;
@class RCTSurfacePresenterBridgeAdapter;
@interface AppDelegate : UIResponder <UIApplicationDelegate, UISceneDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>
@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) RCTBridge *bridge;
@property (nonatomic, strong) NSString *moduleName;
@property (nonatomic, strong) NSDictionary *initialProps;
- (RCTBridge *)createBridgeWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary *)launchOptions;
- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initProps:(NSDictionary *)initProps;
- (UIViewController *)createRootViewController;
- (void)setRootView:(UIView *)rootView toRootViewController:(UIViewController *)rootViewController;
- (BOOL)runtimeSchedulerEnabled;
#if RCT_NEW_ARCH_ENABLED
@property (nonatomic, strong) RCTSurfacePresenterBridgeAdapter *bridgeAdapter;
- (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents;
- (BOOL)turboModuleEnabled;
- (BOOL)fabricEnabled;
- (BOOL)bridgelessEnabled;
- (NSURL *)getBundleURL;
#endif
@end
如何安装expo模块?我尝试复制 EXReactDelegateWrapper 中的方法,但是当我运行应用程序并尝试使用 Expo-image 模块时,它会抛出以下错误:
ERROR 错误:找不到本机模块“ExpoImage”,js 引擎:hermes
错误类型错误:任务队列:任务错误:无法读取未定义的属性“图像”
我尝试从 EXReactDelegateWrapper 复制方法
你找到解决办法了吗?当我尝试将 RN 从 72 升级到 74,将 expo 从 49 升级到 51 时,我遇到了类似的问题