React native, import and read local xml file

Viewed 3967

I'm new to React Native framework. I'm trying to use it for make a cross-platform mobile app. I want to open and read a local XML file, present in my app folder, but I can't work out how to do this.

My biggest problem at the moment is how to assign this local XML file to a variable, I've tried with the require command, or with import, but these commands haven't worked.

1 Answers

You need to transform your xml file to a javascript object, so that you can work with it. Maybe you could use react-native-xml2js

Related