Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup #69

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/CampusApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export default function CampusApp() {
const manualSetting = await AsyncStorage.getItem(
'manualDarkMode'
);
setOverrideSystemScheme(override === 'true' ? true : false);
setOverrideSystemScheme(override === 'true');
if (override !== null) {
setManualDarkMode(manualSetting === 'true' ? true : false);
setManualDarkMode(manualSetting === 'true');
}

if (override === 'true') {
Expand Down
19 changes: 11 additions & 8 deletions js/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,9 @@ export default function Navigator() {

const tabBarLabel = (title, { focused }) => {
const style = {
color: focused
? colorContext.colorScheme.dhbwRed
: colorContext.colorScheme.tabBarText,
color: getFocusedColor(focused),
};

if (Platform.isPad) {
// on iPad, tab bar labels are places beside icon: add some margin
style.marginLeft = 20;
Expand All @@ -269,6 +268,7 @@ export default function Navigator() {
// to prevent line breaks in "Vorlesungen"
style.fontSize = PixelRatio.get() <= 2 ? 8 : 10;
}

return <Text style={style}>{title}</Text>;
};

Expand All @@ -277,15 +277,18 @@ export default function Navigator() {
<FontAwesome6
name={icon}
size={28}
color={
focused
? colorContext.colorScheme.dhbwRed
: colorContext.colorScheme.tabBarText
}
color={getFocusedColor(focused)}
/>
);
};

const getFocusedColor = (focused) => {
return focused
? colorContext.colorScheme.dhbwRed
: colorContext.colorScheme.tabBarText

};

const tabsConfig = () => ({
headerShown: false,
tabBarStyle: {
Expand Down