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 { | |
| StyleSheet, | |
| View, | |
| Text, | |
| ListView | |
| } from 'react-native'; | |
| import Icon from 'react-native-vector-icons/FontAwesome'; | |
| import * as Animatable from 'react-native-animatable'; |
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
| renderPost: function(post) { | |
| return ( | |
| <View style={styles.container}> | |
| <Image | |
| source={{uri: post.screenshot_url['300px']}} | |
| style={styles.thumbnail} | |
| /> | |
| <View style={styles.rightContainer}> | |
| <Text style={styles.title}>{post.name}</Text> | |
| <Text style={styles.hunter}>{post.user.username}</Text> |
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
| render: function() { | |
| if (!this.state.loaded) { | |
| return this.renderLoadingView(); | |
| } | |
| return ( | |
| <ListView | |
| dataSource={this.state.dataSource} | |
| renderRow={this.renderPost} | |
| automaticallyAdjustContentInsets={false} |
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
| renderLoadingView: function() { | |
| return ( | |
| <View style={styles.container}> | |
| <Text> | |
| Loading... | |
| </Text> | |
| </View> | |
| ); | |
| } |
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
| componentDidMount: function() { | |
| Api.getToken().then((response) => { | |
| this.setState({ | |
| token: response.access_token, | |
| }); | |
| }).then(()=>{ | |
| Api.getAllPosts(this.state.token,0).then((response)=> { | |
| this.setState({ | |
| dataSource : this.state.dataSource.cloneWithRows(response.posts), | |
| loaded : true |
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
| getInitialState: function() { | |
| return { | |
| token: '', | |
| dataSource: new ListView.DataSource({ | |
| rowHasChanged: (row1, row2) => row1 !== row2, | |
| }), | |
| loaded: false, | |
| }; | |
| } |
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
| var React = require('react-native'); | |
| var Api = require('./App/api') | |
| var { | |
| AppRegistry, | |
| StyleSheet, | |
| Image, | |
| ListView, | |
| Text, | |
| View, |
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
| 'use strict'; | |
| var React = require('react-native'); | |
| var Api = require('./App/api') | |
| var { | |
| AppRegistry, | |
| StyleSheet, | |
| Image, | |
| ListView, |
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
| var styles = StyleSheet.create({ | |
| container: { | |
| flex: 1, | |
| flexDirection: 'row', | |
| justifyContent: 'center', | |
| alignItems: 'center', | |
| backgroundColor: '#ecf0f1', | |
| }, | |
| rightContainer: { | |
| flex: 1, |
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
| var PHReact = React.createClass({ | |
| getInitialState: function() { | |
| console.log("initial state"); | |
| return { | |
| token:"", | |
| }; | |
| }, | |
| componentWillMount: function(){ | |
| console.log("component will mount"); |
NewerOlder