-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react native codepush using Alert #1366
Comments
As a test, did you try to use any other React-native library in your project, (for example react-native-vector-icons), or something else where the author 'officially' supports React-native only ? If you try those libraries, and you are getting a similar error -- then it means something is wrong your bundler config, and not react-native-web. It is not clear, but it seems that you are not even using CRA (Create React App), so you will have to search for boiler plate examples that go that route. |
I fix my problem by adding a default export in react-native-web. Not sure why the default export has been removed ? |
react-native-codepush doesn't support the web as a platform |
The problem
Hello!
I'm trying to be able to have my mobile app accessible through the web thanks to this repo.
I'm able to build the app, but when I launch the index.html created, i got some JS errors.
After inspection, I think I found the problem but I don't know how to solve it:
I'm using the react-native-codepush repo, and this use the
Alert
module from React like this:import React, { Platform } from "react-native";
let { Alert } = React;
When trying to access to the
Alert
module, in the bundle.js, it try to do this :React.default.Alert
butReact.default
is undefined.I tried to reimplement the Alert, i created an alias
react-native-alert.js
with the code from this reimplementing of Alert: https://github.com/Wildtyto/Alert7.js/blob/master/alert7.jsThen i created the alias
react-native-web.js
to include the Alert :const ReactNative = require('react-native-web');
const Alert = require('./react-native-alert');
export default { ...ReactNative, Alert };
and in my
webpack.config.js
, I put the alias ofreact-native-web
like :resolve {
alias: {
'react-native$': path.resolve(__dirname, './aliases/react-native-web'),
}
}
But still not working.. Did someone try to do something like this?
The text was updated successfully, but these errors were encountered: