🩹 Fix #18: Give title to Move forms

pull/20/head
Alexis Drai 2 years ago
parent 04aab430fc
commit 19e32ec348

@ -1,6 +1,6 @@
// screens/moves/MoveFormScreen.tsx
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { Button, StyleSheet, Text, TextInput } from 'react-native';
import { StackNavigationProp } from '@react-navigation/stack';
import { RootStackParamList } from "../../navigation/navigationTypes";
@ -44,6 +44,12 @@ const MoveFormScreen = ({ navigation, route }: Props) => {
schemaVersion: 2
});
useEffect(() => {
navigation.setOptions({
title: route.params?.move ? route.params.move.name : 'New move',
});
}, [navigation, route.params?.move]);
const [selectedWeakAgainst, setSelectedWeakAgainst] = useState<string[]>(move.type.weakAgainst);
const [selectedEffectiveAgainst, setSelectedEffectiveAgainst] = useState<string[]>(move.type.effectiveAgainst);

Loading…
Cancel
Save