react-native-threads icon indicating copy to clipboard operation
react-native-threads copied to clipboard

RN 69 is no longer auto-linking this module on iOS due to pod issues

Open RustyTheBoyRobot opened this issue 2 years ago • 3 comments

  1. Run pod install on a RN 69+ app that uses react-native-threads. Look at the output for the part that says "Auto-linking React Native modules for target ______: ". Notice that RNThread is no longer listed
  2. Open your app in XCode. In Pods > Development Pods, RNThread is not listed.
  3. Run your app. The ThreadManager native module will be null

RustyTheBoyRobot avatar Aug 22 '23 22:08 RustyTheBoyRobot

I think the root cause is that RN 69 is now looking for a *.podspec file at the root of the project, rather than in the iOS directory. You can manually fix this in your app by using patch-package to move the RNThread.podspec file to the root and changing the file paths accordingly.

require 'json'

package = JSON.parse(File.read(File.join(__dir__, './package.json')))

Pod::Spec.new do |s|
  s.name           = "RNThread"
  s.version        = package['version']
  s.summary        = "React native threads"
  s.description    = "React native threads"
  s.license        = package['license']
  s.author         = package['author']
  s.homepage       = "https://github.com/joltup/RNThread.git"
  s.source       = { :git => "https://github.com/joltup/RNThread.git", :tag => s.version }
  s.source_files  = "ios/**/*.{h,m}"
  s.platform      = :ios, "7.0"
  s.tvos.deployment_target = '10.0'

  s.dependency 'React'
end

RustyTheBoyRobot avatar Aug 22 '23 22:08 RustyTheBoyRobot

I think the root cause is that RN 69 is now looking for a *.podspec file at the root of the project, rather than in the iOS directory. You can manually fix this in your app by using patch-package to move the RNThread.podspec file to the root and changing the file paths accordingly.

require 'json'

package = JSON.parse(File.read(File.join(__dir__, './package.json')))

Pod::Spec.new do |s|
  s.name           = "RNThread"
  s.version        = package['version']
  s.summary        = "React native threads"
  s.description    = "React native threads"
  s.license        = package['license']
  s.author         = package['author']
  s.homepage       = "https://github.com/joltup/RNThread.git"
  s.source       = { :git => "https://github.com/joltup/RNThread.git", :tag => s.version }
  s.source_files  = "ios/**/*.{h,m}"
  s.platform      = :ios, "7.0"
  s.tvos.deployment_target = '10.0'

  s.dependency 'React'
end

This worked for me!

ThalesBMC avatar Sep 04 '23 18:09 ThalesBMC

@RustyTheBoyRobot Did you tried to update RN to 70? I got stuck with react-native-threads on 0.70 and stopped updating.

ThalesBMC avatar Sep 04 '23 18:09 ThalesBMC