react-crud-mobile 1.3.333 → 1.3.335
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/dist/react-crud-mobile.cjs.development.js.map +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +76 -76
- package/src/elements/UI.tsx +77 -77
- package/src/elements/UIChildren.tsx +142 -142
- package/src/elements/UIComplete.tsx +14 -14
- package/src/elements/UIElement.tsx +870 -870
- package/src/elements/UITag.tsx +13 -13
- package/src/elements/charts/ElChart.tsx +10 -10
- package/src/elements/core/GestureView.tsx +16 -16
- package/src/elements/core/SafeView.tsx +63 -63
- package/src/elements/core/UIAutoComplete.tsx +17 -17
- package/src/elements/core/UIButton.tsx +143 -143
- package/src/elements/core/UIHeader.tsx +38 -38
- package/src/elements/core/UIIcon.tsx +25 -25
- package/src/elements/core/UIInclude.tsx +40 -40
- package/src/elements/core/UIInput.tsx +147 -147
- package/src/elements/core/UILink.tsx +17 -17
- package/src/elements/core/UIList.tsx +180 -180
- package/src/elements/core/UIListItem.tsx +32 -32
- package/src/elements/core/UIListRow.tsx +132 -132
- package/src/elements/core/UIModal.tsx +212 -212
- package/src/elements/core/UIOption.tsx +17 -17
- package/src/elements/core/UIOrder.tsx +194 -194
- package/src/elements/core/UIQuantity.tsx +98 -98
- package/src/elements/core/UIRadio.tsx +17 -17
- package/src/elements/core/UISelect.tsx +175 -175
- package/src/elements/core/UISlider.tsx +61 -61
- package/src/elements/core/UIStatusBar.tsx +5 -5
- package/src/elements/core/UISwitch.tsx +27 -27
- package/src/elements/core/UIToast.tsx +44 -44
- package/src/elements/core/UIToggle.tsx +114 -114
- package/src/elements/core/UIView.tsx +69 -69
- package/src/elements/index.ts +1 -1
- package/src/elements/tabs/ElTabs.tsx +178 -178
- package/src/hooks/useIsVisible.ts +39 -39
- package/src/index.ts +1 -1
- package/src/utils/MobileUtils.ts +12 -12
@@ -1,175 +1,175 @@
|
|
1
|
-
import { useRef, useState } from 'react';
|
2
|
-
import { ChildType, MethodType, Utils, ViewUtils } from 'react-crud-utils';
|
3
|
-
import {
|
4
|
-
Text,
|
5
|
-
TouchableOpacity,
|
6
|
-
StyleSheet,
|
7
|
-
Modal,
|
8
|
-
View,
|
9
|
-
SafeAreaView,
|
10
|
-
ScrollView,
|
11
|
-
} from 'react-native';
|
12
|
-
import { Ionicons } from '@expo/vector-icons';
|
13
|
-
import UI from '../UI';
|
14
|
-
|
15
|
-
export default function UISelect(props: ChildType) {
|
16
|
-
const [modalVisible, setModalVisible] = useState(false);
|
17
|
-
const scope = props.scope;
|
18
|
-
const original = scope.original;
|
19
|
-
const items = Utils.nvl(scope.getOptions(), []);
|
20
|
-
const placeholder = scope.attr('placeholder', 'Selecione...');
|
21
|
-
const value = scope.getDisplayValue();
|
22
|
-
const theme = scope.getTheme();
|
23
|
-
const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
|
24
|
-
const handlePress = () => {
|
25
|
-
setModalVisible(!modalVisible);
|
26
|
-
};
|
27
|
-
|
28
|
-
const scrollRef = useRef(null);
|
29
|
-
const iconColor = Utils.nvl(theme.colors?.text, '#100e0e');
|
30
|
-
const modalColor = Utils.nvl(headerStyle.color, 'white');
|
31
|
-
const defaults = { color: modalColor };
|
32
|
-
const onClick = ({ crud, value }: MethodType) => {
|
33
|
-
let val = value as any;
|
34
|
-
|
35
|
-
if (original.isObject && val?.object) {
|
36
|
-
scope.changeValue(val?.object);
|
37
|
-
} else if (val?.value) {
|
38
|
-
scope.changeValue(val?.value);
|
39
|
-
} else {
|
40
|
-
scope.changeValue(value);
|
41
|
-
}
|
42
|
-
|
43
|
-
setModalVisible(false);
|
44
|
-
};
|
45
|
-
|
46
|
-
const style = (part: string, extra?: any) => {
|
47
|
-
let all = { ...styles[part], ...extra };
|
48
|
-
|
49
|
-
return scope.getStyle(part, all);
|
50
|
-
};
|
51
|
-
|
52
|
-
const isModalVisible = () => {
|
53
|
-
return modalVisible;
|
54
|
-
};
|
55
|
-
//v4
|
56
|
-
|
57
|
-
return (
|
58
|
-
<View
|
59
|
-
key={scope.getName(`${scope.getPart('modal')}_${modalVisible}`)}
|
60
|
-
style={style('selectRoot')}
|
61
|
-
>
|
62
|
-
<TouchableOpacity onPress={handlePress} style={style('selectInput')}>
|
63
|
-
<Text style={style('selectLabel')}>
|
64
|
-
{Utils.nvl(value, placeholder)}
|
65
|
-
</Text>
|
66
|
-
<Ionicons
|
67
|
-
name="chevron-down-outline"
|
68
|
-
size={scope.getPart('iconSize', null, 24)}
|
69
|
-
color={scope.getPart('iconColor', null, iconColor)}
|
70
|
-
style={style('iconStyle', {})}
|
71
|
-
/>
|
72
|
-
</TouchableOpacity>
|
73
|
-
<Modal
|
74
|
-
animationType="slide"
|
75
|
-
transparent={true}
|
76
|
-
visible={isModalVisible()}
|
77
|
-
onRequestClose={() => setModalVisible(false)}
|
78
|
-
>
|
79
|
-
<SafeAreaView style={style('modalTop')} />
|
80
|
-
<SafeAreaView style={style('modalSafe')}>
|
81
|
-
<View style={scope.getStyle('header', headerStyle)}>
|
82
|
-
<TouchableOpacity
|
83
|
-
onPress={handlePress}
|
84
|
-
style={style('modalCloseButton')}
|
85
|
-
>
|
86
|
-
<Ionicons
|
87
|
-
name="close"
|
88
|
-
size={24}
|
89
|
-
color={modalColor}
|
90
|
-
style={style('modalCloseText', defaults)}
|
91
|
-
/>
|
92
|
-
</TouchableOpacity>
|
93
|
-
<Text style={style('modalTitle', defaults)}>{placeholder}</Text>
|
94
|
-
</View>
|
95
|
-
<ScrollView
|
96
|
-
contentContainerStyle={{ flexGrow: 1, paddingBottom: 50 }}
|
97
|
-
style={style('modalContent')}
|
98
|
-
nestedScrollEnabled={true}
|
99
|
-
ref={scrollRef}
|
100
|
-
>
|
101
|
-
<View
|
102
|
-
style={{
|
103
|
-
flex: 1,
|
104
|
-
paddingLeft: 15,
|
105
|
-
paddingRight: 15,
|
106
|
-
paddingTop: 10,
|
107
|
-
paddingBottom: 10,
|
108
|
-
}}
|
109
|
-
>
|
110
|
-
<UI.List
|
111
|
-
data={items}
|
112
|
-
name={scope.getName('list')}
|
113
|
-
layout="card"
|
114
|
-
search={original.search === true}
|
115
|
-
click={onClick}
|
116
|
-
rowStyle={{
|
117
|
-
paddingLeft: 15,
|
118
|
-
paddinRight: 15,
|
119
|
-
...original?.rowStyle,
|
120
|
-
}}
|
121
|
-
{...original?.listProps}
|
122
|
-
>
|
123
|
-
<UI.Value value="#{@this.label}" />
|
124
|
-
</UI.List>
|
125
|
-
</View>
|
126
|
-
</ScrollView>
|
127
|
-
</SafeAreaView>
|
128
|
-
</Modal>
|
129
|
-
</View>
|
130
|
-
);
|
131
|
-
}
|
132
|
-
|
133
|
-
const styles = StyleSheet.create({
|
134
|
-
selectRoot: {
|
135
|
-
justifyContent: 'flex-start',
|
136
|
-
alignItems: 'flex-start',
|
137
|
-
flex: 1,
|
138
|
-
},
|
139
|
-
selectInput: {
|
140
|
-
width: '100%',
|
141
|
-
flexDirection: 'row',
|
142
|
-
borderRadius: 5,
|
143
|
-
paddingHorizontal: 15,
|
144
|
-
borderWidth: 1,
|
145
|
-
borderStyle: 'solid',
|
146
|
-
borderColor: '#dedede',
|
147
|
-
paddingVertical: 10,
|
148
|
-
},
|
149
|
-
selectLabel: { flex: 1 },
|
150
|
-
modalTop: {
|
151
|
-
backgroundColor: 'primary',
|
152
|
-
width: '100%',
|
153
|
-
},
|
154
|
-
modalSafe: {
|
155
|
-
flex: 1,
|
156
|
-
width: '100%',
|
157
|
-
backgroundColor: 'background',
|
158
|
-
},
|
159
|
-
modalCloseButton: {
|
160
|
-
padding: 10,
|
161
|
-
},
|
162
|
-
modalCloseText: {
|
163
|
-
fontSize: 18,
|
164
|
-
color: 'white',
|
165
|
-
},
|
166
|
-
modalTitle: {
|
167
|
-
fontSize: 18,
|
168
|
-
fontWeight: 'bold',
|
169
|
-
marginLeft: 10,
|
170
|
-
},
|
171
|
-
modalContent: {
|
172
|
-
flex: 1,
|
173
|
-
backgroundColor: 'background',
|
174
|
-
},
|
175
|
-
});
|
1
|
+
import { useRef, useState } from 'react';
|
2
|
+
import { ChildType, MethodType, Utils, ViewUtils } from 'react-crud-utils';
|
3
|
+
import {
|
4
|
+
Text,
|
5
|
+
TouchableOpacity,
|
6
|
+
StyleSheet,
|
7
|
+
Modal,
|
8
|
+
View,
|
9
|
+
SafeAreaView,
|
10
|
+
ScrollView,
|
11
|
+
} from 'react-native';
|
12
|
+
import { Ionicons } from '@expo/vector-icons';
|
13
|
+
import UI from '../UI';
|
14
|
+
|
15
|
+
export default function UISelect(props: ChildType) {
|
16
|
+
const [modalVisible, setModalVisible] = useState(false);
|
17
|
+
const scope = props.scope;
|
18
|
+
const original = scope.original;
|
19
|
+
const items = Utils.nvl(scope.getOptions(), []);
|
20
|
+
const placeholder = scope.attr('placeholder', 'Selecione...');
|
21
|
+
const value = scope.getDisplayValue();
|
22
|
+
const theme = scope.getTheme();
|
23
|
+
const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
|
24
|
+
const handlePress = () => {
|
25
|
+
setModalVisible(!modalVisible);
|
26
|
+
};
|
27
|
+
|
28
|
+
const scrollRef = useRef(null);
|
29
|
+
const iconColor = Utils.nvl(theme.colors?.text, '#100e0e');
|
30
|
+
const modalColor = Utils.nvl(headerStyle.color, 'white');
|
31
|
+
const defaults = { color: modalColor };
|
32
|
+
const onClick = ({ crud, value }: MethodType) => {
|
33
|
+
let val = value as any;
|
34
|
+
|
35
|
+
if (original.isObject && val?.object) {
|
36
|
+
scope.changeValue(val?.object);
|
37
|
+
} else if (val?.value) {
|
38
|
+
scope.changeValue(val?.value);
|
39
|
+
} else {
|
40
|
+
scope.changeValue(value);
|
41
|
+
}
|
42
|
+
|
43
|
+
setModalVisible(false);
|
44
|
+
};
|
45
|
+
|
46
|
+
const style = (part: string, extra?: any) => {
|
47
|
+
let all = { ...styles[part], ...extra };
|
48
|
+
|
49
|
+
return scope.getStyle(part, all);
|
50
|
+
};
|
51
|
+
|
52
|
+
const isModalVisible = () => {
|
53
|
+
return modalVisible;
|
54
|
+
};
|
55
|
+
//v4
|
56
|
+
|
57
|
+
return (
|
58
|
+
<View
|
59
|
+
key={scope.getName(`${scope.getPart('modal')}_${modalVisible}`)}
|
60
|
+
style={style('selectRoot')}
|
61
|
+
>
|
62
|
+
<TouchableOpacity onPress={handlePress} style={style('selectInput')}>
|
63
|
+
<Text style={style('selectLabel')}>
|
64
|
+
{Utils.nvl(value, placeholder)}
|
65
|
+
</Text>
|
66
|
+
<Ionicons
|
67
|
+
name="chevron-down-outline"
|
68
|
+
size={scope.getPart('iconSize', null, 24)}
|
69
|
+
color={scope.getPart('iconColor', null, iconColor)}
|
70
|
+
style={style('iconStyle', {})}
|
71
|
+
/>
|
72
|
+
</TouchableOpacity>
|
73
|
+
<Modal
|
74
|
+
animationType="slide"
|
75
|
+
transparent={true}
|
76
|
+
visible={isModalVisible()}
|
77
|
+
onRequestClose={() => setModalVisible(false)}
|
78
|
+
>
|
79
|
+
<SafeAreaView style={style('modalTop')} />
|
80
|
+
<SafeAreaView style={style('modalSafe')}>
|
81
|
+
<View style={scope.getStyle('header', headerStyle)}>
|
82
|
+
<TouchableOpacity
|
83
|
+
onPress={handlePress}
|
84
|
+
style={style('modalCloseButton')}
|
85
|
+
>
|
86
|
+
<Ionicons
|
87
|
+
name="close"
|
88
|
+
size={24}
|
89
|
+
color={modalColor}
|
90
|
+
style={style('modalCloseText', defaults)}
|
91
|
+
/>
|
92
|
+
</TouchableOpacity>
|
93
|
+
<Text style={style('modalTitle', defaults)}>{placeholder}</Text>
|
94
|
+
</View>
|
95
|
+
<ScrollView
|
96
|
+
contentContainerStyle={{ flexGrow: 1, paddingBottom: 50 }}
|
97
|
+
style={style('modalContent')}
|
98
|
+
nestedScrollEnabled={true}
|
99
|
+
ref={scrollRef}
|
100
|
+
>
|
101
|
+
<View
|
102
|
+
style={{
|
103
|
+
flex: 1,
|
104
|
+
paddingLeft: 15,
|
105
|
+
paddingRight: 15,
|
106
|
+
paddingTop: 10,
|
107
|
+
paddingBottom: 10,
|
108
|
+
}}
|
109
|
+
>
|
110
|
+
<UI.List
|
111
|
+
data={items}
|
112
|
+
name={scope.getName('list')}
|
113
|
+
layout="card"
|
114
|
+
search={original.search === true}
|
115
|
+
click={onClick}
|
116
|
+
rowStyle={{
|
117
|
+
paddingLeft: 15,
|
118
|
+
paddinRight: 15,
|
119
|
+
...original?.rowStyle,
|
120
|
+
}}
|
121
|
+
{...original?.listProps}
|
122
|
+
>
|
123
|
+
<UI.Value value="#{@this.label}" />
|
124
|
+
</UI.List>
|
125
|
+
</View>
|
126
|
+
</ScrollView>
|
127
|
+
</SafeAreaView>
|
128
|
+
</Modal>
|
129
|
+
</View>
|
130
|
+
);
|
131
|
+
}
|
132
|
+
|
133
|
+
const styles = StyleSheet.create({
|
134
|
+
selectRoot: {
|
135
|
+
justifyContent: 'flex-start',
|
136
|
+
alignItems: 'flex-start',
|
137
|
+
flex: 1,
|
138
|
+
},
|
139
|
+
selectInput: {
|
140
|
+
width: '100%',
|
141
|
+
flexDirection: 'row',
|
142
|
+
borderRadius: 5,
|
143
|
+
paddingHorizontal: 15,
|
144
|
+
borderWidth: 1,
|
145
|
+
borderStyle: 'solid',
|
146
|
+
borderColor: '#dedede',
|
147
|
+
paddingVertical: 10,
|
148
|
+
},
|
149
|
+
selectLabel: { flex: 1 },
|
150
|
+
modalTop: {
|
151
|
+
backgroundColor: 'primary',
|
152
|
+
width: '100%',
|
153
|
+
},
|
154
|
+
modalSafe: {
|
155
|
+
flex: 1,
|
156
|
+
width: '100%',
|
157
|
+
backgroundColor: 'background',
|
158
|
+
},
|
159
|
+
modalCloseButton: {
|
160
|
+
padding: 10,
|
161
|
+
},
|
162
|
+
modalCloseText: {
|
163
|
+
fontSize: 18,
|
164
|
+
color: 'white',
|
165
|
+
},
|
166
|
+
modalTitle: {
|
167
|
+
fontSize: 18,
|
168
|
+
fontWeight: 'bold',
|
169
|
+
marginLeft: 10,
|
170
|
+
},
|
171
|
+
modalContent: {
|
172
|
+
flex: 1,
|
173
|
+
backgroundColor: 'background',
|
174
|
+
},
|
175
|
+
});
|
@@ -1,61 +1,61 @@
|
|
1
|
-
import { useState } from 'react';
|
2
|
-
import { ChildType, ComponentUtils, Utils } from 'react-crud-utils';
|
3
|
-
import { Switch } from 'react-native';
|
4
|
-
import Slider from '@react-native-community/slider';
|
5
|
-
|
6
|
-
export default function UISlider(props: ChildType) {
|
7
|
-
const scope = props.scope;
|
8
|
-
const initial = Utils.nvl(scope.getValue(), 0);
|
9
|
-
const [value, setValue] = useState(initial);
|
10
|
-
|
11
|
-
//redeploy 0
|
12
|
-
|
13
|
-
let onChange = v => {
|
14
|
-
v = Utils.nvl(v, 0);
|
15
|
-
|
16
|
-
console.log(v);
|
17
|
-
|
18
|
-
scope.changeValue(v);
|
19
|
-
|
20
|
-
setValue(v);
|
21
|
-
};
|
22
|
-
|
23
|
-
let step = scope.attr('step', 1);
|
24
|
-
let min = scope.attr('min', 0);
|
25
|
-
let max = scope.attr('min', 100);
|
26
|
-
|
27
|
-
let onSlideScroll = (scrollEnabled: boolean) => {
|
28
|
-
let viewScope = ComponentUtils.getViewScope();
|
29
|
-
|
30
|
-
if (scope.original.debug) {
|
31
|
-
console.log(viewScope);
|
32
|
-
}
|
33
|
-
|
34
|
-
if (viewScope) {
|
35
|
-
let scrollRef = viewScope.get('scrollRef');
|
36
|
-
|
37
|
-
if (scrollRef) scrollRef.current?.setNativeProps?.({ scrollEnabled });
|
38
|
-
}
|
39
|
-
};
|
40
|
-
return (
|
41
|
-
<>
|
42
|
-
<Slider
|
43
|
-
minimumValue={min}
|
44
|
-
maximumValue={max}
|
45
|
-
step={step}
|
46
|
-
minimumTrackTintColor="#1EB1FC"
|
47
|
-
maximumTrackTintColor="#d3d3d3"
|
48
|
-
thumbTintColor="#1EB1FC"
|
49
|
-
value={value}
|
50
|
-
onSlidingStart={() => onSlideScroll(false)}
|
51
|
-
onSlidingComplete={() => onSlideScroll(true)}
|
52
|
-
style={{ width: '100%', height: 40, ...scope.getStyle('element') }}
|
53
|
-
onValueChange={onChange} // Alterna o estado
|
54
|
-
/>
|
55
|
-
</>
|
56
|
-
);
|
57
|
-
}
|
58
|
-
|
59
|
-
const styles = {
|
60
|
-
link: {},
|
61
|
-
};
|
1
|
+
import { useState } from 'react';
|
2
|
+
import { ChildType, ComponentUtils, Utils } from 'react-crud-utils';
|
3
|
+
import { Switch } from 'react-native';
|
4
|
+
import Slider from '@react-native-community/slider';
|
5
|
+
|
6
|
+
export default function UISlider(props: ChildType) {
|
7
|
+
const scope = props.scope;
|
8
|
+
const initial = Utils.nvl(scope.getValue(), 0);
|
9
|
+
const [value, setValue] = useState(initial);
|
10
|
+
|
11
|
+
//redeploy 0
|
12
|
+
|
13
|
+
let onChange = v => {
|
14
|
+
v = Utils.nvl(v, 0);
|
15
|
+
|
16
|
+
console.log(v);
|
17
|
+
|
18
|
+
scope.changeValue(v);
|
19
|
+
|
20
|
+
setValue(v);
|
21
|
+
};
|
22
|
+
|
23
|
+
let step = scope.attr('step', 1);
|
24
|
+
let min = scope.attr('min', 0);
|
25
|
+
let max = scope.attr('min', 100);
|
26
|
+
|
27
|
+
let onSlideScroll = (scrollEnabled: boolean) => {
|
28
|
+
let viewScope = ComponentUtils.getViewScope();
|
29
|
+
|
30
|
+
if (scope.original.debug) {
|
31
|
+
console.log(viewScope);
|
32
|
+
}
|
33
|
+
|
34
|
+
if (viewScope) {
|
35
|
+
let scrollRef = viewScope.get('scrollRef');
|
36
|
+
|
37
|
+
if (scrollRef) scrollRef.current?.setNativeProps?.({ scrollEnabled });
|
38
|
+
}
|
39
|
+
};
|
40
|
+
return (
|
41
|
+
<>
|
42
|
+
<Slider
|
43
|
+
minimumValue={min}
|
44
|
+
maximumValue={max}
|
45
|
+
step={step}
|
46
|
+
minimumTrackTintColor="#1EB1FC"
|
47
|
+
maximumTrackTintColor="#d3d3d3"
|
48
|
+
thumbTintColor="#1EB1FC"
|
49
|
+
value={value}
|
50
|
+
onSlidingStart={() => onSlideScroll(false)}
|
51
|
+
onSlidingComplete={() => onSlideScroll(true)}
|
52
|
+
style={{ width: '100%', height: 40, ...scope.getStyle('element') }}
|
53
|
+
onValueChange={onChange} // Alterna o estado
|
54
|
+
/>
|
55
|
+
</>
|
56
|
+
);
|
57
|
+
}
|
58
|
+
|
59
|
+
const styles = {
|
60
|
+
link: {},
|
61
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { StatusBar } from 'expo-status-bar';
|
2
|
-
|
3
|
-
export default function UIStatusBar() {
|
4
|
-
return <StatusBar style="dark" backgroundColor="#f5f5f5" />;
|
5
|
-
}
|
1
|
+
import { StatusBar } from 'expo-status-bar';
|
2
|
+
|
3
|
+
export default function UIStatusBar() {
|
4
|
+
return <StatusBar style="dark" backgroundColor="#f5f5f5" />;
|
5
|
+
}
|
@@ -1,27 +1,27 @@
|
|
1
|
-
import { useState } from 'react';
|
2
|
-
import { ChildType, Utils } from 'react-crud-utils';
|
3
|
-
import { Switch } from 'react-native';
|
4
|
-
|
5
|
-
export default function UISwitch(props: ChildType) {
|
6
|
-
const scope = props.scope;
|
7
|
-
const initial = Utils.nvl(scope.getValue(), false) as boolean;
|
8
|
-
const [value, setValue] = useState(initial);
|
9
|
-
|
10
|
-
let onChange = v => {
|
11
|
-
scope.changeValue(v);
|
12
|
-
|
13
|
-
setValue(v);
|
14
|
-
};
|
15
|
-
|
16
|
-
return (
|
17
|
-
<Switch
|
18
|
-
value={value}
|
19
|
-
style={scope.getStyle('element')}
|
20
|
-
onValueChange={onChange} // Alterna o estado
|
21
|
-
/>
|
22
|
-
);
|
23
|
-
}
|
24
|
-
|
25
|
-
const styles = {
|
26
|
-
link: {},
|
27
|
-
};
|
1
|
+
import { useState } from 'react';
|
2
|
+
import { ChildType, Utils } from 'react-crud-utils';
|
3
|
+
import { Switch } from 'react-native';
|
4
|
+
|
5
|
+
export default function UISwitch(props: ChildType) {
|
6
|
+
const scope = props.scope;
|
7
|
+
const initial = Utils.nvl(scope.getValue(), false) as boolean;
|
8
|
+
const [value, setValue] = useState(initial);
|
9
|
+
|
10
|
+
let onChange = v => {
|
11
|
+
scope.changeValue(v);
|
12
|
+
|
13
|
+
setValue(v);
|
14
|
+
};
|
15
|
+
|
16
|
+
return (
|
17
|
+
<Switch
|
18
|
+
value={value}
|
19
|
+
style={scope.getStyle('element')}
|
20
|
+
onValueChange={onChange} // Alterna o estado
|
21
|
+
/>
|
22
|
+
);
|
23
|
+
}
|
24
|
+
|
25
|
+
const styles = {
|
26
|
+
link: {},
|
27
|
+
};
|
@@ -1,44 +1,44 @@
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
2
|
-
import Toast, { BaseToast, ErrorToast } from 'react-native-toast-message';
|
3
|
-
|
4
|
-
export default function UIToast() {
|
5
|
-
const toastConfig = {
|
6
|
-
success: props => (
|
7
|
-
<BaseToast
|
8
|
-
{...props}
|
9
|
-
style={styles.darkToast}
|
10
|
-
contentContainerStyle={{ paddingHorizontal: 15 }}
|
11
|
-
text1Style={styles.text}
|
12
|
-
text2Style={styles.text}
|
13
|
-
/>
|
14
|
-
),
|
15
|
-
error: props => (
|
16
|
-
<ErrorToast
|
17
|
-
{...props}
|
18
|
-
style={styles.darkToast}
|
19
|
-
text1Style={styles.text}
|
20
|
-
text2Style={styles.text}
|
21
|
-
/>
|
22
|
-
),
|
23
|
-
info: props => (
|
24
|
-
<BaseToast
|
25
|
-
{...props}
|
26
|
-
style={styles.darkToast}
|
27
|
-
text1Style={styles.text}
|
28
|
-
text2Style={styles.text}
|
29
|
-
/>
|
30
|
-
),
|
31
|
-
};
|
32
|
-
|
33
|
-
const styles = StyleSheet.create({
|
34
|
-
darkToast: {
|
35
|
-
backgroundColor: 'rgba(34, 34, 34, 0.85)',
|
36
|
-
borderLeftColor: '#222', // borda mais escura
|
37
|
-
},
|
38
|
-
text: {
|
39
|
-
color: '#fff', // letras brancas
|
40
|
-
textAlign: 'center',
|
41
|
-
},
|
42
|
-
});
|
43
|
-
return <Toast config={toastConfig} />;
|
44
|
-
}
|
1
|
+
import { StyleSheet } from 'react-native';
|
2
|
+
import Toast, { BaseToast, ErrorToast } from 'react-native-toast-message';
|
3
|
+
|
4
|
+
export default function UIToast() {
|
5
|
+
const toastConfig = {
|
6
|
+
success: props => (
|
7
|
+
<BaseToast
|
8
|
+
{...props}
|
9
|
+
style={styles.darkToast}
|
10
|
+
contentContainerStyle={{ paddingHorizontal: 15 }}
|
11
|
+
text1Style={styles.text}
|
12
|
+
text2Style={styles.text}
|
13
|
+
/>
|
14
|
+
),
|
15
|
+
error: props => (
|
16
|
+
<ErrorToast
|
17
|
+
{...props}
|
18
|
+
style={styles.darkToast}
|
19
|
+
text1Style={styles.text}
|
20
|
+
text2Style={styles.text}
|
21
|
+
/>
|
22
|
+
),
|
23
|
+
info: props => (
|
24
|
+
<BaseToast
|
25
|
+
{...props}
|
26
|
+
style={styles.darkToast}
|
27
|
+
text1Style={styles.text}
|
28
|
+
text2Style={styles.text}
|
29
|
+
/>
|
30
|
+
),
|
31
|
+
};
|
32
|
+
|
33
|
+
const styles = StyleSheet.create({
|
34
|
+
darkToast: {
|
35
|
+
backgroundColor: 'rgba(34, 34, 34, 0.85)',
|
36
|
+
borderLeftColor: '#222', // borda mais escura
|
37
|
+
},
|
38
|
+
text: {
|
39
|
+
color: '#fff', // letras brancas
|
40
|
+
textAlign: 'center',
|
41
|
+
},
|
42
|
+
});
|
43
|
+
return <Toast config={toastConfig} />;
|
44
|
+
}
|