-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Usage with Flow #857
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
Comments
I still don't know whether React Native should be separated app in a browser app or we it should share (have a universal) package.json. I feel it should be separated app. Then, what is the recommended way for Flow in a browser? |
Hi, You can utilize the
This simply points any references to |
@SRandazzo Thank you. I don't understand how it should help. Do you have any example repo? The problem is we need the real React Native repo in another dir I suppose. |
I've been working on filling in a libdef for react-native-web, since we use it without react-native and would like to not get hit by the web-only props/APIs. @necolas is that something you'd like to provide in this package, or would you prefer it submitted to flow-typed? |
Hi @steida , no problem happy to try and help where I can. I'd like to amend my previous answer by adding By doing this, we instruct flow to read flow types for Since react-native-web publishes both the This will get flow to properly read all the types as they exist in react-native-web Note that the API's are slightly different though between RN and RNW, so there may be some inconsistencies. For example, the Additionally, for this to work, we must mark A typed lib-def would be fantastic. There is also |
@SRandazzo Thank you! It seems it works. But, because I want to integrate React Native into Next.js, I will try to read types from /native sub dir. UPDATE: Hmm, it's not probably possible, because React Native flow config is different. module.system=haste etc. |
Hmm, haste does noting it seems. This is an example of working flowconfig for universal React and React Native app with shared package.json https://github.com/este/este
|
@paularmstrong would you mind sharing your interface definition, even if that's a WIP? I would like to help on this. I have a project RNW only I don't have flow support and would like to add it. @necolas are you interested in a effort via a flow-typed definition? We could also try to work on the codebase so flow understands it without any user effort |
@MoOx It's not totally complete and there may be some bugs, but it's here: https://gist.github.com/paularmstrong/f60b40d16fc83e1e8e532d483336f9bb Keep in mind: react-native-web does have quite a bit of flow definitions in source. You could point flow to the |
Solved here https://github.com/este/este |
@steida works (kind of) if you have RN + RNW (but won't work for RNW specificities). If you import "react-native-web" directly you have to use an interface or a mapping. @paularmstrong thanks! |
Uh oh!
There was an error while loading. Please reload this page.
What is the recommended way when we have no react-native in package.json yet?
The text was updated successfully, but these errors were encountered: