react-native-ui-kitten icon indicating copy to clipboard operation
react-native-ui-kitten copied to clipboard

Icon in caption not work

Open allenalston opened this issue 3 years ago • 1 comments

When I use Input caption api, I want to use icon in the renderCaption, but not shown.

This is my code:

 const AlertIcon = style => <Icon {...style} name="alert-circle-outline" />;
 const renderCaption = msg => {
    return (
      <View style={styles.captionContainer}>
        {AlertIcon(styles.captionIcon)}
        <Text status="danger" category="c1">
          {msg}
        </Text>
      </View>
    );
  };
 <Input
    placeholder="Username"
     accessoryRight={props => <Icon {...props} name="person" />}
     onBlur={onBlur}
     onChangeText={onChange}
     value={value}
     caption={errors.username && (() => renderCaption('Required'))}
 />
image

This is the result:

image

allenalston avatar Jun 16 '22 07:06 allenalston

maybe this project had dead

Valar103769 avatar Aug 29 '22 12:08 Valar103769

@allenalston sorry for late response. could you please share captionContainer and captionIcon styles?

greenfrvr avatar Oct 28 '22 08:10 greenfrvr

@allenalston actually I missed one thing. the issue is how you are passing styles to Icon. currently you are destructuring style object and pass each attribute as a separate prop. your icon component should like this instead: const AlertIcon = style => <Icon style={style} name="alert-circle-outline" />;

I'm closing the issue, as I checked this on a test project and caption functionality is working as expected.

greenfrvr avatar Oct 28 '22 09:10 greenfrvr