Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6581

Error after Realm installation "Super expression must be null or a function" in React Native

$
0
0

I'm trying to install Realm in my React Native project. I have done everything and created another file for creating the context in Realm. Here's the realm context file:

import {Realm} from '@realm/react';import {createRealmContext} from '@realm/react';class Movie extends Realm.Object<Movie> {  description!: string;  title!:string;  releaseyear!: number;   userId!: string;  constructor(realm: Realm, description: string, title:string, releaseyear: number, userId?: string) {    super(realm, {description, title, releaseyear, userId: userId || '_SYNC_DISABLED_'});  }  }const realmContext = createRealmContext({  schema: [Movie]  });export default realmContext

After this, i'm just wrapping the context provider in App.js like this:

import {realmContext} from  "./src/hooks/Realm";const App = observer(() => {  const scheme = useColorScheme();  const isDarkMode = scheme === "dark";  const {RealmProvider} = realmContext  // this is line from where the error is coming   React.useEffect(() => {    StatusBar.setBarStyle(isDarkMode ? "light-content" : "dark-content");    if (isAndroid) {      StatusBar.setBackgroundColor("rgba(0,0,0,0)");      StatusBar.setTranslucent(true);    }  }, [scheme, isDarkMode]);  return (<><RealmProvider><Navigation /></RealmProvider></>  );});export default App;

Now where am i going wrong. I am getting the error "Super expression must be null or a function". Thanks in advance.


Viewing all articles
Browse latest Browse all 6581

Latest Images

Trending Articles



Latest Images