Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile: Resolves #10883: Allow accurate value to be set for note history and trashed item TTL #11069

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

import { UpdateSettingValueCallback } from './types';
import { View, Text, TextInput } from 'react-native';
import { View, Text, TextInput, TouchableWithoutFeedback } from 'react-native';
import Setting, { AppType } from '@joplin/lib/models/Setting';
import Dropdown from '../../Dropdown';
import { ConfigScreenStyles } from './configScreenStyles';
Expand Down Expand Up @@ -90,6 +90,11 @@ const SettingComponent: React.FunctionComponent<Props> = props => {
const unitLabel = md.unitLabel ? md.unitLabel(props.value) : props.value;
const minimum = 'minimum' in md ? md.minimum : 0;
const maximum = 'maximum' in md ? md.maximum : 10;
const incrementValue = () => {
if (props.value < maximum) {
void props.updateSettingValue(props.settingId, props.value + 1);
}
};

// Note: Do NOT add the minimumTrackTintColor and maximumTrackTintColor props
// on the Slider as they are buggy and can crash the app on certain devices.
Expand All @@ -101,7 +106,12 @@ const SettingComponent: React.FunctionComponent<Props> = props => {
{md.label()}
</Text>
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', flex: 1 }}>
<Text style={styleSheet.sliderUnits}>{unitLabel}</Text>
<TouchableWithoutFeedback
accessibilityRole="button"
onPress={() => void incrementValue()}
>
<Text style={styleSheet.sliderUnits}>{unitLabel}</Text>
</TouchableWithoutFeedback>
<Slider
key="control"
style={{ flex: 1 }}
Expand Down
Loading