ReactNativeLib
, 独立客户端只需要引 QRNLib
.React
静态库里 头文件引用方式的修改为 <React/XXX.h>
-#import "RCTBridge.h"
+#import <React/RCTBridge.h>
-#import "RCTUIManager.h"
+#import <React/RCTUIManager.h>
-#import "RCTUtils.h"
+#import <React/RCTUtils.h>
-#import "RCTLog.h"
+#import <React/RCTLog.h>
-#import "RCTBridgeModule.h"
+#import <React/RCTBridgeModule.h>
-#import "RCTConvert.h"
+#import <React/RCTConvert.h>
** and so on ... **
QRCTRootView
继承自 RCTRootView
, RCTRootView
的引用改为引用 QRCTRootView
(在QRNLib.h里已经引用,只需引用QRNLib.h即可)-#import "RCTRootView.h"
+#import "QRCTRootView.h"
CSSLayout.h
的引用修改、以及内部方法名及参数名修改** CSSLayout.h
文件迁移到 ReactCommon
的 yoga
文件夹里并改名为 Yoga.h
,引用方式通过 <yoga/Yoga.h>
**
-#import "cssLayout.h"
+#import <yoga/Yoga.h>
** CSSNodeSetMeasureFunc
移到 Yoga.c
文件里并修改方法名修改为 YGNodeSetMeasureFunc
**
if (self) {
-CSSNodeSetMeasureFunc(self.cssNode, RCTMeasure);
+YGNodeSetMeasureFunc(self.cssNode, RCTMeasure);
}
** CSSLayout.h
里的部分枚举移至 YGEnums.h
文件里,并且前缀改由 CSS
改为 YG
, 举例如下: **
CSSMeasureMode
修改为 YGMeasureMode
-NSTextStorage *textStorage = [self buildTextStorageForWidth:width widthMode:CSSMeasureModeExactly];
+NSTextStorage *textStorage = [self buildTextStorageForWidth:width widthMode:YGMeasureModeExactly];
CSSSize
修改为 YGSize
-CSSSize result;
+YGSize result;
** RCTMeasure
方法的 void *context
参数修改为 YGNodeRef node
,并且通过 YGNodeGetContext(node)
方法来获取 context
**
-static CSSSize RCTMeasure(void *context, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode)
+static YGSize RCTMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
-QWHActivityShadowView *shadowActivity = (__bridge QWHActivityShadowView *)context;
+QWHActivityShadowView *shadowActivity = (__bridge QWHActivityShadowView *)YGNodeGetContext(node);
QRCTVCCreater.h
的创建 VC
几个方法,那么需要 check
一下引用方式下列方法需要引用 `ReactNativeLib` 并且 `#import "QRCTVCCreater+CommonClient.h"`
+ (void)createVCWithHybridId:(NSString *)hybridId
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
vcName:(NSString *)vcName
hasLoading:(BOOL)hasLoading
completionHandler:(void(^)(QRCTViewController *qrctVC, NSError *error))completionHandler;
+ (void)createVCWithHybridId:(NSString *)hybridId
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
vcName:(NSString *)vcName
completionHandler:(void(^)(QRCTViewController *qrctVC, NSError *error))completionHandler;
+ (void)createVCWithHybridId:(NSString *)hybridId
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
completionHandler:(void(^)(QRCTViewController *qrctVC, NSError *error))completionHandler;
+ (void)createVCWithHybridId:(NSString *)hybridId
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
delegate:(id<QRCTVCCreaterDelegate>)delegate;
下列方法需要引用 `QRNLib` 并且 `#import "QRCTVCCreater.h"`
+ (void)createVCWithHybridId:(NSString *)hybridId
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
hasLoading:(BOOL)hasLoading
completionHandler:(void(^)(QRCTViewController *qrctVC, NSError *error))completionHandler;
QRNLib.h
里已经将常用到的头文件引用进去了,其余的可以根据需要自行引用