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

wv0.native.js 9.3KB

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