@dhiraj0720/report1chart 3.0.4 → 3.0.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhiraj0720/report1chart",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "main": "src/index.jsx",
5
5
  "scripts": {
6
6
  "test": "echo 'No tests'"
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import {
3
3
  Modal,
4
4
  View,
@@ -12,6 +12,12 @@ import {
12
12
  const MonthFilterModal = ({ visible, months, selected, onApply, onClose }) => {
13
13
  const [local, setLocal] = useState(selected || []);
14
14
 
15
+ useEffect(() => {
16
+ if (visible) {
17
+ setLocal(Array.isArray(selected) ? selected : []);
18
+ }
19
+ }, [visible, selected]);
20
+
15
21
  const toggle = (m) => {
16
22
  if (local.includes(m)) {
17
23
  setLocal(local.filter(x => x !== m));
@@ -20,7 +26,7 @@ const MonthFilterModal = ({ visible, months, selected, onApply, onClose }) => {
20
26
  }
21
27
  };
22
28
 
23
- const selectAll = () => setLocal(months);
29
+ const selectAll = () => setLocal([...(months || [])]);
24
30
  const clearAll = () => setLocal([]);
25
31
 
26
32
  return (
@@ -160,4 +166,4 @@ const styles = StyleSheet.create({
160
166
  },
161
167
  });
162
168
 
163
- export default MonthFilterModal;
169
+ export default MonthFilterModal;
package/src/index.jsx CHANGED
@@ -4,7 +4,9 @@ import SafeScreen from './components/SafeScreen';
4
4
  import ReportListScreen from './screens/ReportListScreen';
5
5
  import Report1Screen from './screens/Report1Screen';
6
6
  import Report2Screen from './screens/Report2Screen';
7
+ import Report2ModernScreen from './screens/Report2ModernScreen';
7
8
  import Report3Screen from './screens/Report3Screen';
9
+ import Report3ModernScreen from './screens/Report3ModernScreen';
8
10
  import Report1AScreen from './screens/Report1AScreen';
9
11
  import Report2AScreen from './screens/Report2AScreen';
10
12
  import Report3AScreen from './screens/Report3AScreen';
@@ -85,6 +87,30 @@ if (active === '2A') {
85
87
  );
86
88
  }
87
89
 
90
+ if (active === '2N1') {
91
+ return (
92
+ <SafeScreen>
93
+ <Report2ModernScreen
94
+ api={config.report2}
95
+ token={config.token}
96
+ onBack={() => setActive(null)}
97
+ />
98
+ </SafeScreen>
99
+ );
100
+ }
101
+
102
+ if (active === '3N1') {
103
+ return (
104
+ <SafeScreen>
105
+ <Report3ModernScreen
106
+ api={config.report3}
107
+ token={config.token}
108
+ onBack={() => setActive(null)}
109
+ />
110
+ </SafeScreen>
111
+ );
112
+ }
113
+
88
114
 
89
115
  // 👉 REPORT 2
90
116
  if (active === 2) {