Merge remote-tracking branch 'origin/develop' into messages-permissions-some-fixes

This commit is contained in:
Guilherme Gazzo 2017-11-24 15:10:17 -02:00
commit 56921af5ab
No known key found for this signature in database
GPG Key ID: 1F85C9AD922D0829
4 changed files with 32 additions and 37 deletions

View File

@ -37,6 +37,12 @@ export default class Cards extends React.PureComponent {
});
}
getDescription() {
if (this.props.data.description) {
return <Text style={{ alignSelf: 'center', fontWeight: 'bold' }}>{this.props.data.description}</Text>;
}
}
getImage() {
return (
<View>
@ -50,7 +56,7 @@ export default class Cards extends React.PureComponent {
</CardImage>
<CardContent>
<Text style={[{ fontSize: 12, alignSelf: 'center', fontStyle: 'italic' }]}>{this.props.data.title}</Text>
<Text style={{ alignSelf: 'center', fontWeight: 'bold' }}>{this.props.data.description}</Text>
{this.getDescription()}
</CardContent>
</Card>
</TouchableOpacity>

View File

@ -1,26 +1,25 @@
import React from 'react';
import { ScrollView, View, Dimensions, Text } from 'react-native';
import { ScrollView, View, Text, TouchableWithoutFeedback } from 'react-native';
import { CachedImage } from 'react-native-img-cache';
import PropTypes from 'prop-types';
import Modal from 'react-native-modal';
const deviceWidth = Dimensions.get('window').width;
const styles = {
imageWrapper: {
alignItems: 'stretch'
alignItems: 'stretch',
flex: 1
},
image: {
width: deviceWidth,
height: deviceWidth
flex: 1
},
titleContainer: {
width: '100%',
alignItems: 'center',
marginBottom: 15
marginVertical: 10
},
title: {
color: '#ffffff',
textAlign: 'center',
fontSize: 16,
fontWeight: '600'
}
@ -43,17 +42,21 @@ export default class extends React.PureComponent {
onBackdropPress={onClose}
onBackButtonPress={onClose}
>
<View style={styles.titleContainer}>
<Text style={styles.title}>{title}</Text>
</View>
<TouchableWithoutFeedback onPress={onClose}>
<View style={styles.titleContainer}>
<Text style={styles.title}>{title}</Text>
</View>
</TouchableWithoutFeedback>
<View style={styles.imageWrapper}>
<ScrollView contentContainerStyle={styles.imageWrapper} maximumZoomScale={1.5}>
<CachedImage
style={styles.image}
source={{ uri: encodeURI(image) }}
mutable
resizeMode='contain'
/>
<ScrollView contentContainerStyle={styles.imageWrapper} maximumZoomScale={5}>
<TouchableWithoutFeedback onPress={onClose}>
<CachedImage
style={styles.image}
source={{ uri: encodeURI(image) }}
mutable
resizeMode='contain'
/>
</TouchableWithoutFeedback>
</ScrollView>
</View>
</Modal>

View File

@ -1,6 +1,6 @@
import React from 'react';
import { Platform } from 'react-native';
import { StackNavigator, DrawerNavigator, NavigationActions, HeaderBackButton } from 'react-navigation';
import { StackNavigator, DrawerNavigator } from 'react-navigation';
import Sidebar from '../../containers/Sidebar';
import DrawerMenuButton from '../../presentation/DrawerMenuButton';
@ -13,14 +13,6 @@ import SelectUsersView from '../../views/SelectUsersView';
const drawerPosition = 'left';
const drawerIconPosition = 'headerLeft';
const backToScreen = (navigation, routeName) => {
const action = NavigationActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName })]
});
navigation.dispatch(action);
};
const AuthRoutes = StackNavigator(
{
RoomsList: {
@ -36,13 +28,7 @@ const AuthRoutes = StackNavigator(
screen: RoomView,
navigationOptions({ navigation }) {
return {
title: navigation.state.params.title || 'Room',
headerLeft: (
<HeaderBackButton
title='Back'
onPress={() => backToScreen(navigation, 'RoomsList')}
/>
)
title: navigation.state.params.title || 'Room'
// [drawerIconPosition]: (<DrawerMenuButton navigation={navigation} />)÷
};
}

View File

@ -193,7 +193,7 @@ export default class RoomsListView extends React.Component {
_onPressItem = (id, item = {}) => {
const navigateToRoom = (room) => {
this.props.navigation.navigate('Room', { room });
this.props.navigation.navigate('Room', { room, title: room.name });
};
const clearSearch = () => {
@ -220,7 +220,7 @@ export default class RoomsListView extends React.Component {
}
});
}))
.then(sub => navigateToRoom({ sid: sub._id }))
.then(sub => navigateToRoom({ sid: sub._id, name: sub.name }))
.then(() => clearSearch());
} else {
clearSearch();
@ -229,7 +229,7 @@ export default class RoomsListView extends React.Component {
return;
}
navigateToRoom({ sid: id, ...item });
navigateToRoom({ sid: id, name: item.name });
clearSearch();
}