@fto-consult/expo-ui 6.26.0 → 6.26.2
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 +3 -3
- package/src/App.js +1 -10
- package/src/components/Datagrid/Actions/index.js +1 -1
- package/src/components/Datagrid/Common/Common.js +2 -1
- package/src/components/Datagrid/utils.js +3 -3
- package/src/components/Drawer/DrawerItems/index.js +7 -6
- package/src/components/ErrorBoundary/index.js +0 -1
- package/src/components/Menu/Menu.js +97 -113
- package/src/components/SplashScreen/index.js +16 -25
- package/src/index.js +48 -41
- package/src/navigation/Drawer/index.js +5 -3
- package/src/navigation/Drawer/items/index.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "6.26.
|
|
3
|
+
"version": "6.26.2",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
"@emotion/react": "^11.11.1",
|
|
68
68
|
"@expo/html-elements": "^0.5.1",
|
|
69
69
|
"@expo/vector-icons": "^13.0.0",
|
|
70
|
-
"@
|
|
70
|
+
"@faker-js/faker": "^8.0.2",
|
|
71
|
+
"@fto-consult/common": "^3.28.4",
|
|
71
72
|
"@gorhom/portal": "^1.0.14",
|
|
72
73
|
"@pchmn/expo-material3-theme": "^1.3.1",
|
|
73
74
|
"@react-native-async-storage/async-storage": "1.18.2",
|
|
@@ -121,7 +122,6 @@
|
|
|
121
122
|
"devDependencies": {
|
|
122
123
|
"@expo/metro-config": "latest",
|
|
123
124
|
"@expo/webpack-config": "^18.1.2",
|
|
124
|
-
"@faker-js/faker": "^8.0.2",
|
|
125
125
|
"babel-plugin-inline-dotenv": "^1.7.0",
|
|
126
126
|
"babel-plugin-module-resolver": "^5.0.0",
|
|
127
127
|
"uninstall": "^0.0.0"
|
package/src/App.js
CHANGED
|
@@ -3,9 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import {SWRConfig} from "$swr";
|
|
4
4
|
import Index from './index';
|
|
5
5
|
import notify from "$notify";
|
|
6
|
-
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
7
|
-
import {GestureHandlerRootView} from "react-native-gesture-handler";
|
|
8
|
-
import KeyboardAvoidingViewComponent from '$ecomponents/KeyboardAvoidingView';
|
|
9
6
|
import APP from "$app";
|
|
10
7
|
import {isMobileNative} from "$cplatform";
|
|
11
8
|
import {setDeviceIdRef} from "$capp";
|
|
@@ -144,13 +141,7 @@ export default function getIndex({onMount,onUnmount,render,onRender,init}){
|
|
|
144
141
|
}
|
|
145
142
|
}}
|
|
146
143
|
>
|
|
147
|
-
|
|
148
|
-
<KeyboardAvoidingViewComponent testID={"RN_AppKeyboardAvoidingView"}>
|
|
149
|
-
<SafeAreaProvider testID={"RN_AppSafeAreaProvider"}>
|
|
150
|
-
<Index onMount={onMount} render={render} onUnmount={onUnmount} onRender={onRender} init={init}/>
|
|
151
|
-
</SafeAreaProvider>
|
|
152
|
-
</KeyboardAvoidingViewComponent>
|
|
153
|
-
</GestureHandlerRootView>
|
|
144
|
+
<Index onMount={onMount} render={render} onUnmount={onUnmount} onRender={onRender} init={init}/>
|
|
154
145
|
</SWRConfig>
|
|
155
146
|
);
|
|
156
147
|
};
|
|
@@ -16,7 +16,7 @@ export default function DatagridActions ({actions,actionProps,...props}){
|
|
|
16
16
|
const selectedRowsCount = useGetSelectedRowsCount();
|
|
17
17
|
useWindowDimensions();
|
|
18
18
|
const selected = !!selectedRowsCount;
|
|
19
|
-
actions = selected ? context?.renderSelectedRowsActions.call(context,
|
|
19
|
+
actions = selected ? context?.renderSelectedRowsActions.call(context,{}) : actions;
|
|
20
20
|
if(selected){
|
|
21
21
|
actionProps = Object.assign({},actionProps);
|
|
22
22
|
actionProps.style = Object.assign({},StyleSheet.flatten(actionProps.style));
|
|
@@ -3560,7 +3560,8 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
3560
3560
|
}
|
|
3561
3561
|
isAllRowsSelected(){
|
|
3562
3562
|
const count = this.getSelectedRowsCount() - this.getSectionListDataSize();
|
|
3563
|
-
|
|
3563
|
+
if(count <= 0) return false;
|
|
3564
|
+
return count >= this.getMaxSelectableRows();
|
|
3564
3565
|
}
|
|
3565
3566
|
getDefaultPaginationRowsPerPageItems (){
|
|
3566
3567
|
return [5,10,15,20,25,30,40,50,60,80,100];
|
|
@@ -173,9 +173,9 @@ export const getRowStyle = ({row,bordered,numColumns,rowData,isAccordion,isTable
|
|
|
173
173
|
style.push(rowIndex%2===0?styles.even : theme.isDark()?styles.oddDark : styles.odd)
|
|
174
174
|
}
|
|
175
175
|
if(selected){
|
|
176
|
-
const selectedBcolor = theme.isDark()? SELECTED_BORDER_COLOR : theme.colors.primary;
|
|
177
|
-
const bordered = isAccordion ? null : {borderBottomWidth:1,borderBottomColor:selectedBcolor,borderTopWidth:1,borderTopColor:selectedBcolor};
|
|
178
|
-
style.push(styles.selected
|
|
176
|
+
//const selectedBcolor = theme.isDark()? SELECTED_BORDER_COLOR : theme.colors.primary;
|
|
177
|
+
//const bordered = null;//isAccordion ? null : {borderBottomWidth:1,borderBottomColor:selectedBcolor,borderTopWidth:1,borderTopColor:selectedBcolor};
|
|
178
|
+
style.push(styles.selected);
|
|
179
179
|
}
|
|
180
180
|
if(paid || row.paid){
|
|
181
181
|
style.push(styles.paid);
|
|
@@ -6,12 +6,13 @@ import DrawerSection from "./DrawerSection"
|
|
|
6
6
|
import PropTypes from "prop-types";
|
|
7
7
|
import Divider from "$ecomponents/Divider";
|
|
8
8
|
import View from "$ecomponents/View";
|
|
9
|
+
import Auth from "$cauth";
|
|
10
|
+
import { useDrawer } from '../Provider';
|
|
9
11
|
|
|
10
12
|
export * from "./utils";
|
|
11
13
|
|
|
12
14
|
const DrawerItemsComponent = React.forwardRef((props,ref)=> {
|
|
13
15
|
let {items:_items,minimized} = props;
|
|
14
|
-
const hasAuth = typeof window.Auth !=='undefined' && Auth && Auth.isAllowedFromStr ? true : false;
|
|
15
16
|
_items = typeof _items ==='function'? _items(props) : _items;
|
|
16
17
|
if(React.isValidElement(_items)){
|
|
17
18
|
return _items;
|
|
@@ -19,7 +20,7 @@ const DrawerItemsComponent = React.forwardRef((props,ref)=> {
|
|
|
19
20
|
const r = React.useMemo(()=>{
|
|
20
21
|
let items = []
|
|
21
22
|
const renderExpandableOrSection = ({item,key,items})=>{
|
|
22
|
-
if(
|
|
23
|
+
if(isNonNullString(item.perm) && !Auth.isAllowedFromStr(item.perm)) return null;
|
|
23
24
|
const {section,items:itx2,...rest} = item;
|
|
24
25
|
if(section){
|
|
25
26
|
return <DrawerSection
|
|
@@ -53,7 +54,7 @@ const DrawerItemsComponent = React.forwardRef((props,ref)=> {
|
|
|
53
54
|
Object.map(item.items,(it,j)=>{
|
|
54
55
|
if(!isObj(it)) return ;
|
|
55
56
|
getDefaultProps(it);
|
|
56
|
-
const r = renderItem({minimized,
|
|
57
|
+
const r = renderItem({minimized,renderExpandableOrSection,items:item.items,item:it,key:i+j,props});
|
|
57
58
|
if(r){
|
|
58
59
|
itx.push(r);
|
|
59
60
|
}
|
|
@@ -65,7 +66,7 @@ const DrawerItemsComponent = React.forwardRef((props,ref)=> {
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
} else {
|
|
68
|
-
const r = renderItem({minimized,
|
|
69
|
+
const r = renderItem({minimized,renderExpandableOrSection,items:_items,item,key:i+"",props});
|
|
69
70
|
if(r){
|
|
70
71
|
items.push(r);
|
|
71
72
|
}
|
|
@@ -120,14 +121,14 @@ const getDefaultProps = function(item){
|
|
|
120
121
|
return item;
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
const renderItem = ({item,minimized,
|
|
124
|
+
const renderItem = ({item,minimized,renderExpandableOrSection,index,key})=>{
|
|
124
125
|
key = key||index;
|
|
125
126
|
if(React.isValidElement(item)){
|
|
126
127
|
return <React.Fragment key={key}>
|
|
127
128
|
{item}
|
|
128
129
|
</React.Fragment>
|
|
129
130
|
} else {
|
|
130
|
-
if(
|
|
131
|
+
if(isNonNullString(item.perm) && !Auth.isAllowedFromStr(item.perm)) return null;
|
|
131
132
|
if(!item.label && !item.text && !item.icon) {
|
|
132
133
|
if(item.divider === true){
|
|
133
134
|
const {divider,...rest} = item;
|
|
@@ -94,16 +94,12 @@ class _Menu extends AppComponent {
|
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
updateVisibility = async () => {
|
|
97
|
-
// _Menu is rendered in Portal, which updates items asynchronously
|
|
98
|
-
// We need to do the same here so that the ref is up-to-date
|
|
99
|
-
await Promise.resolve();
|
|
100
|
-
|
|
101
97
|
if (this.props.visible) {
|
|
102
98
|
this.show();
|
|
103
99
|
} else {
|
|
104
100
|
this.hide();
|
|
105
101
|
}
|
|
106
|
-
}
|
|
102
|
+
}
|
|
107
103
|
|
|
108
104
|
isBrowser = () => Platform.OS === 'web' && 'document' in global;
|
|
109
105
|
|
|
@@ -161,69 +157,62 @@ class _Menu extends AppComponent {
|
|
|
161
157
|
document.removeEventListener('keyup', this.handleKeypress);
|
|
162
158
|
};
|
|
163
159
|
|
|
164
|
-
show
|
|
160
|
+
show (){
|
|
165
161
|
if(!this._isMounted()) return;
|
|
166
|
-
|
|
167
|
-
const [menuLayout, anchorLayout] = await Promise.all([
|
|
162
|
+
return Promise.all([
|
|
168
163
|
this.measureMenuLayout(),
|
|
169
164
|
this.measureAnchorLayout(),
|
|
170
|
-
])
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
!menuLayout.height ||
|
|
183
|
-
(!anchorLayout.width) ||
|
|
184
|
-
(!anchorLayout.height)
|
|
185
|
-
) {
|
|
186
|
-
requestAnimationFrame(this.show);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
this.setState(
|
|
191
|
-
() => ({
|
|
192
|
-
left: anchorLayout.x,
|
|
193
|
-
top: anchorLayout.y,
|
|
194
|
-
anchorLayout: {
|
|
195
|
-
height: anchorLayout.height,
|
|
196
|
-
width: anchorLayout.width,
|
|
197
|
-
},
|
|
198
|
-
menuLayout: {
|
|
199
|
-
width: menuLayout.width,
|
|
200
|
-
height: menuLayout.height,
|
|
201
|
-
},
|
|
202
|
-
}),
|
|
203
|
-
() => {
|
|
204
|
-
this.attachListeners();
|
|
205
|
-
|
|
206
|
-
const animation = theme.animation;
|
|
207
|
-
Animated.parallel([
|
|
208
|
-
Animated.timing(this.state.scaleAnimation, {
|
|
209
|
-
toValue: { x: menuLayout.width, y: menuLayout.height },
|
|
210
|
-
duration: ANIMATION_DURATION * animation.scale,
|
|
211
|
-
easing: EASING,
|
|
212
|
-
useNativeDriver: true,
|
|
213
|
-
}),
|
|
214
|
-
Animated.timing(this.state.opacityAnimation, {
|
|
215
|
-
toValue: 1,
|
|
216
|
-
duration: ANIMATION_DURATION * animation.scale,
|
|
217
|
-
easing: EASING,
|
|
218
|
-
useNativeDriver: true,
|
|
219
|
-
}),
|
|
220
|
-
]).start(({ finished }) => {
|
|
221
|
-
if (finished) {
|
|
222
|
-
this.focusFirstDOMNode(this.menu);
|
|
223
|
-
}
|
|
224
|
-
});
|
|
165
|
+
]).then(([menuLayout, anchorLayout])=>{
|
|
166
|
+
const windowLayout = Dimensions.get('window');
|
|
167
|
+
if (
|
|
168
|
+
!windowLayout.width ||
|
|
169
|
+
!windowLayout.height ||
|
|
170
|
+
!menuLayout.width ||
|
|
171
|
+
!menuLayout.height ||
|
|
172
|
+
(!anchorLayout.width) ||
|
|
173
|
+
(!anchorLayout.height)
|
|
174
|
+
) {
|
|
175
|
+
requestAnimationFrame(this.show.bind(this));
|
|
176
|
+
return;
|
|
225
177
|
}
|
|
226
|
-
|
|
178
|
+
this.setState({
|
|
179
|
+
left: anchorLayout.x,
|
|
180
|
+
top: anchorLayout.y,
|
|
181
|
+
rendered : true,
|
|
182
|
+
anchorLayout: {
|
|
183
|
+
height: anchorLayout.height,
|
|
184
|
+
width: anchorLayout.width,
|
|
185
|
+
},
|
|
186
|
+
menuLayout: {
|
|
187
|
+
width: menuLayout.width,
|
|
188
|
+
height: menuLayout.height,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
() => {
|
|
192
|
+
this.attachListeners();
|
|
193
|
+
|
|
194
|
+
const animation = theme.animation;
|
|
195
|
+
Animated.parallel([
|
|
196
|
+
Animated.timing(this.state.scaleAnimation, {
|
|
197
|
+
toValue: { x: menuLayout.width, y: menuLayout.height },
|
|
198
|
+
duration: ANIMATION_DURATION * animation.scale,
|
|
199
|
+
easing: EASING,
|
|
200
|
+
useNativeDriver: true,
|
|
201
|
+
}),
|
|
202
|
+
Animated.timing(this.state.opacityAnimation, {
|
|
203
|
+
toValue: 1,
|
|
204
|
+
duration: ANIMATION_DURATION * animation.scale,
|
|
205
|
+
easing: EASING,
|
|
206
|
+
useNativeDriver: true,
|
|
207
|
+
}),
|
|
208
|
+
]).start(({ finished }) => {
|
|
209
|
+
if (finished) {
|
|
210
|
+
this.focusFirstDOMNode(this.menu);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
});
|
|
227
216
|
};
|
|
228
217
|
|
|
229
218
|
hide = (cb) => {
|
|
@@ -237,7 +226,7 @@ class _Menu extends AppComponent {
|
|
|
237
226
|
useNativeDriver: true,
|
|
238
227
|
}).start(({ finished }) => {
|
|
239
228
|
if (finished) {
|
|
240
|
-
this.setState({ menuLayout: { width: 0, height: 0 }},(e)=>{if(typeof cb ==='function') cb();});
|
|
229
|
+
this.setState({ rendered:false,menuLayout: { width: 0, height: 0 }},(e)=>{if(typeof cb ==='function') cb();});
|
|
241
230
|
this.state.scaleAnimation.setValue({ x: 0, y: 0 });
|
|
242
231
|
this.focusFirstDOMNode(this.anchor);
|
|
243
232
|
}
|
|
@@ -294,7 +283,7 @@ class _Menu extends AppComponent {
|
|
|
294
283
|
|
|
295
284
|
// We need to translate menu while animating scale to imitate transform origin for scale animation
|
|
296
285
|
const positionTransforms = [];
|
|
297
|
-
|
|
286
|
+
|
|
298
287
|
// Check if menu fits horizontally and if not align it to right.
|
|
299
288
|
if (left <= windowLayout.width - menuLayout.width - SCREEN_INDENT) {
|
|
300
289
|
positionTransforms.push({
|
|
@@ -315,9 +304,7 @@ class _Menu extends AppComponent {
|
|
|
315
304
|
outputRange: [menuLayout.width / 2, 0],
|
|
316
305
|
}),
|
|
317
306
|
});
|
|
318
|
-
|
|
319
307
|
left += anchorLayout.width - menuLayout.width;
|
|
320
|
-
|
|
321
308
|
const right = left + menuLayout.width;
|
|
322
309
|
// Check if menu position has enough space from right side
|
|
323
310
|
if (right > windowLayout.width - SCREEN_INDENT) {
|
|
@@ -325,7 +312,6 @@ class _Menu extends AppComponent {
|
|
|
325
312
|
}
|
|
326
313
|
}
|
|
327
314
|
const handleScroll = canHandleScroll !== false? true : false;
|
|
328
|
-
|
|
329
315
|
// If the menu is larger than available vertical space,
|
|
330
316
|
// calculate the height of scrollable view
|
|
331
317
|
let scrollableMenuHeight = 0;
|
|
@@ -469,50 +455,48 @@ class _Menu extends AppComponent {
|
|
|
469
455
|
style = {{backgroundColor:'transparent'}}
|
|
470
456
|
>
|
|
471
457
|
{anchor}
|
|
472
|
-
|
|
473
|
-
<
|
|
474
|
-
{
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
>
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
>
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
</Portal>
|
|
515
|
-
) : null}
|
|
458
|
+
<Portal>
|
|
459
|
+
{rendered ? <TouchableWithoutFeedback
|
|
460
|
+
testID={testID+"_MenuTouchableWithoutFeedBack"}
|
|
461
|
+
accessibilityLabel={overlayAccessibilityLabel}
|
|
462
|
+
role="button"
|
|
463
|
+
onPress={onDismiss}
|
|
464
|
+
style = {[hiddenStyle]}
|
|
465
|
+
>
|
|
466
|
+
<View style={[StyleSheet.absoluteFill,{flex:1,backgroundColor:'transparent'}]} testID={testID+"_Backdrop"} />
|
|
467
|
+
</TouchableWithoutFeedback>:null}
|
|
468
|
+
<View
|
|
469
|
+
testID = {testID+"_MenuContentContainer"}
|
|
470
|
+
ref={(ref) => {
|
|
471
|
+
this.menu = ref;
|
|
472
|
+
}}
|
|
473
|
+
collapsable={false}
|
|
474
|
+
accessibilityViewIsModal={visible}
|
|
475
|
+
style={[styles.wrapper, positionStyle, style,hiddenStyle]}
|
|
476
|
+
pointerEvents={visible ? 'box-none' : 'none'}
|
|
477
|
+
onAccessibilityEscape={onDismiss}
|
|
478
|
+
>
|
|
479
|
+
{rendered?<Animated.View style={{ transform: positionTransforms }} testID={testID+"_Animated"}>
|
|
480
|
+
<Surface
|
|
481
|
+
elevation = {5}
|
|
482
|
+
testID= {testID+"_MenuContent"}
|
|
483
|
+
style={
|
|
484
|
+
[
|
|
485
|
+
styles.shadowMenuContainer,
|
|
486
|
+
shadowMenuContainerStyle,
|
|
487
|
+
contentStyle,
|
|
488
|
+
{backgroundColor : theme.colors.surface},
|
|
489
|
+
minWidth && {minWidth : Math.max(minWidth,MIN_WIDTH)},
|
|
490
|
+
sameWidth && anchorLayout.width ? {width:Math.max(anchorLayout.width,minWidth,MIN_WIDTH)} : undefined,
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
>
|
|
494
|
+
{((scrollableMenuHeight|| contentContainerStyle) && (<ScrollView contentContainerStyle={contentContainerStyle} testID={testID+"_ScrollView"}>{children}</ScrollView>
|
|
495
|
+
)) || children}
|
|
496
|
+
</Surface>
|
|
497
|
+
</Animated.View> : null}
|
|
498
|
+
</View>
|
|
499
|
+
</Portal>
|
|
516
500
|
</View>
|
|
517
501
|
);
|
|
518
502
|
}
|
|
@@ -7,8 +7,6 @@ import View from "$ecomponents/View";
|
|
|
7
7
|
import {isNativeMobile} from "$cplatform";
|
|
8
8
|
import {defaultDecimal} from "$cutils";
|
|
9
9
|
import {LogoProgress} from "$ecomponents/Logo";
|
|
10
|
-
import { Provider as PaperProvider,Portal as PaperPortal} from "react-native-paper";
|
|
11
|
-
import {PortalProvider } from '$ecomponents/Portal';
|
|
12
10
|
import {defaultStr} from "$cutils";
|
|
13
11
|
import styles, {
|
|
14
12
|
_solidBackground,
|
|
@@ -100,8 +98,8 @@ const SplashScreenComponent = ({isLoaded,children , duration, delay,logoWidth,lo
|
|
|
100
98
|
],
|
|
101
99
|
}
|
|
102
100
|
const child = (animationDone && isLoaded)? React.isValidElement(children) && children : null;
|
|
103
|
-
return
|
|
104
|
-
|
|
101
|
+
if(animationDone) return child;
|
|
102
|
+
return <View style={[styles.container]} testID={testID} id={testID}>
|
|
105
103
|
{!animationDone ? <View style={StyleSheet.absoluteFill} testID={testID+"_Animation"}/> : null}
|
|
106
104
|
<View style={styles.containerGlue} testID={testID+"_ContainerGlue"}>
|
|
107
105
|
{!animationDone && (
|
|
@@ -112,30 +110,23 @@ const SplashScreenComponent = ({isLoaded,children , duration, delay,logoWidth,lo
|
|
|
112
110
|
)}
|
|
113
111
|
{(animationDone || isNative) && child}
|
|
114
112
|
{!animationDone && (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
</Animated.View>
|
|
130
|
-
)}
|
|
131
|
-
</View>
|
|
132
|
-
</PaperPortal.Host>
|
|
133
|
-
</PaperProvider>
|
|
134
|
-
</PortalProvider>
|
|
113
|
+
<View testID={testID+"_LogoContainer"} style={[StyleSheet.absoluteFill, styles.logoStyle]}>
|
|
114
|
+
{(
|
|
115
|
+
<Animated.View
|
|
116
|
+
testID={testID+"_Logo"}
|
|
117
|
+
style={_dynamicCustomComponentStyle(
|
|
118
|
+
logoScale,
|
|
119
|
+
logoOpacity,
|
|
120
|
+
logoWidth,
|
|
121
|
+
logoHeight
|
|
122
|
+
)}>
|
|
123
|
+
{<LogoProgress/>}
|
|
124
|
+
</Animated.View>
|
|
125
|
+
)}
|
|
126
|
+
</View>
|
|
135
127
|
)}
|
|
136
128
|
</View>
|
|
137
129
|
</View>
|
|
138
|
-
)
|
|
139
130
|
}
|
|
140
131
|
|
|
141
132
|
|
package/src/index.js
CHANGED
|
@@ -40,6 +40,9 @@ import StatusBar from "$ecomponents/StatusBar";
|
|
|
40
40
|
import {Provider as PaperProvider } from 'react-native-paper';
|
|
41
41
|
import FontIcon from "$ecomponents/Icon/Font";
|
|
42
42
|
import useContext from "$econtext/hooks";
|
|
43
|
+
import {GestureHandlerRootView} from "react-native-gesture-handler";
|
|
44
|
+
import KeyboardAvoidingViewComponent from '$ecomponents/KeyboardAvoidingView';
|
|
45
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
43
46
|
export * from "./context";
|
|
44
47
|
|
|
45
48
|
let MAX_BACK_COUNT = 1;
|
|
@@ -253,55 +256,59 @@ function App({init:initApp,initialRouteName:appInitialRouteName,render,onMount})
|
|
|
253
256
|
onMountRef.current = true;
|
|
254
257
|
}
|
|
255
258
|
},[isLoaded])
|
|
256
|
-
const child = isLoaded ? <
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
<Portal.Host>
|
|
266
|
-
<PreloaderProvider/>
|
|
267
|
-
<DialogProvider responsive/>
|
|
268
|
-
<AlertProvider SimpleSelect={SimpleSelect}/>
|
|
269
|
-
<FormDataDialogProvider/>
|
|
270
|
-
<BottomSheetProvider/>
|
|
271
|
-
<DropdownAlert ref={notificationRef}/>
|
|
272
|
-
<ErrorBoundaryProvider/>
|
|
273
|
-
<Navigation
|
|
274
|
-
initialRouteName = {defaultStr(hasGetStarted ? appInitialRouteName : getStartedRouteName,"Home")}
|
|
275
|
-
state = {state}
|
|
276
|
-
hasGetStarted = {hasGetStarted}
|
|
277
|
-
isInitialized = {isInitialized}
|
|
278
|
-
onGetStart = {(e)=>{
|
|
279
|
-
setState({...state,hasGetStarted:true})
|
|
280
|
-
}}
|
|
281
|
-
/>
|
|
282
|
-
</Portal.Host>
|
|
283
|
-
</PortalProvider>
|
|
284
|
-
</NavigationContainer> : null;
|
|
259
|
+
const child = isLoaded ? <Navigation
|
|
260
|
+
initialRouteName = {defaultStr(hasGetStarted ? appInitialRouteName : getStartedRouteName,"Home")}
|
|
261
|
+
state = {state}
|
|
262
|
+
hasGetStarted = {hasGetStarted}
|
|
263
|
+
isInitialized = {isInitialized}
|
|
264
|
+
onGetStart = {(e)=>{
|
|
265
|
+
setState({...state,hasGetStarted:true})
|
|
266
|
+
}}
|
|
267
|
+
/>: null;
|
|
285
268
|
const content = isLoaded ? typeof render == 'function'? render({children:child,appConfig,config:appConfig}) : child : null;
|
|
286
|
-
return
|
|
287
|
-
<
|
|
288
|
-
|
|
269
|
+
return <AuthProvider>
|
|
270
|
+
<NavigationContainer
|
|
271
|
+
ref={navigationRef}
|
|
272
|
+
initialState={initialState}
|
|
273
|
+
onStateChange={(state) =>{
|
|
274
|
+
if(!isLoaded) return;
|
|
275
|
+
setSession(NAVIGATION_PERSISTENCE_KEY,decycle(state),false);
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
<PaperProvider
|
|
289
279
|
theme={theme}
|
|
290
280
|
settings={{
|
|
291
281
|
icon: (props) => {
|
|
292
282
|
return <FontIcon {...props}/>
|
|
293
283
|
},
|
|
294
284
|
}}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
285
|
+
>
|
|
286
|
+
<PortalProvider>
|
|
287
|
+
<Portal.Host>
|
|
288
|
+
<PreloaderProvider/>
|
|
289
|
+
<DialogProvider responsive/>
|
|
290
|
+
<AlertProvider SimpleSelect={SimpleSelect}/>
|
|
291
|
+
<FormDataDialogProvider/>
|
|
292
|
+
<BottomSheetProvider/>
|
|
293
|
+
<DropdownAlert ref={notificationRef}/>
|
|
294
|
+
<ErrorBoundaryProvider/>
|
|
295
|
+
<GestureHandlerRootView style={{ flex: 1,flexGrow:1,flexShrink:1}} testID={"RN_GestureHandlerRootView"}>
|
|
296
|
+
<SafeAreaProvider testID={"RN_AppSafeAreaProvider"}>
|
|
297
|
+
<SplashScreen isLoaded={isLoaded}>
|
|
298
|
+
<ErrorBoundary>
|
|
299
|
+
<StatusBar/>
|
|
300
|
+
<PreferencesContext.Provider value={preferences}>
|
|
301
|
+
{React.isValidElement(content) && content || child}
|
|
302
|
+
</PreferencesContext.Provider>
|
|
303
|
+
</ErrorBoundary>
|
|
304
|
+
</SplashScreen>
|
|
305
|
+
</SafeAreaProvider>
|
|
306
|
+
</GestureHandlerRootView>
|
|
307
|
+
</Portal.Host>
|
|
308
|
+
</PortalProvider>
|
|
302
309
|
</PaperProvider>
|
|
303
|
-
|
|
304
|
-
</
|
|
310
|
+
</NavigationContainer>
|
|
311
|
+
</AuthProvider>
|
|
305
312
|
}
|
|
306
313
|
|
|
307
314
|
export default App;
|
|
@@ -25,9 +25,11 @@ const DrawerNavigator = React.forwardRef(({content,children:customChildren,state
|
|
|
25
25
|
setIsLoggedIn(false);
|
|
26
26
|
}
|
|
27
27
|
const refreshItems = ()=>{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
setTimeout(()=>{
|
|
29
|
+
refreshItemsRef.current = true;
|
|
30
|
+
forceRender();
|
|
31
|
+
refreshItemsRef.current = false;
|
|
32
|
+
},100)
|
|
31
33
|
};
|
|
32
34
|
APP.on(APP.EVENTS.AUTH_LOGOUT_USER,onLogoutUser);
|
|
33
35
|
APP.on(APP.EVENTS.UPDATE_THEME,refreshItems);
|
|
@@ -29,12 +29,12 @@ const useGetItems = (options)=>{
|
|
|
29
29
|
APP.on(APP.EVENTS.REFRESH_MAIN_DRAWER,refreshItems);
|
|
30
30
|
APP.on(APP.EVENTS.AUTH_LOGIN_USER,refreshItems);
|
|
31
31
|
APP.on(APP.EVENTS.AUTH_LOGOUT_USER,refreshItems);
|
|
32
|
-
APP.on(APP.EVENTS.UPDATE_THEME,refreshItems);
|
|
32
|
+
//APP.on(APP.EVENTS.UPDATE_THEME,refreshItems);
|
|
33
33
|
return ()=>{
|
|
34
34
|
APP.off(APP.EVENTS.REFRESH_MAIN_DRAWER,refreshItems);
|
|
35
35
|
APP.off(APP.EVENTS.AUTH_LOGIN_USER,refreshItems);
|
|
36
36
|
APP.off(APP.EVENTS.AUTH_LOGOUT_USER,refreshItems);
|
|
37
|
-
APP.off(APP.EVENTS.UPDATE_THEME,refreshItems);
|
|
37
|
+
//APP.off(APP.EVENTS.UPDATE_THEME,refreshItems);
|
|
38
38
|
}
|
|
39
39
|
},[])
|
|
40
40
|
return useMemo(()=>{
|