Getting Flow to work

#1

I’m trying to get flow working with exponent for my first time on a new project, on my package.json, I have:

"main": "node_modules/expo/AppEntry.js",
"scripts": {
 "flow": "flow"
},
"dependencies": {
    "expo": "^18.0.4",
    "flow": "^0.2.3",
    "flow-bin": "^0.49.1",
  },
"devDependencies": {
    "babel-preset-flow": "^6.23.0",
    ....
  }

On my .babelrc

{
  "presets": ["babel-preset-expo", "flow"],
  "env": {
    "development": {
      "plugins": ["transform-react-jsx-source"]
    }
  }
}

When I run yarn run flow, it goes inside node_modules/expo/… and reads the .flowconfig file they have there, giving me some exponent typing errors which of course I don’t want.

How do I customise this to read my .flowconfig file located in my root folder instead? I don’t think I’m going to mess up with "main": "node_modules/expo/AppEntry.js" as this is the default setup with exponent.

1 Like

#2

Hey Rolando, I’m sorry to hear you’re having this problem.

Have you tried starting out with the create react native app flowconfig and going from there? https://github.com/react-community/create-react-native-app/tree/master/create-react-native-app

0 Likes

#3

Hi Jimmy,

Thanks for the answer, I tried the create-react-native-app, after getting the repo started, this are the steps I followed.

1 - yarn add flow flow-bin
2 - yarn run flow

  • I think is looking inside the .flowconfig file located on the expo project, not in mine root folder :frowning:

Result on the terminal:

yarn run v0.21.3
$ "Users/personamac/Documents/Projects/my-app
Spawned flow server (pid=1270)
Logs will go to /private/tmp/flow/zSUserszSpersonamaczSDocumentszSProjectszSmy-app.log
node_modules/expo/src/AV.js:100
100:   if ('rate' in status && (status.rate < 0.0 || status.rate > 32.0)) {
                                ^^^^^^^^^^^ undefined. This type cannot be compared to
100:   if ('rate' in status && (status.rate < 0.0 || status.rate > 32.0)) {
                                              ^^^ number

node_modules/expo/src/AV.js:100
100:   if ('rate' in status && (status.rate < 0.0 || status.rate > 32.0)) {
                                                     ^^^^^^^^^^^ undefined. This type cannot be compared to
100:   if ('rate' in status && (status.rate < 0.0 || status.rate > 32.0)) {
                                                                   ^^^^ number

node_modules/expo/src/AV.js:103
103:   if ('volume' in status && (status.volume < 0.0 || status.volume > 1.0)) {
                                  ^^^^^^^^^^^^^ undefined. This type cannot be compared to
103:   if ('volume' in status && (status.volume < 0.0 || status.volume > 1.0)) {
                                                  ^^^ number

node_modules/expo/src/AV.js:103
103:   if ('volume' in status && (status.volume < 0.0 || status.volume > 1.0)) {
                                                         ^^^^^^^^^^^^^ undefined. This type cannot be compared to
103:   if ('volume' in status && (status.volume < 0.0 || status.volume > 1.0)) {
                                                                         ^^^ number

..........
0 Likes

#4

Hi! I think you got it working and those are just some flow issues we need to resolve internally. I’ve pinged @greg about that, who maintains the AV code in our SDK.

0 Likes

#5

Cool, it would be nice to know when is ready, thank you! :slight_smile:

0 Likes

#6

Do you need the flow preset isn’t it already enough to have babel-preset-expo?

0 Likes