Skip to content

Commit

Permalink
[DEV] Added disabled prop to ButtonSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
procivisAG committed Sep 17, 2024
1 parent 32cc97d commit 72483e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@procivis/one-react-native-components",
"version": "0.1.37",
"version": "0.1.38",
"author": "Procivis AG (https://procivis.ch)",
"license": "Apache-2.0",
"description": "Common Procivis ONE UI components for react-native",
Expand Down
18 changes: 16 additions & 2 deletions src/settings/button-setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@ import SettingItem from './setting-item';

export type ButtonSettingProps = {
accessory?: ComponentType<any> | ReactElement;
disabled?: boolean;
icon?: ComponentType<any> | ReactElement;
onPress: () => void;
style?: StyleProp<ViewStyle>;
testID?: string;
title: string;
};

const ButtonSetting: FunctionComponent<ButtonSettingProps> = ({ accessory, title, onPress, icon, style, testID }) => {
const ButtonSetting: FunctionComponent<ButtonSettingProps> = ({
accessory,
disabled,
title,
onPress,
icon,
style,
testID,
}) => {
const colorScheme = useAppColorScheme();

const accessoryView: React.ReactElement | undefined = useMemo(() => {
Expand All @@ -35,7 +44,12 @@ const ButtonSetting: FunctionComponent<ButtonSettingProps> = ({ accessory, title
}, [accessory, colorScheme.text]);

return (
<TouchableOpacity accessibilityRole="button" onPress={onPress} style={styles.container} testID={testID}>
<TouchableOpacity
disabled={disabled}
accessibilityRole="button"
onPress={onPress}
style={styles.container}
testID={testID}>
<SettingItem icon={icon} style={style} title={title}>
{accessoryView}
</SettingItem>
Expand Down

0 comments on commit 72483e2

Please sign in to comment.