Skip to content

Instantly share code, notes, and snippets.

Avatar

AllGistsEqual

View GitHub Profile
View rng-starter_sceneDataCheck_01.jsx
import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { Text, StyleSheet } from 'react-native'
import BackgroundPage from '../../components/global/layout/BackgroundPage'
import { initialiseApplication } from '../../redux/actions/application.actions'
import background from '../../../assets/bg_abstract_01.jpg'
const SceneDataCheck = ({ initApp }) => {
const [timestamp] = useState(Date.now())
View rng-starter_application.middleware_01.js
import {
INIT_APPLICATION,
} from '../../actions/application.actions'
import manifest from '../../../../app.json'
const { expo: { name, version: manifestVersion } } = manifest
const applicationMiddleware = ({ getState }) => (next) => (action) => {
switch (action.type) {
case INIT_APPLICATION: {
View rng-starter_sceneGameHome.jsx
import React from 'react'
import { View, StyleSheet } from 'react-native'
import PropTypes from 'prop-types'
import BackgroundPage from '../../components/global/layout/BackgroundPage'
import RockPaperScissorsLizardSpock from '../../components/other/RockPaperScissorsLizardSpock'
import IconButton from '../../components/global/ui/IconButton'
import backgroundImage from '../../../assets/bg_abstract_02.jpg'
const SceneGameHome = ({ navigation }) => (
<BackgroundPage background={backgroundImage}>
View rng-starter_IconButton.jsx
import React from 'react'
import PropTypes from 'prop-types'
import {
StyleSheet,
Text,
View,
TouchableOpacity,
} from 'react-native'
const IconButton = ({
View rng-starter_SceneHome_02.jsx
import React from 'react'
import { Image, StyleSheet } from 'react-native'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { userLogout } from '../../redux/actions/user.actions'
import TextButton from '../../components/global/ui/TextButton'
import BackgroundPage from '../../components/global/layout/BackgroundPage'
import backgroundImage from '../../../assets/bg_abstract_02.jpg'
import logo from '../../../assets/game_logo.png'
View rng-starter_SceneSplash_03.jsx
// ...
import { connect } from 'react-redux' // #1 grab connect from react-redux
// ...
const SceneSplash = ({ isUserLoggedIn, navigation }) => {
const navigationTarget = isUserLoggedIn ? 'Home' : 'Login' // #2 determine path
useFocusEffect(
useCallback(() => {
const delayedNavigation = setTimeout(() => {
View rng-starter_store_02.js
import { applyMiddleware, createStore } from 'redux'
import { persistStore, persistReducer } from 'redux-persist'
import { AsyncStorage } from 'react-native'
import rootReducer from './reducers/rootReducer'
import middleware from './middleware'
const persistConfig = {
key: 'root',
storage: AsyncStorage,
}
View rng-starter_App_02.js
import React from 'react';
import { StatusBar } from 'react-native'
import { Provider } from 'react-redux'
import { PersistGate } from 'redux-persist/integration/react'
import { enableScreens } from 'react-native-screens'
import store, { persistor } from './src/redux/store'
import Navigation from './src/navigation'
import SceneAppLoading from './src/scenes/auth/sceneAppLoading'
enableScreens()
View rng-starter_SceneLogin_02.jsx
import React, { useState } from 'react'
import {
View, Text, TextInput, StyleSheet,
} from 'react-native'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { userLogin } from '../../redux/actions/user.actions'
import BackgroundPage from '../../components/global/layout/BackgroundPage'
import backgroundImage from '../../../assets/bg_abstract_01.jpg'
import TextButton from '../../components/global/ui/TextButton'
View rng-starter_TextButton.jsx
import React from 'react'
import PropTypes from 'prop-types'
import {
StyleSheet,
Text,
View,
TouchableOpacity,
} from 'react-native'
const TextButton = ({