Skip to content

Commit

Permalink
Added containerStyle to RadioButton
Browse files Browse the repository at this point in the history
  • Loading branch information
ThakurBallary committed Feb 23, 2021
1 parent 96ba280 commit 43383db
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 23 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default function App() {
Key | Type | Required | Default | Valid Values
--- | --- | --- | --- | ---
color | string | no | #444 | css color formats
containerStyle | object | no | | react style
disabled | boolean | no | false | true / false
id | string | yes | | any string
label | string | no | | any string
Expand Down
21 changes: 3 additions & 18 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
import * as React from "react";

export interface RadioButtonProps {
color?: string;
disabled?: boolean;
id: string;
label?: string;
labelStyle?: object;
layout?: "row" | "column";
onPress?: (id: string) => void;
selected?: boolean;
size?: number;
value?: string;
}

export interface RadioGroupProps {
layout?: "row" | "column";
onPress?: (radioButtons: RadioButtonProps[]) => void;
radioButtons: RadioButtonProps[];
}
import { RadioGroupProps } from "./lib";

declare class RadioGroup extends React.Component<RadioGroupProps, any> {}

export * from "./lib/types";

export default RadioGroup;
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import RadioButtonsGroup from "./lib/RadioButtonsGroup";
import RadioButtonsGroup from "./lib";
export default RadioButtonsGroup;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { RadioButtonProps } from './types';

export default function RadioButton({
color = '#444',
containerStyle,
disabled = false,
id,
label,
Expand Down Expand Up @@ -38,7 +39,7 @@ export default function RadioButton({
return (
<Pressable
onPress={handlePress}
style={[styles.container, orientation, { opacity: disabled ? 0.2 : 1 }]}
style={[styles.container, orientation, { opacity: disabled ? 0.2 : 1 }, containerStyle]}
>
<View
style={[
Expand Down
3 changes: 1 addition & 2 deletions lib/RadioButtonsGroup/RadioGroup.tsx → lib/RadioGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';

import { RadioButtonProps, RadioGroupProps } from './types';
import RadioButton from './RadioButton';
import { RadioButton, RadioButtonProps, RadioGroupProps } from './index';

export default function RadioGroup({ layout = 'column', onPress, radioButtons }: RadioGroupProps) {

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions lib/RadioButtonsGroup/types.ts → lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export type RadioButtonProps = {
color?: string;
containerStyle?: object;
disabled?: boolean;
id: string;
label?: string;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-radio-buttons-group",
"version": "2.0.1",
"version": "2.1.0",
"description": "Simple and Best. An easy to use radio buttons for react native apps.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 43383db

Please sign in to comment.