Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

wv0.native.js 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  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-native-paper';
  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_v2(fn_name,arg1){
  48. var that0 = this
  49. // var ret = function(arg2){
  50. return function(arg2){
  51. // return tglob_au.run_dev_cbs(fn_name,{arg1,arg2,argx:arguments})
  52. var ret2 = tglob_au.run_dev_cbs(fn_name,{arg1,arg2,argx:arguments,thats:{that0,that1:this}})
  53. return ret2.o.ret
  54. }
  55. // return ret
  56. }
  57. function fncb_only(fn_name){
  58. var ret
  59. if (window.glob_vhook.rcb[fn_name]){
  60. // ret = window.glob_vhook.rcb[fn_name](fn_name,o,dflt_ret)
  61. // (fn_name,o,dflt_ret)
  62. ret = {status:1,fn:window.glob_vhook.rcb[fn_name]}
  63. } else {
  64. ret = {status:0,fn:window.nop}
  65. }
  66. return ret
  67. }
  68. class Wview_btns extends Component<Props> {
  69. constructor(props) {
  70. super(props);
  71. }
  72. render(){
  73. // wview_btns = tglob_au.run_dev_cbs("wview_btns",{that:this})
  74. var x1 = tglob_au.run_dev_cbs("wview_btns",{that:this}) || {o:{}}
  75. var wview_btns = x1.o.ret || {}
  76. clog("\n\n\n\nwview_btns",wview_btns)
  77. // wview_btns.style_b1 || {}
  78. // wview_btns.style_b2 || {}
  79. // wview_btns.style_v0 || {}
  80. // color = { wv0_styles_dev.vb1_color || "#00ffffff" }
  81. // onPress = {fncb_only("vbx_press").fn.bind(this)}
  82. // style={wview_btns.style_v0 || {}}
  83. // prop_id = "b1"
  84. // prop_id = "b2"
  85. // style={ {} }
  86. return (
  87. <View style={wview_btns.style_v0 || {}}>
  88. <Button_v2
  89. prop_id = "b1"
  90. style = { wview_btns.style_b1 || {}}
  91. color={wview_btns.color_b1}
  92. onPress = {fncb_only_v2("vbx_press",{wvt:this})}
  93. >
  94. {wview_btns.b1_txt || "udef1"}
  95. </Button_v2>
  96. <Button_v2
  97. prop_id = "b2"
  98. style = { wview_btns.style_b2 || {}}
  99. color={wview_btns.color_b2}
  100. onPress = {fncb_only_v2("vbx_press",{wvt:this})}
  101. >
  102. {wview_btns.b2_txt || "udef2"}
  103. </Button_v2>
  104. </View>
  105. )
  106. }
  107. }
  108. class Wview_vx extends Component<Props> {
  109. constructor(props) {
  110. super(props);
  111. }
  112. render(){
  113. var wb_url
  114. tglob_au.run_dev_cbs("render_vvx",{that:this,args:arguments,a:"z?"})
  115. if (glob_vhook?.fns?.gen_xcal_room3) {
  116. wb_url = glob_vhook.fns.gen_xcal_room3().room_url
  117. } else {
  118. // wb_url = "https://excalidraw.videocorners.com/#room=4zmaf7d5jtcx4pqgruba,4zmaf7BMXbI6tCEiW7rbgy"
  119. wb_url = "https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"
  120. }
  121. var webview_style = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("webview_style",{that:this},{}) : {}
  122. var wv0_styles = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_styles",{that:this},{}) : {}
  123. // <View
  124. // style = {wv0_styles.v1 || {}}
  125. // >
  126. var wv0_styles_dev = this.wv0_styles_dev || {}
  127. // window.postMessage("Your message");
  128. // console.log(">>>>>>>..?")
  129. var injectedJs = `(function(){
  130. console.log(">>>>>>>..")
  131. this.webView.postMessage("ZZ")
  132. return "Send me back!"}());
  133. `;
  134. injectedJs =`
  135. setTimeout(function () {
  136. window.ReactNativeWebView.postMessage("Hello!")
  137. console.log("QWETUI\n")
  138. window.top.postMessage('hello2', '*')
  139. }, 2000)
  140. `
  141. // clog("VVX:")
  142. return (
  143. <View style={wv0_styles_dev.vx_v}>
  144. <WebView source = {{uri:wb_url}}
  145. style = {wv0_styles_dev.webview_style || {}}
  146. injectedJavaScript={injectedJs}
  147. startInLoadingState
  148. javaScriptEnabledAndroid={true}
  149. javaScriptEnabled={true}
  150. onMessage={onMsg}
  151. ></WebView>
  152. </View>
  153. )
  154. return (
  155. <View style={this.props.vx_v}>
  156. <Text style={this.props.vx_tx} >Wview_vx</Text>
  157. </View>
  158. )
  159. }
  160. }
  161. // class Wview_vx
  162. // class Wview_v1 extends PureComponent<Props> {
  163. class Wview_v1 extends Component<Props> {
  164. constructor(props) {
  165. super(props);
  166. // const { palette } = useTheme();
  167. this.v1="a"
  168. // this.palette=palette
  169. tglob_au.reg_qxi_cb(this.rs_state.bind(this),"SET_TILE_VIEW_DIMENSIONS","RS_STATE")
  170. tglob_au.reg_dev_cb(this.rs_state2.bind(this),"rerender_Wview_v1","rerender")
  171. clog("Wview_v1 init")
  172. }
  173. rs_state2(a1,a2,a3,a4,a5){
  174. this.setState(() => {
  175. return { unseen3: Math.random() }
  176. });
  177. }
  178. rs_state(a1,a2,a3,a4,a5){
  179. // clog("RS_STATE",this,{a1,a2,a3,a4,a5})
  180. // clog("RS_STATE",{a1,a2,a3,a4,a5})
  181. this.setState(() => {
  182. // console.log('setting state');
  183. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  184. // return { unseen: "does not display" }
  185. return { unseen2: wv0_dev.ret }
  186. });
  187. /*
  188. try {
  189. // var s = this.props
  190. var s = this.state
  191. clog("::::",s)
  192. } catch (err){
  193. console.error("ERR:,")
  194. }
  195. */
  196. }
  197. /*
  198. componentDidMount() {
  199. setInterval(() => {
  200. this.setState(() => {
  201. // console.log('setting state');
  202. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  203. return { unseen: "does not display" }
  204. // return { unseen: wv0_dev.ret }
  205. });
  206. }, 1000);
  207. }
  208. */
  209. render() {
  210. var wb_url
  211. clog("Wview_v1 render")
  212. // console.log("wview_v1 render.")
  213. if (glob_vhook?.fns?.gen_xcal_room3) {
  214. wb_url = glob_vhook.fns.gen_xcal_room3().room_url
  215. } else {
  216. // wb_url = "https://excalidraw.videocorners.com/#room=4zmaf7d5jtcx4pqgruba,4zmaf7BMXbI6tCEiW7rbgy"
  217. wb_url = "https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"
  218. }
  219. var webview_style = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("webview_style",{that:this},{}) : {}
  220. var wv0_styles = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_styles",{that:this},{}) : {}
  221. // <View
  222. // style = {wv0_styles.v1 || {}}
  223. // >
  224. var wv0_styles_dev = this.wv0_styles_dev || {}
  225. // window.postMessage("Your message");
  226. // console.log(">>>>>>>..?")
  227. var injectedJs = `(function(){
  228. console.log(">>>>>>>..")
  229. this.webView.postMessage("ZZ")
  230. return "Send me back!"}());
  231. `;
  232. injectedJs =`
  233. setTimeout(function () {
  234. window.ReactNativeWebView.postMessage("Hello!")
  235. console.log("QWETUI\n")
  236. window.top.postMessage('hello2', '*')
  237. }, 2000)
  238. `
  239. // <View style = { wv0_styles.v1 || {} }>
  240. // style = {webview_style}
  241. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  242. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  243. // {t('polls.create.create')}
  244. // <Wview_ui style = { wv0_styles_dev.vb1 || {}} />
  245. // vx_v
  246. // vx_tx
  247. return (
  248. <View style = { wv0_styles_dev.v1 || {} }>
  249. <Text style = { wv0_styles_dev.txt || {} }
  250. >
  251. Z??
  252. </Text>
  253. <Wview_vx
  254. vx_tx = { wv0_styles_dev.vx_tx || {} }
  255. vx_v = { wv0_styles_dev.vx_v || {} }
  256. ></Wview_vx>
  257. <Wview_btns
  258. pt0 = { wv0_styles_dev.wv_b || {}}
  259. ></Wview_btns>
  260. <Button_v2
  261. title = "Cheems"
  262. style = { wv0_styles_dev.vb1 || {}}
  263. color = { wv0_styles_dev.vb1_color || "#00ffffff" }
  264. onPress = {fncb_only("vb1_press").fn.bind(this)}
  265. >
  266. {wv0_styles_dev.vb1_txt || "udef"}
  267. </Button_v2>
  268. <Text2 style = { wv0_styles_dev.txt2 || {} }
  269. >
  270. Z2
  271. </Text2>
  272. </View>
  273. )
  274. }
  275. }
  276. // color = { this.palette.screen01Header }
  277. export {Wview_v1}