can't write on my textInput inside my flatlist

Viewed 21

I try to do a profil update with a flatlist to catch all my value and attribute. but when i want to write something new is not working. i tried to take off my placeholder and my default value with my actual value, then write something but i have the same problem.

 const Item = ({ attribute, value, item }) => {
 
      return (
       
          <View
            key={item}
            style={{
              flex: 1,
              flexDirection: "column",
              marginBottom: 20,
              paddingLeft: 10,
            }}>
            <View
              style={{
                flexDirection: "row",
                flex: 1,
                alignItems: "center",
                marginBottom: 5,
              }}>
              <View style={{ marginRight: 10 }}>
                <Feather
                  onPress={() => {
                    setOnEdit(true);
                  }}
                  name="edit"
                  size={24}
                  color="#8E8E8E"
                />
              </View>
              <Text style={{ color: "#FF6B35", fontWeight: "bold" }}>
                {attribute}
              </Text>
            </View>
            <View style={{ flex: 1 }}>
              <View style={{ flex: 1 }}>
                {onEdite ? (
                  <TextInput
                    defaultValue={value}
                    placeholder={value}
                    placeholderTextColor={"black"}
                    onChangeText={(text) => {
                      createHandler(text, attribute);
                    }}
                  />
                ) : (
                  <Text style={{ color: "#8E8E8E" }}>{value}</Text>
                )}
              </View>
            </View>
          </View>
        )
      );
    
  };

this is also my createHandler method of all my textInput

  const createHandler = (text, fieldName) => {
    console.log(text, fieldName);
    setForm((oldValue) => {
      return {
        ...oldValue,
        [fieldName]: text,
      };
    });
  };

0 Answers
Related