react-native-formio icon indicating copy to clipboard operation
react-native-formio copied to clipboard

Figure out how to do ajax requests

Open randallknutson opened this issue 7 years ago • 4 comments

There are several places where we use ajax to load information from a server. Need to figure out how to do this with react-native.

See https://github.com/formio/react-native-formio/blob/master/src/components/Formio.jsx#L46

randallknutson avatar Jul 09 '18 15:07 randallknutson

We confirmed this works except for browser-cookies in formio.js is trying to access document which is throwing an error. By removing or working around browser-cookies we were able to load a form with the formio.js module.

randallknutson avatar Jul 12 '18 18:07 randallknutson

@realbisoye @randallknutson what are the repercussions of removing/bypassing browser cookies? Will this limit us in any other way?

cmavromoustakos avatar Jul 17 '18 17:07 cmavromoustakos

@cmavromoustakos, the browser-cookie is used to store formio-token for subsequent requests after form initialisation and I think it is only used as a fall back when localStorage is not available (majorly in safari private mode). We'll just have to replace both localStorage and browser-cookie with AsyncStorage (RN native storage manager) in react-native environment. @randallknutson can correct me if I'm wrong on any of this.

realbisoye avatar Jul 17 '18 18:07 realbisoye

Bisoye is correct. The storage mechanisms are specific to the browser. We'll want to swap them out with a compatible method to store the tokens.

randallknutson avatar Jul 17 '18 19:07 randallknutson