You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wv0.native.js 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. import { WebView } from 'react-native-webview';
  2. import React, { PureComponent,Component } from 'react';
  3. // Button as R_Button
  4. import { Button, useTheme } from 'react-native-paper';
  5. import {
  6. Animated,
  7. Keyboard,
  8. SafeAreaView,
  9. TextInput,
  10. TouchableHighlight,
  11. TouchableOpacity,
  12. View,
  13. // Text,
  14. } from 'react-native';
  15. import * as rn from 'react-native';
  16. var Text2 = rn.Text
  17. import {AbstractButton} from '../react/features/base/toolbox/components';
  18. import { Header, LoadingIndicator, Text } from '../react/features/base/react';
  19. function onMsg(event ){
  20. clog("OBMSG>>>>")
  21. var onMsg = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("onMsg",{that:this,event},{}) : {}
  22. }
  23. type Props = {}
  24. // class Wview_ui extends AbstractButton<Props> {
  25. class Wview_ui extends PureComponent<Props> {
  26. // class Wview_ui extends AbstractButton<Props, any> {
  27. // icon = "IconMessage";
  28. constructor(props) {
  29. super(props);
  30. this.v1="a"
  31. clog("Wview_v1 init")
  32. }
  33. render() {
  34. // return
  35. }
  36. }
  37. function fncb_only(fn_name){
  38. var ret
  39. if (window.glob_vhook.rcb[fn_name]){
  40. // ret = window.glob_vhook.rcb[fn_name](fn_name,o,dflt_ret)
  41. // (fn_name,o,dflt_ret)
  42. ret = {status:1,fn:window.glob_vhook.rcb[fn_name]}
  43. } else {
  44. ret = {status:0,fn:window.nop}
  45. }
  46. return ret
  47. }
  48. class Wview_v1 extends PureComponent<Props> {
  49. constructor(props) {
  50. super(props);
  51. // const { palette } = useTheme();
  52. this.v1="a"
  53. // this.palette=palette
  54. tglob_au.reg_qxi_cb(this.rs_state.bind(this),"SET_TILE_VIEW_DIMENSIONS","RS_STATE")
  55. clog("Wview_v1 init")
  56. }
  57. rs_state(a1,a2,a3,a4,a5){
  58. // clog("RS_STATE",this,{a1,a2,a3,a4,a5})
  59. // clog("RS_STATE",{a1,a2,a3,a4,a5})
  60. this.setState(() => {
  61. // console.log('setting state');
  62. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  63. // return { unseen: "does not display" }
  64. return { unseen2: wv0_dev.ret }
  65. });
  66. try {
  67. // var s = this.props
  68. var s = this.state
  69. clog("::::",s)
  70. } catch (err){
  71. console.error("ERR:,")
  72. }
  73. }
  74. componentDidMount() {
  75. setInterval(() => {
  76. this.setState(() => {
  77. // console.log('setting state');
  78. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  79. return { unseen: "does not display" }
  80. // return { unseen: wv0_dev.ret }
  81. });
  82. }, 1000);
  83. }
  84. render() {
  85. var wb_url
  86. clog("Wview_v1 render")
  87. // console.log("wview_v1 render.")
  88. if (glob_vhook?.fns?.gen_xcal_room3) {
  89. wb_url = glob_vhook.fns.gen_xcal_room3().room_url
  90. } else {
  91. // wb_url = "https://excalidraw.videocorners.com/#room=4zmaf7d5jtcx4pqgruba,4zmaf7BMXbI6tCEiW7rbgy"
  92. wb_url = "https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"
  93. }
  94. var webview_style = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("webview_style",{that:this},{}) : {}
  95. var wv0_styles = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_styles",{that:this},{}) : {}
  96. // <View
  97. // style = {wv0_styles.v1 || {}}
  98. // >
  99. var wv0_styles_dev = this.wv0_styles_dev || {}
  100. // window.postMessage("Your message");
  101. console.log(">>>>>>>..?")
  102. var injectedJs = `(function(){
  103. console.log(">>>>>>>..")
  104. this.webView.postMessage("ZZ")
  105. return "Send me back!"}());
  106. `;
  107. injectedJs =`
  108. setTimeout(function () {
  109. window.ReactNativeWebView.postMessage("Hello!")
  110. console.log("QWETUI\n")
  111. window.top.postMessage('hello2', '*')
  112. }, 2000)
  113. `
  114. // <View style = { wv0_styles.v1 || {} }>
  115. // style = {webview_style}
  116. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  117. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  118. // {t('polls.create.create')}
  119. // <Wview_ui style = { wv0_styles_dev.vb1 || {}} />
  120. return (
  121. <View style = { wv0_styles_dev.v1 || {} }>
  122. <Text style = { wv0_styles_dev.txt || {} }
  123. >
  124. Z??
  125. </Text>
  126. <WebView source = {{uri:wb_url}}
  127. style = {wv0_styles_dev.webview_style || {}}
  128. injectedJavaScript={injectedJs}
  129. startInLoadingState
  130. javaScriptEnabledAndroid={true}
  131. javaScriptEnabled={true}
  132. onMessage={onMsg}
  133. ></WebView>
  134. <Button
  135. style = { wv0_styles_dev.vb1 || {}}
  136. color = { wv0_styles_dev.vb1_color || "#00ffffff" }
  137. onPress = {fncb_only("vb1_press").fn}
  138. >
  139. {wv0_styles_dev.vb1_txt || "udef"}
  140. </Button>
  141. <Text2 style = { wv0_styles_dev.txt2 || {} }
  142. >
  143. Z2
  144. </Text2>
  145. </View>
  146. )
  147. }
  148. }
  149. // color = { this.palette.screen01Header }
  150. export {Wview_v1}