Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#import "DarkMode.h"
#import <React/RCTLog.h>
@implementation DarkMode
RCT_EXPORT_MODULE();
@end
#import "DarkMode.h"
#import <React/RCTLog.h>
@implementation DarkMode
{
bool hasListeners;
}
// Will be called when this module's first listener is added.
-(void)startObserving {
hasListeners = YES;
// Set up any upstream listeners or background tasks as necessary
}
// Will be called when this module's last listener is removed, or on dealloc.
-(void)stopObserving {
hasListeners = NO;
// Remove upstream listeners, stop unnecessary background tasks
}
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(getDarkMode:())
{
}
- (NSArray<NSString *> *)supportedEvents
{
return @[@"ListenForDarkModeChanged"];
}
- (void)listenForDarkModeChanged:(BOOL *)darkMode
{
[self sendEventWithName:@"ListenForDarkModeChanged" body:darkMode];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.