Skip to content

Commit 6d9d45b

Browse files
docker-runMax Plotnikov
authored andcommitted
add a gif to readme, remove unused colors, font-sizes (maxkordiyak#1)
* add a gif to readme, remove unused colors, font-sizes * add full-length gif * add gif
1 parent 4f537a6 commit 6d9d45b

File tree

10 files changed

+65
-154
lines changed

10 files changed

+65
-154
lines changed

README.md

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
[![npm (scoped)](https://img.shields.io/badge/npm-v1.0.0-blue.svg)](https://www.npmjs.com/package/react-native-dropdown-autocomplete)
44

55
Based on https://bit.ly/2AFjUsj, the most significant advantage of this package among all others is that you can have multiple autocomplete's on your page after following instructions below. Works on Android and IOS.
6+
<p align="center">
7+
<img src="https://media.giphy.com/media/AS6Ts8m31qVFNpVHUZ/giphy.gif" alt="Autocomplete demo">
8+
<img src="https://media.giphy.com/media/3qs6aVPvVVCBkty3v5/giphy.gif" alt="Autocomplete demo with pre-filled inputs">
9+
</p>
610

711
## Usage
812
##### Install the package
@@ -13,8 +17,9 @@ npm i react-native-dropdown-autocomplete
1317
##### Wrap the page you want to have autocomplete on with ```withKeyboardAwareScrollView```:
1418

1519
```javascript
16-
import React from 'react';
17-
import {Ionicons} from '@expo/vector-icons';
20+
import React from "react";
21+
import {StyleSheet, View, SafeAreaView} from "react-native";
22+
import {Ionicons} from "@expo/vector-icons";
1823
import shortid from "shortid";
1924
import {Autocomplete, withKeyboardAwareScrollView} from "react-native-dropdown-autocomplete";
2025

@@ -28,29 +33,33 @@ class HomeScreen extends Component {
2833
render() {
2934
const autocompletes = [...Array(10).keys()];
3035

36+
const apiUrl = "https://5b927fd14c818e001456e967.mockapi.io/branches";
37+
3138
const {scrollToInput, onDropdownClose, onDropdownShow} = this.props;
3239

3340
return (
3441
<View style={styles.autocompletesContainer}>
35-
{autocompletes.map(() => (
36-
<Autocomplete
37-
key={shortid.generate()}
38-
style={styles.input}
39-
scrollToInput={ev => scrollToInput(ev)}
40-
handleSelectItem={(item, id) => this.handleSelectItem(item, id)}
41-
onDropdownClose={() => onDropdownClose()}
42-
onDropdownShow={() => onDropdownShow()}
43-
renderIcon={() => (
44-
<Ionicons name="ios-paper-plane" size={20} color="black" />
45-
)}
46-
fetchDataUrl="https://5b927fd14c818e001456e967.mockapi.io/branches"
47-
minimumCharactersCount={2}
48-
highlightText
49-
valueExtractor={item => item.name}
50-
rightContent
51-
rightTextExtractor={item => item.properties}
52-
/>
53-
))}
42+
<SafeAreaView>
43+
{autocompletes.map(() => (
44+
<Autocomplete
45+
key={shortid.generate()}
46+
style={styles.input}
47+
scrollToInput={ev => scrollToInput(ev)}
48+
handleSelectItem={(item, id) => this.handleSelectItem(item, id)}
49+
onDropdownClose={() => onDropdownClose()}
50+
onDropdownShow={() => onDropdownShow()}
51+
renderIcon={() => (
52+
<Ionicons name="ios-add-circle-outline" size={20} color="#c7c6c1" style={styles.plus} />
53+
)}
54+
fetchDataUrl={apiUrl}
55+
minimumCharactersCount={2}
56+
highlightText
57+
valueExtractor={item => item.name}
58+
rightContent
59+
rightTextExtractor={item => item.properties}
60+
/>
61+
))}
62+
</SafeAreaView>
5463
</View>
5564
);
5665
}
@@ -60,6 +69,7 @@ const styles = StyleSheet.create({
6069
paddingTop: 0,
6170
zIndex: 1,
6271
width: "100%",
72+
paddingHorizontal: 8,
6373
},
6474
input: {maxHeight: 40},
6575
inputContainer: {
@@ -70,7 +80,7 @@ const styles = StyleSheet.create({
7080
flexWrap: "wrap",
7181
alignItems: "center",
7282
borderBottomWidth: 1,
73-
borderColor: theme.dividerColor,
83+
borderColor: "#c7c6c1",
7484
paddingVertical: 13,
7585
paddingLeft: 12,
7686
paddingRight: "5%",
@@ -79,7 +89,7 @@ const styles = StyleSheet.create({
7989
},
8090
container: {
8191
flex: 1,
82-
backgroundColor: theme.bgPrimary,
92+
backgroundColor: "#ffffff",
8393
},
8494
plus: {
8595
position: "absolute",

components/Autocomplete/Autocomplete.styles.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const styles = StyleSheet.create({
1010
flexWrap: "wrap",
1111
alignItems: "center",
1212
borderBottomWidth: 1,
13-
borderColor: theme.dividerColor,
13+
borderColor: theme.divider,
1414
paddingVertical: 13,
1515
paddingLeft: 12,
1616
paddingRight: "5%",
@@ -23,6 +23,7 @@ export const styles = StyleSheet.create({
2323
flexWrap: "wrap",
2424
flexGrow: 1,
2525
flexShrink: 1,
26+
marginVertical: 4,
2627
},
2728
plus: {
2829
position: "absolute",
@@ -36,15 +37,15 @@ export const styles = StyleSheet.create({
3637
},
3738
list: {
3839
minWidth: "80%",
39-
backgroundColor: theme.bgPrimary,
40+
backgroundColor: theme.backgroundPrimary,
4041
paddingTop: 0,
4142
marginTop: 0,
4243
borderWidth: 1,
4344
borderColor: theme.primary,
4445
maxHeight: 300,
4546
},
4647
listShadow: {
47-
backgroundColor: theme.bgPrimary,
48+
backgroundColor: theme.backgroundPrimary,
4849
position: "absolute",
4950
zIndex: 3,
5051
top: 50,
@@ -59,7 +60,7 @@ export const styles = StyleSheet.create({
5960
listFooter: {
6061
height: 16.7,
6162
borderTopWidth: 1,
62-
borderTopColor: theme.dividerColor,
63+
borderTopColor: theme.divider,
6364
},
6465
input: {
6566
fontSize: theme.sizes.size20,
@@ -81,13 +82,13 @@ export const styles = StyleSheet.create({
8182
},
8283
listItemText: {
8384
justifyContent: "center",
84-
color: theme.listItemColor,
85+
color: theme.listItem,
8586
},
8687
listHeader: {
8788
height: 41.8,
8889
justifyContent: "center",
8990
paddingTop: 0,
90-
backgroundColor: theme.bgPrimary,
91+
backgroundColor: theme.backgroundPrimary,
9192
borderBottomWidth: 1,
9293
borderBottomColor: theme.primary,
9394
},
@@ -96,7 +97,7 @@ export const styles = StyleSheet.create({
9697
},
9798
separator: {
9899
height: 1,
99-
backgroundColor: theme.dividerColor,
100+
backgroundColor: theme.divider,
100101
},
101102
sectionSeparator: {
102103
backgroundColor: theme.primary,

components/Dropdown/Dropdown.styles.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default StyleSheet.create({
2626
overflow: "hidden",
2727
alignItems: "center",
2828

29-
backgroundColor: "transparent" /* XXX: Required */,
29+
backgroundColor: "transparent",
3030
},
3131
overlay: {
3232
...StyleSheet.absoluteFillObject,
@@ -59,7 +59,7 @@ export default StyleSheet.create({
5959
},
6060
separator: {
6161
height: 1,
62-
backgroundColor: theme.dividerColor,
62+
backgroundColor: theme.divider,
6363
},
6464
listItem: {
6565
paddingLeft: 15,
@@ -70,22 +70,22 @@ export default StyleSheet.create({
7070
listFooter: {
7171
height: 16.7,
7272
borderTopWidth: 1,
73-
borderTopColor: theme.dividerColor,
73+
borderTopColor: theme.divider,
7474
},
7575
listHeader: {
7676
height: 41.8,
7777
justifyContent: "center",
7878
paddingTop: 0,
79-
backgroundColor: theme.bgPrimary,
79+
backgroundColor: theme.backgroundPrimary,
8080
borderBottomWidth: 1,
8181
borderBottomColor: theme.primary,
8282
},
8383
listItemText: {
8484
justifyContent: "center",
85-
color: theme.listItemColor,
85+
color: theme.listItem,
8686
},
8787
noData: {
88-
color: theme.dividerColor,
88+
color: theme.divider,
8989
},
9090
listHeaderText: {
9191
color: theme.textSubtitle,
@@ -96,9 +96,9 @@ export default StyleSheet.create({
9696
paddingRight: 8,
9797
},
9898
phone: {
99-
color: theme.dividerColor,
99+
color: theme.divider,
100100
textDecorationLine: "underline",
101101
textDecorationStyle: "solid",
102-
textDecorationColor: theme.dividerColor,
102+
textDecorationColor: theme.divider,
103103
},
104104
});

components/Dropdown/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ export default class Dropdown extends PureComponent {
459459
inputValue,
460460
rightContent,
461461
valueExtractor,
462-
highLightColor,
462+
highLightColor,
463463
} = this.props;
464464
if (item === NO_DATA) {
465465
return this.renderEmptyItem();
@@ -469,7 +469,7 @@ export default class Dropdown extends PureComponent {
469469
text = highlightString(
470470
String(valueExtractor(item)),
471471
inputValue,
472-
highLightColor || theme.textInvert,
472+
highLightColor || theme.primary,
473473
);
474474
} else {
475475
text = capitalizeFirstLetter(String(valueExtractor(item)));
@@ -507,11 +507,11 @@ export default class Dropdown extends PureComponent {
507507
},
508508
rightContent
509509
? {
510-
display: "flex",
511-
flexDirection: "row",
512-
justifyContent: "space-between",
513-
alignItems: "center",
514-
}
510+
display: "flex",
511+
flexDirection: "row",
512+
justifyContent: "space-between",
513+
alignItems: "center",
514+
}
515515
: {},
516516
];
517517

components/StyledText.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

components/TabBarIcon.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

components/withKeyboardAwareScrollView/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const withKeyboardAwareScrollView = WrappedComponent => {
104104
const styles = StyleSheet.create({
105105
container: {
106106
flex: 1,
107-
backgroundColor: theme.bgPrimary,
107+
backgroundColor: theme.backgroundPrimary,
108108
paddingBottom: isX ? 30 : 0,
109109
},
110110
});

constants/Colors.js

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,8 @@
11
export const colors = {
2-
lightBlue: "#f0f8f9",
3-
redColor: "#dc4f2c",
4-
whiteColor: "#ffffff",
5-
whiteVeil: "rgba(255, 255, 255, 0.5)",
6-
modalVeil: "rgba(255, 255, 255, 0.98)",
7-
modalDarkVeil: "rgba(211, 211, 211, 0.9)",
8-
modalShade: "rgba(0, 0, 0, 0.42)",
9-
lightGreenColor: "#8cc63f",
10-
greenColor: "#64a143",
11-
darkGreenColor: "#129a8d",
12-
blueColor: "#2392c5",
13-
darkGrayColor: "#616261",
14-
orangeColor: "#e6802d",
2+
white: "#ffffff",
3+
primary: "#129a8d",
154
transparent: "rgba(255, 255, 255, 0)",
165
darkConcrete: "#91928e",
17-
defaultTextColor: "#0a0b09",
18-
concrete: "#acada9",
19-
lightGrayColor: "#c7c6c1",
20-
yellowColor: "rgb(253, 189, 57)",
6+
lightGray: "#c7c6c1",
217
muddyGray: "#585a58",
22-
darkMuddyGray: "#797b7a",
23-
primaryGradient1: "#00a49a",
24-
primaryGradient2: "#00a096",
25-
primaryGradient3: "#00948b",
26-
primaryGradient4: "#008d84",
27-
whiteGradient: "rgba(255,255,255,0)",
28-
whiteGradient1: "rgba(255,255,255,0.6)",
29-
couponIndexBackground: "#bbe1e8",
308
};

0 commit comments

Comments
 (0)