
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
react-native-radio-buttonx
Advanced tools
Create radio buttons with a range of styles and customize the radio button selector using your own custom component. This package is perfect for developers who need to create visually appealing and interactive radio buttons in their mobile applications
npm install react-native-radio-buttonx
import { StyleSheet, Text, View, Image } from 'react-native';
import { useState } from 'react';
import { RadioButtons } from 'react-native-radio-buttonx';
const foo = () => {
return (
<Image source={require('./assets/favicon.png')} style={{width: 12, height: 12}}/>
//<Text>✅</Text>
)
}
export default function App() {
const [selectedOption, setSelectedOption] = useState('Apple');
const handleSelect = (option: string) => {
setSelectedOption(option);
};
return (
<View style={styles.container}>
<Text style={{marginBottom: 40}}>Selected: {selectedOption}</Text>
<RadioButtons
gap={19}
options={['Apple','Orange','Banana']}
selectedOption={selectedOption}
onSelect={handleSelect}
styleOptions={styleOptions}
//SelectorComponent={foo}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
const styleOptions = {
rounded: true,
radio: 20,
display: 'column',
//defaultColor: 'gray',
//selectedColor: 'brown',
//fontWeight: 'bold',
//fontSize: 20,
//fontStyle: 'italic',
//color: 'brown'
}
// ...
The RadioButtons
component accepts the following props:
Property | Type | Required | Description |
---|---|---|---|
options | Array<string> | Yes | An array of options to be displayed as radio buttons |
selectedOption | string | Yes | The currently selected option |
onSelect | (option: string) => void | Yes | A function to be called when an option is selected |
gap | number | No | The gap between the radio buttons |
styleOptions | StyleOptions | No | An object containing style options for the radio buttons |
SelectorComponent | React.ComponentType | No | A custom component to be used as the selector for the radio buttons |
The StyleOptions
type is defined as follows:
type StyleOptions = {
rounded?: boolean;
radio?: number;
display?: 'row' | 'column';
defaultColor?: string;
selectedColor?: string;
fontWeight?: string;
fontSize?: number;
fontStyle?: 'normal' | 'italic' | 'oblique';
color?: string;
};
See the contributing guide to learn how to contribute to the repository and the development workflow.
If you find this project helpful, please consider buying me a coffee.
MIT
Made with :heart: by Énio Carlos
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.