Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import {
- StyleSheet,
- Text,
- View,
- Image,
- TextInput,
- TouchableHighlight
- } from 'react-native';
- import * as ImagePicker from 'expo-image-picker';
- import Constants from 'expo-constants';
- import * as Permissions from 'expo-permissions';
- import {Button} from 'react-native';
- import LogoImage from '../../../assets/images/LionKing.jpg';
- export default class Profile extends Component {
- state = {
- photo:null,
- adresse:'',
- fullName:'',
- telephone:''
- };
- onClickListener = (viewId) => {
- alert( "Button pressed "+viewId+"Nom"+this.state.fullName);
- }
- /* _ChangerPhoto = () => {
- const options = {
- noData:true
- };
- ImagePicker.launchImageLibrary(options,response => {
- if(response.uri){this.setState({photo:response});
- }
- });
- };*/
- getPermissionAsync = async () => {
- if (Constants.platform.ios) {
- const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
- if (status !== 'granted') {
- alert('Sorry, we need camera roll permissions to make this work!');
- }
- }
- }
- _pickImage = async () => {
- let result = await ImagePicker.launchImageLibraryAsync({
- mediaTypes: ImagePicker.MediaTypeOptions.All,
- allowsEditing: true,
- aspect: [4,3]
- });
- console.log(result);
- if (!result.cancelled) {
- this.setState({ photo: result.uri });
- }
- };
- componentDidMount() {
- this.getPermissionAsync();
- }
- render() {
- console.log(this.state);
- const { photo } = this.state;
- return (
- <View style={styles.container}>
- <View style={styles.inputContainer}>
- <Image style={styles.inputIcon} source={{uri: 'https://png.icons8.com/male-user/ultraviolet/50/3498db'}}/>
- <TextInput style={styles.inputs}
- placeholder="Full name"
- keyboardType="email-address"
- underlineColorAndroid='transparent'
- onChangeText={(fullName) => this.setState({fullName})}/>
- </View>
- <View style={styles.inputContainer}>
- <Image style={styles.inputIcon} source={{uri:'https://png.icons8.com/message/ultraviolet/50/3498db'}}/>
- <TextInput style={styles.inputs}
- placeholder="Adresse"
- keyboardType="email-address"
- underlineColorAndroid='transparent'
- onChangeText={(telephone) => this.setState({telephone})}/>
- </View>
- <View style={styles.inputContainer}>
- <Image style={styles.inputIcon} source={{uri: 'https://img.icons8.com/cute-clipart/64/000000/weixing.png'}}/>
- <TextInput style={styles.inputs}
- placeholder="Number de Tel"
- secureTextEntry={true}
- underlineColorAndroid='transparent'
- onChangeText={(adresse) => this.setState({adresse})}/>
- </View>
- <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
- <Button
- title="Pick an image from camera roll"
- onPress={this._pickImage}
- />
- {photo &&
- <Image source={{ uri: photo }} style={{ width: 200, height: 200 }} />}
- </View>
- <TouchableHighlight style={[styles.buttonContainer, styles.signupButton]} onPress={() => this.onClickListener('sign_up')}>
- <Text style={styles.signUpText}>Sign up</Text>
- </TouchableHighlight>
- </View>
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement