Created
April 2, 2018 16:47
-
-
Save Ayyagaries/2a37a2d6291c843cadb52c2db091dcb0 to your computer and use it in GitHub Desktop.
My code for component
This file contains hidden or 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 PropTypes from 'prop-types'; | |
import { connect } from 'react-redux'; | |
import { StyleSheet, View } from 'react-native'; | |
import FitImage from 'react-native-fit-image'; | |
import { | |
Container, | |
Footer, | |
FooterTab, | |
Content, | |
Card, | |
CardItem, | |
Body, | |
Text, | |
Icon, | |
Badge, | |
Button, | |
Left, | |
} from 'native-base'; | |
import Spinner from 'react-native-loading-spinner-overlay'; | |
import { requestAdminAttachedFacilities } from '../actions/pickFacility'; | |
class PickFacility extends Component { | |
static navigationOptions = { | |
drawerLabel: 'Home', | |
title: 'Home', | |
drawerIcon: () => <Icon name="ios-home" />, | |
}; | |
static propTypes = { | |
navigation: PropTypes.object, | |
dispatch: PropTypes.func, | |
isLoading: PropTypes.bool, | |
msg: PropTypes.string, | |
attachedFacilties: PropTypes.array, | |
}; | |
constructor(props) { | |
super(props); | |
this.state = {}; | |
} | |
componentWillMount() { | |
console.log('Component will mount'); | |
this.props.dispatch(requestAdminAttachedFacilities()); | |
} | |
componentDidMount() { | |
console.log('Component did mount'); | |
} | |
componentWillReceiveProps(nextProps) { | |
console.log('***********I have received this*********'); | |
console.log(nextProps); | |
} | |
handlePress = () => {}; | |
render() { | |
console.log('I am in the render method'); | |
console.log(this.props); | |
const networkError = this.props.msg; | |
alert(networkError); | |
return ( | |
<Container> | |
<Content> | |
<Spinner | |
visible={this.props.isLoading} | |
textContent="Loading" | |
textStyle={{ color: '#FFF' }} | |
/> | |
<Text>Flat list comes here</Text> | |
</Content> | |
</Container> | |
); | |
} | |
} | |
const styles = StyleSheet.create({}); | |
const mapStateToProps = state => ({ PickFacility: state.PickFacility }); | |
export default connect(mapStateToProps)(PickFacility); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment