一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
49 行
1.3 KiB
TypeScript
49 行
1.3 KiB
TypeScript
import * as React from 'react';
|
|
import { FunctionComponent, ReactNode } from 'react';
|
|
|
|
import { View, Text, Switch } from 'react-native';
|
|
import { UpdateSettingValueCallback } from './types';
|
|
import { themeStyle } from '@joplin/lib/theme';
|
|
import { ConfigScreenStyles } from './configScreenStyles';
|
|
|
|
interface Props {
|
|
settingId: string;
|
|
value: boolean;
|
|
|
|
themeId: number;
|
|
styles: ConfigScreenStyles;
|
|
|
|
label: string;
|
|
updateSettingValue: UpdateSettingValueCallback;
|
|
|
|
description?: ReactNode;
|
|
}
|
|
|
|
const SettingsToggle: FunctionComponent<Props> = props => {
|
|
const theme = themeStyle(props.themeId);
|
|
const styleSheet = props.styles.styleSheet;
|
|
|
|
const containerStyles = props.styles.getContainerStyle(!!props.description);
|
|
|
|
return (
|
|
<View style={containerStyles.outerContainer}>
|
|
<View style={containerStyles.innerContainer}>
|
|
<Text key="label" style={styleSheet.switchSettingText}>
|
|
{props.label}
|
|
</Text>
|
|
<Switch
|
|
key="control"
|
|
style={styleSheet.switchSettingControl}
|
|
trackColor={{ false: theme.dividerColor }}
|
|
value={props.value}
|
|
onValueChange={(value: boolean) => void props.updateSettingValue(props.settingId, value)}
|
|
accessibilityHint={props.label}
|
|
/>
|
|
</View>
|
|
{props.description}
|
|
</View>
|
|
);
|
|
};
|
|
|
|
export default SettingsToggle;
|