You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Better handling of settings
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { Component } from 'react';
|
||||
import { View, StyleSheet, Picker, Text, Button } from 'react-native';
|
||||
import { View, Switch, StyleSheet, Picker, Text, Button } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import { _, setLocale } from 'lib/locale.js';
|
||||
@@ -21,7 +21,7 @@ let styles = {
|
||||
color: globalStyle.color,
|
||||
},
|
||||
settingControl: {
|
||||
color: globalStyle.color,
|
||||
//color: globalStyle.color,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
|
||||
const value = this.state.values[key];
|
||||
|
||||
if (setting.type == 'enum') {
|
||||
if (setting.isEnum) {
|
||||
let items = [];
|
||||
const settingOptions = setting.options();
|
||||
for (let k in settingOptions) {
|
||||
@@ -80,7 +80,14 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
</Picker>
|
||||
</View>
|
||||
);
|
||||
} else {
|
||||
} else if (setting.type == Setting.TYPE_BOOL) {
|
||||
return (
|
||||
<View key={key} style={styles.settingContainer}>
|
||||
<Text key="label" style={styles.settingText}>{setting.label()}</Text>
|
||||
<Switch key="control" style={styles.settingControl} value={value} onValueChange={(value) => updateSettingValue(key, value)} />
|
||||
</View>
|
||||
);
|
||||
|
||||
//throw new Error('Unsupported setting type: ' + setting.type);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user