您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

wv0.native.js 11KB

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