Skip to content

Commit 563cc67

Browse files
committed
fix logout confirm + modal padding
1 parent 4ed764b commit 563cc67

File tree

2 files changed

+24
-32
lines changed

2 files changed

+24
-32
lines changed

screens/app/Feed/EventList.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class EventList extends Component {
166166
<Button transparent onPress={() => this.setState({showDescription: false})} style={{position: 'absolute', top: 4, left: 8}}>
167167
<Icon name="ios-arrow-back" />
168168
</Button>
169-
<View style={{padding: 20, marginTop: 28}}>
169+
<Content style={{paddingTop: 10, paddingHorizontal: 20, marginTop: 40}}>
170170
<View style={{flexDirection: 'row', marginTop: 4}}>
171171
<Thumbnail source={{uri: photo_url}} style={{flex: 0}} />
172172
<View style={{flex: 1, marginLeft: 10}}>
@@ -182,7 +182,7 @@ class EventList extends Component {
182182
<View style={{marginTop: 10}}>
183183
<Text>{description}</Text>
184184
</View>
185-
<View style={{marginTop: 20}}>
185+
<View style={{marginTop: 20, marginBottom: 30}}>
186186
{this.state.bookingTicket ? (
187187
<Spinner color={color.primary} />
188188
) : this.state.ticket ? (
@@ -195,7 +195,7 @@ class EventList extends Component {
195195
</Button>
196196
)}
197197
</View>
198-
</View>
198+
</Content>
199199
</Modal>
200200
);
201201
}
@@ -221,8 +221,8 @@ class EventList extends Component {
221221
const qrcodeSize = 256;
222222
return (
223223
<Modal visible={this.state.showQrCode} animationType="slide" onRequestClose={() => this.setState({showQrCode: false})}>
224-
<Content style={{padding: 15, alignItems: 'center'}}>
225-
<H2 style={{marginTop: 10, alignSelf: 'center'}}>Your Ticket</H2>
224+
<Content style={{padding: 15}} contentContainerStyle={{alignItems: 'center'}}>
225+
<H2 style={{marginTop: 20}}>Your Ticket</H2>
226226
<Text style={{marginTop: 20, alignSelf: 'flex-start'}}>
227227
<Text style={{fontWeight: '700'}}>Ticket Code: </Text> {this.state.ticket.tid}
228228
</Text>
@@ -236,7 +236,7 @@ class EventList extends Component {
236236
<Text style={{fontWeight: '700'}}>Created At: </Text>
237237
{moment(this.state.ticket.created_date).format('MMMM Do YYYY, h:mm:ss a')}
238238
</Text>
239-
<View style={customStyles.qrcodeSection}>
239+
<View style={{...customStyles.qrcodeSection, marginBottom: 30}}>
240240
{this.state.qrcodeContent ? (
241241
<QRCode value={this.state.qrcodeContent} size={qrcodeSize} fgColor="white" />
242242
) : (

screens/app/Feed/Profile.js

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import React from 'react';
7-
import {StyleSheet, View, Dimensions, Alert, RefreshControl, Modal} from 'react-native';
7+
import {StyleSheet, View, Alert, RefreshControl, Modal} from 'react-native';
88
import {Button, Icon, Text, Thumbnail, Form, Item, Label, Content, Input, Spinner, Badge, ListItem, List, Left, Right, Body, H2} from 'native-base';
99
import QRCode from 'react-native-qrcode';
1010
import * as jws from '../../../utils/jws';
@@ -33,7 +33,6 @@ export default class ProfileScreen extends React.Component {
3333
qrcodeCountDown: 60,
3434
qrcodeContent: null,
3535

36-
showDialog: false,
3736
showQrCode: false,
3837
showChangePassword: false,
3938

@@ -164,27 +163,6 @@ export default class ProfileScreen extends React.Component {
164163
);
165164
}
166165

167-
renderModalLogout() {
168-
const dialogSize = Math.round((Dimensions.get('screen').width * 4) / 5);
169-
return (
170-
<Modal visible={this.state.showDialog} transparent animationType="none" onRequestClose={() => this.setState({showDialog: false})}>
171-
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#00000050'}}>
172-
<View style={{flexDirection: 'column', paddingHorizontal: 20, paddingVertical: 15, backgroundColor: color.white, width: dialogSize, borderRadius: 12}}>
173-
<Text style={{marginVertical: 15, fontSize: 18}}>Do you want to logout?</Text>
174-
<View style={{flexDirection: 'row', justifyContent: 'flex-end', marginBottom: 5}}>
175-
<Button dark onPress={() => this.setState({showDialog: false})} style={{margin: 3}}>
176-
<Text>Cancel</Text>
177-
</Button>
178-
<Button danger onPress={this._onClickSignOut} style={{margin: 3}}>
179-
<Text>OK</Text>
180-
</Button>
181-
</View>
182-
</View>
183-
</View>
184-
</Modal>
185-
);
186-
}
187-
188166
renderModalQrCode() {
189167
const qrcodeSize = 256;
190168
return (
@@ -272,7 +250,7 @@ export default class ProfileScreen extends React.Component {
272250
<View style={{position: 'absolute', top: 0, left: 0, height: 80, width: '100%', backgroundColor: color.primary}} />
273251
<View style={{height: 160, justifyContent: 'center', alignItems: 'center'}}>
274252
<View style={{flexDirection: 'row', flex: 1, height: 120, width: '100%', justifyContent: 'space-around', alignItems: 'center'}}>
275-
<Button rounded small iconLeft style={{backgroundColor: '#d60022', alignSelf: 'center'}} onPress={() => this.setState({showDialog: true})}>
253+
<Button rounded small iconLeft style={{backgroundColor: '#d60022', alignSelf: 'center'}} onPress={() => this.handleLogout()}>
276254
<Icon name="logout" type="SimpleLineIcons" style={{fontSize: 15}} />
277255
<Text style={{fontSize: 12}}>Logout</Text>
278256
</Button>
@@ -338,12 +316,26 @@ export default class ProfileScreen extends React.Component {
338316
</List>
339317
{this.renderModalQrCode()}
340318
{this.renderModalChangePassword()}
341-
{this.renderModalLogout()}
342319
</Content>
343320
</AppScreenWrapper>
344321
);
345322
}
346323

324+
handleLogout() {
325+
Alert.alert('Warning', 'Do you want to logout?', [
326+
{
327+
text: 'Cancel',
328+
style: 'cancel',
329+
},
330+
{
331+
text: 'YES',
332+
onPress: async () => {
333+
this.signOut();
334+
},
335+
},
336+
]);
337+
}
338+
347339
onChangePassword = async () => {
348340
if (this.state.oldPassword === '' || this.state.newPassword === '') {
349341
return Alert.alert('Error', "Fields can't be empty");
@@ -364,7 +356,7 @@ export default class ProfileScreen extends React.Component {
364356
});
365357
};
366358

367-
_onClickSignOut = async () => {
359+
signOut = async () => {
368360
authApi
369361
.logout()
370362
.then(() => this.props.navigation.navigate('Auth'))

0 commit comments

Comments
 (0)