a React Native newbie here.
Inside my component (inside by App.js file), I'm declaring a variable and setting it to a local CSV file, using require( )
.
This errors --->
componentWillMount() {
var csvFilePath = require('./assets/imagesdata.csv');
However, when I set this to the CSV I want, it gives me an error:
Unable to resolve ./assets/imagesdata.csv" from ".//App.js`: The module `./assets/imagesdata.csv` could not be found"
The curious thing is this: if I just sub out the CSV file for another file in the same directory, let's use a .png image file, it works fine with no error -- what gives?
No error (subbed in .png file in the SAME subdirectory as the .csv file that didn't work) --->
componentWillMount() {
var csvFilePath = require('./assets/locationlogo.png');
is there syntax specific to CSV imports that I am unfamiliar with in React?
Here is what my directory looks like, so that you can see that the CSV file in question (imagesdata.csv) is in fact in the same exact subdirectory of assets/
as the .png files that work (locationlogo.png in that example above) .
Thanks!
FYI: I've googled around and tried the solution proposed here (probably not applicable to my case, but i'm desperate: https://github.com/oblador/react-native-vector-icons/issues/626
This suggested running rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
before building packager, but I did this, and still didn't solve my weird error).