React-native-camera: What is the proper way to import for flowtype to work?

Created on 27 Nov 2018  路  3Comments  路  Source: react-native-camera/react-native-camera

Question

In trying to get flow typing in my project for react-native-camera, it seems I have to import like this:

import RNCamera from "react-native-camera/src/RNCamera";

instead of what all the docs say which is:

import { RNCamera } from "react-native-camera";

Am I missing something? Is flow not configured correctly? I notice that src/index.js doesn't have // @flow at the top and if I add it locally, everything works with the standard import.

Is there a reason the index.js file doesn't have // @flow?

Tags
static-typing, flow-type, flow

Help Wanted Question

All 3 comments

I just realized that the import change causes the packager build to fail, so it doesn't actually work even though the flow typing works great that way.

@sibelius Can you answer this question?

this should work:

import { RNCamera } from "react-native-camera";

feel free to send a pr to fix or improve this

I recommend moving to TS

Was this page helpful?
0 / 5 - 0 ratings