Use transparent header for game

This commit is contained in:
Arnaud Vergnet 2020-08-07 14:00:21 +02:00
parent a3ce3a76c3
commit 92603cbaf7
2 changed files with 19 additions and 14 deletions

View file

@ -98,6 +98,9 @@ function MainStackComponent(props: {
MainStack, MainStack,
GameStartScreen, GameStartScreen,
i18n.t('screens.game.title'), i18n.t('screens.game.title'),
true,
null,
'transparent',
)} )}
<MainStack.Screen <MainStack.Screen
name="game-main" name="game-main"

View file

@ -384,22 +384,24 @@ class GameStartScreen extends React.Component<PropsType> {
recoverGameScore() { recoverGameScore() {
const {route} = this.props; const {route} = this.props;
this.gameStats = route.params; this.gameStats = route.params;
this.isHighScore = if (this.gameStats.score != null) {
this.scores.length === 0 || this.gameStats.score > this.scores[0]; this.isHighScore =
for (let i = 0; i < 3; i += 1) { this.scores.length === 0 || this.gameStats.score > this.scores[0];
if (this.scores.length > i && this.gameStats.score > this.scores[i]) { for (let i = 0; i < 3; i += 1) {
this.scores.splice(i, 0, this.gameStats.score); if (this.scores.length > i && this.gameStats.score > this.scores[i]) {
break; this.scores.splice(i, 0, this.gameStats.score);
} else if (this.scores.length <= i) { break;
this.scores.push(this.gameStats.score); } else if (this.scores.length <= i) {
break; this.scores.push(this.gameStats.score);
break;
}
} }
if (this.scores.length > 3) this.scores.splice(3, 1);
AsyncStorageManager.set(
AsyncStorageManager.PREFERENCES.gameScores.key,
this.scores,
);
} }
if (this.scores.length > 3) this.scores.splice(3, 1);
AsyncStorageManager.set(
AsyncStorageManager.PREFERENCES.gameScores.key,
this.scores,
);
} }
render(): React.Node { render(): React.Node {