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 6.3KB

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