Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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