Wednesday, October 28, 2026
HomeiOS DevelopmentReact Native - IOS ScreenRecordingListener Native Module error: Bridge will not be...

React Native – IOS ScreenRecordingListener Native Module error: Bridge will not be set

[ad_1]

I’ve created a module for listening when a display report occasion is trigered however I preserve getting this error: Bridge will not be set. That is most likely since you’ve explicitly synthesized the bridge in ScreenCaptureNotification, despite the fact that it is inherited from RCTEventEmitter.’

That is my header file: ScreenRecordingNotification.h

#import <React/RCTBridgeModule.h>
#import <React/RCTBridgeDelegate.h>
#import <React/RCTEventEmitter.h>

#ifndef ScreenCaptureNotification_h
#outline ScreenCaptureNotification_h

@interface ScreenCaptureNotification : RCTEventEmitter <RCTBridgeModule>
-(void) isScreenCaptureEnabled:(BOOL)isCaptured;
@finish

#endif

and my Goal-c file: ScreenCaptureNotification.m

#import "ScreenRecordingNotification.h"

#import <Basis/Basis.h>

#import <React/RCTLog.h>

@implementation ScreenCaptureNotification

+ (id)allocWithZone:(NSZone *)zone {
  static ScreenCaptureNotification *sharedInstance = nil;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    sharedInstance = [super allocWithZone:zone];
  });
  return sharedInstance;
}

RCT_EXPORT_MODULE();

- (NSArray<NSString *> *)supportedEvents {
  return @[@"isScreenCaptureEnabled"];
}

-(void) isScreenCaptureEnabled:(BOOL)isCaptured {
  [self sendEventWithName:@"isScreenCaptureEnabled" body:@{@"value": @(isCaptured)}];
}

@finish

Lastly I take advantage of the module on AppDelegate.m

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
    if ([keyPath isEqualToString:@"captured"]){
      NSLog(@"Display screen Seize is Enabled");
      RCTLog(@"Display screen Seize is Enabled");
      if (@accessible(iOS 11.0, *)) {
        ScreenCaptureNotification *supervisor = [ScreenCaptureNotification allocWithZone: nil];
        [manager isScreenCaptureEnabled:true];
        
        
      }
    }
}

This code relies on this submit’s reply stop display seize react-native

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments