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

wv0.native.js 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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_vx extends Component<Props> {
  50. constructor(props) {
  51. super(props);
  52. }
  53. render(){
  54. return (
  55. <View>
  56. <Text>Wview_vx</Text>
  57. </View>
  58. )
  59. }
  60. }
  61. // class Wview_vx
  62. // class Wview_v1 extends PureComponent<Props> {
  63. class Wview_v1 extends Component<Props> {
  64. constructor(props) {
  65. super(props);
  66. // const { palette } = useTheme();
  67. this.v1="a"
  68. // this.palette=palette
  69. tglob_au.reg_qxi_cb(this.rs_state.bind(this),"SET_TILE_VIEW_DIMENSIONS","RS_STATE")
  70. tglob_au.reg_dev_cb(this.rs_state2.bind(this),"rerender_Wview_v1","rerender")
  71. clog("Wview_v1 init")
  72. }
  73. rs_state2(a1,a2,a3,a4,a5){
  74. this.setState(() => {
  75. return { unseen3: Math.random() }
  76. });
  77. }
  78. rs_state(a1,a2,a3,a4,a5){
  79. // clog("RS_STATE",this,{a1,a2,a3,a4,a5})
  80. // clog("RS_STATE",{a1,a2,a3,a4,a5})
  81. this.setState(() => {
  82. // console.log('setting state');
  83. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  84. // return { unseen: "does not display" }
  85. return { unseen2: wv0_dev.ret }
  86. });
  87. /*
  88. try {
  89. // var s = this.props
  90. var s = this.state
  91. clog("::::",s)
  92. } catch (err){
  93. console.error("ERR:,")
  94. }
  95. */
  96. }
  97. /*
  98. componentDidMount() {
  99. setInterval(() => {
  100. this.setState(() => {
  101. // console.log('setting state');
  102. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  103. return { unseen: "does not display" }
  104. // return { unseen: wv0_dev.ret }
  105. });
  106. }, 1000);
  107. }
  108. */
  109. render() {
  110. var wb_url
  111. clog("Wview_v1 render")
  112. // console.log("wview_v1 render.")
  113. if (glob_vhook?.fns?.gen_xcal_room3) {
  114. wb_url = glob_vhook.fns.gen_xcal_room3().room_url
  115. } else {
  116. // wb_url = "https://excalidraw.videocorners.com/#room=4zmaf7d5jtcx4pqgruba,4zmaf7BMXbI6tCEiW7rbgy"
  117. wb_url = "https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"
  118. }
  119. var webview_style = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("webview_style",{that:this},{}) : {}
  120. var wv0_styles = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_styles",{that:this},{}) : {}
  121. // <View
  122. // style = {wv0_styles.v1 || {}}
  123. // >
  124. var wv0_styles_dev = this.wv0_styles_dev || {}
  125. // window.postMessage("Your message");
  126. console.log(">>>>>>>..?")
  127. var injectedJs = `(function(){
  128. console.log(">>>>>>>..")
  129. this.webView.postMessage("ZZ")
  130. return "Send me back!"}());
  131. `;
  132. injectedJs =`
  133. setTimeout(function () {
  134. window.ReactNativeWebView.postMessage("Hello!")
  135. console.log("QWETUI\n")
  136. window.top.postMessage('hello2', '*')
  137. }, 2000)
  138. `
  139. // <View style = { wv0_styles.v1 || {} }>
  140. // style = {webview_style}
  141. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  142. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  143. // {t('polls.create.create')}
  144. // <Wview_ui style = { wv0_styles_dev.vb1 || {}} />
  145. return (
  146. <View style = { wv0_styles_dev.v1 || {} }>
  147. <Text style = { wv0_styles_dev.txt || {} }
  148. >
  149. Z??
  150. </Text>
  151. <Wview_vx></Wview_vx>
  152. <WebView source = {{uri:wb_url}}
  153. style = {wv0_styles_dev.webview_style || {}}
  154. injectedJavaScript={injectedJs}
  155. startInLoadingState
  156. javaScriptEnabledAndroid={true}
  157. javaScriptEnabled={true}
  158. onMessage={onMsg}
  159. ></WebView>
  160. <Button
  161. style = { wv0_styles_dev.vb1 || {}}
  162. color = { wv0_styles_dev.vb1_color || "#00ffffff" }
  163. onPress = {fncb_only("vb1_press").fn.bind(this)}
  164. >
  165. {wv0_styles_dev.vb1_txt || "udef"}
  166. </Button>
  167. <Text2 style = { wv0_styles_dev.txt2 || {} }
  168. >
  169. Z2
  170. </Text2>
  171. </View>
  172. )
  173. }
  174. }
  175. // color = { this.palette.screen01Header }
  176. export {Wview_v1}