Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

wv0.native.js 11KB

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