Icons not loading in paper, works fine with react-native-vector-icons directly
Current behaviour
Can't load icons from paper.
The source code checks for material icons with this code
try {
// Optionally require vector-icons
MaterialCommunityIcons =
require('react-native-vector-icons/MaterialCommunityIcons').default;
} catch (e) {
...
}
and shows the console.warn message.
However if I write require('react-native-vector-icons/MaterialCommunityIcons').default in my source code, it works fine. I can even load icons using
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
// ...
<Icon name="chevron-right" size={20} color={color} />
Expected behaviour
Paper should be able to load icons
Code sample
Screenshots (if applicable)
What have you tried
I am kinda clueless to be honest, how can the same package work in my code and not in paper
Your Environment
| software | version |
|---|---|
| ios or android | ios |
| react-native | 0.69.2 |
| react-native-paper | 4.12.3 |
| react-native-vector-icons | 9.2.0 |
| node | v18.6.0 |
| npm | 8.13.2 |
| expo sdk | NA |
Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link or link to a GitHub repo under your username).
Can you provide a minimal repro which demonstrates the issue? A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.
Couldn't find version numbers for the following packages in the issue:
-
react-native-vector-icons -
npm -
expo
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
-
yarn(found:8.13.2, latest:1.22.19)
Can you verify that the issue still exists after upgrading to the latest versions of these packages?
Couldn't find version numbers for the following packages in the issue:
-
expo
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
-
npm(found:8.13.2, latest:8.15.0)
Can you verify that the issue still exists after upgrading to the latest versions of these packages?
Hey @sourabhv, could you please provide the repro?
Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.
For future reference the install instructions are these