Skip to content

Instantly share code, notes, and snippets.

View FranciscoMSM's full-sized avatar

Francisco Magalhães FranciscoMSM

View GitHub Profile
const teams = [
{ league: 'PremierLeague', team: 'Arsenal' },
{ league: 'LaLiga', team: 'Barcelona' },
{ league: 'SerieA', team: 'Milan' },
];
for (let i = 0; i < teams.length; i += 1) {
const league = teams[i].league;
const team = teams[i].team;
import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import LeagueComponent from '../LeagueComponent'
import mockStore from 'redux-mock-store';
import { FlatList } from 'react-native';
import { expect as expectChai } from 'chai';
const league = {"name":"English Premier League 2016/17","routeName":"PremierLeague","clubs":[{"key":"chelsea","name":"Chelsea","code":"CHE"},{"key":"arsenal","name":"Arsenal","code":"ARS"},{"key":"tottenham","name":"Tottenham Hotspur","code":"TOT"},{"key":"westham","name":"West Ham United","code":"WHU"},{"key":"crystalpalace","name":"Crystal Palace","code":"CRY"},{"key":"manutd","name":"Manchester United","code":"MUN"},{"key":"mancity","name":"Manchester City","code":"MCI"},{"key":"everton","name":"Everton","code":"EVE"},{"key":"liverpool","name":"Liverpool","code":"LIV"},{"key":"westbrom","name":"West Bromwich Albion","code":"WBA"},{"key":"stoke","name":"Stoke City","code":"STK"},{"key":"sunderland","name":"Sunderland","code":"SUN"},{"ke
import { NavigationActions } from 'react-navigation';
import { GET_TEAM, BACK } from '../actions/types';
import { Stack } from '../router/stack/navigationConfiguration';
import { Drawer } from '../router/drawer/navigationConfiguration';
export function stack(state, action) {
switch (action.type) {
case BACK: {
const navigationAction = NavigationActions.back({});
return Stack.router.getStateForAction(navigationAction, state);
import { GET_TEAM } from './types';
export function getTeam(currentLeague, team) {
return {
type: GET_TEAM,
payload: { currentLeague, team },
};
}
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import Spinner from './components/loaders/Spinner';
import DrawerNavigation from './router/DrawerNavigation';
import configureStore from './configureStore';
function setup():React.Component {
class Root extends Component {
constructor(props) {
import { NavigationActions } from 'react-navigation';
import { Stack } from '../router/stack/navigationConfiguration';
import { Drawer } from '../router/drawer/navigationConfiguration';
import { GOTO_MATCH } from '../actions/types';
export function stack(state, action) {
switch (action.type) {
case GOTO_MATCH: {
const navigationAction = NavigationActions.navigate({
routeName: 'MatchScreen',
import { GOTO_MATCH } from './types';
import { getMatch } from '../db';
export function gotoMatch(id) {
return {
type: GOTO_MATCH,
payload: { match: getMatch(id) },
}
}
import { Stack } from '../router/stack/navigationConfiguration';
import { Drawer } from '../router/drawer/navigationConfiguration';
export function stack(state, action) {
return Stack.router.getStateForAction(action, state);
}
export function drawer(state, action) {
return Drawer.router.getStateForAction(action, state);
}
import React, { PropTypes } from 'react';
import { addNavigationHelpers } from 'react-navigation';
import { connect } from 'react-redux';
import { Drawer } from './navigationConfiguration';
const DrawerNavigation = ({ dispatch, navigation }) => (
<Drawer
navigation={
addNavigationHelpers({
dispatch,
import { DrawerNavigator } from 'react-navigation';
import StackNavigation from '../stack/StackNavigation';
const routeConfiguration = {
PremierLeague: {
screen: StackNavigation,
navigationOptions: {
drawer: { label: 'Premier League' },
},
},