@aks-dev/easyui 1.0.96 → 1.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-05-05 14:52:53
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-14 18:24:09
5
+ * @LastEditTime: 2022-07-21 18:21:18
6
6
  * @FilePath: /@aks-dev/easyui/lib/Echarts/EchartsView.tsx
7
7
  */
8
8
  import * as React from 'react'
@@ -53,11 +53,12 @@ const EchartsView: React.FC<EchartsViewProps> = (props) => {
53
53
 
54
54
 
55
55
  React.useEffect(() => {
56
+ // console.log('useEffect', state.isLoaded,props.option)
56
57
  if (state.isLoaded) {
57
58
  const run = `
58
59
  ;(function() {
59
- var myChart = echarts.init(document.getElementById('main'));
60
- myChart.setOption(${toString(props.option)});
60
+ var instance = echarts.init(document.getElementById('main'));
61
+ instance.setOption(${toString(props.option)});
61
62
  })();
62
63
  `
63
64
  WebViewRef.current?.injectJavaScript(run);
@@ -65,11 +66,13 @@ const EchartsView: React.FC<EchartsViewProps> = (props) => {
65
66
  return () => {
66
67
  const run = `
67
68
  ;(function() {
68
- var myChart = echarts.init(document.getElementById('main'));
69
- myChart.clear();
69
+ var instance = echarts.getInstanceByDom(document.getElementById('main'));
70
+ instance.clear();
70
71
  })();
71
72
  `
72
73
  WebViewRef.current?.injectJavaScript(run);
74
+
75
+
73
76
  }
74
77
  }
75
78
 
@@ -81,15 +84,16 @@ const EchartsView: React.FC<EchartsViewProps> = (props) => {
81
84
 
82
85
 
83
86
  const injectedJavaScript = (): string => {
87
+ // console.log('injectedJavaScript',props.option)
84
88
  let height = state.height ? `${state.height}px` : 'auto'
85
89
  let width = state.width ? `${state.width}px` : 'auto'
86
90
  return `
87
91
  ;(function() {
88
92
  document.getElementById('main').style.height = "${height}";
89
93
  document.getElementById('main').style.width = "${width}";
90
- var myChart = echarts.init(document.getElementById('main'));
91
- myChart.setOption(${toString(props.option)});
92
- myChart.on('click', function(params) {
94
+ var instance = echarts.init(document.getElementById('main'));
95
+ instance.setOption(${toString(props.option)});
96
+ instance.on('click', function(params) {
93
97
  var seen = [];
94
98
  var paramsString = JSON.stringify(params, function(key, val) {
95
99
  if (val != null && typeof val == "object") {
@@ -100,7 +104,7 @@ const EchartsView: React.FC<EchartsViewProps> = (props) => {
100
104
  }
101
105
  return val;
102
106
  });
103
- window.ReactNativeWebView.postMessage(JSON.stringify({"types":"ON_PRESS","payload": paramsString}));
107
+ // window.ReactNativeWebView.postMessage(JSON.stringify({"types":"ON_PRESS","payload": paramsString}));
104
108
  });
105
109
  })();
106
110
  `
@@ -123,12 +127,15 @@ const EchartsView: React.FC<EchartsViewProps> = (props) => {
123
127
  }} // 设置空View,修复ioswebview闪白
124
128
  style={{ backgroundColor: (props.style as ViewStyle)?.backgroundColor || 'transparent' }} // 设置背景色透明,修复android闪白
125
129
  scrollEnabled={false}
126
- // onMessage={onMessage}
130
+ // onMessage={e=>{
131
+ // console.log(e)
132
+ // }}
127
133
  javaScriptEnabled={true}
128
134
  injectedJavaScript={injectedJavaScript()}
129
135
  startInLoadingState={false}
130
136
  onLoadEnd={(_) => {
131
137
  dispatch({ isLoaded: true })
138
+ // console.log('onLoadEnd')
132
139
  }}
133
140
  source={{
134
141
  baseUrl: '',
@@ -152,4 +159,5 @@ const styles = StyleSheet.create({
152
159
 
153
160
 
154
161
 
155
- export default React.memo(EchartsView)
162
+ export default EchartsView
163
+ // React.memo(EchartsView)
@@ -2,8 +2,8 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2021-04-27 10:38:04
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-05-12 11:33:40
6
- * @FilePath: /@aks/easyui/lib/Easy-Hud/Toast/Toast.tsx
5
+ * @LastEditTime: 2022-08-04 10:43:06
6
+ * @FilePath: /@aks-dev/easyui/lib/Hud/Toast/Toast.tsx
7
7
  */
8
8
  import React, { useImperativeHandle, useState, useRef } from 'react';
9
9
  import { View, StyleSheet, Text, Dimensions, Animated, Easing } from 'react-native';
@@ -16,6 +16,7 @@ const errorMsg = '(^_^)∠※ 送你一束小花'
16
16
  export const Toast = React.forwardRef<ToastCurrent, {}>((_, ref) => {
17
17
  const [tipText, setTipText] = useState(errorMsg);
18
18
  const fade = useRef(new Animated.Value(0)).current;
19
+ const [tipTheme, setTipTheme] = useState<'black' | 'white'>('black')
19
20
 
20
21
  const fadeAnimation = Animated.sequence([
21
22
  Animated.timing(fade, {
@@ -34,8 +35,9 @@ export const Toast = React.forwardRef<ToastCurrent, {}>((_, ref) => {
34
35
  ])
35
36
 
36
37
  useImperativeHandle<unknown, ToastCurrent>(ref, () => ({
37
- showToast: (content: string) => {
38
+ showToast: (content: string, theme?: 'black' | 'white') => {
38
39
  setTipText(content || errorMsg)
40
+ setTipTheme(theme ? theme : 'black')
39
41
  fadeAnimation.reset()
40
42
  fadeAnimation.start()
41
43
  },
@@ -43,8 +45,8 @@ export const Toast = React.forwardRef<ToastCurrent, {}>((_, ref) => {
43
45
 
44
46
  return (
45
47
  <Animated.View style={{ ...styles.toastContainer, opacity: fade }}>
46
- <View style={styles.toastTipsContainer}>
47
- <Text numberOfLines={5} style={{ ...styles.toastTitle, }}>{tipText} </Text>
48
+ <View style={[styles.toastTipsContainer, { backgroundColor: tipTheme == 'black' ? '#00000088' : '#ffffff88' }]}>
49
+ <Text numberOfLines={5} style={[styles.toastTitle, { color: tipTheme == 'black' ? ' white' : 'black' }]}>{tipText} </Text>
48
50
  </View>
49
51
  </Animated.View>
50
52
 
@@ -53,7 +55,7 @@ export const Toast = React.forwardRef<ToastCurrent, {}>((_, ref) => {
53
55
 
54
56
  export const toastRef = React.createRef<ToastCurrent>();
55
57
 
56
- export const showToast = (content: string) => toastRef.current?.showToast(content)
58
+ export const showToast = (content: string, theme?: 'black' | 'white') => toastRef.current?.showToast(content, theme)
57
59
 
58
60
 
59
61
 
@@ -2,8 +2,8 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-18 19:18:03
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-05-12 11:33:32
6
- * @FilePath: /@aks/easyui/lib/Easy-Hud/Toast/index.ts
5
+ * @LastEditTime: 2022-08-04 09:51:29
6
+ * @FilePath: /@aks-dev/easyui/lib/Hud/Toast/index.ts
7
7
  */
8
8
  import * as React from 'react'
9
9
 
@@ -11,10 +11,10 @@ import * as React from 'react'
11
11
 
12
12
 
13
13
  export declare type ToastCurrent = {
14
- showToast: (content: string) => void;
14
+ showToast: (content: string, theme?: 'black' | 'white') => void;
15
15
  }
16
16
 
17
- export declare const showToast: (content: string) => void;
17
+ export declare const showToast: (content: string, theme?: 'black' | 'white') => void;
18
18
 
19
19
 
20
20
  export declare const toastRef: React.RefObject<ToastCurrent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.96",
3
+ "version": "1.0.99",
4
4
  "description": "移动端App开发工具包",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",