Calvin-Huang / react-native-device-brightness

Screen brightness adjustment tool for ReactNative iOS and Android.
MIT License
49 stars 57 forks source link

iOS 13 compatibility #26

Open adrianso opened 4 years ago

adrianso commented 4 years ago

Set brightness level in main thread.

bcalik commented 4 years ago

Will this ever be merged? @Calvin-Huang

cinnabarcaracal commented 4 years ago

In hopes of making this easier for others to track down, we started getting crash reports similar to this:

Last Exception Backtrace:
0   CoreFoundation                  0x1b7e84300 __exceptionPreprocess + 228 (NSException.m:199)
1   libobjc.A.dylib                 0x1b7b98c1c objc_exception_throw + 60 (objc-exception.mm:565)
2   CoreFoundation                  0x1b7d811f8 +[NSException raise:format:arguments:] + 100 (NSException.m:146)
3   Foundation                      0x1b81c5998 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 132 (NSException.m:231)
4   FrontBoardServices              0x1bd132c5c -[FBSSerialQueue assertOnQueue] + 236 (FBSSerialQueue.m:98)
5   FrontBoardServices              0x1bd0e5690 -[FBSSceneImpl updateClientSettings:withTransitionContext:] + 80 (FBSSceneImpl.m:190)
6   FrontBoardServices              0x1bd0e5914 -[FBSSceneImpl updateClientSettingsWithTransitionBlock:] + 160 (FBSSceneImpl.m:213)
7   FrontBoardServices              0x1bd0e5814 -[FBSSceneImpl updateClientSettingsWithBlock:] + 128 (FBSSceneImpl.m:203)
8   UIKitCore                       0x1bbb25a4c -[FBSScene(UIApp) updateUIClientSettingsWithBlock:] + 184 (FBSScene+UIApp.m:41)
9   UIKitCore                       0x1bbc2455c -[UIDevice _setBacklightLevel:] + 172 (UIDevice.m:935)
10  UIKitCore                       0x1bbc2f544 -[UIScreen setBrightness:] + 360 (UIScreen.m:2709)
11  AppName                     0x104368ec0 -[RNDeviceBrightness setBrightnessLevel:] + 68 (RNDeviceBrightness.m:17)
...

We were able to resolve the issue by switching to this PR:

// package.json
"react-native-device-brightness": "Calvin-Huang/react-native-device-brightness#26/head",

Given the introduction of autolinking and the iOS 13 issue, it would be nice if this could be merged.