Skip to content

Commit

Permalink
Merge pull request #80 from redacademy/kw-feature-backbutton
Browse files Browse the repository at this point in the history
Kw-feature backbutton
  • Loading branch information
iyuvraajsingh authored Dec 17, 2019
2 parents 0f702ad + d92f0e4 commit 1b85407
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
40 changes: 37 additions & 3 deletions client/js/navigation/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ import {
ImageBackground,
} from 'react-native';
import {Header} from 'react-navigation-stack';

import styles from './styles';

import {queryViewer} from '../config/models';


const AppHeader = props => (
<View
style={{
backgroundColor: 'white',
overflow: 'hidden',

width: '100%',
}}>
<Image
style={{
position: 'absolute',
top: 40,
top: 65,
left: 65,
height: '40%',
height: '30%',
width: '70%',
resizeMode: 'contain',
}}
Expand All @@ -42,6 +47,21 @@ const MenuButton = ({navigation}) => {
);
};

const BackButton = ({navigation}) => (
<TouchableOpacity onPress={() => navigation.goBack()}>
<Image
style={{
height: 30,
width: 30,
resizeMode: 'contain',
marginLeft: 20,
marginTop: 5,
}}
source={require('../assets/headingelement/backarrow.png')}
/>
</TouchableOpacity>
);

const ProfileButton = ({navigation}) => {
const [user, setUser] = useState(null);

Expand All @@ -55,6 +75,9 @@ const ProfileButton = ({navigation}) => {

return (
<TouchableOpacity onPress={() => navigation.navigate('EditProfile')}>



<ImageBackground
style={{height: 25, width: 25, resizeMode: 'contain', marginRight: 20}}
source={require('../assets/headingelement/Signedin.png')}>
Expand All @@ -64,17 +87,28 @@ const ProfileButton = ({navigation}) => {
</Text>
)}
</ImageBackground>

</TouchableOpacity>
);
};

export const sharedNavigationOptions = navigation => ({
headerBackTitle: null,
header: props => <AppHeader {...props} />,
headerLeft: props => <MenuButton {...props} navigation={navigation} />,
headerLeft: props =>
navigation.state.routeName === 'Campaigns' ||
navigation.state.routeName === 'Campaign' ||
navigation.state.routeName === 'Events' ||
navigation.state.routeName === 'EditProfile' ? (
<BackButton {...props} navigation={navigation} />
) : (
<MenuButton {...props} navigation={navigation} />
),

headerRight: props => <ProfileButton {...props} navigation={navigation} />,

headerStyle: {
backgroundColor: 'transparent',
height: 70,
},
});
2 changes: 1 addition & 1 deletion client/js/navigation/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const styles = StyleSheet.create({
appHeader: {
backgroundColor: white,
overflow: 'hidden',
height: 100,
height: 200,
width: '100%',
},
titleNavigation: {
Expand Down
6 changes: 6 additions & 0 deletions client/js/screens/Campaign/CampaignContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import React, {Component} from 'react';
import Campaign from './Campaign';
import {queryViewer} from '../../config/models';

import gql from 'graphql-tag';
import {withNavigation} from 'react-navigation';
import {Mutation, Query} from '@apollo/react-components';
import {UserContext} from '../../context/UserProvider';


class CampaignContainer extends Component {
constructor(props) {
super(props);
Expand Down

0 comments on commit 1b85407

Please sign in to comment.