ReactNative entities are not loaded
See original GitHub issueIssue type:
[ ] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[x] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
//db/index.ts
import 'reflect-metadata';
import {
Column,
createConnection,
Entity,
PrimaryGeneratedColumn,
} from 'typeorm/browser';
@Entity()
export class Product {
@PrimaryGeneratedColumn()
public id: number;
@Column('string')
public name: string;
@Column('number')
public amount: number;
@Column('string')
public createdAt: string;
@Column('boolean')
public synced: boolean;
}
createConnection({
type: 'react-native',
database: 'test',
location: 'default',
logging: ['error', 'query', 'schema'],
synchronize: true,
entities: [
Product
]
})
.then(conn => {
console.log('✅ init db', conn);
console.log('connnnn', conn);
const x = new Product();
x.amount = 90;
x.name = 'ddddddd';
x.createdAt = 'lkjlkj';
x.synced = false;
conn.manager.save(x);
})
.catch(err => console.error(err));
// then in App.tsx
import './db/index.ts';
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
React native HTML entities - Stack Overflow
I did install the package in my React Native project. I import using import Entities from 'html-entities' and put const entities = new...
Read more >Entities no longer registered after Hot Reloading #5676 - GitHub
I've edited the title. The most common issue I've seen in this thread relates to the hot-reload feature used by development environments & ......
Read more >JSX Gotchas | React
If you pass properties to native HTML elements that do not exist in the HTML specification, React will not render them. If you...
Read more >Tutorial | React.js and Spring Data REST
This entity is used to track employee information — in this case, their names and job descriptions. Spring Data REST is not confined...
Read more >Entities - typeorm - GitBook
Column types for sqlite / cordova / react-native / expo ... creates instances of entity classes when loading from the database, therefore...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solved. If you’re facing a similar issue, try changing babel decorators config from
decoratorsBeforeExport: true
tolegacy: true
Welp, I looked for that solution for ages, thanks @mustafawm
Don’t forget to clear the Metro cache when you change your babel config!