title: How can I change background color of a FlatList row?
body: <p>I'm learning a about lists in React-Native but I can't seem to make my code work. I want to change the background color of a certain row in a FlatList when the button inside that row is pressed. I found some answers online but most of them were complex for me to understand and didn't work(I'm very new to React-Native)</p>
  <p>This is my code so far:</p>
  <pre><code>export default function Listt () {
  
      const [click, setClick] = useState(null);
      const [productsData, setproductsData] = useState([]);
  
      const ItemView = ({item, index}) =&gt; {
        return (
          // FlatList Item
          &lt;TouchableOpacity style={styles.row} onPress={() =&gt; {setClick(index);}}&gt;
            &lt;View&gt;
              &lt;Text style={styles.rowtext}&gt;
                {item[0]+ '  ' + item[1]}
              &lt;/Text&gt;
            &lt;/View&gt;
          &lt;/TouchableOpacity&gt;
        );
      };
  
      async function loadInState() { 
        const keys =await AsyncStorage.getAllKeys();  
        const result = await AsyncStorage.multiGet(keys); 
        setproductsData([...productsData, ...result]);
      }
  
  
      useFocusEffect(
        React.useCallback(() =&gt; {
            loadInState()        
        }, [])
      );
  
      return (
        &lt;View style={styles.container}&gt;
          &lt;FlatList
          data={productsData}
          renderItem={ItemView}
          keyExtractor={(item, index) =&gt; index.toString()}
          /&gt;
  
        &lt;/View&gt;
      );
  };
  
  const styles = StyleSheet.create({
    
    container: {
      flex: 1,
      justifyContent: 'center',
      alignItems: 'center',
    },
  
    row: {
      width:widtht,
      height:45,
      borderWidth: 2, 
      borderColor: 'black',
      textAlign: 'center',
      justifyContent: 'center',
      alignItems:'center',
      textAlign:'center'
      //backgroundColor:'blue',
    },
    rowtext:{
      fontSize:17,
    },
  
  });
  </code></pre>