How do I find all the icons that this can be: <Card.Title title={ data.title }…
- User
How do I find all the icons that this can be:
<Card.Title title={ data.title } subtitle={ data.date } left={() => <Avatar.Icon icon="error" />
- Assistant
To find all the possible icons that can be used in the
iconprop of theAvatar.Iconcomponent, you need to refer to the specific icon set or library your framework or components library uses. A common choice in React Native projects is the Material Community Icons.Using Material Community Icons in React Native Paper
If you are using
react-native-paper, it typically uses Material Community Icons by default. You can browse the entire list of supported icons on the Material Design Icons website.Example
Here's an example of how to browse and use different icons with
react-native-paper:- Go to the Material Design Icons website.
- Search for the icon you want to use.
- Click on the icon, and you will see its name. For example,
error.
To switch the icon in your component, simply replace the icon's name in the
iconprop:import React from 'react'; import { Card, Avatar } from 'react-native-paper'; const MyComponent = ({ data }) => ( <Card> <Card.Title title={data.title} subtitle={data.date} left={() => <Avatar.Icon icon="home" />} // Example of changing the icon /> </Card> ); export default MyComponent;Using Other Icons
If you're using other icon sets or would like to use a custom icon,
react-native-paperalso allows you to pass a component as theiconprop:import React from 'react'; import { Card, Avatar } from 'react-native-paper'; import { Ionicons } from '@expo/vector-icons'; // Or any other icon library const MyComponent = ({ data }) => ( <Card> <Card.Title title={data.title} subtitle={data.date} left={() => <Avatar.Icon icon={() => <Ionicons name="md-checkmark-circle" size={24} color="black" />} />} /> </Card> ); export default MyComponent;This way, you can use any icon from any icon library compatible with React Native.
Summary
- Material Community Icons: Use the icon name directly in the
iconprop. - Custom/Icon from Other Libraries: Pass a component as the
iconprop.
Always ensure to check the documentation for any specific details about the icons supported in the framework or library you are using.