''RCTBridgeModule.h' file not found when trying to bridge for react native

I am currently building a widget using widgetkit for my react native application. However, I keep getting RCTBridgeModule.h file not found. I created theese 3 files. Any ideas what I am missing

RCTMyProjectModule.m

#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>

@interface RCT_EXTERN_MODULE(MyProjectWidgetModule, NSObject)

RCT_EXTERN_METHOD(refreshAllWidgets)

@end

RCTMyProjectModule.h

#import <React/RCTBridgeModule.h>

MyProjectWidgetModule.swift

import Foundation
import WidgetKit

@objc(MyProjectWidgetModule)
class MyProjectWidgetModule: NSObject {
  
  @objc(refreshAllWidgets)
  func refreshAllWidgets() {
    if #available(iOS 14.0, *) {
      WidgetCenter.shared.reloadAllTimelines()
    }
  }
}

I'm getting the error on my RCTMyProjectModule.m file. Any ideas how I can fix this?



Solution 1:[1]

Search for your project bridging header file inside ios folder, it's look like ProjectName-Bridging-Header.h

Then add the followings imports to the end

// Headers React Native
#import <React/RCTBridgeModule.h>
#import <React/RCTViewManager.h>
#import <React/RCTBridge.h>
#import <React/RCTUIManager.h>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yan Brito