formio / react-native-formio

React Native Version of Formio Renderer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Figure out how to do ajax requests

randallknutson opened this issue · 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

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.

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

@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.

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.