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

Initial Tags are not getting set #91

Description

@macmichael01

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>
            )}
          />
 )
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions