Skip to content

Instantly share code, notes, and snippets.

@Ayyagaries
Ayyagaries / homescreen.js
Created April 4, 2018 19:48
homescreen with spinner
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { StyleSheet, View, FlatList } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import { List, ListItem, SearchBar } from 'react-native-elements';
import { Container, Content, Text, Button, Label } from 'native-base';
import Spinner from 'react-native-loading-spinner-overlay';
import { requestAttachedFacilities } from '../actions/pickFacility';
@Ayyagaries
Ayyagaries / Filter Flat List
Last active April 5, 2018 11:53
filterFaltList.js
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { StyleSheet, View, FlatList } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import { List, ListItem, SearchBar } from 'react-native-elements';
import { Container, Content, Text, Button, Label } from 'native-base';
import Spinner from 'react-native-loading-spinner-overlay';
import { requestAttachedFacilities } from '../actions/pickFacility';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { StyleSheet, View, FlatList } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import { List, ListItem, SearchBar } from 'react-native-elements';
import { Container, Content, Text, Button, Label } from 'native-base';
import Spinner from 'react-native-loading-spinner-overlay';
import { requestAttachedFacilities } from '../actions/pickFacility';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { StyleSheet, View, FlatList } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import { List, ListItem, SearchBar } from 'react-native-elements';
import { Container, Content, Text, Button, Label } from 'native-base';
import Spinner from 'react-native-loading-spinner-overlay';
import { requestAttachedFacilities } from '../actions/pickFacility';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { StyleSheet, View, FlatList } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import { List, ListItem, SearchBar } from 'react-native-elements';
import { Container, Content, Text, Button, Label } from 'native-base';
import Spinner from 'react-native-loading-spinner-overlay';
import { requestAttachedFacilities } from '../actions/pickFacility';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { StyleSheet, View, FlatList } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import { List, ListItem, SearchBar } from 'react-native-elements';
import { Container, Content, Text, Button, Label } from 'native-base';
import Spinner from 'react-native-loading-spinner-overlay';
import { requestAttachedFacilities } from '../actions/pickFacility';
-------------- REDUCER -----------------------
import { RESPONSE_ADMIN_ATTACHED_FACILITIES, ERROR, RESET_DATA } from '../actions/pickFacility';
const initialState = {
isLoading: true,
msg: null,
attachedFacilities: [],
};
export default (state = initialState, action) => {
@Ayyagaries
Ayyagaries / gist:a25ba98e9b2b32e3d3c4f6cbef5ba4dc
Last active April 2, 2018 20:45
reducer with REQUEST_ATTACHED_ENTITIES_STARTED
import {
RESPONSE_ADMIN_ATTACHED_FACILITIES,
ERROR,
REQUEST_ATTACHED_ENTITIES_STARTED,
} from '../actions/pickFacility';
const initialState = {
attachedFacilities: [],
msg: false,
isLoading: true,
render() {
console.log(`i am in the render method with this.props.PickFacility.msg ${this.props.PickFacility.msg}`);
const displayView = this.props.PickFacility.msg ? (
<View
style={{
flex: 1,
alignSelf: 'center',
marginTop: '50%',
import { call, put, select, take, fork, all, takeLatest } from 'redux-saga/effects';
import axios from 'axios';
import querystring from 'query-string';
import Config from 'react-native-config';
import {
REQUEST_ATTACHED_FACILITIES,
responseAdminAttachedFacilities,
errorFetchFacilties,
} from '../../../actions/pickFacility';