Skip to content

Instantly share code, notes, and snippets.

View viniciusvelasco's full-sized avatar

Vinícius Velasco viniciusvelasco

  • Cuiabá - MT, Brasil
View GitHub Profile
@viniciusvelasco
viniciusvelasco / mapas.js
Created November 5, 2019 03:21
Criar mapa com dados do realmdb
import React, {useEffect, useState} from 'react';
import {Dimensions} from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import {
Container,
List,
ContainerPasto,
MapaContainer,
Mapa,
@Entity('tblCategory')
export class Category {
@PrimaryColumn({ name: 'ID_CATEGORY', type: 'uniqueidentifier' })
id: string;
@Column({ name: 'NM_CATEGORY', type: 'nvarchar' })
name: string;
@OneToMany(type => Book, book => book.category)
@JoinTable({
import getRealm from '../realm';
import { Event } from '../../database/entities';
export default class EventService {
public async save(events: Event[]): Promise<Event[]> {
const realm = await getRealm();
realm.write(() => {
events.forEach(event => {
realm.create(Event.schema.name, event, true);
});
@viniciusvelasco
viniciusvelasco / Mapa.js
Last active June 6, 2019 02:44
Mapa e hooks
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { useState, useEffect } from 'react';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';