Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {
  3. AppRegistry,
  4. StyleSheet,
  5. Text,
  6. Button,
  7. TouchableHighlight,
  8. View
  9. } from 'react-native';
  10.  
  11. import {StackNavigator} from 'react-navigation';
  12.  
  13. var QRCode = require('react-native-qrcode');
  14.  
  15. export default class App extends Component {
  16. static navigationOptions = {
  17. title: 'App Page',
  18. };
  19.  
  20. constructor(props){
  21. super(props);
  22. this.state = {
  23. }
  24. }
  25.  
  26. render() {
  27. return (
  28. <View style={styles.container}>
  29. <Text style={styles.welcome}>
  30. Welcome to React Native!
  31. </Text>
  32. <Text style={styles.instructions}>
  33. To get started, edit index.ios.js
  34. </Text>
  35. <Text style={styles.instructions}>
  36. This is App Page
  37. </Text>
  38. <Text style={styles.welcome}>
  39. This is the example for QRCODE
  40. </Text>
  41. <TouchableHighlight onPress = { this._onPressButton }>
  42. <View style={styles.button}>
  43. <Text style= {styles.welcome}>
  44. App page botton
  45. </Text>
  46. </View>
  47. </TouchableHighlight>
  48. <View style={styles.imgqrcode}>
  49. <QRCode
  50. value={this.state.text}
  51. size={200}
  52. bgColor='black'
  53. fgColor='white'/>
  54. </View>
  55. </View>
  56. );
  57. }
  58. }
  59.  
  60. const styles = StyleSheet.create({
  61. container: {
  62. flex: 1,
  63. justifyContent: 'center',
  64. alignItems: 'center',
  65. backgroundColor: '#F5FCFF',
  66. },
  67. welcome: {
  68. fontSize: 20,
  69. textAlign: 'center',
  70. margin: 10,
  71. },
  72. instructions: {
  73. textAlign: 'center',
  74. color: '#333333',
  75. marginBottom: 5,
  76. },
  77. imgqrcode: {
  78. marginTop: 100,
  79. },
  80. button: {
  81. justifyContent: 'center',
  82. alignItems: 'center',
  83. backgroundColor: 'yellow',
  84. }
  85. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement