display the correct default value for the keep daemon running option

This commit is contained in:
Akinwale Ariwodola 2018-05-19 21:10:27 +01:00
parent ceeef6324e
commit 0cd33ddada

View file

@ -16,7 +16,10 @@ class SettingsPage extends React.PureComponent {
showNsfw, showNsfw,
setClientSetting setClientSetting
} = this.props; } = this.props;
// If no true / false value set, default to true
const actualKeepDaemonRunning = (keepDaemonRunning === undefined || keepDaemonRunning === null) ? true : keepDaemonRunning;
return ( return (
<View> <View>
<PageHeader title={"Settings"} <PageHeader title={"Settings"}
@ -47,7 +50,7 @@ class SettingsPage extends React.PureComponent {
<Text style={settingsStyle.description}>Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.</Text> <Text style={settingsStyle.description}>Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.</Text>
</View> </View>
<View style={settingsStyle.switchContainer}> <View style={settingsStyle.switchContainer}>
<Switch value={keepDaemonRunning} onValueChange={(value) => setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value)} /> <Switch value={actualKeepDaemonRunning} onValueChange={(value) => setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value)} />
</View> </View>
</View> </View>
</ScrollView> </ScrollView>