Last active
October 5, 2019 09:01
-
-
Save lukebrandonfarrell/a8ab3e7756b1ac62ad2b7cc8ff355294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "DarkMode.h" | |
#import <React/RCTLog.h> | |
@implementation DarkMode | |
RCT_EXPORT_MODULE(); | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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