Guest User

Untitled

a guest
Nov 23rd, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {
  3. Platform,
  4. StyleSheet,
  5. Text,
  6. View,
  7. ScrollView,
  8. Image,
  9. Dimensions,
  10. Alert,
  11. } from 'react-native';
  12.  
  13. import {
  14. CameraKitCamera,
  15. CameraKitGallery
  16. } from 'react-native-camera-kit';
  17.  
  18. import CameraScreen from './CameraScreen';
  19. //import GalleryScreen from './GetUserInfo/GalleryScreen';
  20.  
  21. import { Container, Content, Icon, Form, Input, Label, Item, Button, } from 'native-base';
  22. import chitChat from '../../images/chitchat.png';
  23. import { ButtonProps } from '../../components/button'
  24.  
  25. class ActivityTab extends Component {
  26.  
  27. constructor(props) {
  28. super(props);
  29. this.state = {
  30. example: undefined,
  31. uri: undefined
  32. };
  33. this.OpenCamera = this.OpenCamera.bind(this)
  34. }
  35.  
  36. componentDidMount() {
  37. console.log("asddddddddddd")
  38. const {state} = this.props.navigation;
  39. const imageProps = state.params ? JSON.parse(state.params.imageProps) : null;
  40. console.log("imageProps",imageProps)
  41.  
  42. if(imageProps != null){
  43. console.log("enterder in this one")
  44. console.log("imageProps in this one",imageProps[0].uri)
  45. this.setState({
  46. uri: imageProps[0].uri
  47. })
  48. console.log("inner data",this.state)
  49. }
  50.  
  51. }
  52.  
  53. OpenCamera = () => {
  54. Alert.alert(
  55. 'Take a Avatar',
  56. 'My Alert Msg',
  57. [
  58. {text: 'Gallery', onPress: () => console.log('Open Camera') },
  59. {text: 'Take A Picture', onPress: () => this.props.navigation.navigate('CameraScreen') },
  60. {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
  61. ],
  62. { cancelable: false }
  63. )
  64. }
  65.  
  66. render() {
  67. if (this.state.example) {
  68. const Example = this.state.example;
  69. return <Example />;
  70. }
  71. return (
  72. <Container>
  73. <Content style={{ backgroundColor:"#f5f3f9", }}>
  74. <View style={{ flex:1, alignSelf:'center', top:10, }}>
  75. <Image source={this.state.uri ? 'uri:' + this.state.uri : chitChat } style={{borderRadius:100}}/ >
  76. <ButtonProps buttonContainer={styles.buttonContainer} innerDisplay={true} iconName={'md-camera'} iconCss={styles.IconSize} onPress={()=> this.OpenCamera()}/>
  77. </View>
  78. <View style={{flex:1,}}>
  79. <Form>
  80. <View style={{flexDirection: 'row', justifyContent: 'space-between' }}>
  81. <View style={{flex:1}}>
  82. <Item floatingLabel>
  83. <Label style={{color:'black'}}>First Name</Label>
  84. <Input onChangeText={(value) => this.setState({ firstName: value }) }/>
  85. </Item>
  86. </View>
  87. <View style={{flex:1}}>
  88. <Item floatingLabel>
  89. <Label style={{color:'black'}}>Last Name</Label>
  90. <Input onChangeText={(value) => this.setState({ lastName: value }) }/>
  91. </Item>
  92. </View>
  93. </View>
  94. <Item floatingLabel>
  95. <Label style={{color:'black'}}>User Name</Label>
  96. <Input onChangeText={(value) => this.setState({ userName: value }) }/>
  97. </Item>
  98. <Item floatingLabel>
  99. <Label style={{color:'black'}}>Email</Label>
  100. <Input onChangeText={(value) => this.setState({ email: value }) }/>
  101. </Item>
  102. <Item floatingLabel>
  103. <Label style={{color:'black'}}>Password</Label>
  104. <Input secureTextEntry={ true } onChangeText={(value) => this.setState({ password: value })}/>
  105. </Item>
  106. </Form>
  107. </View>
  108. <Button block style={{ backgroundColor:'#5269BE', margin: 15, marginTop: 25 }} onPress={this.signUp}>
  109. <Text style={{ color: 'white' }}>Create User</Text>
  110. </Button>
  111. </Content>
  112. </Container>
  113. );
  114. }
  115. }
  116.  
  117.  
  118. const styles = StyleSheet.create({
  119. container: {
  120. flex: 1,
  121. flexDirection: 'column',
  122. backgroundColor: '#f5f3f9'
  123. },
  124. buttonContainer: {
  125. borderRadius: 55,
  126. width: 55,
  127. height: 55,
  128. backgroundColor:'#6989FF',
  129. bottom:0,
  130. position:'absolute',
  131. alignSelf:'flex-end',
  132. },
  133. });
  134.  
  135. export default ActivityTab;
Add Comment
Please, Sign In to add comment