Skip to content

Commit

Permalink
fix settings race condition on react native
Browse files Browse the repository at this point in the history
  • Loading branch information
teticio committed Oct 1, 2021
1 parent c2cad84 commit f9c7406
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/App.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Linking, SafeAreaView } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { View, ScrollView } from './Platform';
import { getHashParams, usePersistedState, VerticalSpacer } from './Lib';
import { getHashParams, usePersistedState } from './Lib';
import { getRoutes } from './Menu';
import Banner from './Banner';
import Spotify from './Spotify';
Expand Down
14 changes: 7 additions & 7 deletions src/components/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const getRoutes = (
waypoints, setWaypoints,
size, setSize,
creativity, setCreativity,
noise, setNoise,
noise, setNoise,
playlist, setPlaylist,
spotify, navigate, numPlaylists
) => {
Expand All @@ -27,12 +27,12 @@ export const getRoutes = (
noise: noise,
spotify: spotify,
onCreate: (playlist, waypoints) => {
setWaypoints(waypoints);
setPlaylist(playlist);
setWaypoints(() => waypoints);
setPlaylist(() => playlist);
navigate('/playlist');
},
onSettings: waypoints => {
setWaypoints(waypoints);
setWaypoints(() => waypoints);
navigate('/settings');
}
},
Expand All @@ -51,9 +51,9 @@ export const getRoutes = (
creativity: creativity,
noise: noise,
onChange: (size, creativity, noise) => {
setSize(size !== '' ? size : 0);
setCreativity(creativity);
setNoise(noise);
setSize(() => { return size !== '' ? size : 0; });
setCreativity(() => creativity);
setNoise(() => noise);
},
onClose: () => navigate('/')
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/ShowPlaylists.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function ShowPlaylists({ playlists, spotify = null, header = null
<FlatList
initialNumToRender={1}
maxToRenderPerBatch={1}
updateCellsBatchingPeriod={60000}
updateCellsBatchingPeriod={5000}
ListHeaderComponent={header ? header : null}
data={data}
renderItem={renderItem}
Expand Down

0 comments on commit f9c7406

Please sign in to comment.