Guest User

Untitled

a guest
Dec 13th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {
  3. AppRegistry,
  4. StyleSheet,
  5. Text,
  6. ScrollView,
  7. TextInput,
  8. View ,
  9. } from 'react-native';
  10.  
  11. var styles = require('./Style/customStyle');
  12.  
  13. import Button from 'react-native-button';
  14. import RadioButton from 'react-native-radio-button'
  15.  
  16. class AwesomeProject extends Component {
  17.  
  18. constructor(props){
  19. super(props)
  20.  
  21. this.state = {
  22. username: '',
  23. password: '',
  24. }
  25. }
  26.  
  27. render() {
  28. return (
  29. <ScrollView style={styles.content}>
  30. <View style={styles.content}>
  31.  
  32. <Text style={styles.welcome}>
  33. Create Account
  34. </Text>
  35.  
  36. <Text style={styles.textStyle}>
  37. Name
  38. </Text>
  39.  
  40. <TextInput
  41. style={styles.textInputStyle}
  42. placeholder="Enter Name"
  43. returnKeyLabel = {"next"}
  44. onChangeText={(text) => this.setState({text})}
  45. />
  46.  
  47. <Button style={styles.buttonStyle}>
  48. Submit
  49. </Button>
  50.  
  51. </View>
  52. </ScrollView>
  53. );
  54. }
  55. }
  56.  
  57. AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
  58.  
  59. <TextInput
  60. style={styles.textInputStyle}
  61. placeholder="Enter Name"
  62. returnKeyLabel = {"next"}
  63. onChangeText={(text) => this.setState({text})}
  64. />
  65.  
  66. <Button
  67. onPress={() => function }>
  68.  
  69. class AwesomeProject extends Component {
  70.  
  71. constructor(props){
  72. super(props)
  73.  
  74. this.state = {
  75. username: '',
  76. password: '',
  77. }
  78. }
  79.  
  80. _handlePress() {
  81. console.log(this.state.username);
  82. console.log(this.state.password);
  83. }
  84.  
  85. render() {
  86. return (
  87. <ScrollView style={styles.content}>
  88. <View style={styles.content}>
  89.  
  90. <Text style={styles.welcome}>
  91. Create Account
  92. </Text>
  93.  
  94. <Text style={styles.textStyle}>
  95. Name
  96. </Text>
  97.  
  98. <TextInput
  99. style={styles.textInputStyle}
  100. placeholder="Enter Name"
  101. returnKeyLabel = {"next"}
  102. onChangeText={(text) => this.setState({username:text})}
  103. />
  104.  
  105. <Text style={styles.textStyle}>
  106. Name
  107. </Text>
  108.  
  109. <TextInput
  110. style={styles.textInputStyle}
  111. placeholder="Enter Name"
  112. returnKeyLabel = {"next"}
  113. onChangeText={(text) => this.setState({password:text})}
  114. />
  115.  
  116. <Button
  117. onPress={() => this._handlePress()}
  118. style={styles.buttonStyle}>
  119. Submit
  120. </Button>
  121.  
  122. </View>
  123. </ScrollView>
  124. );
  125. }
  126. }
  127.  
  128. constructor(){
  129. super();
  130. this.state = {isLoggedIn : false, email :"", password : ""};
  131. }
  132.  
  133. render() {
  134. return (
  135. <View style={styles.container}>
  136. <TextInput style={styles.input}
  137. placeholder = "Username"
  138. returnKeyType = "next"
  139. underlineColorAndroid='transparent'
  140. onChange = {(text) => this.setState({email : text})}
  141. />
  142. <TextInput style={styles.input}
  143. secureTextEntry
  144. returnKeyType= 'go'
  145. onChange = {(password) => this.setState({password : password})}
  146.  
  147. placeholder = "password"/>
  148.  
  149. <TouchableOpacity style={styles.clickContainer} onPress=
  150. {this.login.bind(this)}>
  151. <Text style={styles.buttonText} >Login</Text>
  152. </TouchableOpacity>
  153. </View>
  154. );
  155. }
  156.  
  157. login(){
  158. console.log(this.state.email);
  159. this.setState({isLoggedIn : true});
  160. }
  161.  
  162. <Button
  163. style={styles.textInputStyle}
  164. onPress={() => console.log(this.state.username)}>
  165. Submit
  166. </Button>
  167.  
  168. this.state = {
  169. username: '',
  170. password: '',
  171. name: ''
  172. }
  173.  
  174. import React, { Component } from 'react';
  175. import {
  176. AppRegistry,
  177. StyleSheet,
  178. Text,
  179. ScrollView,
  180. TextInput,
  181. View ,
  182. } from 'react-native';
  183.  
  184. var styles = require('./Style/customStyle');
  185.  
  186. import Button from 'react-native-button';
  187. import RadioButton from 'react-native-radio-button'
  188.  
  189. class AwesomeProject extends Component {
  190.  
  191. constructor(props){
  192. super(props)
  193.  
  194. this.state = {
  195. username: '',
  196. password: '',
  197. }
  198. }
  199.  
  200. onUsernameChange(username) {
  201. let s = this.state;
  202. s.username = username;
  203. this.setState(s);
  204. }
  205.  
  206. onPasswordChange(password) {
  207. let s = this.state;
  208. s.password = password;
  209. this.setState(s);
  210. }
  211.  
  212. render() {
  213. return (
  214. <ScrollView style={styles.content}>
  215. <View style={styles.content}>
  216.  
  217. <Text style={styles.welcome}>
  218. Create Account
  219. </Text>
  220.  
  221. <Text style={styles.textStyle}>
  222. Name
  223. </Text>
  224.  
  225. <TextInput
  226. style={styles.textInputStyle}
  227. placeholder="Enter Username"
  228. returnKeyLabel = {"next"}
  229. onChangeText={this.onUsernameChange}
  230. />
  231.  
  232. <TextInput
  233. style={styles.textInputStyle}
  234. placeholder="Enter Password"
  235. returnKeyLabel = {"next"}
  236. onChangeText={this.onPasswordChange}
  237. />
  238.  
  239. <Button style={styles.buttonStyle}>
  240. Submit
  241. </Button>
  242.  
  243. </View>
  244. </ScrollView>
  245. );
  246. }
  247. }
  248.  
  249. AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
  250.  
  251. <Button
  252. onPress={()=>Alert.alert(this.state.text1)}
  253. title="Press Me"
  254. color="#841584"
  255. />
Add Comment
Please, Sign In to add comment