├── .gitignore
├── LICENSE
├── README.md
├── dropdown-both.gif
├── lib
├── index.js
├── items.js
├── option.js
├── optionList.js
├── overlay.js
└── select.js
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 |
5 | # Runtime data
6 | pids
7 | *.pid
8 | *.seed
9 | .DS_Store
10 |
11 | # Directory for instrumented libs generated by jscoverage/JSCover
12 | lib-cov
13 |
14 | # Coverage directory used by tools like istanbul
15 | coverage
16 |
17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
18 | .grunt
19 |
20 | # node-waf configuration
21 | .lock-wscript
22 |
23 | # Compiled binary addons (http://nodejs.org/api/addons.html)
24 | build/Release
25 |
26 | # Dependency directory
27 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
28 | node_modules
29 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Akhan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # React Native Selectme
3 | Simple DropDown menu for React Native App! Your Select Tag for React Native.
4 |
5 |
6 | ## Alternatives :
7 |
8 | [react-native-chooser](https://github.com/gs-akhan/react-native-chooser) : This is an upgraded and simple-to-use API. You can customize it to fullest.
9 |
10 |
11 | ## Introduction
12 |
13 | React Native Selectme is simple, customizable and easy to use dropdown in React Native. It has been tested on both Android and IOS and works like a charm.
14 |
15 | ## Installation
16 | ```
17 | npm i react-native-selectme --save
18 | ```
19 |
20 | ## Usage
21 | Require it inside your Javascript files. Also supporting components using object-deconstructing.
22 | ```Select``` ```Option``` ```OptionList```.
23 |
24 | `````` Is to be used to append the options. This has to be placed as a last component so that it take the highest Z-Index.
25 |
26 | ## Example
27 |
28 | ```jsx
29 | import React, {
30 | Component,
31 | AppRegistry,
32 | Text,
33 | View,
34 | } from 'react-native';
35 |
36 | import DropDown, {
37 | Select,
38 | Option,
39 | OptionList,
40 | } from 'react-native-selectme';
41 |
42 | class App extends Component {
43 | constructor(props) {
44 | super(props);
45 |
46 | this.state = {
47 | canada: ''
48 | };
49 | }
50 |
51 | _getOptionList() {
52 | return this.refs['OPTIONLIST'];
53 | }
54 |
55 |
56 | _canada(province) {
57 |
58 | this.setState({
59 | ...this.state,
60 | canada: province
61 | });
62 | }
63 |
64 | render() {
65 | return (
66 |
67 |
87 |
88 | Selected Canada's province: {this.state.canada}
89 |
90 |
91 |
92 | );
93 | }
94 | }
95 |
96 | AppRegistry.registerComponent('App', () => App);
97 |
98 |
99 | ```
100 |
101 | ### Configuration
102 |
103 | ##### Select:
104 | | Property | Type | Default | Description |
105 | |---------------|----------|--------------|----------------------------------------------------------------|
106 | | width | number | 400 | Width of the selection |
107 | | onSelect | function(text, value) | null | function to be invoked when option is selected |
108 | | height | number | 50 | Height of the selection |
109 | | optionListRef | function | required | Reference to `````` to display the selection menu |
110 | | style | object | null | Custom styles to be applied if supplied |
111 | | defaultValue | string | first option | The value to be displayed if none of the options are selected. |
112 |
113 | ```blur()``` : close the select by calling blur ```this.refs.SELECT1.blur();```
114 |
115 |
116 | ##### Option:
117 |
118 | | Property | Type | Default | Description |
119 | |-----------|--------|---------|--------------------------------------------|
120 | | value | any | null | value will be passed on callback `onSelect` as second argument |
121 | | style | object | null | Styles to be applied on 'Option' component |
122 | | styleText | object | null | Styles to be applied on text inside of 'Option' |
123 |
124 |
125 | ##### OptionList:
126 |
127 | | Property | Type | Default | Description |
128 | |-----------|--------|---------|--------------------------------------------|
129 | | overlayStyles | object | null | Styles to be applied on 'overlay' backdrop |
130 | | itemsStyles | object | null | Styles to be applied on 'items' dropdown |
131 |
132 |
133 | ## Demo
134 | ##### IOS and Android:
135 |