Skip to content

Commit b7e92f2

Browse files
committed
Activity Nav
1 parent fc88e45 commit b7e92f2

File tree

5 files changed

+29
-22
lines changed

5 files changed

+29
-22
lines changed

App/App.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import React, {Component} from "react";
2-
import {Platform, StatusBar, StyleSheet, SafeAreaView, AppRegistry} from 'react-native';
2+
import {Platform, StatusBar, StyleSheet, AppRegistry} from 'react-native';
33
import { createRootNavigator } from "./navigation/Navigation";
44
import { isSignedIn } from "./auth/Auth";
55
import { SaveCourse } from "./functions/functions";
6+
import { SafeAreaView } from 'react-navigation';
7+
import { SafeAreaProvider } from 'react-native-safe-area-context';
8+
9+
610

711
export default class App extends Component {
812
constructor(props) {
@@ -24,19 +28,18 @@ export default class App extends Component {
2428
// return (
2529
// <SaveCourse/>
2630
// );
27-
const { checkedSignIn, signedIn } = this.state;
31+
let { checkedSignIn, signedIn } = this.state;
2832

2933
// If we haven't checked AsyncStorage yet, don't render anything (better ways to do this)
3034
if (!checkedSignIn) {
3135
return null;
3236
}
33-
37+
signedIn = true;
3438
const Layout = createRootNavigator(signedIn);
3539
return (
36-
<SafeAreaView style={styles.droidSafeArea}>
40+
<SafeAreaProvider>
3741
<Layout />
38-
</SafeAreaView>
39-
42+
</SafeAreaProvider>
4043
);
4144
}
4245
}

App/navigation/Navigation.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ import { Platform, StatusBar } from "react-native";
33
import { createStackNavigator } from 'react-navigation-stack';
44
import { createSwitchNavigator,createAppContainer } from 'react-navigation';
55
import createBottomTabNavigator from "react-navigation-tabs/src/navigators/createBottomTabNavigator";
6-
7-
86
import LoginScreen from '../view/Login';
97
import InscriptionScreen from '../view/Inscription';
10-
import ForgotPasswordScreen from '../view/ForgotPassword';
118
import Activity from "../view/Activity";
129
import Home from '../view/Home'
1310
import Icon from "react-native-vector-icons/FontAwesome5";
@@ -37,23 +34,23 @@ export const SignedOut = createAppContainer(createStackNavigator({
3734

3835
export const SignedIn = createAppContainer(createBottomTabNavigator(
3936
{
40-
Activités: {
37+
Courses: {
4138
screen: Activity,
4239
navigationOptions: {
4340
tabBarIcon: ({ tintColor }) => (
4441
<Icon name="list" size={25} color={tintColor} />
4542
)
4643
}
4744
},
48-
Course: {
45+
Activité: {
4946
screen: Home,
5047
navigationOptions: {
5148
tabBarIcon: ({ tintColor }) => (
5249
<Icon name="walking" size={25} color={tintColor} />
5350
)
5451
}
5552
},
56-
Profile: {
53+
Profil: {
5754
screen: Home,
5855
navigationOptions: {
5956
tabBarIcon: ({ tintColor }) => (
@@ -63,7 +60,7 @@ export const SignedIn = createAppContainer(createBottomTabNavigator(
6360
},
6461
},
6562
{
66-
initialRouteName: 'Course',
63+
initialRouteName: 'Activité',
6764
tabBarOptions: {
6865
style: {
6966
activeTintColor: '#2C5077'

App/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@fortawesome/fontawesome-svg-core": "^1.2.27",
1414
"@fortawesome/free-solid-svg-icons": "^5.12.1",
1515
"@fortawesome/react-native-fontawesome": "^0.1.0",
16+
"@react-native-community/masked-view": "0.1.5",
1617
"@react-navigation/material-bottom-tabs": "^5.0.0-alpha.36",
1718
"@react-navigation/native": "latest",
1819
"@react-navigation/stack": "^5.2.8",
@@ -40,6 +41,8 @@
4041
"react-native-material-bottom-navigation": "^1.0.5",
4142
"react-native-paper": "^3.5.1",
4243
"react-native-reanimated": "~1.4.0",
44+
"react-native-safe-area-context": "^0.6.0",
45+
"react-native-safe-area-view": "^1.0.0",
4346
"react-native-scl-alert": "^1.2.1",
4447
"react-native-screens": "2.0.0-alpha.12",
4548
"react-native-stopwatch-timer": "0.0.21",
@@ -53,9 +56,7 @@
5356
"react-navigation-transitions": "^1.0.12",
5457
"react-redux": "^7.1.3",
5558
"redux": "^4.0.4",
56-
"yup": "^0.28.0",
57-
"react-native-safe-area-context": "0.6.0",
58-
"@react-native-community/masked-view": "0.1.5"
59+
"yup": "^0.28.0"
5960
},
6061
"devDependencies": {
6162
"babel-preset-expo": "^7.1.0",

App/view/Activity.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ class ActivityScreen extends React.Component {
8080
const { navigation } = this.props;
8181
return (
8282
<View style={{flex: 1}}>
83-
<View style={{flex: 1, flexDirection: 'row',alignContent:'stretch',paddingTop:10}}>
84-
<Text style={{fontSize: 20, fontWeight: 'bold',textAlign:'left',marginLeft: 20}}>ACTIVITÉS</Text>
85-
</View>
86-
<View style={{flex:12}}>
83+
<View style={{flex:1}}>
8784
<NavigationEvents
8885
onDidFocus={() => this.refreshCourses()}
8986
/>
@@ -102,6 +99,7 @@ class ActivityScreen extends React.Component {
10299
class DetailScreen extends React.Component {
103100
render() {
104101
const { navigation } = this.props;
102+
navigation.setOptions({ title: 'MAR 21/01/2020' });
105103
return (
106104
<View style={{flex:1}}>
107105
<View style={{flex:1}}>
@@ -132,8 +130,13 @@ const Stack = createStackNavigator();
132130
function MyStack() {
133131
return (
134132
<Stack.Navigator>
135-
<Stack.Screen name="ActivityScreen" component={ActivityScreen} />
136-
<Stack.Screen name="DetailScreen" component={DetailScreen} />
133+
<Stack.Screen name="ActivityScreen" component={ActivityScreen} options={{
134+
title: 'Liste des courses',
135+
}} />
136+
<Stack.Screen name="DetailScreen" component={DetailScreen} options={{
137+
title: 'MAR., 21/01/2020',
138+
}}
139+
/>
137140
</Stack.Navigator>
138141
);
139142
}

App/view/Home.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as Location from 'expo-location';
88
import * as TaskManager from 'expo-task-manager';
99
import { Stopwatch } from 'react-native-stopwatch-timer';
1010
import ViewShot from "react-native-view-shot";
11+
import SafeAreaView from 'react-native-safe-area-view';
1112
import * as geolib from 'geolib';
1213

1314
const STORAGE_KEY_COORDINATES = 'COORDINATES';
@@ -204,6 +205,7 @@ export default class Home extends Component {
204205
}
205206
}
206207
return (
208+
<SafeAreaView style={{ flex: 1}} forceInset={{ top: 'always' }}>
207209
<View style={{flex:1}}>
208210
<View style={{flex:1,backgroundColor:'white', padding: 10, paddingBottom: 20}}>
209211
<View style={{flex: 1, flexDirection: 'row',alignContent:'stretch',justifyContent:'center',alignItems: 'stretch',paddingTop:10}}>
@@ -302,6 +304,7 @@ export default class Home extends Component {
302304
</View>
303305

304306
</View>
307+
</SafeAreaView>
305308
);
306309
}
307310

0 commit comments

Comments
 (0)