Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lukebrandonfarrell
Last active October 5, 2019 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukebrandonfarrell/a8ab3e7756b1ac62ad2b7cc8ff355294 to your computer and use it in GitHub Desktop.
Save lukebrandonfarrell/a8ab3e7756b1ac62ad2b7cc8ff355294 to your computer and use it in GitHub Desktop.
#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