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

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