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 User from './User'; | |
import { connect } from 'react-redux'; | |
import { fetchUsers } from '../actions/index'; | |
import { lifecycle, compose } from 'recompose'; | |
const enhance = compose( | |
lifecycle({ | |
componentDidMount() { | |
this.props.fetchUsers(); |
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
// quick snippet to check the connection in your RN app | |
// dispatches an `setIsConnected` action every time the NetInfo changes (on/off network) | |
componentDidMount() { | |
const dispatchConnected = isConnected => this.props.dispatch(setIsConnected(isConnected)); | |
NetInfo.isConnected.fetch().then().done(() => { | |
NetInfo.isConnected.addEventListener('change', dispatchConnected); | |
}); | |
} |
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
/* @flow */ | |
import React, { Component, PropTypes } from 'react' | |
import { | |
Animated | |
} from 'react-native' | |
export default class FadeIn extends Component { | |
static propTypes = { | |
children: PropTypes.node, |
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, | |
PropTypes | |
} from 'react' | |
import { | |
ListView | |
} from 'react-native' | |
// arbitrarily large distance to pre-render all sections for measurements | |
const RENDER_AHEAD_DISTANCE = 1000000 |
NewerOlder