0.1.27 • Published 3 years ago
react-native-upper v0.1.27
react-native-upper
Simple
Installation
yarn add react-native-upperInstallation dependencies
yarn add reflect-metadata react-native-quick-sqliteUsage
import 'reflect-metadata';
import 'react-native-quick-sqlite';
import { Upper } from 'react-native-upper';
import { User } from './src/entities/user.entity';
// ...
const upper = new Upper({
name: 'upper.sllite' // database name,
entities: {
User
}
});
const users = upper.Query('User');
import { Observer } from 'react-native-upper/src/react/Observer'
const Home = () => {
function handleUpdate(){
users.at(0).name = "Upper name" //detect change
}
return (
<View style={styles.container} >
<Observer>
{() => users.map(user => (
<Observer key={user.id}> //update some item list
{() => <Text>{user.name}</Text>}
</Observer>
))}
</Observer>
<Button title="Update name" onPress={handleUpdate} />
</View>
)
}
import {
Field,
PrimaryColumn,
UpperEntity,
} from 'react-native-upper/src/decorators';
@UpperEntity('users')
export class User {
@PrimaryColumn({type: 'uuid'})
id: string;
@Field({type: 'string'})
name: string;
}Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library
0.1.27
3 years ago
0.1.26
3 years ago
0.1.25
3 years ago
0.1.24
3 years ago
0.1.23
3 years ago
0.1.22
3 years ago
0.1.20
3 years ago
0.1.19
3 years ago
0.1.18
3 years ago
0.1.17
3 years ago
0.1.16
3 years ago
0.1.15
3 years ago
0.1.14
3 years ago
0.1.13
3 years ago
0.1.12
3 years ago
0.1.11
3 years ago
0.1.10
3 years ago
0.1.9
3 years ago
0.1.8
3 years ago
0.1.7
3 years ago
0.1.6
3 years ago
0.1.5
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago