This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react' | |
import Button from '../components/Button' | |
import {connect} from 'react-redux' | |
import {incrementCount, decrementCount} from '../actions/index' | |
class CounterComponent extends Component{ | |
handleBtnActionIncrement = () => { | |
this.props.onIncrementClick(this.props.count) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { render } from 'react-dom' | |
import { Provider } from 'react-redux' | |
import CounterComponent from './containers/CounterComponent' | |
import store from './store' | |
render( | |
<Provider store={store}> | |
<CounterComponent /> | |
</Provider>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render() { | |
return ( | |
<Container> | |
<Header androidStatusBarColor="#af1313" style={{ backgroundColor: '#d11919' }}> | |
<Body style = {{ flex: 1, flexDirection: 'column', justifyContent: 'center', alignItems: 'center', }}> | |
<Title>BLOOD DONORS</Title> | |
</Body> | |
</Header> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_toggleDonorPost(){ | |
this.setState({ | |
isSubmited: false | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onValueChange2(value) { | |
this.setState({ | |
grouptoBeFiltered: value | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onValueChange(value) { | |
this.setState({ | |
group: value | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constructor(props) { | |
super(props); | |
this.state = { | |
isSubmited: false, | |
name: null, | |
mobile: null, | |
group: null, | |
donors: [], | |
grouptoBeFiltered: null, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class App extends Component { | |
} |