flexn-io / create

Build apps for web, TVs, desktops, consoles, wearables and more. Developer friendly UI library targeting all form factors platforms. Another notable feature is providing focus management for TVs which very easy to implement using Create.
https://create.flexn.org
MIT License
27 stars 6 forks source link

Integrating Mongodb Atlas Realm #158

Open saimirg opened 1 year ago

saimirg commented 1 year ago

Hi, could you please advice how to integrate Realm library into flexn/create ? I installed the latest stable version of flexn-io/create with the demo app template, and included the realm library, but its generating errors.

Here is the code:

import React from 'react';
import Realm from 'realm';
//import * as Realm from "realm-web";

import { App, Debugger } from '@flexn/create';
import { LogBox } from 'react-native';
import { ThemeProvider } from '../config';
import Navigation from '../navigation';

const realmApp = new Realm.App({ id: my-app-id });

LogBox.ignoreAllLogs();

const MyApp = () => (

    <ThemeProvider>
        <App style={{ flex: 1 }}>
            <Navigation />
            <Debugger />
        </App>
    </ThemeProvider>

);

export default MyApp;

This is the error message i get.

image

I also tried adding it at the plugin file but no success:

 "plugins": {
        "realm": {
            "version": "0.1.0",
            "android": {
              "package": "io.realm.react",
              "path": "node_modules/realm/android"
            }

        }

    },
pauliusguzas commented 1 year ago

@saimirg thanks for reporting this, did you try to remove Realm and test? did the issue not occur again?

saimirg commented 1 year ago

@pauliusguzas yes, it runs fine when removing realm. I think integrating react/realm will be a great benefit as it will minimize the need of a backend.

pauliusguzas commented 1 year ago

@saimirg thanks, please write down versions of rnv, node, create, os, renative.json and package.json, this will be checked

saimirg commented 1 year ago

@pauliusguzas Please find details below:

image

ReNative Version: 0.37.3 │ │ Project Name ($package.name): rnvrealmtest │ │ Project Version ($package.version): 0.1.0 │ │ Workspace ($.workspaceID): rnv │ │ Platform (-p): androidtv │ │ Engine ($.platforms.androidtv.engine): engine-rn-tvos │ │ Template: @flexn/create-template-starter@1.1.0 │ │ App Config (-c): app │ │ Build Scheme (-s): debug │ │ Target (-t): Android_TV_720p_API_22 │ │ Supported Platforms: android, androidtv, firetv, androidwear, │ │ ios, web, macos, tvos, tizen, webos │ │ Env Info: darwin | x64 | node v16.16.0

saimirg commented 1 year ago

@pauliusguzas is it possible to use realm as local database ? What other local database would you recommend using ?