Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react'
- import { ScrollView, View, Text, TouchableOpacity, Linking } from 'react-native'
- import Header from '../../components/Header'
- import IconTouchable from '../../components/IconTouchable'
- import ImagePicker from 'react-native-image-picker'
- import BackgroundImage from '../../components/BackgroundImage'
- import DefaultBackgroundImg from '../../components/DefaultBackgroundImg'
- import DialogComponent from '../../components/DialogComponent'
- import styles from './styles'
- class ProfileSettings extends Component {
- constructor (props) {
- super(props)
- this.state = {
- image: null,
- username: '',
- password: '',
- showUserNameDialog: false,
- showPassDialog: false
- }
- this.handleSubmit = this.handleSubmit.bind(this)
- this.pickImage = this.pickImage.bind(this)
- this.renderUserNamePrompt = this.renderUserNamePrompt.bind(this)
- this.renderPassPrompt = this.renderPassPrompt.bind(this)
- }
- handleSubmit () {
- // TODO: Implement validation and proceed logic
- console.log('Profile Settings: ', this.state)
- this.props.navigation.navigate('Splash')
- }
- renderUserNamePrompt () {
- return (
- <DialogComponent
- visibility={this.state.showUserNameDialog}
- title='Профилно име'
- description='Въведете профилното си име'
- labelInput='Вашето профилно име'
- confirm='запази'
- onCancel={() => this.setState({ showUserNameDialog: false })}
- onPress={(text) => this.setState({ username: text, showUserNameDialog: false })}
- />
- )
- }
- renderPassPrompt () {
- return (
- <DialogComponent
- visibility={this.state.showPassDialog}
- title='Парола'
- description='Въведете паролата си'
- labelInput='Вашата парола'
- confirm='запази'
- onCancel={() => this.setState({ showPassDialog: false })}
- onPress={(value) => this.setState({ password: value, showPassDialog: false })}
- />
- )
- }
- pickImage () {
- const options = {
- title: 'Избери снимка',
- storageOptions: {
- skipBackup: true,
- path: 'images'
- }
- }
- ImagePicker.showImagePicker(options, (response) => {
- if (!response.didCancel && !response.error) {
- const source = { uri: response.uri }
- this.setState({ image: source })
- }
- })
- }
- render () {
- const { image } = this.state
- const PATH = 'socourt-admin/resources/imgs/'
- const FIDWEB = 'http://fidweb.net'
- const SOCOURT = 'http://thesocourt.com'
- const BFT = 'https://www.facebook.com/BulgarianTennisFederation/'
- return (
- <View style={styles.container}>
- <Header
- text='Настройки'
- goBack={() => this.props.navigation.goBack()}
- goToProfile={() => this.props.navigation.navigate('UserProfile')}
- />
- {/* MAIN CONTENT */}
- <ScrollView style={styles.scrollContainer}>
- <View style={styles.innerContainer}>
- <View style={styles.mainContent}>
- <View style={styles.profileContainer}>
- {/* PICTURE SELECT */}
- <View style={styles.userPhoto}>
- {image
- ? <BackgroundImage
- image={image}
- style={styles.imgUserPhoto}
- colorFilter='#00000040'
- />
- : <DefaultBackgroundImg
- style={styles.imgUserPhoto}
- colorFilter='#00000060'
- />
- }
- <IconTouchable
- image={require(PATH + 'icon-camera-white.png')}
- style={styles.iconPickPhoto}
- onPress={this.pickImage}
- />
- </View>
- {/* USER CONTENT */}
- <View style={styles.btnUserName}>
- <Text style={styles.btnUserNameTxt}>
- {this.state.username || 'User Name'}
- </Text>
- <IconTouchable
- image={require(PATH + 'icon-pencil-dark.png')}
- style={styles.iconEditUserName}
- onPress={() => this.setState({ showUserNameDialog: true })}
- />
- {this.state.showUserNameDialog && this.renderUserNamePrompt()}
- </View>
- <View />
- <View >
- <Text style={styles.userEmail}>
- useremail@gmail.com
- </Text>
- </View>
- </View>
- <View style={styles.btnContainer}>
- {/* BUTTONS */}
- <View style={styles.btnView}>
- <TouchableOpacity
- style={styles.btnEdit}
- onPress={() => this.setState({ showPassDialog: true })}
- >
- <Text style={styles.btnViewText}>
- редактирай парола
- </Text>
- <IconTouchable
- image={require(PATH + 'icon-pencil-dark.png')}
- style={styles.iconEdit}
- onPress={() => this.setState({ showPassDialog: true })}
- />
- {this.state.showPassDialog && this.renderPassPrompt()}
- </TouchableOpacity>
- </View>
- <View style={styles.btnView}>
- <TouchableOpacity
- style={styles.btnViewTouch}
- onPress={() => this.props.navigation.navigate('FrequentQuestions')}
- >
- <Text style={styles.btnViewText}>
- често задавани въпроси
- </Text>
- </TouchableOpacity>
- </View>
- <View style={styles.btnView}>
- <TouchableOpacity
- style={styles.btnViewTouch}>
- <Text style={styles.btnViewText}>
- свързване с поддръжка
- </Text>
- </TouchableOpacity>
- </View>
- <View style={styles.fbButton}>
- <TouchableOpacity
- onPress={() => Linking.openURL(BFT)}
- >
- <Text style={styles.fbButtonTxt}>
- последвай БФТ във facebook
- </Text>
- </TouchableOpacity>
- </View>
- </View>
- </View>
- {/* FOOTER */}
- <View style={styles.footerContainer}>
- <TouchableOpacity style={styles.exitBtn}>
- <Text style={styles.exitBtnTxt}>
- изход
- </Text>
- </TouchableOpacity>
- <View style={styles.footerView}>
- <Text style={styles.footerText}>
- БФТ Livescore старателно създадено от екипа на <Text style={styles.companyText} onPress={() => Linking.openURL(FIDWEB)}>FidWeb</Text> и <Text style={styles.companyText} onPress={() => Linking.openURL(SOCOURT)}> SoCourt</Text>
- </Text>
- </View>
- </View>
- </View>
- </ScrollView>
- </View>
- )
- }
- }
- export default ProfileSettings
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement