I'm building a react native app using expo and am using Back4App as my backend.
I was interested in using their live query functionality for a shared "todo list" style app.
Their docs state that you should place the following code in your App.js:
import { initializeParse } from '@parse/react-native';
// remember to call initializeParse with your credentials before using useParseQuery
initializeParse(
'https://YOUR-SUBDOMAIN.b4a.io/',
'APPLICATION_ID',
'JAVASCRIPT_KEY'
);
Before continuing any further just placing that in my code already caused issues. My app would build but would then get stuck on the splash screen without outputting any error. Commenting those lines of code out immediately fixed the issue (which is what leads me to believe that the issue is this).
Note: I replaced the placeholders with the correct keys and id's as well as enabled live queries for my app.
My App.js:
import React from 'react';
import { Provider } from 'react-redux';
import { store } from './redux/store.js';
import RootStack from './stackComponents/RootStack.js';
import { initializeParse } from '@parse/react-native';
initializeParse(
'https://myapp.b4a.io/',
'my_application_id',
'my_js_key'
);
export default function App() {
return (
<Provider store={store}>
<RootStack/>
</Provider>
);
};
Upon a little digging I noticed that in their App Templates they seem to be initializing Parse in a different way from what is written in their docs:
const PARSE_APPLICATION_ID = 'Your_AppId';
const PARSE_HOST_URL = 'https://parseapi.back4app.com/';
const PARSE_JAVASCRIPT_ID = 'Your_Javascript_Key';
Parse.initialize(PARSE_APPLICATION_ID, PARSE_JAVASCRIPT_ID);
Parse.serverURL = PARSE_HOST_URL;
I'm not sure if this is connected? Maybe their hook is not supported by expo?
I'm using the Expo Go app on an iPhone 11