2023-07-18 15:58:06 +02:00
|
|
|
|
|
|
|
import * as React from 'react';
|
|
|
|
import { FunctionComponent, ReactNode } from 'react';
|
|
|
|
import { View, Text, Button } from 'react-native';
|
|
|
|
import { ConfigScreenStyles } from './configScreenStyles';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
title: string;
|
2023-11-09 21:19:08 +02:00
|
|
|
description?: string;
|
2023-07-18 15:58:06 +02:00
|
|
|
clickHandler: ()=> void;
|
|
|
|
styles: ConfigScreenStyles;
|
|
|
|
disabled?: boolean;
|
|
|
|
statusComponent?: ReactNode;
|
|
|
|
}
|
|
|
|
|
2023-11-09 21:19:08 +02:00
|
|
|
const SettingsButton: FunctionComponent<Props> = props => {
|
|
|
|
const styles = props.styles.styleSheet;
|
|
|
|
|
2023-07-18 15:58:06 +02:00
|
|
|
let descriptionComp = null;
|
|
|
|
if (props.description) {
|
|
|
|
descriptionComp = (
|
|
|
|
<View style={{ flex: 1, marginTop: 10 }}>
|
2023-11-09 21:19:08 +02:00
|
|
|
<Text style={styles.descriptionText}>{props.description}</Text>
|
2023-07-18 15:58:06 +02:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2023-11-09 21:19:08 +02:00
|
|
|
<View style={styles.settingContainer}>
|
2023-07-18 15:58:06 +02:00
|
|
|
<View style={{ flex: 1, flexDirection: 'column' }}>
|
|
|
|
<View style={{ flex: 1 }}>
|
|
|
|
<Button title={props.title} onPress={props.clickHandler} disabled={!!props.disabled} />
|
|
|
|
</View>
|
|
|
|
{props.statusComponent}
|
|
|
|
{descriptionComp}
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
2023-11-09 21:19:08 +02:00
|
|
|
export default SettingsButton;
|