Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screens/profile screen #48

Open
wants to merge 2 commits into
base: examples
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { View, StatusBar } from 'react-native';

import GalioApp from './routes';

console.disableYellowBox = true;

export default class App extends React.Component {
render() {
return (
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
},
"dependencies": {
"expo": "^29.0.0",
"galio-framework": "^1.0.3",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
"react-native-vector-icons": "^6.0.2"
Expand All @@ -49,7 +50,6 @@
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.11.1",
"galio-framework": "^1.0.1",
"prettier": "^1.14.2",
"prop-types": "^15.6.2",
"react-devtools": "^3.3.2",
Expand Down
37 changes: 28 additions & 9 deletions routes.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
Image, StyleSheet, ScrollView, SafeAreaView, Platform,
Image,
StyleSheet,
ScrollView,
SafeAreaView,
Platform,
TouchableWithoutFeedback,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kostimarko TouchableWithoutFeedback is not used anywhere, can you please update this?

} from 'react-native';
import {
createDrawerNavigator,
DrawerItems,
} from 'react-navigation';
import { createDrawerNavigator, DrawerItems } from 'react-navigation';

// screens
import Article from './src/screens/Article';
Expand All @@ -20,19 +22,25 @@ import Presentation from './src/screens/Presentation';
import Dashboard from './src/screens/Dashboard';
import Register from './src/screens/Register';
import Grid from './src/screens/Grid';
import Profile from './src/screens/Profile';

import theme from './src/theme';
import { Block, Icon, Text } from './src';

const GalioDrawer = props => (
<SafeAreaView style={styles.drawer} forceInset={{ top: 'always', horizontal: 'never' }}>
<Block space="between" row style={styles.header}>
<Block flex={0.3}><Image source={{ uri: 'http://i.pravatar.cc/100' }} style={styles.avatar} /></Block>
<Block flex={0.3}>
<Image source={{ uri: 'http://i.pravatar.cc/100' }} style={styles.avatar} />
</Block>
<Block flex style={styles.middle}>
<Text size={theme.SIZES.FONT * 0.875}>Galio Framework</Text>
<Text muted size={theme.SIZES.FONT * 0.875}>React Native</Text>
<Text muted size={theme.SIZES.FONT * 0.875}>
React Native
</Text>
</Block>
</Block>

<ScrollView>
<DrawerItems {...props} />
</ScrollView>
Expand Down Expand Up @@ -101,14 +109,18 @@ const screens = {
screen: Article,
navigationOptions: {
drawerLabel: 'Article Screen',
drawerIcon: props => <MenuIcon name="tablet-reader-31" family="Galio" focused={props.focused} />,
drawerIcon: props => (
<MenuIcon name="tablet-reader-31" family="Galio" focused={props.focused} />
),
},
},
ArticleCover: {
screen: ArticleCover,
navigationOptions: {
drawerLabel: 'Article Cover',
drawerIcon: props => <MenuIcon name="single-paragraph" family="Galio" focused={props.focused} />,
drawerIcon: props => (
<MenuIcon name="single-paragraph" family="Galio" focused={props.focused} />
),
},
},
Dashboard: {
Expand Down Expand Up @@ -160,6 +172,13 @@ const screens = {
drawerIcon: props => <MenuIcon name="grid-48" family="Galio" focused={props.focused} />,
},
},
Profile: {
screen: Profile,
navigationOptions: {
drawerLabel: 'Profile',
drawerIcon: props => <MenuIcon name="users-wm" family="Galio" focused={props.focused} />,
},
},
};

const options = {
Expand Down
234 changes: 234 additions & 0 deletions src/screens/Profile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
import React from 'react';
import {
Alert, Dimensions, StyleSheet, Platform, Image, ScrollView,
} from 'react-native';
import { LinearGradient } from 'expo';

// galio component
import {
Block, Button, NavBar, Text, Icon,
} from 'galio-framework';
import theme from '../theme';

const { height, width } = Dimensions.get('window');

const friends = [
{
id: 0,
image: 'https://randomuser.me/api/portraits/men/27.jpg',
name: 'Christopher',
},
{
id: 1,
image: 'https://randomuser.me/api/portraits/women/60.jpg',
name: 'Sam',
},
{
id: 2,
image: 'https://randomuser.me/api/portraits/women/84.jpg',
name: 'Sally',
},
{
id: 3,
image: 'https://randomuser.me/api/portraits/men/85.jpg',
name: 'Steven',
},
];
const photos = [
{
id: 0,
image: 'https://picsum.photos/200/300?image=0',
},
{
id: 1,
image: 'https://picsum.photos/200/300?image=1',
},
{
id: 2,
image: 'https://picsum.photos/200/300?image=2',
},
{
id: 3,
image: 'https://picsum.photos/200/300?image=3',
},
];

class Profile extends React.Component {
handleChange = (name, value) => {
this.setState({ [name]: value });
};

render() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kostimarko let us know when you finish the Profile screen, it should look like the one in design

const { navigation } = this.props;
return (
<Block flex style={{ backgroundColor: 'white' }}>
<Block flex={2}>
<LinearGradient colors={['#F4F6F6', '#E9EDEE']} style={{ flex: 1 }}>
<NavBar
title="Profile"
transparent
right={(
<Button
onlyIcon
icon="heart-2"
iconFamily="Galio"
iconSize={theme.SIZES.BASE}
iconColor={theme.COLORS.ICON}
color="transparent"
onPress={() => Alert.alert('Like it!')}
/>
)}
onLeftPress={() => navigation.openDrawer()}
style={Platform.OS === 'android' ? { marginTop: theme.SIZES.BASE } : null}
/>
<Block
flex
style={{
alignItems: 'center',
justifyContent: 'center',
zIndex: 1001,
marginBottom: 50,
}}
>
<Text h3 color="#3423A6" bold style={{ marginBottom: 10 }}>
Michael Brown
</Text>
<Text h5 bold muted style={{ marginBottom: 10 }}>
User Experience Designer
</Text>
<Block row style={{ marginBottom: 25 }}>
<Icon name="pin-3" family="Galio" size={18} color="#3423A6" />
<Text p muted style={{ marginLeft: 8 }}>
Los Angeles,CA
</Text>
</Block>
</Block>
</LinearGradient>
</Block>
<Block flex={3}>
<Block center>
<Image
source={{ uri: 'https://randomuser.me/api/portraits/men/58.jpg' }}
style={styles.image}
/>
</Block>
<Block row space="around" style={{ marginBottom: 20 }}>
<Block center>
<Text h5 bold>
768
</Text>
<Text p muted>
Photos
</Text>
</Block>
<Block center>
<Text h5 bold>
43 K
</Text>
<Text p muted>
Followers
</Text>
</Block>
<Block center>
<Text h5 bold>
231
</Text>
<Text p muted>
Articles
</Text>
</Block>
</Block>
<ScrollView
contentContainerStyle={{ backgroundColor: 'white' }}
showsVerticalScrollIndicator={false}
>
<Block
style={{
paddingTop: 20,
paddingBottom: 20,
paddingLeft: 15,
paddingRight: 15,
borderTopColor: '#E9F1F7',
borderTopWidth: 1,
}}
>
<Block>
<Text>Common Friends</Text>
</Block>

<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
contentContainerStyle={{ marginTop: 10 }}
>
{friends.map((friend) => {
const { name, image } = friend;
return (
<Block center style={{ marginRight: 15 }}>
<Image source={{ uri: image }} style={styles.avatar} />
<Text p muted>
{name}
</Text>
</Block>
);
})}
</ScrollView>
</Block>
<Block
style={{
paddingTop: 20,
paddingBottom: 20,
paddingLeft: 15,
paddingRight: 15,
borderTopColor: '#E9F1F7',
borderTopWidth: 1,
}}
>
<Block row space="between" style={{ marginBottom: 10 }}>
<Text h4 bold>
Photos
</Text>
<Text p muted>
View All
</Text>
</Block>

<Block row style={{ flexWrap: 'wrap' }}>
{photos.map((photo) => {
const { image } = photo;
return (
<Block style={{ marginRight: 15, marginBottom: 15 }}>
<Image source={{ uri: image }} style={styles.photos} />
</Block>
);
})}
</Block>
</Block>
</ScrollView>
</Block>
</Block>
);
}
}

const styles = StyleSheet.create({
image: {
width: 150,
height: 150,
borderRadius: 150 / 2,
top: -25,
},
avatar: {
width: 100,
height: 100,
borderRadius: 100 / 2,
marginBottom: 5,
},
photos: {
width: 110,
height: 110,
borderRadius: 10,
},
});

export default Profile;