commit
889f3001ae
|
@ -18,25 +18,28 @@ import Router from './Router'
|
|||
import Login from './screens/Login'
|
||||
import {AsyncStorage, ActivityIndicator} from 'react-native';
|
||||
import AuthLoadingScreen from "./screens/AuthLoading";
|
||||
import {getToken} from "./Helpers/Requests";
|
||||
|
||||
|
||||
import thunkMiddleware from 'redux-thunk';
|
||||
import reducer from './reducers';
|
||||
import { AppRegistry } from 'react-native';
|
||||
import { Provider } from 'react-redux';
|
||||
import { createLogger } from 'redux-logger';
|
||||
import { compose, createStore, combineReducers, applyMiddleware} from 'redux';
|
||||
const loggerMiddleware = createLogger({ predicate: (getState, action) => __DEV__ });
|
||||
import {AppRegistry} from 'react-native';
|
||||
import {Provider} from 'react-redux';
|
||||
import {createLogger} from 'redux-logger';
|
||||
import {compose, createStore, combineReducers, applyMiddleware} from 'redux';
|
||||
|
||||
const loggerMiddleware = createLogger({predicate: (getState, action) => __DEV__});
|
||||
|
||||
|
||||
function configureStore(initialState) {
|
||||
const enhancer = compose(
|
||||
applyMiddleware(
|
||||
thunkMiddleware, // used to dispatch() functions
|
||||
loggerMiddleware, // used for logging actions
|
||||
),
|
||||
applyMiddleware(
|
||||
thunkMiddleware, // used to dispatch() functions
|
||||
loggerMiddleware, // used for logging actions
|
||||
),
|
||||
);
|
||||
return createStore(reducer, initialState, enhancer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const store = configureStore({});
|
||||
|
@ -58,28 +61,12 @@ export default class App extends Component {
|
|||
}
|
||||
|
||||
//componentDidMount() is invoked immediately after a component is mounted
|
||||
/*componentDidMount() {
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
AsyncStorage.removeItem('firstLogin');
|
||||
console.log('oi - ' + getToken('TC2MT8QFJT', '80f3b6e5'));
|
||||
|
||||
AsyncStorage.getItem('firstLogin').then((value) => {
|
||||
|
||||
console.log('aqui')
|
||||
if (value == null) {
|
||||
//setItem (key: string, value: string)
|
||||
deviceStorage.saveItem('firstLogin', JSON.stringify(true));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
//this.setState({firstLogin: false});
|
||||
}
|
||||
|
||||
this.setState({loading: false});
|
||||
|
||||
})
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
//Buttons do Intro Slider
|
||||
|
@ -113,13 +100,12 @@ export default class App extends Component {
|
|||
|
||||
render() {
|
||||
|
||||
|
||||
|
||||
return (
|
||||
|
||||
|
||||
<Provider store={store}>
|
||||
<Router />
|
||||
</Provider>
|
||||
<Router/>
|
||||
</Provider>
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
const axios = require('axios');
|
||||
|
||||
const url = "http://enei2019.uingress.com/internal/api/token";
|
||||
|
||||
export function getToken(userName, password) {
|
||||
|
||||
let headers = {
|
||||
header: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
};
|
||||
|
||||
let request = {
|
||||
method: 'GET',
|
||||
headers: headers,
|
||||
body: {
|
||||
username: userName,
|
||||
password: password,
|
||||
grant_type: 'password'
|
||||
}
|
||||
};
|
||||
|
||||
fetch(url, request).then(response => {
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log('There has been a problem with your fetch operation: ' + error.message);
|
||||
// ADD THIS THROW error
|
||||
throw error;
|
||||
});
|
||||
};
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import {TouchableOpacity} from 'react-native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
createAppContainer,
|
||||
|
@ -12,7 +11,6 @@ import Login from './screens/Login'
|
|||
|
||||
import AuthLoadingScreen from './screens/AuthLoading'
|
||||
|
||||
|
||||
import Eventos from './screens/Eventos'
|
||||
|
||||
import Social from './screens/Social'
|
||||
|
@ -20,68 +18,107 @@ import Scan from './screens/Scan'
|
|||
|
||||
import Calendar from './screens/Calendar'
|
||||
|
||||
/*Icons*/
|
||||
import Icon from "react-native-vector-icons/Ionicons"
|
||||
|
||||
import IconF from "react-native-vector-icons/Foundation"
|
||||
import IconFA from "react-native-vector-icons/FontAwesome5"
|
||||
|
||||
|
||||
const AppStack = createBottomTabNavigator(
|
||||
{
|
||||
Calendar:{
|
||||
screen:Calendar,
|
||||
|
||||
navigationOptions: {
|
||||
|
||||
tabBarIcon: ({ tintColor }) => (
|
||||
<Icon name="ios-beer" size={30}/>
|
||||
)
|
||||
},
|
||||
},
|
||||
Social:{
|
||||
screen:Social,
|
||||
|
||||
navigationOptions: {
|
||||
|
||||
tabBarIcon: ({ tintColor }) => (
|
||||
<Icon name="ios-mail" size={30}/>
|
||||
)
|
||||
},
|
||||
},
|
||||
Scan:{
|
||||
screen:Scan,
|
||||
|
||||
navigationOptions: {
|
||||
|
||||
tabBarIcon: ({ tintColor }) => (
|
||||
<Icon name="ios-qr-scanner" size={30}/>
|
||||
)
|
||||
},
|
||||
},
|
||||
Eventos: {
|
||||
screen: Eventos,
|
||||
|
||||
navigationOptions: {
|
||||
|
||||
tabBarIcon: ({ tintColor }) => (
|
||||
<Icon name="ios-beer" size={30}/>
|
||||
)
|
||||
},
|
||||
},
|
||||
|
||||
Home: {
|
||||
screen:Screens.Home,
|
||||
screen: Screens.Home,
|
||||
navigationOptions: {
|
||||
|
||||
tabBarIcon: ({ tintColor }) => (
|
||||
<Icon name="md-person" size={30}/>
|
||||
)
|
||||
|
||||
tabBarIcon: ({tintColor}) => (
|
||||
<Icon name="md-home" color={tintColor} size={30}/>
|
||||
)
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
},{
|
||||
initialRouteName : 'Home'
|
||||
|
||||
Social: {
|
||||
screen: Social,
|
||||
|
||||
navigationOptions: {
|
||||
|
||||
tabBarIcon: ({tintColor}) => (
|
||||
<Icon name="ios-mail" color={tintColor} size={30}/>
|
||||
)
|
||||
},
|
||||
},
|
||||
Scan: {
|
||||
screen: Scan,
|
||||
|
||||
navigationOptions: {
|
||||
tabBarIcon: ({tintColor}) => (
|
||||
<Icon name="ios-qr-scanner" color={tintColor} size={30}/>
|
||||
),
|
||||
},
|
||||
},
|
||||
Calendar: {
|
||||
screen: Calendar,
|
||||
|
||||
navigationOptions: {
|
||||
|
||||
tabBarIcon: ({tintColor}) => (
|
||||
<IconF name="calendar" color={tintColor} size={30}/>
|
||||
)
|
||||
},
|
||||
},
|
||||
|
||||
Eventos: {
|
||||
screen: Eventos,
|
||||
|
||||
navigationOptions: {
|
||||
|
||||
tabBarIcon: ({tintColor}) => (
|
||||
<Icon name="ios-beer" color={tintColor} size={30}/>
|
||||
)
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
initialRouteName: 'Home',
|
||||
|
||||
tabBarOptions: {
|
||||
showLabel: false, // hide labels
|
||||
activeTintColor: '#858683', // active icon color
|
||||
inactiveTintColor: '#d8d6c9', // inactive icon color
|
||||
style: {
|
||||
backgroundColor: '#fff' // TabBar background
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
const Stack = createStackNavigator({
|
||||
tabs: {
|
||||
screen: AppStack,
|
||||
navigationOptions: ({navigation}) => {
|
||||
const index = navigation.state.index;
|
||||
|
||||
if (navigation.state.routes[index].routeName !== 'Scan') {
|
||||
return {
|
||||
headerTitle: `${navigation.state.routes[index].routeName}`,
|
||||
headerRight: (
|
||||
<TouchableOpacity style={{marginRight: 20}} onPress={() => navigation.navigate('Home')}>
|
||||
<IconFA name="user-edit" size={22}/>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
header: null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
const AuthStack = createStackNavigator(
|
||||
{
|
||||
|
@ -95,19 +132,21 @@ const AuthStack = createStackNavigator(
|
|||
headerVisible: false,
|
||||
}
|
||||
}*/
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
export default createAppContainer(createSwitchNavigator(
|
||||
{
|
||||
AuthLoading: AuthLoadingScreen,
|
||||
App: AppStack,
|
||||
App: Stack,
|
||||
Auth: AuthStack,
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
initialRouteName: 'AuthLoading'
|
||||
},
|
||||
{
|
||||
headerMode: 'none'
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import React, { Component } from 'react';
|
||||
import { Button, View, Text , TouchableOpacity} from 'react-native';
|
||||
import {RkButton,
|
||||
RkTheme } from 'react-native-ui-kitten';
|
||||
import React, {Component} from 'react';
|
||||
import {Button, View, Text, TouchableOpacity} from 'react-native';
|
||||
import {
|
||||
RkButton,
|
||||
RkTheme
|
||||
} from 'react-native-ui-kitten';
|
||||
|
||||
import deviceStorage from '../services/deviceStorage';
|
||||
import AuthLoadingScreen from './AuthLoading';
|
||||
|
@ -9,35 +11,35 @@ import api from '../services/api';
|
|||
|
||||
|
||||
import Counter from './Counter'
|
||||
import { createStore } from 'redux';
|
||||
import {createStore} from 'redux';
|
||||
import {Provider} from 'react-redux'
|
||||
|
||||
const initialState={
|
||||
const initialState = {
|
||||
|
||||
counter:0
|
||||
}
|
||||
const reducer=(state =initialState, action)=>{
|
||||
counter: 0
|
||||
};
|
||||
|
||||
const reducer = (state = initialState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
switch(action.type){
|
||||
|
||||
case 'INCREASE_COUNTER':
|
||||
return {
|
||||
counter: state.counter+1
|
||||
counter: state.counter + 1
|
||||
}
|
||||
|
||||
case 'DECREASE_COUNTER':
|
||||
return {
|
||||
counter: state.counter-1
|
||||
}
|
||||
case 'DECREASE_COUNTER':
|
||||
return {
|
||||
counter: state.counter - 1
|
||||
}
|
||||
}
|
||||
|
||||
return state
|
||||
}
|
||||
return state
|
||||
};
|
||||
|
||||
const store = createStore(reducer);
|
||||
|
||||
|
||||
|
||||
export class Home extends Component {
|
||||
|
||||
static navigationOptions = {
|
||||
|
@ -47,17 +49,17 @@ export class Home extends Component {
|
|||
|
||||
render() {
|
||||
|
||||
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<View style={{flex:1, alignItems: 'center', alignContent: 'center'}}>
|
||||
<Counter></Counter>
|
||||
|
||||
|
||||
</View>
|
||||
|
||||
</Provider>
|
||||
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<View style={{flex: 1, alignItems: 'center', alignContent: 'center'}}>
|
||||
<Counter></Counter>
|
||||
|
||||
|
||||
</View>
|
||||
|
||||
</Provider>
|
||||
|
||||
);
|
||||
}
|
||||
}
|
|
@ -12,13 +12,12 @@ import {RkButton,
|
|||
|
||||
export default class Scan extends React.Component {
|
||||
|
||||
|
||||
onSuccess = (e) => {
|
||||
|
||||
// console.log(e.data);
|
||||
|
||||
|
||||
console.log(e);
|
||||
console.log(e.data);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2953,11 +2953,13 @@
|
|||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -2970,15 +2972,18 @@
|
|||
},
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -3081,7 +3086,8 @@
|
|||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -3091,6 +3097,7 @@
|
|||
"is-fullwidth-code-point": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
@ -3103,17 +3110,20 @@
|
|||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.2.4",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.1",
|
||||
"yallist": "^3.0.0"
|
||||
|
@ -3130,6 +3140,7 @@
|
|||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
@ -3202,7 +3213,8 @@
|
|||
},
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -3212,6 +3224,7 @@
|
|||
"once": {
|
||||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -3317,6 +3330,7 @@
|
|||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
|
Loading…
Reference in New Issue