-
-
Save leviduan/e46d3ee76756775ba2036a511ed26c92 to your computer and use it in GitHub Desktop.
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
# When using RN in combination with Cocoapods, a lot of | |
# things are broken. These are the fixes we had to append | |
# to our Podfile when upgrading to [email protected]. | |
# | |
# WARNING: Check those line numbers when you're on a different version! | |
def change_lines_in_file(file_path, &change) | |
print "Fixing #{file_path}...\n" | |
contents = [] | |
file = File.open(file_path, 'r') | |
file.each_line do | line | | |
contents << line | |
end | |
file.close | |
File.open(file_path, 'w') do |f| | |
f.puts(change.call(contents)) | |
end | |
end | |
post_install do |installer| | |
# https://github.com/facebook/yoga/issues/711#issuecomment-381098373 | |
change_lines_in_file('./Pods/Target Support Files/yoga/yoga-umbrella.h') do |lines| | |
lines.reject do | line | | |
[ | |
'#import "Utils.h"', | |
'#import "YGLayout.h"', | |
'#import "YGNode.h"', | |
'#import "YGNodePrint.h"', | |
'#import "YGStyle.h"', | |
'#import "Yoga-internal.h"', | |
].include?(line.strip) | |
end | |
end | |
# https://github.com/facebook/yoga/issues/711#issuecomment-374605785 | |
change_lines_in_file('./node_modules/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h') do |lines| | |
unless lines[27].include?("#ifdef __cplusplus") | |
lines.insert(27, "#ifdef __cplusplus") | |
lines.insert(34, "#endif") | |
end | |
lines | |
end | |
# https://github.com/facebook/react-native/issues/13198 | |
change_lines_in_file('./node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h') do |lines| | |
lines.map { |line| line.include?("#import <RCTAnimation/RCTValueAnimatedNode.h>") ? '#import "RCTValueAnimatedNode.h"' : line } | |
end | |
# https://github.com/facebook/react-native/issues/16039 | |
change_lines_in_file('./node_modules/react-native/Libraries/WebSocket/RCTReconnectingWebSocket.m') do |lines| | |
lines.map { |line| line.include?("#import <fishhook/fishhook.h>") ? '#import "fishhook.h"' : line } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment