Skip to content

Commit f1d76a5

Browse files
committed
first commit
0 parents  commit f1d76a5

24 files changed

+8537
-0
lines changed

.expo-shared/assets.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"f9155ac790fd02fadcdeca367b02581c04a353aa6d5aa84409a59f6804c87acd": true,
3+
"89ed26367cdb9b771858e026f2eb95bfdb90e5ae943e716575327ec325f39c44": true
4+
}

.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules/**/*
2+
.expo/*
3+
npm-debug.*
4+
*.jks
5+
*.p8
6+
*.p12
7+
*.key
8+
*.mobileprovision
9+
*.orig.*
10+
web-build/
11+
web-report/
12+
13+
# macOS
14+
.DS_Store

API.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
base: "https://my-json-server.typicode.com/TARTIGA/DATABASE",
3+
auth: "/auth",
4+
refresh: '/refresh'
5+
6+
}

App.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React, { useState } from 'react'
2+
import { AutorizationScreen, HomeScreen } from './screens'
3+
import { NavigationContainer } from '@react-navigation/native';
4+
import { createStackNavigator } from '@react-navigation/stack';
5+
import { Provider } from 'react-redux';
6+
import store from './store'
7+
8+
const AuthStack = createStackNavigator();
9+
const AppStack = createStackNavigator();
10+
const RootStack = createStackNavigator();
11+
12+
13+
import { connect } from 'react-redux';
14+
15+
//don`t use expressions
16+
const AppStackScreen = () =>
17+
<AppStack.Navigator >
18+
<AppStack.Screen name="Home" component={HomeScreen} />
19+
</AppStack.Navigator>
20+
21+
const AuthStackScreen = () =>
22+
<AuthStack.Navigator >
23+
<AuthStack.Screen name="Authorization" component={AutorizationScreen} options={{
24+
headerShown: false
25+
}} />
26+
</AuthStack.Navigator>
27+
28+
const RootStackScreen = ({ userToken }) =>
29+
<RootStack.Navigator headerMode="none">
30+
{userToken ?
31+
<RootStack.Screen name="App" component={AppStackScreen} /> :
32+
<RootStack.Screen name="Auth" component={AuthStackScreen} />}
33+
</RootStack.Navigator>
34+
35+
36+
const App = () => {
37+
return (
38+
<Provider store={store}>
39+
<NavigationContainer>
40+
<RootStackScreen />
41+
</NavigationContainer>
42+
</Provider>
43+
);
44+
}
45+
46+
export default App;

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# React Native Authorization
2+
3+
### Simple Authorization React Native Project
4+
5+
![](/assets/auth_page_layout.png?raw=true 'React Native Authorization Layout')

app.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"expo": {
3+
"name": "React Native Redux-Auth Template",
4+
"slug": "ReactNativeReduxAutorization",
5+
"privacy": "public",
6+
"sdkVersion": "36.0.0",
7+
"platforms": [
8+
"ios",
9+
"android",
10+
"web"
11+
],
12+
"version": "1.0.0",
13+
"orientation": "portrait",
14+
"icon": "./assets/icon.png",
15+
"splash": {
16+
"image": "./assets/splash.png",
17+
"resizeMode": "contain",
18+
"backgroundColor": "#ffffff"
19+
},
20+
"updates": {
21+
"fallbackToCacheTimeout": 0
22+
},
23+
"assetBundlePatterns": [
24+
"**/*"
25+
],
26+
"ios": {
27+
"supportsTablet": true
28+
}
29+
}
30+
}

assets/auth_page_layout.png

50.6 KB
Loading

assets/icon.png

1.07 KB
Loading

assets/splash.png

7.01 KB
Loading

assets/waterfall.svg

+200
Loading

babel.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function(api) {
2+
api.cache(true);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
};
6+
};

components/Button.jsx

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react'
2+
import styled from 'styled-components/native';
3+
//Use Theme Context here
4+
import theme from '../theme'
5+
6+
const Button = ({ children, bgColor, width, handler, disabled }) => {
7+
return (
8+
<ButtonContainer bgColor={bgColor} width={width} disabled={disabled}>
9+
<ButtonInside onPress={handler} disabled={disabled}>
10+
<ButtonText>{children}</ButtonText>
11+
</ButtonInside>
12+
</ButtonContainer>
13+
)
14+
}
15+
Button.defaultProps = {
16+
event: null,
17+
bgColor: theme.palette.primary.main,
18+
width: '100%',
19+
disabled: false
20+
}
21+
22+
const ButtonContainer = styled.View`
23+
background:${props => props.bgColor};
24+
height:45px;
25+
border-radius:30px;
26+
width:${props => props.width};
27+
margin-top:20px;
28+
opacity:${props => props.disabled ? 0.5 : 1};
29+
`;
30+
31+
const ButtonInside = styled.TouchableOpacity`
32+
flex:1;
33+
justify-content:center;
34+
align-items:center;
35+
`;
36+
37+
const ButtonText = styled.Text`
38+
color:#fff;
39+
font-weight:500;
40+
font-size:16px;
41+
`;
42+
43+
export default Button;

0 commit comments

Comments
 (0)