@@ -26,6 +26,45 @@ const newPostInstallBlock =
2626 end
2727 end
2828 end
29+
30+ # Fix for React Native Firebase when using static frameworks
31+ # ROOT CAUSE: Static frameworks with modules enabled create strict module boundaries.
32+ # When RNFBMessaging imports <RNFBApp/...>, the module system expects ALL types to be
33+ # visible through RNFBApp's module exports. But RCTPromiseRejectBlock is in React-Core,
34+ # and RNFBApp doesn't re-export it. The module system blocks access even if headers exist.
35+ #
36+ # SOLUTION: Disable modules for RNFB targets entirely. This makes the compiler use
37+ # traditional #import header inclusion instead of strict module boundaries.
38+ installer.pods_project.targets.each do |target|
39+ if target.name.start_with?('RNFB')
40+ target.build_configurations.each do |config|
41+ # DISABLE modules - this is the key fix
42+ # Without modules, the compiler uses traditional header inclusion and can find
43+ # React-Core types through the header search paths
44+ config.build_settings['CLANG_ENABLE_MODULES'] = 'NO'
45+
46+ # Ensure header maps are enabled so headers can be found
47+ config.build_settings['USE_HEADERMAP'] = 'YES'
48+
49+ # Add React-Core headers to search paths so they can be found via #import
50+ header_search_paths = config.build_settings['HEADER_SEARCH_PATHS'] || '$(inherited)'
51+ react_core_path = File.join(installer.sandbox.root, 'Headers', 'Public', 'React-Core')
52+ react_core_path_quoted = '"' + react_core_path + '"'
53+ if header_search_paths.is_a?(Array)
54+ unless header_search_paths.any? { |path| path.include?('React-Core') }
55+ header_search_paths << react_core_path_quoted
56+ end
57+ elsif header_search_paths.is_a?(String)
58+ unless header_search_paths.include?('React-Core')
59+ config.build_settings['HEADER_SEARCH_PATHS'] = [header_search_paths, react_core_path_quoted]
60+ end
61+ else
62+ config.build_settings['HEADER_SEARCH_PATHS'] = ['$(inherited)', react_core_path_quoted]
63+ end
64+ end
65+ end
66+ end
67+
2968end` ;
3069
3170module . exports = {
0 commit comments