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

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