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

Switched the CheckboxInput component to use Checkbox.Item to stay mor… #56

Merged
merged 4 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/components/checkBox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { memo } from 'react';
import { View, StyleSheet } from 'react-native';
import { Checkbox, Text } from 'react-native-paper';
import { Checkbox } from 'react-native-paper';
import type { PaperSelectCheckboxProps } from 'src/interface/checkbox.interface';

interface CheckboxPropsFull extends PaperSelectCheckboxProps {
Expand All @@ -14,14 +14,18 @@ const CheckboxInput = ({
checkboxColor,
checkboxLabelStyle,
checkboxUncheckedColor,
checkboxMode,
}: CheckboxPropsFull) => (
<View style={styles.container}>
<Checkbox
<Checkbox.Item
uncheckedColor={checkboxUncheckedColor || '#000007'}
color={checkboxColor || 'blue'}
status={isChecked === true ? 'checked' : 'unchecked'}
label={label.trim()}
labelStyle={checkboxLabelStyle}
mode={checkboxMode}
position={`leading`}
/>
<Text style={[styles.labelStyle, checkboxLabelStyle]}>{label.trim()}</Text>
</View>
);

Expand All @@ -32,10 +36,6 @@ const styles = StyleSheet.create({
flex: 1,
marginBottom: 1.5,
himrocks33 marked this conversation as resolved.
Show resolved Hide resolved
},
labelStyle: {
flexDirection: 'row',
flexShrink: 1,
},
});

export default memo(CheckboxInput);
1 change: 1 addition & 0 deletions src/interface/checkbox.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export interface PaperSelectCheckboxProps {
checkboxColor?: string;
checkboxUncheckedColor?: string;
checkboxLabelStyle?: TextStyle;
checkboxMode?: 'android' | 'ios';
}