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

wv0.native.js 12KB

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