fix(mobile): auto-save watch directory on blur, not via Save button
The Save button is anchored to the Instance section near the top. Moving the auto_import_path write to onBlur on the field itself means the value is persisted as soon as the user leaves the input — no need to scroll up and hit Save.
This commit is contained in:
@@ -37,9 +37,6 @@ export default function SettingsScreen() {
|
|||||||
async function save() {
|
async function save() {
|
||||||
await setSetting(db, 'instance_url', instanceUrl.trim());
|
await setSetting(db, 'instance_url', instanceUrl.trim());
|
||||||
await setSetting(db, 'handle', handle.trim());
|
await setSetting(db, 'handle', handle.trim());
|
||||||
if (Platform.OS === 'android') {
|
|
||||||
await setSetting(db, 'auto_import_path', autoPath.trim());
|
|
||||||
}
|
|
||||||
setSaved(true);
|
setSaved(true);
|
||||||
setTimeout(() => setSaved(false), 2000);
|
setTimeout(() => setSaved(false), 2000);
|
||||||
}
|
}
|
||||||
@@ -173,11 +170,12 @@ export default function SettingsScreen() {
|
|||||||
placeholder="/sdcard/FitFiles"
|
placeholder="/sdcard/FitFiles"
|
||||||
value={autoPath}
|
value={autoPath}
|
||||||
onChangeText={setAutoPath}
|
onChangeText={setAutoPath}
|
||||||
|
onBlur={() => setSetting(db, 'auto_import_path', autoPath.trim())}
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
/>
|
/>
|
||||||
<Text style={styles.hint}>
|
<Text style={styles.hint}>
|
||||||
New FIT files in this directory are imported automatically in the
|
New FIT files in this directory are imported automatically when you
|
||||||
background. Leave blank to disable. Requires storage permission.
|
open the app. Leave blank to disable. Requires storage permission.
|
||||||
</Text>
|
</Text>
|
||||||
</Section>
|
</Section>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user