mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-25 12:55:41 +08:00
Implemented thread control for exported methods
This commit is contained in:
@@ -29,31 +29,25 @@ RCT_EXPORT_MODULE()
|
||||
RCT_EXPORT_METHOD(setStyle:(UIStatusBarStyle)statusBarStyle
|
||||
animated:(BOOL)animated)
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
if (RCTViewControllerBasedStatusBarAppearance()) {
|
||||
RCTLogError(@"RCTStatusBarManager module requires that the \
|
||||
UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO");
|
||||
} else {
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:statusBarStyle
|
||||
animated:animated];
|
||||
}
|
||||
});
|
||||
if (RCTViewControllerBasedStatusBarAppearance()) {
|
||||
RCTLogError(@"RCTStatusBarManager module requires that the \
|
||||
UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO");
|
||||
} else {
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:statusBarStyle
|
||||
animated:animated];
|
||||
}
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setHidden:(BOOL)hidden
|
||||
withAnimation:(UIStatusBarAnimation)animation)
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
if (RCTViewControllerBasedStatusBarAppearance()) {
|
||||
RCTLogError(@"RCTStatusBarManager module requires that the \
|
||||
UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO");
|
||||
} else {
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:hidden
|
||||
withAnimation:animation];
|
||||
}
|
||||
});
|
||||
if (RCTViewControllerBasedStatusBarAppearance()) {
|
||||
RCTLogError(@"RCTStatusBarManager module requires that the \
|
||||
UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO");
|
||||
} else {
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:hidden
|
||||
withAnimation:animation];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSDictionary *)constantsToExport
|
||||
|
||||
Reference in New Issue
Block a user