react-native-paper
react-native-paper copied to clipboard
Undefined color from MaterialCommunityIcon
Patch file:
diff --git a/node_modules/react-native-paper/lib/module/components/MaterialCommunityIcon.js b/node_modules/react-native-paper/lib/module/components/MaterialCommunityIcon.js
index 472fee1..523fac9 100644
--- a/node_modules/react-native-paper/lib/module/components/MaterialCommunityIcon.js
+++ b/node_modules/react-native-paper/lib/module/components/MaterialCommunityIcon.js
@@ -1,7 +1,6 @@
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import * as React from 'react';
-import { StyleSheet, Text, Platform } from 'react-native';
-import { black } from '../styles/themes/v2/colors';
+import { Platform, StyleSheet, Text } from 'react-native';
export const accessibilityProps = Platform.OS === 'web' ? {
role: 'img',
focusable: false
@@ -55,7 +54,7 @@ const MaterialCommunityIcons = IconModule || FallbackIcon;
*/
const DefaultIcon = ({
name,
- color = black,
+ color = "black",
size,
direction,
allowFontScaling,
Hey! Thanks for opening the issue. Can you provide a minimal repro which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible. The easiest way to provide a repro is on snack.expo.dev. If it's not possible to repro it on snack.expo.dev, then you can also provide the repro in a GitHub repository.
Any update on this ? This is blocking us
@abhilmp could you please add a repro?
any update ?
Hi @mohammedshameelvk, could you please describe the steps to reproduce the issue?
@lukewalczak when i am using button from react-native-paper it show the error :
ROR Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run yarn or npm install., js engine: hermes
ERROR Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run yarn or npm install., js engine: hermes
ERROR Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run yarn or npm install., js engine: hermes
ERROR Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run yarn or npm install., js engine: hermes
ERROR TypeError: Cannot read property 'jsx' of undefined
It point into materialCommunityIcon
I'm not able to reproduce it on the fresh project nor on the expo snack. Please attach the minimal repro in a GitHub repository which demonstrates the issue.
@lukewalczak i am using react native cli "react-native-paper": "^5.14.5", "react-native-paper-dates": "^0.18.27", "react-native-safe-area-context": "^4.6.3", "react-native-screens": "4.0.0",
I am already using this package But now I am getting the issue TypeError: 0, _$$_REQUIRE(_dependencyMap[7], "react/jsx-runtime").jsx is not a function (it is undefined)
I was also getting this undefined color variable error. What I ended up doing to fix it is making sure to spread the default theme and colors before providing my own coloring theme that gets passed into the paper provider to make sure nothing was missed. Snippet below is from the paper theming docs.
import * as React from 'react'; import { MD3LightTheme as DefaultTheme, PaperProvider, } from 'react-native-paper'; import App from './src/App';
const theme = { ...DefaultTheme, // Specify custom property myOwnProperty: true, // Specify custom property in nested object colors: { ...DefaultTheme.colors, }, };
I'm not sure why that black variable in the icon is not being recognized, but if you provide your own defaults in the theme it never seems to need it and provides a patchless way of fixing the problem.
@lukewalczak any update?
I am so facing this issues could please share any solution for this
Facing same issue.
Pls share any solution for this....
@mohammedshameelvk
have you find any solution for the below issue
"TypeError: 0, _$$_REQUIRE(_dependencyMap[7], "react/jsx-runtime").jsx is not a function (it is undefined)"
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.