passing directly PlayView view function to the react screen to solve loss of state issues

This commit is contained in:
Clément Le Bihan
2023-02-23 22:52:37 +01:00
parent 054913952e
commit 67a03f196e
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ export const protectedRoutes = <>
<Stack.Screen name="Home" component={HomeView} options={{ title: translate('welcome') }} />
<Stack.Screen name="Settings" component={SetttingsNavigator} options={{ title: 'Settings' }} />
<Stack.Screen name="Song" component={SongLobbyView} options={{ title: translate('play') }} />
<Stack.Screen name="Play" component={() => PlayView({ songId: 1 })} options={{ title: translate('play') }} />
<Stack.Screen name="Play" component={PlayView} options={{ title: translate('play') }} />
<Stack.Screen name="Score" component={ScoreView} options={{ title: translate('score') }} />
<Stack.Screen name="Search" component={SearchView} options={{ title: translate('search') }} />
<Stack.Screen name="User" component={ProfileView} options={{ title: translate('user') }} />
+2 -1
View File
@@ -29,7 +29,8 @@ if (process.env.NODE_ENV != 'development' && Platform.OS === 'web') {
}
}
const PlayView = ({ songId }: PlayViewProps) => {
const PlayView = () => {
const songId = 1;
const navigation = useNavigation();
const queryClient = useQueryClient();
const song = useQuery(['song', songId], () => API.getSong(songId));