Guest User

Untitled

a guest
Dec 3rd, 2019
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import PropTypes from 'prop-types';
  3. import {
  4. Platform,
  5. StyleSheet,
  6. Text,
  7. View,
  8. WebView,
  9. Alert,
  10. ActivityIndicator,
  11. } from 'react-native';
  12. import { Actions } from 'react-native-router-flux';
  13. import Messages from '../UI/Messages';
  14. import Header from '../UI/Header';
  15. import Spacer from '../UI/Spacer';
  16. import Offline from '../User/OfflineNotice';
  17.  
  18. // const url = 'https://gwadev.xtendly.com/'
  19. const url = 'https://globalcareercreation.com/myaccount/'
  20. class LoginWeb extends React.Component {
  21.  
  22. constructor(props) {
  23. super(props)
  24.  
  25. this.state = {
  26. isLoaded: false,
  27. }
  28. }
  29.  
  30.  
  31. render() {
  32. // var renderTime = Date.now();
  33. const INJECTEDJAVASCRIPT = `const meta = document.createElement('meta'); meta.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'); meta.setAttribute('name', 'viewport'); document.getElementsByTagName('head')[0].appendChild(meta); `
  34. return (
  35. // <View pointerEvents="none">
  36. <WebView
  37. useWebKit={true}
  38. source={{ uri: url }}
  39. style={{ flex: 1, alignItems: 'center' }}
  40. style={{ marginTop: 20 }}
  41. injectedJavaScript={INJECTEDJAVASCRIPT}
  42. scrollEnabled
  43. // // scalesPageToFit={false}
  44. // onLoad={() => {
  45. // Alert.alert('On load event', `Loading time : ${Date.now() - renderTime}`)
  46. // }}
  47. />
  48. // </View>
  49. );
  50. }
  51. }
  52.  
  53. export default class Login extends Component<{}> {
  54. constructor(props) {
  55. super(props)
  56.  
  57. this.state = {
  58. isLoaded: false,
  59. }
  60. }
  61.  
  62. render() {
  63.  
  64. if (this.state.isLoaded) {
  65. return (
  66. <LoginWeb />
  67.  
  68. )
  69. }
  70.  
  71. return (
  72. <View style={styles.container}>
  73. <View style={{ height: 0, width: 0 }}>
  74. <WebView
  75. source={{ uri: url }}
  76. onLoad={() => {
  77. this.setState({ isLoaded: true })
  78. }}
  79. />
  80. </View>
  81. <ActivityIndicator />
  82. </View>
  83. );
  84. }
  85. }
  86.  
  87. const styles = StyleSheet.create({
  88. container: {
  89. flex: 1,
  90. justifyContent: 'center',
  91. alignItems: 'center',
  92. backgroundColor: '#F5FCFF',
  93. },
  94. });
Advertisement
Add Comment
Please, Sign In to add comment