How to show selected item different in React Native











up vote
0
down vote

favorite












I'm using react-native's picker to pick an item from the list of items. What I want to ask is how can I make the selected item to look different may be with a different style or with an icon?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I'm using react-native's picker to pick an item from the list of items. What I want to ask is how can I make the selected item to look different may be with a different style or with an icon?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm using react-native's picker to pick an item from the list of items. What I want to ask is how can I make the selected item to look different may be with a different style or with an icon?










      share|improve this question













      I'm using react-native's picker to pick an item from the list of items. What I want to ask is how can I make the selected item to look different may be with a different style or with an icon?







      react-native






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 8 at 11:08









      Ammar Tariq

      958




      958
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          You can use library to get such functionality, Please take a look...



          http://docs.nativebase.io/Components.html#picker-with-icon-style-headref



          It look like this



          import React, { Component } from "react";
          import { Container, Header, Content, Icon, Picker, Form } from "native-base";
          class PickerWithIconStyle extends Component {
          constructor(props) {
          super(props);
          this.state = {
          selected: "key1"
          };
          }
          onValueChange(value: string) {
          this.setState({
          selected: value
          });
          }
          render() {
          return (
          <Container>
          <Header />
          <Content>
          <Form>
          <Picker
          mode="dropdown"
          iosHeader="Select your SIM"
          iosIcon={<Icon name="arrow-dropdown-circle" style={{ color: "#007aff", fontSize: 25 }} />}
          style={{ width: undefined }}
          selectedValue={this.state.selected}
          onValueChange={this.onValueChange.bind(this)}
          >
          <Picker.Item label="Wallet" value="key0" />
          <Picker.Item label="ATM Card" value="key1" />
          <Picker.Item label="Debit Card" value="key2" />
          <Picker.Item label="Credit Card" value="key3" />
          <Picker.Item label="Net Banking" value="key4" />
          </Picker>
          </Form>
          </Content>
          </Container>
          );
          }
          }





          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206524%2fhow-to-show-selected-item-different-in-react-native%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            You can use library to get such functionality, Please take a look...



            http://docs.nativebase.io/Components.html#picker-with-icon-style-headref



            It look like this



            import React, { Component } from "react";
            import { Container, Header, Content, Icon, Picker, Form } from "native-base";
            class PickerWithIconStyle extends Component {
            constructor(props) {
            super(props);
            this.state = {
            selected: "key1"
            };
            }
            onValueChange(value: string) {
            this.setState({
            selected: value
            });
            }
            render() {
            return (
            <Container>
            <Header />
            <Content>
            <Form>
            <Picker
            mode="dropdown"
            iosHeader="Select your SIM"
            iosIcon={<Icon name="arrow-dropdown-circle" style={{ color: "#007aff", fontSize: 25 }} />}
            style={{ width: undefined }}
            selectedValue={this.state.selected}
            onValueChange={this.onValueChange.bind(this)}
            >
            <Picker.Item label="Wallet" value="key0" />
            <Picker.Item label="ATM Card" value="key1" />
            <Picker.Item label="Debit Card" value="key2" />
            <Picker.Item label="Credit Card" value="key3" />
            <Picker.Item label="Net Banking" value="key4" />
            </Picker>
            </Form>
            </Content>
            </Container>
            );
            }
            }





            share|improve this answer

























              up vote
              0
              down vote













              You can use library to get such functionality, Please take a look...



              http://docs.nativebase.io/Components.html#picker-with-icon-style-headref



              It look like this



              import React, { Component } from "react";
              import { Container, Header, Content, Icon, Picker, Form } from "native-base";
              class PickerWithIconStyle extends Component {
              constructor(props) {
              super(props);
              this.state = {
              selected: "key1"
              };
              }
              onValueChange(value: string) {
              this.setState({
              selected: value
              });
              }
              render() {
              return (
              <Container>
              <Header />
              <Content>
              <Form>
              <Picker
              mode="dropdown"
              iosHeader="Select your SIM"
              iosIcon={<Icon name="arrow-dropdown-circle" style={{ color: "#007aff", fontSize: 25 }} />}
              style={{ width: undefined }}
              selectedValue={this.state.selected}
              onValueChange={this.onValueChange.bind(this)}
              >
              <Picker.Item label="Wallet" value="key0" />
              <Picker.Item label="ATM Card" value="key1" />
              <Picker.Item label="Debit Card" value="key2" />
              <Picker.Item label="Credit Card" value="key3" />
              <Picker.Item label="Net Banking" value="key4" />
              </Picker>
              </Form>
              </Content>
              </Container>
              );
              }
              }





              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                You can use library to get such functionality, Please take a look...



                http://docs.nativebase.io/Components.html#picker-with-icon-style-headref



                It look like this



                import React, { Component } from "react";
                import { Container, Header, Content, Icon, Picker, Form } from "native-base";
                class PickerWithIconStyle extends Component {
                constructor(props) {
                super(props);
                this.state = {
                selected: "key1"
                };
                }
                onValueChange(value: string) {
                this.setState({
                selected: value
                });
                }
                render() {
                return (
                <Container>
                <Header />
                <Content>
                <Form>
                <Picker
                mode="dropdown"
                iosHeader="Select your SIM"
                iosIcon={<Icon name="arrow-dropdown-circle" style={{ color: "#007aff", fontSize: 25 }} />}
                style={{ width: undefined }}
                selectedValue={this.state.selected}
                onValueChange={this.onValueChange.bind(this)}
                >
                <Picker.Item label="Wallet" value="key0" />
                <Picker.Item label="ATM Card" value="key1" />
                <Picker.Item label="Debit Card" value="key2" />
                <Picker.Item label="Credit Card" value="key3" />
                <Picker.Item label="Net Banking" value="key4" />
                </Picker>
                </Form>
                </Content>
                </Container>
                );
                }
                }





                share|improve this answer












                You can use library to get such functionality, Please take a look...



                http://docs.nativebase.io/Components.html#picker-with-icon-style-headref



                It look like this



                import React, { Component } from "react";
                import { Container, Header, Content, Icon, Picker, Form } from "native-base";
                class PickerWithIconStyle extends Component {
                constructor(props) {
                super(props);
                this.state = {
                selected: "key1"
                };
                }
                onValueChange(value: string) {
                this.setState({
                selected: value
                });
                }
                render() {
                return (
                <Container>
                <Header />
                <Content>
                <Form>
                <Picker
                mode="dropdown"
                iosHeader="Select your SIM"
                iosIcon={<Icon name="arrow-dropdown-circle" style={{ color: "#007aff", fontSize: 25 }} />}
                style={{ width: undefined }}
                selectedValue={this.state.selected}
                onValueChange={this.onValueChange.bind(this)}
                >
                <Picker.Item label="Wallet" value="key0" />
                <Picker.Item label="ATM Card" value="key1" />
                <Picker.Item label="Debit Card" value="key2" />
                <Picker.Item label="Credit Card" value="key3" />
                <Picker.Item label="Net Banking" value="key4" />
                </Picker>
                </Form>
                </Content>
                </Container>
                );
                }
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 8 at 11:54









                Rajneesh Shukla

                727




                727






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206524%2fhow-to-show-selected-item-different-in-react-native%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Schultheiß

                    Verwaltungsgliederung Dänemarks

                    Liste der Kulturdenkmale in Wilsdruff