Skip to content

Instantly share code, notes, and snippets.

View syamjayaraj's full-sized avatar
🎯
Focusing

Syamlal CM syamjayaraj

🎯
Focusing
View GitHub Profile
import React, { Component } from 'react';
import { Text, View, StyleSheet, TouchableOpacity, FlatList } from 'react-native';
export default class FAB extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
export default class FAB extends Component {
constructor(props) {
super(props);
this.state = {
data: [
{ name: 'John', age: 18 },
{ name: 'Lilli', age: 23 },
{ name: 'Lavera', age: 46 },
{ name: 'Paul', age: 32 },
{ name: 'Jene', age: 14 },
export default class FAB extends Component {
...
...
render() {
const { data } = this.state;
return (
<View style={styles.container}>
...
...
import React, { Component } from "react";
import { TouchableOpacity, StyleSheet, Alert, Picker } from 'react-native';
import { Container, View, Header, Content, Text, Left, Right, Body, Title, Item, Input, Button, List, ListItem, } from "native-base";
import Communications from 'react-native-communications';
export default class App extends Component {
}
constructor(props) {
super(props);
this.state = {
isSubmited: false,
name: null,
mobile: null,
group: null,
donors: [],
grouptoBeFiltered: null,
};
componentDidMount() {
this.timer=setInterval(() =>this.getDonor(), 1000);
}
async getDonor() {
return fetch(`https://blood-donors-db.firebaseio.com/donors.json`)
.then((response) => response.json())
.then((responseJson) => {
this.setState({
donors: Object.values(responseJson),
addDonor = (name, mobile, group) => {
if(this.state.name != null && this.state.mobile != null && this.state.group != null){
fetch('https://blood-donors-db.firebaseio.com/donors.json', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": name,
onValueChange(value) {
this.setState({
group: value
});
}
onValueChange2(value) {
this.setState({
grouptoBeFiltered: value
});
}