@expo/vector-icons#EvilIcons TypeScript Examples
The following examples show how to use
@expo/vector-icons#EvilIcons.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BottomTabNavigator.tsx From SpotifyClone with MIT License | 6 votes |
export default function BottomTabNavigator() {
const colorScheme = useColorScheme();
return (
<BottomTab.Navigator
initialRouteName="TabOne"
tabBarOptions={{ activeTintColor: Colors[colorScheme].tint }}>
<BottomTab.Screen
name="Home"
component={TabOneNavigator}
options={{
tabBarIcon: ({ color }) => <Entypo name="home" size={30} style={{ marginBottom: -3 }} color={color} />,
}}
/>
<BottomTab.Screen
name="Search"
component={TabTwoNavigator}
options={{
tabBarIcon: ({ color }) => <EvilIcons name="search" size={30} style={{ marginBottom: -3 }} color={color} />,
}}
/>
<BottomTab.Screen
name="Your Library"
component={TabTwoNavigator}
options={{
tabBarIcon: ({ color }) => <MaterialCommunityIcons name="library-music-outline" size={30} style={{ marginBottom: -3 }} color={color} />,
}}
/>
<BottomTab.Screen
name="Premium"
component={TabTwoNavigator}
options={{
tabBarIcon: ({ color }) => <FontAwesome5 name="spotify" size={30} style={{ marginBottom: -3 }} color={color} />,
}}
/>
</BottomTab.Navigator>
);
}
Example #2
Source File: index.tsx From TwitterClone with MIT License | 4 votes |
Footer = ({ tweet }: FooterContainerProps) => {
console.log(tweet);
const [user, setUser] = useState(null);
const [myLike, setMyLike] = useState(null);
const [likesCount, setLikesCount] = useState(tweet.likes.items.length);
useEffect(() => {
const fetchUser = async () => {
const currentUser = await Auth.currentAuthenticatedUser();
setUser(currentUser);
const searchedLike = tweet.likes.items.find(
(like) => like.userID === currentUser.attributes.sub
);
setMyLike(searchedLike);
}
fetchUser();
}, [])
const submitLike = async () => {
const like = {
userID: user.attributes.sub,
tweetID: tweet.id,
}
try {
const res = await API.graphql(graphqlOperation(createLike, { input: like }))
setMyLike(res.data.createLike);
setLikesCount(likesCount + 1);
} catch (e) {
console.log(e);
}
}
const removeLike = async () => {
try {
await API.graphql(graphqlOperation(deleteLike, { input: { id: myLike.id } }))
setLikesCount(likesCount - 1);
setMyLike(null);
} catch (e) {
console.log(e);
}
}
const onLike = async () => {
if (!user) {
return;
}
if (!myLike) {
await submitLike()
} else {
await removeLike();
}
}
return (
<View style={styles.container}>
<View style={styles.iconContainer}>
<Feather name={"message-circle"} size={20} color={'grey'}/>
<Text style={styles.number}>{tweet.numberOfComments}</Text>
</View>
<View style={styles.iconContainer}>
<EvilIcons name={"retweet"} size={28} color={'grey'}/>
<Text style={styles.number}>{tweet.numberOfRetweets}</Text>
</View>
<View style={styles.iconContainer}>
<TouchableOpacity onPress={onLike}>
<AntDesign name={!myLike ? "hearto" : "heart"} size={20} color={!myLike ? 'grey' : 'red'}/>
</TouchableOpacity>
<Text style={styles.number}>{likesCount}</Text>
</View>
<View style={styles.iconContainer}>
<EvilIcons name={"share-google"} size={28} color={'grey'}/>
</View>
</View>
)
}