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

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