-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdcf683
commit 5f2edfb
Showing
29 changed files
with
262 additions
and
259 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
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 +1,2 @@ | ||
export {default as useTheme} from './useThemeColors'; | ||
import {default as useTheme} from './useThemeColors'; | ||
export {useTheme}; |
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,66 +1,100 @@ | ||
import React, {useContext} from 'react'; | ||
import {useTheme} from './index'; | ||
import {StatusBar, StatusBarProps, Platform} from 'react-native'; | ||
//import SystemNavigationBar from 'react-native-system-navigation-bar'; | ||
type ParamProps = { | ||
inverse?: boolean; | ||
import changeNavigationBarColor from 'react-native-navigation-bar-color'; | ||
|
||
type ThemeColors = { | ||
primary: string; | ||
secondary: string; | ||
background: string; | ||
card: string; | ||
text: string; | ||
border: string; | ||
}; | ||
|
||
interface ScreenNavProp { | ||
routeName?: any; | ||
colors?: any; | ||
theme?: any; | ||
translucent?: boolean; | ||
statusColor?: string; | ||
statusBaseLight?: boolean; | ||
isBarLight?: boolean; | ||
navColor?: string; | ||
navBaseLight?: boolean; | ||
}; | ||
isNavLight?: boolean; | ||
} | ||
|
||
const styleLight = 'light-content'; | ||
const styleDark = 'dark-content'; | ||
const inverseColor = 'transparent'; | ||
const blackColor = 'black'; | ||
interface StatusNavProp { | ||
defaultColor: any; | ||
defaultTheme: any; | ||
translucent?: boolean; | ||
statusColor?: string; | ||
isBarLight?: boolean; | ||
navColor?: string; | ||
isNavLight?: boolean; | ||
} | ||
|
||
class StatusNav { | ||
static setScreenNav = (params?: ScreenNavProp) => { | ||
const defaultColor = params?.colors as ThemeColors; | ||
const defaultTheme = params?.theme; | ||
if ( | ||
params?.routeName === 'AcquireARScreen' || | ||
params?.routeName === 'AcquireScreen' | ||
) { | ||
StatusNav.setStatusNav({ | ||
defaultColor: defaultColor, | ||
defaultTheme: defaultTheme, | ||
translucent: true, | ||
}); | ||
} else if (params?.routeName === 'AuthenticationScreen') { | ||
StatusNav.setStatusNav({ | ||
defaultColor: defaultColor, | ||
defaultTheme: defaultTheme, | ||
statusColor: defaultColor.primary, | ||
navColor: defaultColor.card, | ||
}); | ||
} else if (params?.routeName === 'HomeScreen') { | ||
StatusNav.setStatusNav({ | ||
defaultColor: defaultColor, | ||
defaultTheme: defaultTheme, | ||
}); | ||
} | ||
}; | ||
|
||
const useStatusNav = (params: ParamProps) => { | ||
const {theme, colors} = useTheme(); | ||
const baseColor = colors.card; | ||
const themeIsLight = theme === 'light'; | ||
static setStatusNav = (params?: StatusNavProp) => { | ||
const styleLight = 'light-content'; | ||
const styleDark = 'dark-content'; | ||
const translucentColor = 'translucent'; | ||
const blackColor = 'black'; | ||
|
||
let navColor = params?.navColor === undefined ? baseColor : blackColor; | ||
let navStyle = params?.navBaseLight ? true : false; | ||
const colors = params?.defaultColor; | ||
const theme = params?.defaultTheme; | ||
|
||
let barColor = | ||
params?.statusColor === undefined ? baseColor : params.statusColor; | ||
const baseColor = colors.card; | ||
const themeIsLight = theme === 'light'; | ||
var navStyle = params?.isNavLight ? params.isNavLight : themeIsLight; | ||
var barStyle = params?.isBarLight ? params.isBarLight : themeIsLight; | ||
const barStyleType = { | ||
styleType: barStyle ? styleDark : styleLight, | ||
}; | ||
|
||
let baseLight = | ||
params?.statusBaseLight === undefined | ||
? themeIsLight | ||
: params.statusBaseLight; | ||
var navColor = | ||
params?.navColor === undefined ? baseColor : params?.navColor; | ||
var barColor = | ||
params?.statusColor === undefined ? baseColor : params?.statusColor; | ||
|
||
const defaultNav = () => { | ||
console.log('>>>>>>>> DEFAULT' + theme); | ||
//const currStatusStyle = baseLight ? styleDark : styleLight; | ||
//navStyle = baseLight ? true : false; | ||
// StatusBar.setTranslucent(false); | ||
//StatusBar.setBarStyle(currStatusStyle); | ||
StatusBar.setBackgroundColor(baseColor); | ||
if (Platform.OS === 'android') { | ||
// SystemNavigationBar.setNavigationColor(baseColor, !themeIsLight); | ||
if (params?.translucent) { | ||
navColor = translucentColor; | ||
navStyle = false; | ||
barStyleType.styleType = styleLight; | ||
//StatusBar.setTranslucent(true); | ||
StatusBar.setBackgroundColor('rgba(0,0,0,0.4)'); | ||
} else { | ||
StatusBar.setTranslucent(false); | ||
StatusBar.setBackgroundColor(barColor); | ||
} | ||
}; | ||
const translucentNav = () => { | ||
console.log('hree'); | ||
|
||
StatusBar.setBarStyle(barStyleType.styleType as any); | ||
if (Platform.OS === 'android') { | ||
//SystemNavigationBar.fullScreen(true); | ||
//const result = SystemNavigationBar.setNavigationColor( | ||
// 'hsla(110, 56%, 49%, 0.5)', | ||
// !themeIsLight, | ||
// ); | ||
changeNavigationBarColor(navColor, navStyle, false); | ||
} | ||
//StatusBar.setBackgroundColor('rgba(0,0,0,0.2)'); | ||
}; | ||
const leanBackNav = () => {}; | ||
|
||
React.useEffect(() => { | ||
defaultNav(); | ||
}, []); | ||
|
||
return {defaultNav, translucentNav, leanBackNav}; | ||
}; | ||
|
||
export default useStatusNav; | ||
} | ||
export default StatusNav; |
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
Oops, something went wrong.