Skip to content

Commit

Permalink
fix(Radio): 调整Radio明暗主题
Browse files Browse the repository at this point in the history
  • Loading branch information
panbibi committed Apr 8, 2023
1 parent 32ace39 commit 0733cf9
Showing 1 changed file with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions packages/core/src/Radio/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,34 @@ function MaybeTextOrView({ children, ...otherProps }: MaybeTextOrViewProps & Tex
return <View {...otherProps}>{children}</View>;
}

const styles = StyleSheet.create({
defalut: {},
checkBg: {
borderRadius: 999,
borderColor: 'rgb(189, 193, 204)',
borderWidth: 1,
justifyContent: 'center',
alignItems: 'center',
},
check: {
borderRadius: 999,
backgroundColor: '#4DD964',
},
touch: {
flexDirection: 'row',
alignItems: 'center',
},
label: {
marginLeft: 6,
},
});
type CreStyle = {
textColor: string;
};

function createStyles({ textColor }: CreStyle) {
return StyleSheet.create({
defalut: {},
checkBg: {
borderRadius: 999,
borderColor: 'rgb(189, 193, 204)',
borderWidth: 1,
justifyContent: 'center',
alignItems: 'center',
},
check: {
borderRadius: 999,
backgroundColor: '#4DD964',
},
touch: {
flexDirection: 'row',
alignItems: 'center',
},
label: {
marginLeft: 6,
color: textColor,
},
});
}

export interface RadioProps extends ViewProps {
checked?: boolean;
Expand All @@ -64,6 +71,9 @@ export interface RadioState {

export default function Radio(props: RadioProps) {
const theme = useTheme<Theme>();
const styles = createStyles({
textColor: theme.colors.primary_text || '#ccc',
});
const [state, setState] = useState({
checked: props.checked,
sizeValue: new Animated.Value(0),
Expand Down

0 comments on commit 0733cf9

Please sign in to comment.