Commit caa73f16 by atichat

Initial commit

parents
{
"0cae4d70c6df3e5e96ee8b5c442b59d55c8ab8deb466992ab9abc523822f2a1b": true,
"e997a5256149a4b76e6bfd6cbf519c5e5a0f1d278a3d8fa1253022b03c90473b": true,
"af683c96e0ffd2cf81287651c9433fa44debc1220ca7cb431fe482747f34a505": true,
"e7fc0741cc6562975a990e3d9ef820571588dab20aba97032df9f00caa9cd57a": true
}
\ No newline at end of file
node_modules/**/*
.expo/*
npm-debug.*
*.jks
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
web-report/
{
"printWidth": 120,
"trailingComma": "es5",
"tabWidth": 4,
"singleQuote": true,
"jsxBracketSameLine": true,
"useTabs": true
}
import { AppLoading } from 'expo'
import * as Font from 'expo-font'
import React, { useState } from 'react'
import { Ionicons } from '@expo/vector-icons'
import AppRouter from './src/navigation/AppRouter'
const loadResourcesAsync = async () => {
await Promise.all([
// Asset.loadAsync([require('./src/assets/images/robot-dev.png'), require('./src/assets/images/robot-prod.png')]),
Font.loadAsync({
Roboto: require('native-base/Fonts/Roboto.ttf'),
Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
...Ionicons.font,
// We include SpaceMono because we use it in HomeScreen.js. Feel free to
// remove this if you are not using it in your app
// 'space-mono': require('./src/assets/fonts/SpaceMono-Regular.ttf'),
}),
])
}
const handleLoadingError = (error: Error) => {
// In this case, you might want to report the error to your error reporting
// service, for example Sentry
console.warn(error)
}
const handleFinishLoading = setLoadingComplete => {
setLoadingComplete(true)
}
const Application = props => {
const [isLoadingComplete, setLoadingComplete] = useState(false)
if (!isLoadingComplete && !props.skipLoadingScreen) {
return (
<AppLoading
startAsync={loadResourcesAsync}
onError={handleLoadingError}
onFinish={() => handleFinishLoading(setLoadingComplete)}
/>
)
} else {
return <AppRouter />
}
}
export default Application
{
"expo": {
"name": "Safetcut-app",
"slug": "safetcut-app",
"privacy": "unlisted",
"sdkVersion": "33.0.0",
"platforms": ["ios", "android"],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./src/assets/images/icon.png",
"splash": {
"image": "./src/assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"primaryColor": "#ffffff"
}
}
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/samples": "~3.0.0",
"@expo/vector-icons": "^10.0.1",
"expo": "^33.0.0",
"expo-asset": "^5.0.0",
"expo-constants": "^5.0.0",
"expo-font": "^5.0.0",
"expo-linear-gradient": "~5.0.1",
"expo-web-browser": "^5.0.0",
"native-base": "^2.1.1",
"react": "^16.8.3",
"react-dom": "^16.8.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"react-native-animatable": "^1.3.2",
"react-native-elements": "^1.1.0",
"react-native-gesture-handler": "^1.2.1",
"react-native-router-flux": "^3.38.0",
"react-native-vector-icons": "^6.5.0",
"react-native-web": "^0.11.4",
"react-navigation": "^3.11.0",
"react-navigation-redux-helpers": "^3.0.2",
"react-redux": "^5.0.3",
"redux": "^3.6.0",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"babel-eslint": "^10.0.2",
"babel-preset-expo": "^5.1.0",
"jest-expo": "^33.0.0"
},
"private": true
}
import React, { useState } from 'react';
import { Container, Header, Footer } from 'native-base';
const LayoutComponent = props => {
return (
<Container>
<Header transparent />
{props.children}
<Footer />
</Container>
);
};
export default LayoutComponent;
const tintColor = '#2f95dc';
export default {
tintColor,
tabIconDefault: '#ccc',
tabIconSelected: tintColor,
tabBar: '#fefefe',
errorBackground: 'red',
errorText: '#fff',
warningBackground: '#EAEB5E',
warningText: '#666804',
noticeBackground: tintColor,
noticeText: '#fff',
};
import { Dimensions } from 'react-native';
const width = Dimensions.get('window').width;
const height = Dimensions.get('window').height;
export default {
window: {
width,
height,
},
isSmallDevice: width < 375,
};
import React, { Component } from 'react'
import { Router, Scene } from 'react-native-router-flux'
import { Provider } from 'react-redux'
import store from '../store'
import PageOne from '../screens/private/pageOne'
import PageTwo from '../screens/private/pageTwo'
class AppRouter extends Component {
render() {
return (
<Provider store={store}>
<Router hideNavBar>
<Scene key="root">
<Scene key="pageOne" component={PageOne} initial={true} />
<Scene key="pageTwo" component={PageTwo} />
</Scene>
</Router>
</Provider>
)
}
}
export default AppRouter
import React, { Component } from 'react'
import { Container, Content, Text, Card, Header, Body, Button, Title, CardItem } from 'native-base'
import { Actions } from 'react-native-router-flux'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { increment, decrement } from '../../store/actions'
class pageOne extends Component {
render() {
console.log(this.props)
return (
<Container>
<Header>
<Body>
<Title>{this.props.sceneKey}</Title>
</Body>
</Header>
<Content padder>
<Card>
<CardItem>
<Body>
<Text>This is Page One, Press button to goto page two </Text>
</Body>
</CardItem>
</Card>
<Button
dark
bordered
onPress={() => {
Actions.pageTwo()
}}>
<Text>Goto Page 2</Text>
</Button>
<Card>
<CardItem>
<Text style={{ fontSize: 20, fontWeight: 'bold' }}>{this.props.count}</Text>
</CardItem>
</Card>
<Button dark bordered onPress={() => this.props.increment()}>
<Text>Increment</Text>
</Button>
<Button dark bordered onPress={() => this.props.decrement()}>
<Text>Decrement</Text>
</Button>
</Content>
</Container>
)
}
}
const mapStateToProps = state => {
return {
count: state.count,
}
}
const mapDispatchToProps = { increment, decrement }
export default connect(
mapStateToProps,
mapDispatchToProps
)(pageOne)
import React, { Component } from 'react'
import { Container, Content, Text, Card, Header, Body, Button, Title, CardItem } from 'native-base'
import { Actions } from 'react-native-router-flux'
class pageTwo extends Component {
render() {
// console.log(this.props)
return (
<Container>
<Header>
<Body>
<Title>PageTwo</Title>
</Body>
</Header>
<Content padder>
<Card>
<CardItem>
<Body>
<Text>This is Page Two, Press button to goto page one</Text>
</Body>
</CardItem>
</Card>
<Button
dark
bordered
style={{ alignSelf: 'center', margin: 30 }}
onPress={() => {
Actions.pop()
}}>
<Text>Goto Page 1</Text>
</Button>
</Content>
</Container>
)
}
}
export default pageTwo
export function increment(){
return{
type: "Increment"
};
}
export function decrement(){
return{
type: "Decrement"
};
}
import allReducers from './reducers'
import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
export default (store = createStore(allReducers, applyMiddleware(thunk)))
let count = 0;
export default function(state = count, action) {
switch (action.type) {
case 'Increment':
count++;
break;
case 'Decrement':
count--;
break;
}
return count;
}
import { combineReducers } from 'redux'
import routes from './routes'
import countReducer from './countReducer.js'
export default combineReducers({
// routes,
count: countReducer,
// ... other reducers
})
import { ActionConst } from 'react-native-router-flux'
const initialState = {
scene: {},
}
export default (state = initialState, action = {}) => {
switch (action.type) {
// focus action is dispatched when a new screen comes into focus
case ActionConst.FOCUS:
console.log(action)
return {
...state,
scene: action.scene,
}
// ...other actions
default:
return state
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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