react-native-ui-kitten
react-native-ui-kitten copied to clipboard
Icon in caption not work
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'))}
/>
This is the result:

maybe this project had dead
@allenalston sorry for late response. could you please share captionContainer and captionIcon styles?
@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.