-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auto-dark): Month Picker Auto Dark Mode (iOS) (#18)
* feat(auto-dark): Month Picker Auto Dark Mode (iOS)
- Loading branch information
Showing
13 changed files
with
660 additions
and
496 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// | ||
// RNDarkMode.h | ||
// RNMonthPicker | ||
// | ||
// Created by Gustavo Paris on 15/06/2020. | ||
// Copyright © 2020 Facebook. All rights reserved. | ||
// | ||
#import <React/RCTBridgeModule.h> | ||
|
||
@interface RNDarkModeManager : NSObject <RCTBridgeModule> | ||
@end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// RNDarkMode.m | ||
// RNMonthPicker | ||
// | ||
// Created by Gustavo Paris on 15/06/2020. | ||
// Copyright © 2020 Facebook. All rights reserved. | ||
// | ||
#import "RNDarkMode.h" | ||
#import <React/RCTLog.h> | ||
|
||
@implementation RNDarkModeManager | ||
|
||
RCT_EXPORT_MODULE(); | ||
|
||
RCT_EXPORT_METHOD(isDarkMode:(RCTResponseSenderBlock)callback) { | ||
NSNumber* isDark = [NSNumber numberWithBool:false]; | ||
if (@available(iOS 13.0, *)) { | ||
if (UITraitCollection.currentTraitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { | ||
isDark = [NSNumber numberWithBool:true]; | ||
} | ||
} | ||
callback(@[[NSNull null], isDark]); | ||
} | ||
|
||
@end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import MonthPicker from './MonthPicker'; | ||
|
||
export const ACTION_DATE_SET = 'dateSetAction'; | ||
export const ACTION_DISMISSED = 'dismissedAction'; | ||
export { ACTION_DATE_SET, ACTION_DISMISSED } from './utils'; | ||
|
||
export default MonthPicker; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Platform } from 'react-native'; | ||
|
||
export const ACTION_DATE_SET = 'dateSetAction'; | ||
export const ACTION_DISMISSED = 'dismissedAction'; | ||
|
||
const theme = { | ||
ios: { | ||
dark: { | ||
container: { backgroundColor: '#636366' }, | ||
cancelButton: { color: '#f2f2f2' }, | ||
okButton: { color: '#0a84ff' }, | ||
}, | ||
light: { | ||
container: { backgroundColor: '#f2f2f2' }, | ||
cancelButton: { color: '#636366' }, | ||
okButton: { color: '#007aff' }, | ||
}, | ||
}, | ||
}; | ||
|
||
export const useTheme = (isDarkMode) => | ||
theme[Platform.OS][isDarkMode ? 'dark' : 'light']; |
Oops, something went wrong.