how to make your own drop down react native

Solutions on MaxInterview for how to make your own drop down react native by the best coders in the world

showing results for - "how to make your own drop down react native"
Olivia
12 Apr 2020
1import React, { Component } from "react";
2import { Picker, View, Text, StyleSheet } from "react-native";
3
4export default class CategoryScreen extends Component {
5  state = {
6    selectedcat: "",
7    category: [
8      {
9        itemName: "Samsung M20"
10      },
11      {
12        itemName: "Nokia"
13      },
14      {
15        itemName: "Apple"
16      },
17      {
18        itemName: "Samsung M23"
19      },
20      {
21        itemName: "Samsung M24"
22      },
23      {
24        itemName: "Samsung M25"
25      }
26    ]
27  };
28
29  async onValueChangeCat(value) {
30    this.setState({ selectedcat: value });
31  }
32
33  render() {
34    return (
35      <View style={styles.viewStyle}>
36        <View style={{ flex: 0.3 }}>
37          <Text style={styles.textStyle}>Categories</Text>
38        </View>
39        <View style={{ flex: 0.7, fontSize: 14 }}>
40          <Picker
41            itemStyle={styles.itemStyle}
42            mode="dropdown"
43            style={styles.pickerStyle}
44            selectedValue={this.state.selectedcat}
45            onValueChange={this.onValueChangeCat.bind(this)}
46          >
47            {this.state.category.map((item, index) => (
48              <Picker.Item
49                color="#0087F0"
50                label={item.itemName}
51                value={item.itemName}
52                index={index}
53              />
54            ))}
55          </Picker>
56        </View>
57      </View>
58    );
59  }
60}
61
62const styles = StyleSheet.create({
63  viewStyle: {
64    flex: 1,
65    alignSelf: "center",
66    flexDirection: "row",
67    width: "92%",
68    justifyContent: "space-between",
69    alignItems: "center"
70  },
71  itemStyle: {
72    fontSize: 10,
73    fontFamily: "Roboto-Regular",
74    color: "#007aff"
75  },
76  pickerStyle: {
77    width: "100%",
78    height: 40,
79    color: "#007aff",
80    fontSize: 14,
81    fontFamily: "Roboto-Regular"
82  },
83  textStyle: {
84    fontSize: 14,
85    fontFamily: "Roboto-Regular"
86  }
87});
88
queries leading to this page
dropdown react nativecreate custom dropdown react nativehow to make dropdown in react nativecreate dropdown in react nativehow to add drop down box in react nativecustom drop down react nativedropdown animation react nativemake dropdown in react native drop down select react nativehow to create a dropdown in react nativehow to use drop down menu in react nativecustom made react native dropdown listdropdown in react nativemake a drop down in react nativehow to add drop down menu in react nativedrop down list react nativehow to make drop down in react nativecustom drop down in react nativereact native dropdown list examplehow to make drop down componentn in react nativereact native dropdownreact native dropdownbest way to make a dropdown in react nativehow to create drop down menu in react nativehow to implement dropdown in react nativehow to use dropdown in react nativedrop down in react nativedropdown in react native exampledrop down list react nativehow to use drop down in react nativehow to create a dropdown menu react nativedropdown react native exampledrop down list in react nativehow to add drop down menu in the header in react nativedrop down react nativereact native custom dropdown listcreate drop down list in react nativecreate dropdown react nativehow to create drop down list in react nativedrop down menu react native ios and androidreact native create custom dropdownshow to create dropdown component in react nativedrop down menu in react nativedrop down menu react nativedropdown react native from scratchcustom dropdown in react nativehow to make dropdown in reactnativecreate a customized dropdown element in react nativehow to create drop down react nativedown drop react nativedropdown web react nativereact native drop downa custom dropdown in react nativehow to make a dropdown in react nativecustom dropdown react nativecreate custom dropdown in react nativereact native drop down sample codereact native dropdown menuhow to make custom dropdown in react nativehow to make your own drop down react nativereact native drop down menureact native dropdown menuhow to create custom dropdown in react nativepull down menu react nativecreate a dropdown in react nativereact native create dropdownopen a drop down in react nativemake a dropdwon list in react nativehow to make your own drop down react native