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

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