Closed yogevlahyani closed 2 years ago
To remove these warnings you can make sure the library is being transpiled by babel/other.
To do this using webpack you can add this to your webpack config:
entry: "./src/index.ts",
module: {
rules: [
{
test: /\.js$/i,
loader: "babel-loader",
include: [
path.resolve(__dirname, "node_modules/phosphor-react-native")
]
}
Besides, phosphor-react-native
APIs is the same as phosphor-react
APIs, you can add an extra layer to make your app load 2 different libs on 2 platforms. Eg writing a wrapper layer with .web.tsx
for the web. That could be another solution for you.
Besides,
phosphor-react-native
APIs is the same asphosphor-react
APIs, you can add an extra layer to make your app load 2 different libs on 2 platforms. Eg writing a wrapper layer with.web.tsx
for the web. That could be another solution for you.
That worked for me.
The error
The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.
caused by using NativeBase Icon component.
Here is my webpack.config.js
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
config.resolve.alias['phosphor-react-native'] = 'phosphor-react';
return config;
};
@yogevlahyani did you solve the issue? Does NativeBase inject style
prop into the component?
@yogevlahyani did you solve the issue? Does NativeBase inject
style
prop into the component?
Yes, thank you!
Recently I've created a react-native app and tried to make some adjustments for the web.
The icons do work but I'm getting lots of errors and warnings when bundled:![image](https://user-images.githubusercontent.com/9413983/149628878-6be22a25-7a1e-4aac-bdad-9da3b774e8c9.png)
I also tried to make an alias for the web using webpack
but getting a different error:![image](https://user-images.githubusercontent.com/9413983/149628926-5e578df3-7c7f-42b1-aee6-5e9560125c8a.png)
Is there a way to use phosphor icons for react-native-web?