Application Android et IOS pour l'amicale des élèves
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GameStartScreen.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // @flow
  2. import * as React from "react";
  3. import {StackNavigationProp} from "@react-navigation/stack";
  4. import type {CustomTheme} from "../../../managers/ThemeManager";
  5. import {Button, Headline, withTheme} from "react-native-paper";
  6. import {View} from "react-native";
  7. import i18n from "i18n-js";
  8. import {MASCOT_STYLE} from "../../../components/Mascot/Mascot";
  9. import MascotPopup from "../../../components/Mascot/MascotPopup";
  10. import AsyncStorageManager from "../../../managers/AsyncStorageManager";
  11. type Props = {
  12. navigation: StackNavigationProp,
  13. theme: CustomTheme,
  14. }
  15. type State = {
  16. mascotDialogVisible: boolean,
  17. }
  18. class GameStartScreen extends React.Component<Props, State> {
  19. state = {
  20. mascotDialogVisible: AsyncStorageManager.getInstance().preferences.gameStartShowBanner.current === "1",
  21. }
  22. hideMascotDialog = () => {
  23. AsyncStorageManager.getInstance().savePref(
  24. AsyncStorageManager.getInstance().preferences.gameStartShowBanner.key,
  25. '0'
  26. );
  27. this.setState({mascotDialogVisible: false})
  28. };
  29. render() {
  30. return (
  31. <View style={{flex: 1}}>
  32. <Headline style={{textAlign: "center"}}>Coucou</Headline>
  33. <Button
  34. mode={"contained"}
  35. onPress={() => this.props.navigation.navigate("game-main")}
  36. >
  37. PLAY
  38. </Button>
  39. <MascotPopup
  40. visible={this.state.mascotDialogVisible}
  41. title={i18n.t("screens.game.mascotDialog.title")}
  42. message={i18n.t("screens.game.mascotDialog.message")}
  43. icon={"gamepad-variant"}
  44. buttons={{
  45. action: null,
  46. cancel: {
  47. message: i18n.t("screens.game.mascotDialog.button"),
  48. icon: "check",
  49. onPress: this.hideMascotDialog,
  50. }
  51. }}
  52. emotion={MASCOT_STYLE.COOL}
  53. />
  54. </View>
  55. );
  56. }
  57. }
  58. export default withTheme(GameStartScreen);