This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect } from 'react' | |
import { Text } from 'react-native' | |
import PropTypes from 'prop-types' | |
import DefaultPage from '../../components/DefaultPage' | |
const SceneSplash = ({ navigation }) => { | |
useEffect(() => { | |
setTimeout(() => { | |
navigation.navigate('Login') | |
}, 2000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const USER = '[USER]' | |
export const USER_LOGIN = `${USER} Set user as logged in` | |
export const USER_LOGOUT = `${USER} Set user as logged out` | |
export const userLogin = ({ name }) => ({ | |
type: USER_LOGIN, | |
payload: { | |
name, | |
}, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { USER_LOGIN, USER_LOGOUT } from '../actions/user.actions' | |
const initialState = { | |
isLoggedIn: false, | |
} | |
const userReducer = (state = initialState, action) => { | |
switch (action.type) { | |
case USER_LOGIN: { | |
const { name } = action.payload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
import { Text, TextInput, Button } from 'react-native' | |
import { connect } from 'react-redux' | |
import PropTypes from 'prop-types' | |
import DefaultPage from '../../components/DefaultPage' | |
import { userLogin } from '../../redux/actions/user.actions' | |
const SceneLogin = ({ loginUser, isUserLoggedIn, storedUserName }) => { | |
const [name, setName] = useState('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { USER_LOGIN } from '../../actions/user.actions' | |
import * as RootNavigation from '../../../navigation/RootNavigation' | |
const fakeLoginCheck = () => true // It's an older code, sir, but it checks out. | |
const userMiddleware = () => (next) => (action) => { | |
if (action.type === USER_LOGIN) { | |
if (fakeLoginCheck()) { | |
next(action) // continue with the login |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { Text, Button } from 'react-native' | |
import PropTypes from 'prop-types' | |
import DefaultPage from '../../components/DefaultPage' | |
const SceneHome = ({ navigation }) => ( | |
<DefaultPage> | |
<Text> | |
Home | |
</Text> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { Button, Text } from 'react-native' | |
import PropTypes from 'prop-types' | |
import DefaultPage from '../../components/DefaultPage' | |
const SceneSettings = ({ navigation }) => ( | |
<DefaultPage> | |
<Text> | |
Settings | |
</Text> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { TouchableWithoutFeedback, StyleSheet, View } from 'react-native' | |
import PropTypes from 'prop-types' | |
const TouchableWrapper = ({ handlePress, children }) => ( | |
<TouchableWithoutFeedback | |
style={styles.touchableWrapper} | |
onPress={() => handlePress()} | |
> | |
<View style={styles.touchableWrapperHelper}> |