Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import {
- Container,
- Header,
- Content,
- Card,
- CardItem,
- Body,
- Text,
- Button,
- Form,
- Item,
- Input,
- Label,
- List,
- ListItem,
- Radio,
- Right,
- Left,
- } from 'native-base';
- import { FlatList, TouchableOpacity } from 'react-native';
- import { FontAwesome5 } from '@expo/vector-icons';
- import * as firebase from 'firebase';
- // Your web app's Firebase configuration
- var firebaseConfig = {
- apiKey: 'AIzaSyApmI9dEQ0ZhXYdO0ofl3F7LuwfuuZ4Q-U',
- authDomain: 'aulapdm2020-c43f0.firebaseapp.com',
- databaseURL: 'https://aulapdm2020-c43f0.firebaseio.com',
- projectId: 'aulapdm2020-c43f0',
- storageBucket: 'aulapdm2020-c43f0.appspot.com',
- messagingSenderId: '660803083439',
- appId: '1:660803083439:web:2dde11a2a9086c372ec85a',
- };
- try {
- // Initialize Firebase
- firebase.initializeApp(firebaseConfig);
- } catch (e) {
- console.log('O App recarregou');
- }
- export default class BDFirebase extends Component {
- constructor(props) {
- super(props);
- this.state = {
- arrayUsuario: null,
- };
- firebase
- .database()
- .ref('usuario/001')
- .set({
- nome: 'Jackson',
- telefone: '84 98800-5500',
- cpf: '000.555.000-50',
- })
- .then(() => {
- console.log('Inserido!');
- })
- .catch((error) => {
- console.log(error);
- });
- }
- render() {
- const { route } = this.props;
- const { nome } = route.params;
- return (
- <Container>
- <Content scrollEnabled={true}>
- <Card>
- <CardItem>
- <Body>
- <Text>Bem vindo {nome}</Text>
- </Body>
- </CardItem>
- </Card>
- </Content>
- </Container>
- );
- }
- }
Add Comment
Please, Sign In to add comment