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 renderer from 'react-test-renderer'; | |
import { ActivityIndicator } from 'react-native'; | |
import TeamsList from './src/components/TeamsList'; | |
import App from './App'; | |
it('renders the loading component when the app is first rendered', () => { | |
const rendered = renderer.create(<App />); | |
const TeamsListRendered = rendered.root.findByType(TeamsList); | |
const ActivityIndicatorRendered = TeamsListRendered.findByType(ActivityIndicator); |
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 PropTypes from 'prop-types'; | |
import { | |
StyleSheet, | |
Text, | |
Image, | |
TouchableOpacity, | |
} from 'react-native'; | |
import { withNavigation } from 'react-navigation'; |
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 { createStackNavigator } from 'react-navigation'; | |
import Home from './src/screens/Home'; | |
import TeamDetails from './src/screens/TeamDetails'; | |
export default createStackNavigator( | |
{ | |
Home: { | |
screen: Home, | |
}, |
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 { View, ActivityIndicator } from 'react-native'; | |
import TeamDetails from './../components/TeamDetails'; | |
import teamsApi from '../api/TeamsApi'; | |
class TeamDetailsScreen extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { |
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 PropTypes from 'prop-types'; | |
import { | |
StyleSheet, | |
Image, | |
View, | |
Text, | |
FlatList, | |
Dimensions, | |
} from 'react-native'; |
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 { createStackNavigator } from 'react-navigation'; | |
import Home from './src/screens/Home'; | |
export default createStackNavigator( | |
{ | |
Home: { | |
screen: Home, | |
}, | |
}, |
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 { | |
StyleSheet, | |
View, | |
} from 'react-native'; | |
import TeamsList from './../components/TeamsList'; | |
const styles = StyleSheet.create({ | |
itemsContainer: { |
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
const teamsApiUrl = 'http://private-c09d5b-worldcup20181.apiary-mock.com/teams'; | |
async function getAll() { | |
try { | |
const response = await fetch(teamsApiUrl); | |
const responseJson = await response.json(); | |
return responseJson; | |
} catch (error) { | |
console.error(error); /* eslint-disable-line no-console */ |
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 httpRequest from '../services/httpRequest'; | |
const teamsApiUrl = 'http://private-c09d5b-worldcup20181.apiary-mock.com/teams'; | |
function getAll() { | |
return httpRequest.get(teamsApiUrl); | |
} | |
function get(teamCode) { | |
return httpRequest.get(`${teamsApiUrl}/${teamCode}`); |
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
Show hidden characters
{ | |
"plugins": [ | |
"react", | |
"react-native", | |
"jest" | |
], | |
"extends": [ | |
"airbnb", | |
"plugin:react/recommended" | |
], |