Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

wv0.native.js 11KB

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