You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

react-native+0.66.4.patch 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. diff --git a/node_modules/react-native/React/CoreModules/RCTTiming.mm b/node_modules/react-native/React/CoreModules/RCTTiming.mm
  2. index 70f0543..d43a4be 100644
  3. --- a/node_modules/react-native/React/CoreModules/RCTTiming.mm
  4. +++ b/node_modules/react-native/React/CoreModules/RCTTiming.mm
  5. @@ -146,6 +146,11 @@ - (void)setup
  6. name:name
  7. object:nil];
  8. }
  9. +
  10. + [[NSNotificationCenter defaultCenter] addObserver:self
  11. + selector:@selector(proximityChanged)
  12. + name:UIDeviceProximityStateDidChangeNotification
  13. + object:nil];
  14. }
  15. - (void)dealloc
  16. @@ -182,6 +187,16 @@ - (void)appDidMoveToForeground
  17. [self startTimers];
  18. }
  19. +- (void)proximityChanged
  20. +{
  21. + BOOL isClose = [UIDevice currentDevice].proximityState;
  22. + if (isClose) {
  23. + [self appDidMoveToBackground];
  24. + } else {
  25. + [self appDidMoveToForeground];
  26. + }
  27. +}
  28. +
  29. - (void)stopTimers
  30. {
  31. if (_inBackground) {
  32. diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
  33. index df31139..061ded9 100644
  34. --- a/node_modules/react-native/scripts/react_native_pods.rb
  35. +++ b/node_modules/react-native/scripts/react_native_pods.rb
  36. @@ -125,20 +125,49 @@ def exclude_architectures(installer)
  37. .uniq{ |p| p.path }
  38. .push(installer.pods_project)
  39. - arm_value = `/usr/sbin/sysctl -n hw.optional.arm64 2>&1`.to_i
  40. -
  41. # Hermes does not support `i386` architecture
  42. excluded_archs_default = has_pod(installer, 'hermes-engine') ? "i386" : ""
  43. projects.each do |project|
  44. project.build_configurations.each do |config|
  45. - if arm_value == 1 then
  46. - config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = excluded_archs_default
  47. - else
  48. - config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 " + excluded_archs_default
  49. + config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = excluded_archs_default
  50. + end
  51. +
  52. + project.save()
  53. + end
  54. +end
  55. +
  56. +def fix_library_search_paths(installer)
  57. + def fix_config(config)
  58. + lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
  59. + if lib_search_paths
  60. + if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
  61. + # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
  62. + # since the libraries there are only built for x86_64 and i386.
  63. + lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
  64. + lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
  65. + if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
  66. + # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
  67. + lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
  68. + end
  69. end
  70. end
  71. + end
  72. +
  73. + projects = installer.aggregate_targets
  74. + .map{ |t| t.user_project }
  75. + .uniq{ |p| p.path }
  76. + .push(installer.pods_project)
  77. + projects.each do |project|
  78. + project.build_configurations.each do |config|
  79. + fix_config(config)
  80. + end
  81. + project.native_targets.each do |target|
  82. + target.build_configurations.each do |config|
  83. + fix_config(config)
  84. + end
  85. + end
  86. project.save()
  87. end
  88. end
  89. @@ -149,6 +178,7 @@ def react_native_post_install(installer)
  90. end
  91. exclude_architectures(installer)
  92. + fix_library_search_paths(installer)
  93. end
  94. def use_react_native_codegen!(spec, options={})
  95. @@ -218,36 +248,8 @@ end
  96. # See https://github.com/facebook/react-native/issues/31480#issuecomment-902912841 for more context.
  97. # Actual fix was authored by https://github.com/mikehardy.
  98. # New app template will call this for now until the underlying issue is resolved.
  99. +#
  100. +# It's not needed anymore and will be removed later
  101. def __apply_Xcode_12_5_M1_post_install_workaround(installer)
  102. - # Apple Silicon builds require a library path tweak for Swift library discovery to resolve Swift-related "symbol not found".
  103. - # Note: this was fixed via https://github.com/facebook/react-native/commit/eb938863063f5535735af2be4e706f70647e5b90
  104. - # Keeping this logic here but commented out for future reference.
  105. - #
  106. - # installer.aggregate_targets.each do |aggregate_target|
  107. - # aggregate_target.user_project.native_targets.each do |target|
  108. - # target.build_configurations.each do |config|
  109. - # config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)']
  110. - # end
  111. - # end
  112. - # aggregate_target.user_project.save
  113. - # end
  114. -
  115. - # Flipper podspecs are still targeting an older iOS deployment target, and may cause an error like:
  116. - # "error: thread-local storage is not supported for the current target"
  117. - # The most reliable known workaround is to bump iOS deployment target to match react-native (iOS 11 now).
  118. - installer.pods_project.targets.each do |target|
  119. - target.build_configurations.each do |config|
  120. - # ensure IPHONEOS_DEPLOYMENT_TARGET is at least 11.0
  121. - should_upgrade = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].split('.')[0].to_i < 11
  122. - if should_upgrade
  123. - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
  124. - end
  125. - end
  126. - end
  127. -
  128. - # But... doing so caused another issue in Flipper:
  129. - # "Time.h:52:17: error: typedef redefinition with different types"
  130. - # We need to make a patch to RCT-Folly - remove the `__IPHONE_OS_VERSION_MIN_REQUIRED` check.
  131. - # See https://github.com/facebook/flipper/issues/834 for more details.
  132. - `sed -i -e $'s/ && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)//' Pods/RCT-Folly/folly/portability/Time.h`
  133. + puts "__apply_Xcode_12_5_M1_post_install_workaround() is not needed anymore"
  134. end