0

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

yem
  • 529
  • 1
  • 6
  • 20
  • What's the message error you are facing when you try to run it? – Charles Jul 31 '23 at 18:00
  • There doesn't seem to be any error as far as I can see. It just gets stuck by the splash screen after the bundling completes. This happens if I just add the `import { initializeParse } from '@parse/react-native';` even if no other code is added. Removing the import causes the app to run properly. – yem Jul 31 '23 at 20:26
  • Have you already tried this GitHub template: https://github.com/templates-back4app/react-native-todo-app? It's available here: https://www.back4app.com/docs/react-native/parse-sdk/real-time/react-native-real-time – Charles Jul 31 '23 at 20:31

0 Answers0