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.6KB

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