Make planex title prettier
This commit is contained in:
parent
5d65d72418
commit
d42c719cf1
3 changed files with 13 additions and 5 deletions
|
@ -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<PropsType> {
|
||||
isFav: boolean;
|
||||
|
||||
|
@ -86,7 +85,7 @@ class GroupListItem extends React.Component<PropsType> {
|
|||
const {colors} = props.theme;
|
||||
return (
|
||||
<List.Item
|
||||
title={props.item.name.replace(REPLACE_REGEX, ' ')}
|
||||
title={getPrettierPlanexGroupName(props.item.name)}
|
||||
onPress={props.onPress}
|
||||
left={(iconProps) => (
|
||||
<List.Icon
|
||||
|
|
|
@ -37,6 +37,7 @@ import ErrorView from '../../components/Screens/ErrorView';
|
|||
import type {PlanexGroupType} from './GroupSelectionScreen';
|
||||
import {MASCOT_STYLE} from '../../components/Mascot/Mascot';
|
||||
import MascotPopup from '../../components/Mascot/MascotPopup';
|
||||
import {getPrettierPlanexGroupName} from '../../utils/Utils';
|
||||
|
||||
type PropsType = {
|
||||
navigation: StackNavigationProp<any>;
|
||||
|
@ -162,7 +163,9 @@ class PlanexScreen extends React.Component<PropsType, StateType> {
|
|||
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<PropsType, StateType> {
|
|||
AsyncStorageManager.PREFERENCES.planexCurrentGroup.key,
|
||||
group,
|
||||
);
|
||||
navigation.setOptions({title: group.name});
|
||||
navigation.setOptions({title: getPrettierPlanexGroupName(group.name)});
|
||||
this.generateInjectedJS(group.id);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,3 +37,9 @@ export function setupStatusBar() {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
const REPLACE_REGEX = /_/g;
|
||||
|
||||
export function getPrettierPlanexGroupName(name: string) {
|
||||
return name.replace(REPLACE_REGEX, ' ');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue