Skip to content
Open
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
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,30 @@
![Single select](https://raw.githubusercontent.com/xuho/demo-images/master/react-native-select2-single-select.gif)

## Add it to your project
- Using NPM
`npm install react-native-select-two`
- or:
- Using Yarn
`yarn add react-native-select-two`

- Using NPM
`npm install react-native-select-two`
- or:
- Using Yarn
`yarn add react-native-select-two`

## Install dependencies

1. [react-native-modal](https://github.com/react-native-community/react-native-modal)
2. [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons)


## Usage

```javascript
import React, { Component } from "react"
import { View, Text, StyleSheet } from "react-native"
import Select2 from "react-native-select-two"
import React, { Component } from "react";
import { View, Text, StyleSheet } from "react-native";
import Select2 from "react-native-select-two";

const mockData = [
{ id: 1, name: "React Native Developer", checked: true }, // set default checked for render option item
{ id: 2, name: "Android Developer" },
{ id: 3, name: "iOS Developer" }
]
{ id: 3, name: "iOS Developer" },
];

// create a component
class CreateNewAppointment extends Component {
Expand All @@ -43,15 +42,15 @@ class CreateNewAppointment extends Component {
popupTitle="Select item"
title="Select item"
data={mockData}
onSelect={data => {
this.setState({ data })
onSelect={(data) => {
this.setState({ data });
}}
onRemoveItem={data => {
this.setState({ data })
onRemoveItem={(data) => {
this.setState({ data });
}}
/>
</View>
)
);
}
}
```
Expand All @@ -65,6 +64,8 @@ class CreateNewAppointment extends Component {
| Property name | Type | Default | Description |
| ------------------------- | -------------- | ------------------------------- | ------------------------------------------------------------------------------------------- |
| **style** | _Object_ | none | Custom style for component |
| **tagStyle** | _Object_ | none | Custom style for tag component |
| **tagTextStyle** | _Object_ | none | Custom style for text component inside tag component |
| **modalStyle** | _Object_ | none | Custom style for modal |
| **title** | _String_ | none | String display when you don't select any item |
| **data** | _Array_ | \*required | Datasource of list options: an array of objects (each object have `name` and `id` property) |
Expand Down
Loading