vonovak / react-native-theme-control

Natively control react native application theme at runtime and persist it for the next app start.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'RNThemeControl.h' file not found

Doko-Demo-Doa opened this issue · comments

Hi @vonovak , I followed the guide here but could not build and install the iOS app.

This is the log:

/apps/mobile/node_modules/react-native/Libraries/AppDelegate/RCTAppDelegate.mm:15:9: 'RNThemeControl.h' file not found

Other necessary commands are executed, like pod install. Is there a step that I am missing?

Hello and thanks for asking,
it'd help to have a runnable repro. What does your podfile look like? Try importing #import <RNThemeControl.h> and checking your header search paths.
Thank you 🙂

@vonovak Thanks for your response. It's a private repo so I cannot share the whole source code, but this is my Pofile.lock:

https://jpst.it/3yAbx

And this is the Podfile:

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```

# Disable Flipper because of the conflict with RN Firebase
# flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
flipper_config = FlipperConfiguration.disabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'DemoApp' do
  # https://rnfirebase.io/#altering-cocoapods-to-use-frameworks
  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'DemoAppTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )

    installer.pods_project.targets.each do |target|
      if ["react-native-keyboard-controller"].any? { |t| t == target.name }
        append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
      end
    end
  end
end

# https://github.com/software-mansion/react-native-svg/issues/2081
def append_header_search_path(target, path)
  target.build_configurations.each do |config|
      # Note that there's a space character after `$(inherited)`.
      config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
      config.build_settings["HEADER_SEARCH_PATHS"] << path
  end
end

Thank you,
I understand you cannot share private repo but to solve an issue, a reproduction is needed. Did you try the changed import? You likely need to fiddle around with the import and check header search paths.

Thank you 🙂

hello @Doko-Demo-Doa
did you get this resolved?

thank you!

Uh... no. I decided to use this library with react-native-mmkv for theme persisting anyway.

@vonovak This is the repo: https://github.com/Doko-Demo-Doa/theme-control-rn-reproduce

Basically it's just a Turborepo of React Native (CLI-generated project) with a NextJS app.

I have same issue after enable use_frameworks! :linkage => :static (when using react-native-firebase)

Hello!
Can you please let me know if these updated installation instructions help resolve the issue?

https://github.com/vonovak/react-native-theme-control/blob/fix/header-docs/docs/install.md#ios

Thank you! :)

I'm going to assume it's fixed, TY :)