Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions template/generators/redux/saga.js.hbs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {AnyAction} from 'redux'
import {takeLatest, call, put} from 'redux-saga/effects'
import {appActions, {{camelCase name}}Actions} from '../reducers'
import {Toast} from '../../components'
import {showToast} from '../../components'

function* {{camelCase name}}Saga(action: any): IterableIterator<AnyAction> {
try {
yield put(appActions.setShowGlobalIndicator(true))
// TODO:
} catch (e) {
if (e instanceof Error) {
Toast.error(e.message)
showToast({type: 'ERROR', message: e.message})
}
} finally {
yield put(appActions.setShowGlobalIndicator(false))
Expand Down
2 changes: 1 addition & 1 deletion template/src/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function MainLayout() {
}, [])

useEffect(() => {
if (appState === RouteKey.MainStack) {
if (appState === RouteKey.HomeStack) {
handleAppState()
handleDeepLink()
}
Expand Down
5 changes: 2 additions & 3 deletions template/src/components/Row.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, {ReactElement} from 'react'
import React, {PropsWithChildren} from 'react'
import {View, StyleSheet, StyleProp, ViewStyle} from 'react-native'

interface IRowProps {
children: ReactElement
interface IRowProps extends PropsWithChildren {
style?: StyleProp<ViewStyle>
}

Expand Down
4 changes: 2 additions & 2 deletions template/src/constants/configs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import packageJSON from '../../package.json'
import {getBundleId} from 'react-native-device-info'

const AppEnv = {
DEV: 'dev',
DEV: 'development',
STAGING: 'staging',
PRODUCTION: 'production',
}

const configs = {
appBundleID: getBundleId(),
appVersion: packageJSON.version,
APP_ENV: RNConfig.APP_ENV || 'dev',
APP_ENV: RNConfig.APP_ENV || 'development',
DEBUG_ENABLED: RNConfig.APP_ENV !== AppEnv.PRODUCTION,
API_URL: RNConfig.API_URL,
buildEvn: RNConfig.APP_ENV,
Expand Down
1 change: 0 additions & 1 deletion template/src/navigation/RouteKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export enum RouteKey {

/** Stack */
AuthStack = 'AuthStack',
MainStack = 'MainStack',
HomeStack = 'HomeStack',

/** Tab */
Expand Down
8 changes: 4 additions & 4 deletions template/src/store/saga/user.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {AnyAction} from 'redux'
import {delay, put, takeLatest} from 'redux-saga/effects'
import {Toast} from '../../components'
import {showToast} from '../../components'
import RouteKey from '../../navigation/RouteKey'
import {appActions, userActions} from '../reducers'

Expand All @@ -9,10 +9,10 @@ function* userLoginSaga(): IterableIterator<AnyAction> {
yield put(appActions.setShowGlobalIndicator(true))
// TODO: login login
yield delay(1000)
yield put(appActions.setAppStack(RouteKey.MainStack))
yield put(appActions.setAppStack(RouteKey.HomeStack))
} catch (e) {
if (e instanceof Error) {
Toast.error(e.message)
showToast({type: 'ERROR', message: e.message})
}
yield put(appActions.setAppStack(RouteKey.AuthStack))
} finally {
Expand All @@ -25,7 +25,7 @@ function* userSignUpSaga(): IterableIterator<AnyAction> {
yield put(appActions.setShowGlobalIndicator(true))
} catch (e) {
if (e instanceof Error) {
Toast.error(e.message)
showToast({type: 'ERROR', message: e.message})
}
} finally {
yield put(appActions.setShowGlobalIndicator(false))
Expand Down
Loading