Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

wv0.native.js 11KB

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