Skip to content

Separate radioGroup and radioButton to fix their packages #1388

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

Merged
merged 1 commit into from
Jul 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
123 changes: 123 additions & 0 deletions generatedTypes/components/radioButton/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import React from 'react';
import { TextStyle, StyleProp, ImageSourcePropType, ImageStyle, ViewStyle, ViewProps } from 'react-native';
import { RadioGroupContextProps } from '../radioGroup/RadioGroupContext';
export declare type RadioButtonProps = RadioGroupContextProps & ViewProps & {
/**
* The identifier value of the radio button. must be different than other RadioButtons in the same group
*/
value?: string | number | boolean;
/**
* When using RadioButton without a RadioGroup, use this prop to toggle selection
*/
selected?: boolean;
/**
* Invoked when pressing the button
*/
onPress?: (selected: boolean) => void;
/**
* Whether the radio button should be disabled
*/
disabled?: boolean;
/**
* The color of the radio button
*/
color?: string;
/**
* The size of the radio button, affect both width & height
*/
size?: number;
/**
* The radio button border radius
*/
borderRadius?: number;
/**
* A label for the radio button description
*/
label?: string;
/**
* Label style
*/
labelStyle?: TextStyle;
/**
* Icon image source
*/
iconSource?: ImageSourcePropType;
/**
* Icon image style
*/
iconStyle?: ImageStyle;
/**
* Should the icon be on the right side of the label
*/
iconOnRight?: boolean;
/**
* Should the content be rendered right to the button
*/
contentOnRight?: boolean;
/**
* Additional styling for the container
*/
containerStyle?: StyleProp<ViewStyle>;
};
export declare type RadioButtonPropTypes = RadioButtonProps;
declare const _default: React.ComponentClass<RadioGroupContextProps & ViewProps & {
/**
* The identifier value of the radio button. must be different than other RadioButtons in the same group
*/
value?: string | number | boolean | undefined;
/**
* When using RadioButton without a RadioGroup, use this prop to toggle selection
*/
selected?: boolean | undefined;
/**
* Invoked when pressing the button
*/
onPress?: ((selected: boolean) => void) | undefined;
/**
* Whether the radio button should be disabled
*/
disabled?: boolean | undefined;
/**
* The color of the radio button
*/
color?: string | undefined;
/**
* The size of the radio button, affect both width & height
*/
size?: number | undefined;
/**
* The radio button border radius
*/
borderRadius?: number | undefined;
/**
* A label for the radio button description
*/
label?: string | undefined;
/**
* Label style
*/
labelStyle?: TextStyle | undefined;
/**
* Icon image source
*/
iconSource?: ImageSourcePropType | undefined;
/**
* Icon image style
*/
iconStyle?: ImageStyle | undefined;
/**
* Should the icon be on the right side of the label
*/
iconOnRight?: boolean | undefined;
/**
* Should the content be rendered right to the button
*/
contentOnRight?: boolean | undefined;
/**
* Additional styling for the container
*/
containerStyle?: StyleProp<ViewStyle>;
} & {
useCustomTheme?: boolean | undefined;
}, any>;
export default _default;
14 changes: 14 additions & 0 deletions generatedTypes/components/radioGroup/RadioGroupContext.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
export interface RadioGroupContextProps {
/**
* The identifier value of the radio button. must be different than other RadioButtons in the same group
*/
value?: string | number | boolean;
/**
* Invoked once when value changes, by selecting one of the radio buttons in the group
*/
onValueChange?: (value: string | number | boolean) => void;
}
export declare type RadioGroupContextPropTypes = RadioGroupContextProps;
declare const _default: React.Context<RadioGroupContextProps>;
export default _default;
2 changes: 2 additions & 0 deletions generatedTypes/components/radioGroup/asRadioGroupChild.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import React from 'react';
export default function asRadioGroupChild(WrappedComponent: React.ComponentType<any>): any;
50 changes: 50 additions & 0 deletions generatedTypes/components/radioGroup/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React, { PureComponent, GetDerivedStateFromProps } from 'react';
import { BaseComponentInjectedProps, ForwardRefInjectedProps } from '../../commons/new';
import { ViewProps } from '../view';
export declare type RadioGroupProps = ViewProps & {
/**
* The initial value of the selected radio button
*/
initialValue?: string | number | boolean;
/**
* Invoked once when value changes, by selecting one of the radio buttons in the group
*/
onValueChange?: ((value: string) => void) | ((value: number) => void) | ((value: boolean) => void) | ((value: any) => void);
};
export declare type RadioGroupPropTypes = RadioGroupProps;
interface RadioGroupState {
initialValue?: RadioGroupProps['initialValue'];
value?: RadioGroupProps['initialValue'];
}
declare type Props = RadioGroupProps & BaseComponentInjectedProps & ForwardRefInjectedProps;
/**
* @description: Wrap a group of Radio Buttons to automatically control their selection
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/RadioButton/Default.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/RadioButton/Alignment.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/RadioButton/Custom.gif?raw=true
* @image: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/RadioButton/Individual.png?raw=true
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/RadioButtonScreen.js
*/
declare class RadioGroup extends PureComponent<Props, RadioGroupState> {
static displayName: string;
constructor(props: Props);
static getDerivedStateFromProps: GetDerivedStateFromProps<Props, RadioGroupState>;
getContextProviderValue(): {
value: string | number | boolean | undefined;
onValueChange: (value: string | number | boolean | undefined) => void;
};
onValueChange: (value: RadioGroupProps['initialValue']) => void;
render(): JSX.Element;
}
export { RadioGroup };
declare const _default: React.ComponentClass<ViewProps & {
/**
* The initial value of the selected radio button
*/
initialValue?: string | number | boolean | undefined;
/**
* Invoked once when value changes, by selecting one of the radio buttons in the group
*/
onValueChange?: ((value: string) => void) | ((value: number) => void) | ((value: boolean) => void) | ((value: any) => void) | undefined;
} & {
useCustomTheme?: boolean | undefined;
}, any>;
export default _default;
4 changes: 2 additions & 2 deletions generatedTypes/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export {default as FloatingButton, FloatingButtonProps} from './components/float
export {default as Hint, HintProps} from './components/hint';
export {default as Image, ImageProps} from './components/image';
export {default as Overlay, OverlayTypes} from './components/overlay';
export {default as RadioButton, RadioButtonPropTypes, RadioButtonProps} from './components/radioButton/RadioButton';
export {default as RadioGroup, RadioGroupPropTypes, RadioGroupProps} from './components/radioButton/RadioGroup';
export {default as RadioButton, RadioButtonPropTypes, RadioButtonProps} from './components/radioButton';
export {default as RadioGroup, RadioGroupPropTypes, RadioGroupProps} from './components/radioGroup';
export {default as SectionsWheelPicker, SectionsWheelPickerProps} from './components/sectionsWheelPicker';
export {default as HapticService, HapticType} from './services/HapticService';
export {default as SegmentedControl, SegmentedControlProps, SegmentedControlItemProps} from './components/segmentedControl';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import TouchableOpacity from '../touchableOpacity';
import View from '../view';
import Text from '../text';
import Image from '../image';
import asRadioGroupChild from './asRadioGroupChild';
import {RadioGroupContextProps} from './RadioGroupContext';
import asRadioGroupChild from '../radioGroup/asRadioGroupChild';
import {RadioGroupContextProps} from '../radioGroup/RadioGroupContext';

