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 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. import { WebView } from 'react-native-webview';
  2. import React, { PureComponent,Component } from 'react';
  3. // Button as R_Button
  4. import { Button, useTheme } from 'react-native-paper';
  5. import {
  6. Animated,
  7. Keyboard,
  8. SafeAreaView,
  9. TextInput,
  10. TouchableHighlight,
  11. TouchableOpacity,
  12. View,
  13. // Text,
  14. } from 'react-native';
  15. import * as rn from 'react-native';
  16. var Text2 = rn.Text
  17. import {AbstractButton} from '../react/features/base/toolbox/components';
  18. import { Header, LoadingIndicator, Text } from '../react/features/base/react';
  19. function onMsg(event ){
  20. clog("OBMSG>>>>")
  21. var onMsg = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("onMsg",{that:this,event},{}) : {}
  22. }
  23. type Props = {}
  24. // class Wview_ui extends AbstractButton<Props> {
  25. class Wview_ui extends PureComponent<Props> {
  26. // class Wview_ui extends AbstractButton<Props, any> {
  27. // icon = "IconMessage";
  28. constructor(props) {
  29. super(props);
  30. this.v1="a"
  31. clog("Wview_v1 init")
  32. glob_vhook.nodes.wvui = this
  33. }
  34. render() {
  35. // return
  36. }
  37. }
  38. function fncb_only(fn_name){
  39. var ret
  40. if (window.glob_vhook.rcb[fn_name]){
  41. // ret = window.glob_vhook.rcb[fn_name](fn_name,o,dflt_ret)
  42. // (fn_name,o,dflt_ret)
  43. ret = {status:1,fn:window.glob_vhook.rcb[fn_name]}
  44. } else {
  45. ret = {status:0,fn:window.nop}
  46. }
  47. return ret
  48. }
  49. // class Wview_v1 extends PureComponent<Props> {
  50. class Wview_v1 extends Component<Props> {
  51. constructor(props) {
  52. super(props);
  53. // const { palette } = useTheme();
  54. this.v1="a"
  55. // this.palette=palette
  56. tglob_au.reg_qxi_cb(this.rs_state.bind(this),"SET_TILE_VIEW_DIMENSIONS","RS_STATE")
  57. tglob_au.reg_dev_cb(this.rs_state2.bind(this),"rerender_Wview_v1","rerender")
  58. clog("Wview_v1 init")
  59. }
  60. rs_state2(a1,a2,a3,a4,a5){
  61. this.setState(() => {
  62. return { unseen3: Math.random() }
  63. });
  64. }
  65. rs_state(a1,a2,a3,a4,a5){
  66. // clog("RS_STATE",this,{a1,a2,a3,a4,a5})
  67. // clog("RS_STATE",{a1,a2,a3,a4,a5})
  68. this.setState(() => {
  69. // console.log('setting state');
  70. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  71. // return { unseen: "does not display" }
  72. return { unseen2: wv0_dev.ret }
  73. });
  74. /*
  75. try {
  76. // var s = this.props
  77. var s = this.state
  78. clog("::::",s)
  79. } catch (err){
  80. console.error("ERR:,")
  81. }
  82. */
  83. }
  84. /*
  85. componentDidMount() {
  86. setInterval(() => {
  87. this.setState(() => {
  88. // console.log('setting state');
  89. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  90. return { unseen: "does not display" }
  91. // return { unseen: wv0_dev.ret }
  92. });
  93. }, 1000);
  94. }
  95. */
  96. render() {
  97. var wb_url
  98. clog("Wview_v1 render")
  99. // console.log("wview_v1 render.")
  100. if (glob_vhook?.fns?.gen_xcal_room3) {
  101. wb_url = glob_vhook.fns.gen_xcal_room3().room_url
  102. } else {
  103. // wb_url = "https://excalidraw.videocorners.com/#room=4zmaf7d5jtcx4pqgruba,4zmaf7BMXbI6tCEiW7rbgy"
  104. wb_url = "https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"
  105. }
  106. var webview_style = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("webview_style",{that:this},{}) : {}
  107. var wv0_styles = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_styles",{that:this},{}) : {}
  108. // <View
  109. // style = {wv0_styles.v1 || {}}
  110. // >
  111. var wv0_styles_dev = this.wv0_styles_dev || {}
  112. // window.postMessage("Your message");
  113. console.log(">>>>>>>..?")
  114. var injectedJs = `(function(){
  115. console.log(">>>>>>>..")
  116. this.webView.postMessage("ZZ")
  117. return "Send me back!"}());
  118. `;
  119. injectedJs =`
  120. setTimeout(function () {
  121. window.ReactNativeWebView.postMessage("Hello!")
  122. console.log("QWETUI\n")
  123. window.top.postMessage('hello2', '*')
  124. }, 2000)
  125. `
  126. // <View style = { wv0_styles.v1 || {} }>
  127. // style = {webview_style}
  128. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  129. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  130. // {t('polls.create.create')}
  131. // <Wview_ui style = { wv0_styles_dev.vb1 || {}} />
  132. return (
  133. <View style = { wv0_styles_dev.v1 || {} }>
  134. <Text style = { wv0_styles_dev.txt || {} }
  135. >
  136. Z??
  137. </Text>
  138. <WebView source = {{uri:wb_url}}
  139. style = {wv0_styles_dev.webview_style || {}}
  140. injectedJavaScript={injectedJs}
  141. startInLoadingState
  142. javaScriptEnabledAndroid={true}
  143. javaScriptEnabled={true}
  144. onMessage={onMsg}
  145. ></WebView>
  146. <Button
  147. style = { wv0_styles_dev.vb1 || {}}
  148. color = { wv0_styles_dev.vb1_color || "#00ffffff" }
  149. onPress = {fncb_only("vb1_press").fn.bind(this)}
  150. >
  151. {wv0_styles_dev.vb1_txt || "udef"}
  152. </Button>
  153. <Text2 style = { wv0_styles_dev.txt2 || {} }
  154. >
  155. Z2
  156. </Text2>
  157. </View>
  158. )
  159. }
  160. }
  161. // color = { this.palette.screen01Header }
  162. export {Wview_v1}