Skip to content

Commit adf503e

Browse files
committed
added CosyncJWT ReactNative Expo
1 parent 1fa6f56 commit adf503e

File tree

25 files changed

+11150
-0
lines changed

25 files changed

+11150
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
24+
# Android/IntelliJ
25+
#
26+
build/
27+
.idea
28+
.gradle
29+
local.properties
30+
*.iml
31+
32+
# node.js
33+
#
34+
node_modules/
35+
npm-debug.log
36+
yarn-error.log
37+
38+
# BUCK
39+
buck-out/
40+
\.buckd/
41+
*.keystore
42+
!debug.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/
60+
61+
# @generated expo-cli sync-e7dcf75f4e856f7b6f3239b3f3a7dd614ee755a8
62+
# The following patterns were generated by expo-cli
63+
64+
# OSX
65+
#
66+
.DS_Store
67+
68+
# Xcode
69+
#
70+
build/
71+
*.pbxuser
72+
!default.pbxuser
73+
*.mode1v3
74+
!default.mode1v3
75+
*.mode2v3
76+
!default.mode2v3
77+
*.perspectivev3
78+
!default.perspectivev3
79+
xcuserdata
80+
*.xccheckout
81+
*.moved-aside
82+
DerivedData
83+
*.hmap
84+
*.ipa
85+
*.xcuserstate
86+
project.xcworkspace
87+
88+
# Android/IntelliJ
89+
#
90+
build/
91+
.idea
92+
.gradle
93+
local.properties
94+
*.iml
95+
*.hprof
96+
97+
# node.js
98+
#
99+
node_modules/
100+
npm-debug.log
101+
yarn-error.log
102+
103+
# BUCK
104+
buck-out/
105+
\.buckd/
106+
*.keystore
107+
!debug.keystore
108+
109+
# Bundle artifacts
110+
*.jsbundle
111+
112+
# CocoaPods
113+
/ios/Pods/
114+
115+
# Expo
116+
.expo/
117+
web-build/
118+
dist/
119+
120+
# @end expo-cli
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// App.js
3+
// CosyncJWT
4+
//
5+
// Licensed to the Apache Software Foundation (ASF) under one
6+
// or more contributor license agreements. See the NOTICE file
7+
// distributed with this work for additional information
8+
// regarding copyright ownership. The ASF licenses this file
9+
// to you under the Apache License, Version 2.0 (the
10+
// "License"); you may not use this file except in compliance
11+
// with the License. You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing,
16+
// software distributed under the License is distributed on an
17+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18+
// KIND, either express or implied. See the License for the
19+
// specific language governing permissions and limitations
20+
// under the License.
21+
//
22+
// Created by Tola Voeung.
23+
// Copyright © 2022 cosync. All rights reserved.
24+
//
25+
26+
27+
28+
import { useContext } from 'react';
29+
import { StatusBar } from 'expo-status-bar';
30+
import { NavigationContainer } from '@react-navigation/native';
31+
import AppStack from './route/AppStack';
32+
import AuthStack from './route/AuthStack'
33+
import AuthContextProvider, {AuthContext} from './store/auth-context';
34+
35+
36+
function Navigation(){
37+
38+
const authCtx = useContext(AuthContext)
39+
40+
return(
41+
<NavigationContainer>
42+
{!authCtx.isAuthenticated && <AuthStack /> }
43+
{authCtx.isAuthenticated && <AppStack /> }
44+
</NavigationContainer>
45+
)
46+
47+
}
48+
49+
export default function App() {
50+
51+
return (
52+
<>
53+
<StatusBar style='light' />
54+
55+
<AuthContextProvider>
56+
<Navigation />
57+
</AuthContextProvider>
58+
</>
59+
);
60+
}
61+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"expo": {
3+
"name": "ExpoCosyncJWT",
4+
"slug": "ExpoCosyncJWT",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"splash": {
9+
"image": "./assets/cosynclogo.png",
10+
"resizeMode": "contain",
11+
"backgroundColor": "#ffffff"
12+
},
13+
"updates": {
14+
"fallbackToCacheTimeout": 0
15+
},
16+
"assetBundlePatterns": [
17+
"**/*"
18+
],
19+
"ios": {
20+
"supportsTablet": true,
21+
"bundleIdentifier": "CosyncJWTExpo"
22+
},
23+
"android": {
24+
"adaptiveIcon": {
25+
"foregroundImage": "./assets/adaptive-icon.png",
26+
"backgroundColor": "#FFFFFF"
27+
}
28+
},
29+
"web": {
30+
"favicon": "./assets/favicon.png"
31+
}
32+
}
33+
}
17.1 KB
Loading
6.25 KB
Loading
1.43 KB
Loading
21.9 KB
Loading
46.2 KB
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const pak = require('./package.json');
2+
3+
module.exports = function(api) {
4+
api.cache(true);
5+
return {
6+
presets: ['babel-preset-expo'],
7+
plugins: ['react-native-reanimated/plugin'],
8+
};
9+
};
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//
2+
// Loader.js
3+
// CosyncJWT
4+
//
5+
// Licensed to the Apache Software Foundation (ASF) under one
6+
// or more contributor license agreements. See the NOTICE file
7+
// distributed with this work for additional information
8+
// regarding copyright ownership. The ASF licenses this file
9+
// to you under the Apache License, Version 2.0 (the
10+
// "License"); you may not use this file except in compliance
11+
// with the License. You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing,
16+
// software distributed under the License is distributed on an
17+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18+
// KIND, either express or implied. See the License for the
19+
// specific language governing permissions and limitations
20+
// under the License.
21+
//
22+
// Created by Tola Voeung.
23+
// Copyright © 2022 cosync. All rights reserved.
24+
//
25+
26+
//Import React and Hook we needed
27+
import React from 'react';
28+
29+
//Import all required component
30+
import { StyleSheet, View, Modal, ActivityIndicator } from 'react-native';
31+
32+
const Loader = props => {
33+
const { loading, ...attributes } = props;
34+
35+
return (
36+
<Modal
37+
transparent={true}
38+
animationType={'none'}
39+
visible={loading}
40+
>
41+
<View style={styles.modalBackground}>
42+
<View style={styles.activityIndicatorWrapper}>
43+
<ActivityIndicator animating={loading} />
44+
</View>
45+
</View>
46+
</Modal>
47+
);
48+
};
49+
export default Loader;
50+
51+
const styles = StyleSheet.create({
52+
modalBackground: {
53+
flex: 1,
54+
alignItems: 'center',
55+
flexDirection: 'column',
56+
justifyContent: 'space-around',
57+
backgroundColor: '#00000040',
58+
},
59+
activityIndicatorWrapper: {
60+
backgroundColor: '#FFFFFF',
61+
height: 100,
62+
width: 100,
63+
borderRadius: 10,
64+
display: 'flex',
65+
alignItems: 'center',
66+
justifyContent: 'space-around',
67+
},
68+
});

0 commit comments

Comments
 (0)