Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

wv0.native.js 11KB

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