React-native-ui-kitten: Add left icon on Input

Created on 23 Nov 2019  路  11Comments  路  Source: akveo/react-native-ui-kitten

Issue type

  • [ ] bug report
  • [x] feature request

Issue description

Current behavior:

  • icon is always rendered on the right side of Input

Expected behavior:

  • There's a way for me to render icon on the left side of Input

Related code:

<Input leftIcon={this.renderLeftIcon} />
Proposal Components

Most helpful comment

@jeloagnasin Alternatively you can do like it. I Hope it will help you.

export const EmailTextBox = () => {
  const [value, setValue] = React.useState('');

  const renderIcon = style => (
    <Image
    style={{position:"absolute"}}
      source={{
        uri: 'https://akveo.github.io/eva-icons/outline/png/128/person-outline.png',
      }}
    />
  );

  return (
    <Input  
      textStyle={{paddingLeft:25}} 
      value={value}
      placeholder="Email"
      icon={renderIcon}
      onChangeText={setValue}
    />
  );
};

All 11 comments

Hi! 馃憢 Can you, please, describe the use case? We need to discuss such changes with our design team. Thanks!

@artyorsh, search icons in search fields are usually placed on the left side.

Screen Shot 2019-11-25 at 7 27 22 PM
Screen Shot 2019-11-25 at 7 30 47 PM

@jeloagnasin Yes, that makes sense. I think we could implement this in future releases

I'll try to make a PR for this around Dec 22/23.

+1

I need this too!

@jeloagnasin Alternatively you can do like it. I Hope it will help you.

export const EmailTextBox = () => {
  const [value, setValue] = React.useState('');

  const renderIcon = style => (
    <Image
    style={{position:"absolute"}}
      source={{
        uri: 'https://akveo.github.io/eva-icons/outline/png/128/person-outline.png',
      }}
    />
  );

  return (
    <Input  
      textStyle={{paddingLeft:25}} 
      value={value}
      placeholder="Email"
      icon={renderIcon}
      onChangeText={setValue}
    />
  );
};

+1

@harshnavadiya good idea, but if UI requires both icons? :)

+1

Available in v5! 馃帀

Was this page helpful?
0 / 5 - 0 ratings