Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.45k stars 587 forks source link

Cannot read property initializeJSI of null #1814

Open raulalhena opened 2 months ago

raulalhena commented 2 months ago

I follow the installation and setup steps and I got this error.

Screenshot_20240717-085559

-babel.config.js:

module.exports = { presets: [ 'module:metro-react-native-babel-preset', '@babel/preset-typescript', ], plugins: [ ['react-native-reanimated/plugin'], [ 'babel-plugin-root-import', { rootPathPrefix: '~', rootPathSuffix: 'src', }, ], 'babel-plugin-transform-typescript-metadata', ['@babel/plugin-proposal-decorators', { legacy: true }], ['@babel/plugin-proposal-class-properties', { loose: true }], ['@babel/plugin-transform-private-methods', { loose: true }], ['@babel/plugin-transform-private-property-in-object', { loose: true }] ], };

import {Database} from '@nozbe/watermelondb'; import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';

import schema from './schema'; // import migrations from './migrations'; import Treatment from './treatements'; import Visit from './visits';

const adapter = new SQLiteAdapter({ dbName: 'appv3', schema, // migrations, jsi: true / Platform.OS === 'ios' /, onSetUpError: error => { console.log(error); }, });

export const database = new Database({ adapter, modelClasses: [ Treatment, Visit, // and so on ], });

import { appSchema, tableSchema } from "@nozbe/watermelondb" import { tableName } from './table-name';

const schema = appSchema({ version: 1, tables: [ tableSchema({ name: tableName.VISITS, columns: [ { name: 'name', type: 'string' } ], }), tableSchema({ name: tableName.TREATMENTS, columns: [ { name: 'name', type: 'string' } ], }), ], });

export default schema;

lucaswitch commented 3 weeks ago

Try jsi: false when you're using new arch. Will be added support to new arch soon.