const DEFAULT_SIZE = 24;
const DEFAULT_COLOR = Colors.primary;
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ export default {
return require('./components/chipsInput').default;
},
get RadioButton() {
return require('./components/radioButton/RadioButton').default;
return require('./components/radioButton').default;
},
get RadioGroup() {
return require('./components/radioButton/RadioGroup').default;
return require('./components/radioGroup').default;
},
get ScrollBar() {
return require('./components/scrollBar').default;
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export {default as ColorSwatch, ColorSwatchProps} from './components/colorPicker
export {default as FloatingButton, FloatingButtonProps} from './components/floatingButton';
export {default as Image, ImageProps} from './components/image';
export {default as Overlay, OverlayTypes} from './components/overlay';
export {default as RadioButton, RadioButtonPropTypes, RadioButtonProps} from './components/radioButton/RadioButton';
export {default as RadioGroup, RadioGroupPropTypes, RadioGroupProps} from './components/radioButton/RadioGroup';
export {default as RadioButton, RadioButtonPropTypes, RadioButtonProps} from './components/radioButton';
export {default as RadioGroup, RadioGroupPropTypes, RadioGroupProps} from './components/radioGroup';
export {default as SectionsWheelPicker, SectionsWheelPickerProps} from './components/sectionsWheelPicker';
export {default as SegmentedControl, SegmentedControlProps, SegmentedControlItemProps} from './components/segmentedControl';
export {default as Switch, SwitchProps} from './components/switch';
Expand Down