Open aksonov opened 9 years ago
That error looks unrelated to alt
I'm running into the same problem / error and tracked it down to:
const connectToStores = require('alt/utils/connectToStores');
Is there anything required to make Alt work with react-native?
I'm running alt with reactive native without any issues! I just npm installed everything.
@froatsnook What versions are you using?
Really the only thing I have to do to break my app is
const connectToStores = require('alt/utils/connectToStores');
I don't get it! :/
From my package.json:
"alt": "^0.16.10"
"react-native": "^0.6.0"
Yes this might be an issue. I'll patch it.
@goatslacker great to hear that you're on to something! I'm using 0.17.1, so I guess there is a difference there.
No difference. It's just that connectToStores uses React when it should be using react-native.
I'm actually not sure how it works for @froatsnook
maybe they've got some aliasing going on in their build system that maps react to react-native?
I think it's working for me because I call listen and unlisten manually.
Requiring the package alone should probably give you an error, since it requires React to build the connectToStores class...again, idk /shrug.
For now I managed to get things working by doing a find/replace of "react" with "react-native" in all of the utils files
Hey @goatslacker I am running into the same issue. Is @0x80 's fix an acceptable solution? Thank you.
Yup that works well.
Hello everyone, future everyone who may have an issue with React Native + Alt (and webpack)
If you're using webpack, you can try to set an alias inside resolve:
resolve: {
alias: {
'react': 'react-native'
}
}
https://github.com/mjohnston/react-native-webpack-server/issues/58#issuecomment-139622341
Hello
I tried @0x80 fix, but that didn't help.
I don't know how to do @ppiekarczyk fix in a react-native android application?
I get Uncaught SyntaxError: Unexpected token ILLEGAL
in alt\lib\index.js : 1
alt version 0.17.3 react-native version 0.11.0
Please help, thank you Bernd
I am using OOTB react-native sample app (react-native version 0.16.0) and alt (0.18.1). Alt works fine without alt/utils but when I try to use the 'alt/utils/..." decorators I run into this error:
I don't even know what webpack is so I'm not sure where to specify the 'react': 'react-native' alias.
I believe its require('alt/utils/lib/connectToStores')
There's this though: https://github.com/altjs/react
Looking through my web and mobile app alt node_modules, I see that the appropriatealt/utils
files exist in ^0.17.0 but not in ^0.18.5 (on my react-native app). Using npm install alt-utils
with the path alt-utils/lib/...
fixed this for me when importing connectToStores.
Trying to add stores/actions to my react-native project and got following error: