@fto-consult/expo-ui 1.3.2 → 1.3.4
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
|
@@ -17,7 +17,7 @@ import PropTypes from "prop-types";
|
|
|
17
17
|
const white = "white",black = "black";
|
|
18
18
|
|
|
19
19
|
const ButtonComponent = React.forwardRef(({
|
|
20
|
-
disabled,
|
|
20
|
+
disabled:customDisabled,
|
|
21
21
|
compact,
|
|
22
22
|
mode = 'text',
|
|
23
23
|
dark,
|
|
@@ -86,7 +86,7 @@ const ButtonComponent = React.forwardRef(({
|
|
|
86
86
|
|
|
87
87
|
const [state,setState] = React.useState({
|
|
88
88
|
isLoading : typeof loading =='boolean'? loading : false,
|
|
89
|
-
isDisabled : typeof
|
|
89
|
+
isDisabled : typeof customDisabled =='boolean'? customDisabled : false,
|
|
90
90
|
});
|
|
91
91
|
const {isLoading,isDisabled} = state;
|
|
92
92
|
const setIsLoading = (loading)=>{
|
|
@@ -114,16 +114,16 @@ const ButtonComponent = React.forwardRef(({
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
React.useEffect(()=>{
|
|
117
|
-
if(typeof
|
|
118
|
-
if(typeof loading =='boolean' && loading == isLoading && typeof
|
|
117
|
+
if(typeof customDisabled !=='boolean' && typeof loading !== 'boolean') return;
|
|
118
|
+
if(typeof loading =='boolean' && loading == isLoading && typeof customDisabled =='boolean' && customDisabled === isDisabled){
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
setState({
|
|
122
122
|
...state,
|
|
123
123
|
isLoading : typeof loading =='boolean' ? loading : state.isLoading,
|
|
124
|
-
isDisabled : typeof
|
|
124
|
+
isDisabled : typeof customDisabled =='boolean' ? customDisabled : state.isDisabled,
|
|
125
125
|
});
|
|
126
|
-
},[loading,
|
|
126
|
+
},[loading,customDisabled]);
|
|
127
127
|
|
|
128
128
|
const handlePressOut = () => {
|
|
129
129
|
if (hasElevation) {
|
|
@@ -139,7 +139,7 @@ const ButtonComponent = React.forwardRef(({
|
|
|
139
139
|
containerProps = defaultObj(containerProps);
|
|
140
140
|
style = StyleSheet.flatten(style) || {};
|
|
141
141
|
labelStyle = StyleSheet.flatten([labelStyle]);
|
|
142
|
-
disabled = isDisabled || isLoading;
|
|
142
|
+
const disabled = isDisabled || isLoading;
|
|
143
143
|
let textColor = Colors.isValid(buttonColor)?buttonColor : Colors.isValid(labelStyle.color) ? labelStyle.color : Colors.isValid(style.color)? style.color : theme.colors.primary,
|
|
144
144
|
borderWidth;
|
|
145
145
|
const restButtonStyle = {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "$react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import Button from "$
|
|
3
|
+
import Button from "$components/Button";
|
|
4
4
|
import notify from "$notify";
|
|
5
5
|
import FormsManager from "./utils/FormsManager";
|
|
6
6
|
import {uniqid} from "$utils";
|
|
7
7
|
import { getFormInstance } from "./utils/FormsManager";
|
|
8
8
|
import {flattenStyle} from "$theme";
|
|
9
|
+
import APP from "$capp/instance";
|
|
9
10
|
|
|
10
11
|
const FormActionComponent = React.forwardRef(({
|
|
11
12
|
formName,disabled:customDisabled,
|
|
@@ -30,6 +31,13 @@ const FormActionComponent = React.forwardRef(({
|
|
|
30
31
|
if(!isMounted()) return;
|
|
31
32
|
setState({...state,disabled:true})
|
|
32
33
|
}
|
|
34
|
+
let _disabled = disabled;
|
|
35
|
+
if(!disabled && formName){
|
|
36
|
+
const f = getFormInstance(formName);
|
|
37
|
+
if(!f || (!f.isValid || !f.isValid())){
|
|
38
|
+
_disabled = true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
33
41
|
context.isDisabled = x=> disabled ? true : false;
|
|
34
42
|
context.isEnabled = x=> !context.isDisabled();
|
|
35
43
|
context.toggleStatus = () =>{
|
|
@@ -50,19 +58,19 @@ const FormActionComponent = React.forwardRef(({
|
|
|
50
58
|
React.setRef(ref,context);
|
|
51
59
|
React.useEffect(()=>{
|
|
52
60
|
FormsManager.trigger("mountAction",formName,context);
|
|
61
|
+
const onMountForm = (nFormNmae)=>{
|
|
62
|
+
if(nFormNmae == formName){
|
|
63
|
+
context.toggleStatus();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
APP.on("MOUNT_FORM",onMountForm);
|
|
53
67
|
context.toggleStatus();
|
|
54
68
|
return ()=>{
|
|
55
69
|
React.setRef(ref,null);
|
|
56
70
|
FormsManager.trigger("unmountAction",formName,id);
|
|
71
|
+
APP.off("MOUNT_FORM",onMountForm);
|
|
57
72
|
}
|
|
58
73
|
},[]);
|
|
59
|
-
let _disabled = disabled;
|
|
60
|
-
if(!disabled && formName){
|
|
61
|
-
const f = getFormInstance(formName);
|
|
62
|
-
if(!f || (!f.isValid || !f.isValid())){
|
|
63
|
-
_disabled = true;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
74
|
const props = {
|
|
67
75
|
...rest,
|
|
68
76
|
...componentProps,
|
|
@@ -93,7 +101,7 @@ const FormActionComponent = React.forwardRef(({
|
|
|
93
101
|
delete props.formName;
|
|
94
102
|
delete props.isAction;
|
|
95
103
|
delete props.formName;
|
|
96
|
-
return <Component
|
|
104
|
+
return <Component ref = {innerRef} {...props}>{children}</Component>
|
|
97
105
|
});
|
|
98
106
|
|
|
99
107
|
|
|
@@ -24,6 +24,7 @@ if(!isObj(APP.FormsManager)){
|
|
|
24
24
|
formObject._fields = defaultObj(formObject._fields);
|
|
25
25
|
formObject._actions= defaultObj(formObject._actions);
|
|
26
26
|
APP.FormsManager.forms[formName] = formObject;
|
|
27
|
+
APP.trigger("MOUNT_FORM",formName);
|
|
27
28
|
}).on("unmount",(formName)=>{
|
|
28
29
|
delete APP.FormsManager.forms[formName];
|
|
29
30
|
}).on("registerField",(fieldName,formName,fieldObj)=>{
|
|
@@ -46,7 +46,6 @@ const DrawerNavigator = React.forwardRef(({content,children,state,...props},ref)
|
|
|
46
46
|
if(prevIsLoggedIn === isLoggedIn) return;
|
|
47
47
|
navigate("Home");
|
|
48
48
|
},[isLoggedIn]);
|
|
49
|
-
console.log(isLoggedIn," is loggggedd in ddd",isAuthLoggedIn)
|
|
50
49
|
if(!isLoggedIn) {
|
|
51
50
|
return <Login withPortal
|
|
52
51
|
onSuccess = {(data)=>{
|
package/src/screens/index.js
CHANGED
|
@@ -127,9 +127,7 @@ export const handleScreen = ({Screen,Factory,ModalFactory,result,useTheme,filter
|
|
|
127
127
|
},[]);
|
|
128
128
|
setScreenOptions(options);
|
|
129
129
|
const allowDrawer = typeof options.allowDrawer ==='boolean'? options.allowDrawer : typeof Screen.allowDrawer =='boolean'? Screen.allowDrawer : Screen.isModalScreen == true ? false : true;
|
|
130
|
-
return
|
|
131
|
-
<Screen authRequired={authRequired||allowDrawer} backAction={Screen.isModalScreen} modal={Screen.isModalScreen} allowDrawer={allowDrawer} withDrawer = {allowDrawer !== false ? true : false} {...props} screenName={sanitizedName} extra ={defaultObj(extra)} options={options} />
|
|
132
|
-
</>
|
|
130
|
+
return <Screen authRequired={authRequired||allowDrawer} backAction={Screen.isModalScreen} modal={Screen.isModalScreen} allowDrawer={allowDrawer} withDrawer = {allowDrawer !== false ? true : false} {...props} screenName={sanitizedName} extra ={defaultObj(extra)} options={options} />
|
|
133
131
|
}}
|
|
134
132
|
</ScreenComponent>)
|
|
135
133
|
} else {
|