Initial Tags are not getting set
macmichael01 opened this issue · comments
Rapid Rabbit Software commented
I am having problems setting my initial tags with the code below. Is there something obvious that I am doing wrong?
import React, {useEffect, useState} from 'react';
import {
TouchableOpacity, Text
} from 'react-native';
import Tags from "react-native-tags";
function JobScreen({ route, navigation }) {
const [niche, setNiche] = useState(['tag1', 'tag2'])
return (
<Tags
textInputProps={{placeholder: "E.g - Fashion"}}
maxNumberOfTags={10}
initialTags={niche}
onChangeTags={niches => setNiche(niches)}
containerStyle={{ borderColor: '#E0E0E0', borderWidth: 1, marginVertical: 4, borderRadius: 8, paddingTop: 4 }}
inputStyle={{ backgroundColor: "white" }}
renderTag={({ tag, index, onPress, deleteTagOnPress, readonly }) => (
<TouchableOpacity key={`${tag}-${index}`} onPress={onPress}>
<Text style={{ marginTop: 2, marginBottom: 2, color: "#7A7A7A", marginLeft: 5, paddingVertical: 5, paddingHorizontal: 10,
borderColor: "#7A7A7A", borderWidth: 2, borderRadius: 15 }}>{tag}</Text>
</TouchableOpacity>
)}
/>
)
}
Rapid Rabbit Software commented
Also I happen to notice that the placeholder field is not working either.
textInputProps={{placeholder: "E.g - Fashion"}}
Emmanuel Ibikunle commented
This is true. Is there a way to override the default value?