Skip to content

Instantly share code, notes, and snippets.

@mirsahib
Created December 19, 2021 12:02
Show Gist options
  • Save mirsahib/561217658818d864283f5560422c2af3 to your computer and use it in GitHub Desktop.
Save mirsahib/561217658818d864283f5560422c2af3 to your computer and use it in GitHub Desktop.
import React from 'react';
import {
Text,
ScrollView,
TouchableOpacity
} from 'react-native';
import colors from '../assets/colors/colors';
export default function SuggestionList({inputState,setInputState,list,name}) {
return (
<ScrollView horizontal={true} showsHorizontalScrollIndicator={false}>
{list.map((item,index)=>{
return (
<TouchableOpacity key={index} style={{paddingHorizontal:2}} onPress={()=>setInputState({...inputState,[name]:item})}>
<Text style={{borderRadius:10,paddingHorizontal:5,backgroundColor:colors.primary,color:'white'}}>{item}</Text>
</TouchableOpacity>
)
})}
</ScrollView>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment