-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lzj
committed
Apr 20, 2020
1 parent
ea16a06
commit b5716bf
Showing
11 changed files
with
143 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
example/react-native-patch/reswift_modify_delete_methods.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- a/Pods/ReSwift/ReSwift/CoreTypes/Store.swift | ||
+++ b/Pods/ReSwift/ReSwift/CoreTypes/Store.swift | ||
@@ -86,9 +86,6 @@ | ||
|
||
subscriptions.append(subscriptionBox) | ||
|
||
- if let state = self.state { | ||
- originalSubscription.newValues(oldState: nil, newState: state) | ||
- } | ||
} | ||
|
||
open func subscribe<S: StoreSubscriber>(_ subscriber: S) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- a/node_modules/react-native/React/Base/RCTBridgeModule.h | ||
+++ b/node_modules/react-native/React/Base/RCTBridgeModule.h | ||
@@ -74,6 +74,17 @@ | ||
+ (void)load { RCTRegisterModule(self); } | ||
|
||
/** | ||
+ * Same as RCT_EXPORT_MODULE, but uses __attribute__((constructor)) for module | ||
+ * registration. Useful for registering swift classes that forbids use of load | ||
+ * Used in RCT_EXTERN_REMAP_MODULE | ||
+ */ | ||
+#define RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name) \ | ||
+RCT_EXTERN void RCTRegisterModule(Class); \ | ||
++ (NSString *)moduleName { return @#js_name; } \ | ||
+__attribute__((constructor)) static void \ | ||
+RCT_CONCAT(initialize_, objc_name)() { RCTRegisterModule([objc_name class]); } | ||
+ | ||
+/** | ||
* To improve startup performance users may want to generate their module lists | ||
* at build time and hook the delegate to merge with the runtime list. This | ||
* macro takes the place of the above for those cases by omitting the +load | ||
@@ -250,7 +261,7 @@ | ||
@interface objc_name (RCTExternModule) <RCTBridgeModule> \ | ||
@end \ | ||
@implementation objc_name (RCTExternModule) \ | ||
- RCT_EXPORT_MODULE(js_name) | ||
+ RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name) | ||
|
||
/** | ||
* Use this macro in accordance with RCT_EXTERN_MODULE to export methods | ||
@@ -323,10 +334,29 @@ | ||
@end | ||
|
||
/** | ||
+ * A protocol that allows TurboModules to do lookup on other TurboModules. | ||
+ * Calling these methods may cause a module to be synchronously instantiated. | ||
+ */ | ||
+ @protocol RCTTurboModuleLookupDelegate <NSObject> | ||
+ - (id)moduleForName:(const char *)moduleName; | ||
+ | ||
+ /** | ||
+ * Rationale: | ||
+ * When TurboModules lookup other modules by name, we first check the TurboModule | ||
+ * registry to see if a TurboModule exists with the respective name. In this case, | ||
+ * we don't want a RedBox to be raised if the TurboModule isn't found. | ||
+ * | ||
+ * This method is deprecated and will be deleted after the migration from | ||
+ * TurboModules to TurboModules is complete. | ||
+ */ | ||
+ - (id)moduleForName:(const char *)moduleName warnOnLookupFailure:(BOOL)warnOnLookupFailure; | ||
+ - (BOOL)moduleIsInitialized:(const char *)moduleName; | ||
+ @end | ||
+ | ||
+/** | ||
* Experimental. | ||
* A protocol to declare that a class supports TurboModule. | ||
* This may be removed in the future. | ||
+ * See RCTTurboModule.h for actual signature. | ||
*/ | ||
-@protocol RCTTurboModule <NSObject> | ||
- | ||
-@end | ||
+@protocol RCTTurboModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- a/node_modules/react-native/React/Base/RCTModuleMethod.mm | ||
+++ b/node_modules/react-native/React/Base/RCTModuleMethod.mm | ||
@@ -90,6 +90,7 @@ | ||
|
||
static BOOL RCTParseUnused(const char **input) | ||
{ | ||
return RCTReadString(input, "__unused") || | ||
+ RCTReadString(input, "__attribute__((__unused__))") || //lzj fixed | ||
RCTReadString(input, "__attribute__((unused))"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- a/node_modules/react-native/React.podspec | ||
+++ b/node_modules/react-native/React.podspec | ||
@@ -115,6 +115,8 @@ | ||
s.subspec "jsiexecutor" do |ss| | ||
ss.dependency "React/cxxreact" | ||
ss.dependency "React/jsi" | ||
+ ss.dependency "DoubleConversion" | ||
+ ss.dependency "glog" | ||
ss.dependency "Folly", folly_version | ||
ss.compiler_flags = folly_compiler_flags | ||
ss.source_files = "ReactCommon/jsiexecutor/jsireact/*.{cpp,h}" | ||
@@ -125,6 +127,8 @@ | ||
|
||
s.subspec "jsi" do |ss| | ||
ss.dependency "Folly", folly_version | ||
+ ss.dependency "DoubleConversion" | ||
+ ss.dependency "glog" | ||
ss.compiler_flags = folly_compiler_flags | ||
ss.source_files = "ReactCommon/jsi/*.{cpp,h}" | ||
ss.private_header_files = "ReactCommon/jsi/*.h" | ||
@@ -142,6 +146,8 @@ | ||
ss.dependency "React/jsinspector" | ||
ss.dependency "boost-for-react-native", "1.63.0" | ||
ss.dependency "Folly", folly_version | ||
+ ss.dependency "DoubleConversion" | ||
+ ss.dependency "glog" | ||
ss.compiler_flags = folly_compiler_flags | ||
ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}" | ||
ss.exclude_files = "ReactCommon/cxxreact/SampleCxxModule.*" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
SRCROOT=`pwd` | ||
REACT_NATIVE_DIR=${SRCROOT}/node_modules/react-native | ||
PATCH_FILE_PATH=${SRCROOT}/react-native-patch | ||
echo "REACT_NATIVE_DIR:$REACT_NATIVE_DIR" | ||
echo "PATCH_FILE_PATH:$PATCH_FILE_PATH" | ||
|
||
set -x | ||
patch -p0 -N --dry-run --silent -f $REACT_NATIVE_DIR/React/Base/RCTModuleMethod.mm < $PATCH_FILE_PATH/rn_modify_module_method.patch 1>/dev/null | ||
if [ $? -eq 0 ]; then | ||
patch -p0 -f $REACT_NATIVE_DIR/React/Base/RCTModuleMethod.mm < $PATCH_FILE_PATH/rn_modify_module_method.patch | ||
fi | ||
|
||
set -x | ||
patch -p0 -N --dry-run --silent -f $REACT_NATIVE_DIR/React.podspec < $PATCH_FILE_PATH/rn_modify_react_podspec.patch 1>/dev/null | ||
if [ $? -eq 0 ]; then | ||
patch -p0 -f $REACT_NATIVE_DIR/React.podspec < $PATCH_FILE_PATH/rn_modify_react_podspec.patch | ||
fi | ||
|
||
set -x | ||
patch -p0 -N --dry-run --silent -f $REACT_NATIVE_DIR/React/Base/RCTBridgeModule.h < $PATCH_FILE_PATH/rn_modify_add_macro.patch 1>/dev/null | ||
if [ $? -eq 0 ]; then | ||
patch -p0 -f $REACT_NATIVE_DIR/React/Base/RCTBridgeModule.h < $PATCH_FILE_PATH/rn_modify_add_macro.patch | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters