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 MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import type {PlanexGroupType} from '../../../screens/Planex/GroupSelectionScreen';
|
import type {PlanexGroupType} from '../../../screens/Planex/GroupSelectionScreen';
|
||||||
import {View} from 'react-native';
|
import {View} from 'react-native';
|
||||||
|
import {getPrettierPlanexGroupName} from '../../../utils/Utils';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
theme: ReactNativePaper.Theme;
|
theme: ReactNativePaper.Theme;
|
||||||
|
@ -33,8 +34,6 @@ type PropsType = {
|
||||||
height: number;
|
height: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const REPLACE_REGEX = /_/g;
|
|
||||||
|
|
||||||
class GroupListItem extends React.Component<PropsType> {
|
class GroupListItem extends React.Component<PropsType> {
|
||||||
isFav: boolean;
|
isFav: boolean;
|
||||||
|
|
||||||
|
@ -86,7 +85,7 @@ class GroupListItem extends React.Component<PropsType> {
|
||||||
const {colors} = props.theme;
|
const {colors} = props.theme;
|
||||||
return (
|
return (
|
||||||
<List.Item
|
<List.Item
|
||||||
title={props.item.name.replace(REPLACE_REGEX, ' ')}
|
title={getPrettierPlanexGroupName(props.item.name)}
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
left={(iconProps) => (
|
left={(iconProps) => (
|
||||||
<List.Icon
|
<List.Icon
|
||||||
|
|
|
@ -37,6 +37,7 @@ import ErrorView from '../../components/Screens/ErrorView';
|
||||||
import type {PlanexGroupType} from './GroupSelectionScreen';
|
import type {PlanexGroupType} from './GroupSelectionScreen';
|
||||||
import {MASCOT_STYLE} from '../../components/Mascot/Mascot';
|
import {MASCOT_STYLE} from '../../components/Mascot/Mascot';
|
||||||
import MascotPopup from '../../components/Mascot/MascotPopup';
|
import MascotPopup from '../../components/Mascot/MascotPopup';
|
||||||
|
import {getPrettierPlanexGroupName} from '../../utils/Utils';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
navigation: StackNavigationProp<any>;
|
navigation: StackNavigationProp<any>;
|
||||||
|
@ -162,7 +163,9 @@ class PlanexScreen extends React.Component<PropsType, StateType> {
|
||||||
currentGroup = {name: 'SELECT GROUP', id: -1};
|
currentGroup = {name: 'SELECT GROUP', id: -1};
|
||||||
} else {
|
} else {
|
||||||
currentGroup = JSON.parse(currentGroupString);
|
currentGroup = JSON.parse(currentGroupString);
|
||||||
props.navigation.setOptions({title: currentGroup.name});
|
props.navigation.setOptions({
|
||||||
|
title: getPrettierPlanexGroupName(currentGroup.name),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.state = {
|
this.state = {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
@ -348,7 +351,7 @@ class PlanexScreen extends React.Component<PropsType, StateType> {
|
||||||
AsyncStorageManager.PREFERENCES.planexCurrentGroup.key,
|
AsyncStorageManager.PREFERENCES.planexCurrentGroup.key,
|
||||||
group,
|
group,
|
||||||
);
|
);
|
||||||
navigation.setOptions({title: group.name});
|
navigation.setOptions({title: getPrettierPlanexGroupName(group.name)});
|
||||||
this.generateInjectedJS(group.id);
|
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