Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Initial Tags are not getting set #91

Open
macmichael01 opened this issue Nov 14, 2021 · 2 comments
Open

Initial Tags are not getting set #91

macmichael01 opened this issue Nov 14, 2021 · 2 comments

Comments

@macmichael01
Copy link

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>
            )}
          />
 )
}
@macmichael01
Copy link
Author

Also I happen to notice that the placeholder field is not working either.

   textInputProps={{placeholder: "E.g - Fashion"}}

@shinnida220
Copy link

This is true. Is there a way to override the default value?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants