As Im new with React native, Can anyone understand the problem im having here. And if so do give a solution
import React from 'react'; import { StyleSheet, TouchableOpacity, ScrollView } from 'react-native'; import { ListItem, Badge, Text } from 'native-base';
const CategoryFilter = (props) => {
return( <ScrollView bounces={true} horizontal={true} style={{ backgroundColor: "#f2f2f2" }} > <ListItem style={{ margin: 0, padding: 0, borderRadius: 0 }}> <TouchableOpacity // Here the key is different key={1} onPress={() => { props.categoryFilter('all'), props.setActive(-1) }} > <Badge style={[styles.center, {margin: 5}, props.active == -1 ? styles.active : styles.inactive ]} > <Text style={{ color: 'white' }}>All</Text> </Badge> </TouchableOpacity> {props.categories.map((item) => ( <TouchableOpacity // Here the key is also different key={item._id} onPress={() => { props.categoryFilter(item._id.$oid), props.setActive(props.categories.indexOf(item)) }} > <Badge style={[styles.center, {margin: 5}, props.active == props.categories.indexOf(item) ? styles.active : styles.inactive ]} > <Text style={{ color: 'white' }}>{item.name}</Text> </Badge> </TouchableOpacity> ))} </ListItem> </ScrollView> )
}
const styles = StyleSheet.create({ center: { justifyContent: 'center', alignItems: 'center' }, active: { backgroundColor: '#03bafc' }, inactive: { backgroundColor: '#a0e1eb' } })
export default CategoryFilter;
I guess the problem im having is in toucAbleOpacity but the keys are different in both components still it's giving the warning