Commit c89081df authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

fix error

See merge request !2
parents c9163241 ee2ff593
import React, { Component } from 'react'
import { ScrollView, Text, KeyboardAvoidingView } from 'react-native'
import { connect } from 'react-redux'
// Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux'
// Styles
import styles from './Styles/LoginScreenStyle'
class LoginScreen extends Component {
render () {
return (
<ScrollView style={styles.container}>
<KeyboardAvoidingView behavior='position'>
<Text>LoginScreen</Text>
</KeyboardAvoidingView>
</ScrollView>
)
}
}
const mapStateToProps = (state) => {
return {
}
}
const mapDispatchToProps = (dispatch) => {
return {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(LoginScreen)
import React, { Component } from 'react'
import { ScrollView, Text, KeyboardAvoidingView } from 'react-native'
import { connect } from 'react-redux'
// Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux'
// Styles
import styles from './Styles/RegisterScreenStyle'
class RegisterScreen extends Component {
render () {
return (
<ScrollView style={styles.container}>
<KeyboardAvoidingView behavior='position'>
<Text>RegisterScreen</Text>
</KeyboardAvoidingView>
</ScrollView>
)
}
}
const mapStateToProps = (state) => {
return {
}
}
const mapDispatchToProps = (dispatch) => {
return {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(RegisterScreen)
import { StyleSheet } from 'react-native'
import { ApplicationStyles } from '../../Themes/'
export default StyleSheet.create({
...ApplicationStyles.screen
})
import { StyleSheet } from 'react-native'
import { ApplicationStyles } from '../../Themes/'
export default StyleSheet.create({
...ApplicationStyles.screen
})
import { createAppContainer } from 'react-navigation'
import RegisterScreen from '../Containers/RegisterScreen'
import LoginScreen from '../Containers/LoginScreen'
import WishlistScreen from '../Containers/WishlistScreen'
import NotificationScreen from '../Containers/NotificationScreen'
import HomeBottomTabScreen from '../Containers/HomeBottomTabScreen'
......@@ -14,8 +12,6 @@ import HomeNavigation from './HomeNavigation'
// Manifest of possible screens
const PrimaryNav = createStackNavigator({
RegisterScreen: { screen: RegisterScreen },
LoginScreen: { screen: LoginScreen },
WishlistScreen: { screen: WishlistScreen },
NotificationScreen: { screen: NotificationScreen },
HomeBottomTabScreen: { screen: HomeBottomTabScreen },
......
import { createReducer, createActions } from 'reduxsauce'
import Immutable from 'seamless-immutable'
/* ------------- Types and Action Creators ------------- */
const { Types, Creators } = createActions({
authRequest: ['data'],
authSuccess: ['payload'],
authFailure: null
})
export const AuthTypes = Types
export default Creators
/* ------------- Initial State ------------- */
export const INITIAL_STATE = Immutable({
data: null,
fetching: null,
payload: null,
error: null
})
/* ------------- Selectors ------------- */
export const AuthSelectors = {
getData: state => state.data
}
/* ------------- Reducers ------------- */
// request the data from an api
export const request = (state, { data }) =>
state.merge({ fetching: true, data, payload: null })
// successful api lookup
export const success = (state, action) => {
const { payload } = action
return state.merge({ fetching: false, error: null, payload })
}
// Something went wrong somewhere.
export const failure = state =>
state.merge({ fetching: false, error: true, payload: null })
/* ------------- Hookup Reducers To Types ------------- */
export const reducer = createReducer(INITIAL_STATE, {
[Types.AUTH_REQUEST]: request,
[Types.AUTH_SUCCESS]: success,
[Types.AUTH_FAILURE]: failure
})
......@@ -8,8 +8,7 @@ import ReduxPersist from '../Config/ReduxPersist'
export const reducers = combineReducers({
nav: require('./NavigationRedux').reducer,
github: require('./GithubRedux').reducer,
search: require('./SearchRedux').reducer,
auth: require('./AuthRedux').reducer,
search: require('./SearchRedux').reducer
})
export default () => {
......
/* ***********************************************************
* A short word on how to use this automagically generated file.
* We're often asked in the Infinite Red Slack channel how to connect
* to a to a third party api, so we thought we'd demonstrate - but
* you should know you can use sagas for other flow control too.
*
* Other points:
* - You'll need to add this saga to sagas/index.js
* - This template uses the api declared in sagas/index.js, so
* you'll need to define a constant in that file.
*************************************************************/
import { call, put } from 'redux-saga/effects'
import AuthActions from '../Redux/AuthRedux'
// import { AuthSelectors } from '../Redux/AuthRedux'
export function * getAuth (api, action) {
const { data } = action
// get current data from Store
// const currentData = yield select(AuthSelectors.getData)
// make the call to the api
const response = yield call(api.getauth, data)
// success?
if (response.ok) {
// You might need to change the response here - do this with a 'transform',
// located in ../Transforms/. Otherwise, just pass the data back from the api.
yield put(AuthActions.authSuccess(response.data))
} else {
yield put(AuthActions.authFailure())
}
}
......@@ -7,12 +7,12 @@ import DebugConfig from '../Config/DebugConfig'
import { StartupTypes } from '../Redux/StartupRedux'
import { GithubTypes } from '../Redux/GithubRedux'
import { AuthTypes } from '../Redux/AuthRedux'
/* ------------- Sagas ------------- */
import { startup } from './StartupSagas'
import { getUserAvatar } from './GithubSagas'
import { getAuth } from './AuthSagas'
/* ------------- API ------------- */
// The API we use is only used from Sagas, so we create it here and pass along
......@@ -27,7 +27,6 @@ export default function * root () {
takeLatest(StartupTypes.STARTUP, startup),
// some sagas receive extra parameters in addition to an action
takeLatest(GithubTypes.USER_REQUEST, getUserAvatar, api),
takeLatest(AuthTypes.AUTH_REQUEST, getAuth, api)
takeLatest(GithubTypes.USER_REQUEST, getUserAvatar, api)
])
}
# eCartProCustomer
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
//How to run
npm i -> react-native run-android
* Standard compliant React Native App Utilizing [Ignite](https://github.com/infinitered/ignite)
//How to create screen
npx ignite-cli g screen <ScreenName>
## :arrow_up: How to Setup
//How to create redux
npx ignite-cli g redux <ReduxName>
**Step 1:** git clone this repo:
//How to create saga
npx ignite-cli g saga <SagasName>
\ No newline at end of file
**Step 2:** cd to the cloned repo:
**Step 3:** Install the Application with `yarn` or `npm i`
## :arrow_forward: How to Run App
1. cd to the repo
2. Run Build for either OS
* for iOS
* run `npx react-native run-ios`
* for Android
* Run Genymotion
* run `npx react-native run-android`
## :no_entry_sign: Standard Compliant
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
This project adheres to Standard. Our CI enforces this, so we suggest you enable linting to keep your project compliant during development.
**To Lint on Commit**
This is implemented using [husky](https://github.com/typicode/husky). There is no additional setup needed.
**Bypass Lint**
If you have to bypass lint for a special commit that you will come back and clean (pushing something to a branch etc.) then you can bypass git hooks with adding `--no-verify` to your commit command.
**Understanding Linting Errors**
The linting rules are from JS Standard and React-Standard. [Regular JS errors can be found with descriptions here](http://eslint.org/docs/rules/), while [React errors and descriptions can be found here](https://github.com/yannickcr/eslint-plugin-react).
## :closed_lock_with_key: Secrets
This project uses [react-native-config](https://github.com/luggit/react-native-config) to expose config variables to your javascript code in React Native. You can store API keys
and other sensitive information in a `.env` file:
```
API_URL=https://myapi.com
GOOGLE_MAPS_API_KEY=abcdefgh
```
and access them from React Native like so:
```
import Secrets from 'react-native-config'
Secrets.API_URL // 'https://myapi.com'
Secrets.GOOGLE_MAPS_API_KEY // 'abcdefgh'
```
The `.env` file is ignored by git keeping those secrets out of your repo.
### Get started:
1. Copy .env.example to .env
2. Add your config variables
3. Follow instructions at [https://github.com/luggit/react-native-config#setup](https://github.com/luggit/react-native-config#setup)
4. Done!
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment