Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
react-native-paper-dropdown
Advanced tools
Dropdown component using React Native Paper TextInput and Menu, now also with multiselect
Material Design Dropdown Component using React Native Paper, now also with multiselect
react-native-paper
yarn add react-native-paper-dropdown
or
npm i react-native-paper-dropdown
import React, { useState } from 'react';
import { View } from 'react-native';
import { Dropdown } from 'react-native-paper-dropdown';
import { Provider as PaperProvider } from 'react-native-paper';
const OPTIONS = [
{ label: 'Male', value: 'male' },
{ label: 'Female', value: 'female' },
{ label: 'Other', value: 'other' },
];
export default function App() {
const [gender, setGender] = useState<string>();
return (
<PaperProvider>
<View style={{ margin: 16 }}>
<Dropdown
label="Gender"
placeholder="Select Gender"
options={OPTIONS}
value={gender}
onSelect={setGender}
/>
</View>
</PaperProvider>
);
}
import React, { useState } from 'react';
import { View } from 'react-native';
import { MultiSelectDropdown } from 'react-native-paper-dropdown';
import { Provider as PaperProvider } from 'react-native-paper';
const MULTI_SELECT_OPTIONS = [
{ label: 'White', value: 'white' },
{ label: 'Red', value: 'red' },
{ label: 'Blue', value: 'blue' },
{ label: 'Green', value: 'green' },
{ label: 'Orange', value: 'orange' },
];
export default function App() {
const [colors, setColors] = useState<string[]>([]);
return (
<PaperProvider>
<View style={{ margin: 16 }}>
<MultiSelectDropdown
label="Colors"
placeholder="Select Colors"
options={MULTI_SELECT_OPTIONS}
value={colors}
onSelect={setColors}
/>
</View>
</PaperProvider>
);
}
DropdownProps
Prop | Type | Description |
---|---|---|
testID | string | Test ID for the dropdown component. |
menuTestID | string | Test ID for the dropdown menu. |
value | string | The currently selected value. |
onSelect | (value: string) => void | Callback function to handle value selection. |
options | Option[] | Array of options for the dropdown. |
menuUpIcon | JSX.Element | Custom icon for menu up state. |
menuDownIcon | JSX.Element | Custom icon for menu down state. |
maxMenuHeight | number | Maximum height of the dropdown menu. |
menuContentStyle | ViewStyle | Style for the dropdown menu content. |
CustomDropdownItem | (props: DropdownItemProps) => JSX.Element | Custom component for dropdown item. |
CustomDropdownInput | (props: DropdownInputProps) => JSX.Element | Custom component for dropdown input. |
CustomMenuHeader | (props: DropdownHeaderProps) => JSX.Element | Custom component for the dropdown menu header. |
Touchable | ForwardRefExoticComponent<PressableProps & RefAttributes<View>> | Custom touchable component for the dropdown. |
placeholder | string | Placeholder text for the dropdown input. |
label | TextInputLabelProp | Label for the dropdown input. |
mode | 'flat' | 'outlined' | Mode for the dropdown input. |
disabled | boolean | Whether the dropdown is disabled. |
error | boolean | Whether the dropdown has an error. |
hideMenuHeader | boolean | Hide menu header component (default: false). |
statusBarHeight | number | Additional top margin for the status bar on Android. |
MultiSelectDropdownProps
Prop | Type | Description |
---|---|---|
testID | string | Test ID for the dropdown component. |
menuTestID | string | Test ID for the dropdown menu. |
value | string[] | The currently selected values. |
onSelect | (value: string[]) => void | Callback function to handle value selection. |
options | Option[] | Array of options for the dropdown. |
menuUpIcon | JSX.Element | Custom icon for menu up state. |
menuDownIcon | JSX.Element | Custom icon for menu down state. |
Touchable | ForwardRefExoticComponent<PressableProps & RefAttributes<View>> | Custom touchable component for the dropdown. |
maxMenuHeight | number | Maximum height of the dropdown menu. |
menuContentStyle | ViewStyle | Style for the dropdown menu content. |
CustomMultiSelectDropdownItem | (props: MultiSelectDropdownItemProps) => JSX.Element | Custom component for multi-select dropdown item. |
CustomMultiSelectDropdownInput | (props: DropdownInputProps) => JSX.Element | Custom component for multi-select dropdown input. |
CustomMenuHeader | (props: DropdownHeaderProps) => JSX.Element | Custom component for the dropdown menu header. |
placeholder | string | Placeholder text for the dropdown input. |
label | TextInputLabelProp | Label for the dropdown input. |
mode | 'flat' | 'outlined' | Mode for the dropdown input. |
disabled | boolean | Whether the dropdown is disabled. |
error | boolean | Whether the dropdown has an error. |
hideMenuHeader | boolean | Hide menu header component (default: false). |
statusBarHeight | number | Additional top margin for the status bar on Android. |
Method | Return | Description |
---|---|---|
focus() | void | Open the dropdown manually. |
blur() | void | Close the dropdown manually. |
MIT
FAQs
Dropdown component using React Native Paper TextInput and Menu, now also with multiselect
The npm package react-native-paper-dropdown receives a total of 4,595 weekly downloads. As such, react-native-paper-dropdown popularity was classified as popular.
We found that react-native-paper-dropdown demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.