diff --git a/src/components/Lists/PlanexGroups/GroupListItem.tsx b/src/components/Lists/PlanexGroups/GroupListItem.tsx index 07a7af3..497bd51 100644 --- a/src/components/Lists/PlanexGroups/GroupListItem.tsx +++ b/src/components/Lists/PlanexGroups/GroupListItem.tsx @@ -23,6 +23,7 @@ import * as Animatable from 'react-native-animatable'; import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; import type {PlanexGroupType} from '../../../screens/Planex/GroupSelectionScreen'; import {View} from 'react-native'; +import {getPrettierPlanexGroupName} from '../../../utils/Utils'; type PropsType = { theme: ReactNativePaper.Theme; @@ -33,8 +34,6 @@ type PropsType = { height: number; }; -const REPLACE_REGEX = /_/g; - class GroupListItem extends React.Component { isFav: boolean; @@ -86,7 +85,7 @@ class GroupListItem extends React.Component { const {colors} = props.theme; return ( ( ; @@ -162,7 +163,9 @@ class PlanexScreen extends React.Component { currentGroup = {name: 'SELECT GROUP', id: -1}; } else { currentGroup = JSON.parse(currentGroupString); - props.navigation.setOptions({title: currentGroup.name}); + props.navigation.setOptions({ + title: getPrettierPlanexGroupName(currentGroup.name), + }); } this.state = { dialogVisible: false, @@ -348,7 +351,7 @@ class PlanexScreen extends React.Component { AsyncStorageManager.PREFERENCES.planexCurrentGroup.key, group, ); - navigation.setOptions({title: group.name}); + navigation.setOptions({title: getPrettierPlanexGroupName(group.name)}); this.generateInjectedJS(group.id); } diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index b0c7c13..301e2e1 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -37,3 +37,9 @@ export function setupStatusBar() { ); } } + +const REPLACE_REGEX = /_/g; + +export function getPrettierPlanexGroupName(name: string) { + return name.replace(REPLACE_REGEX, ' '); +}