react-crud-mobile 1.3.185 → 1.3.187

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": "react-crud-mobile",
3
- "version": "1.3.185",
3
+ "version": "1.3.187",
4
4
  "license": "MIT",
5
5
  "description": "Uma biblioteca de componentes para React Native",
6
6
  "main": "dist/index.js",
@@ -57,7 +57,7 @@ export default function UIElement(props: ElementType) {
57
57
  const theme = Utils.nvl(props.theme, ctx?.theme);
58
58
 
59
59
  let crud: Crud = Utils.nvl(props.crud, ctx?.crud);
60
- let [scope] = useState(ScopeUtils.create({ crud, ...props, theme }));
60
+ let scope = ScopeUtils.create({ crud, ...props, theme });
61
61
  let [index, setIndex] = useState(0);
62
62
  let [error, setError]: string | any = useState(null);
63
63
 
@@ -602,6 +602,10 @@ export default function UIElement(props: ElementType) {
602
602
  };
603
603
 
604
604
  scope.dialogShow = (args?: MethodType) => {
605
+ let event = Utils.nvl(args?.event, {});
606
+
607
+ if (event?.debug) console.log(args);
608
+
605
609
  let main = ViewUtils.getCrud('view');
606
610
  let parent = main.dialog;
607
611
  let { crud } = args;
@@ -609,7 +613,6 @@ export default function UIElement(props: ElementType) {
609
613
  let edit = args.edit === true;
610
614
  let def: any = {};
611
615
  let rowItem = null;
612
- let event = Utils.nvl(args?.event, {});
613
616
  let component = event?.component;
614
617
 
615
618
  if (crud.is('row')) {
@@ -1,17 +1,17 @@
1
- import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
-
3
- export default function UIAutoComplete(props: any) {
4
- const handlePress = () => {
5
- Linking.openURL('https://reactnative.dev/');
6
- };
7
-
8
- return (
9
- <TouchableOpacity onPress={handlePress}>
10
- <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
- </TouchableOpacity>
12
- );
13
- }
14
-
15
- const styles = {
16
- link: {},
17
- };
1
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
+
3
+ export default function UIAutoComplete(props: any) {
4
+ const handlePress = () => {
5
+ Linking.openURL('https://reactnative.dev/');
6
+ };
7
+
8
+ return (
9
+ <TouchableOpacity onPress={handlePress}>
10
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
+ </TouchableOpacity>
12
+ );
13
+ }
14
+
15
+ const styles = {
16
+ link: {},
17
+ };
@@ -1,17 +1,17 @@
1
- import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
-
3
- export default function UILink(props: any) {
4
- const handlePress = () => {
5
- Linking.openURL('https://reactnative.dev/');
6
- };
7
-
8
- return (
9
- <TouchableOpacity onPress={handlePress}>
10
- <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
- </TouchableOpacity>
12
- );
13
- }
14
-
15
- const styles = {
16
- link: {},
17
- };
1
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
+
3
+ export default function UILink(props: any) {
4
+ const handlePress = () => {
5
+ Linking.openURL('https://reactnative.dev/');
6
+ };
7
+
8
+ return (
9
+ <TouchableOpacity onPress={handlePress}>
10
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
+ </TouchableOpacity>
12
+ );
13
+ }
14
+
15
+ const styles = {
16
+ link: {},
17
+ };
@@ -1,32 +1,32 @@
1
- import { useState } from 'react';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import { FlatList, StyleSheet, Switch, Text, View } from 'react-native';
4
-
5
- interface UIListItemType extends ChildType {
6
- data: any;
7
- }
8
-
9
- export default function UIListItem(props: UIListItemType) {
10
- const scope = props.scope;
11
- const crud = props.crud;
12
-
13
- return <View style={styles.item}></View>;
14
- }
15
-
16
- const styles = StyleSheet.create({
17
- container: {
18
- flex: 1,
19
- padding: 20,
20
- backgroundColor: '#fff',
21
- },
22
- item: {
23
- padding: 15,
24
- marginVertical: 8,
25
- backgroundColor: '#f9c2ff',
26
- borderRadius: 8,
27
- },
28
- text: {
29
- fontSize: 18,
30
- fontWeight: 'bold',
31
- },
32
- });
1
+ import { useState } from 'react';
2
+ import { ChildType, Utils } from 'react-crud-utils';
3
+ import { FlatList, StyleSheet, Switch, Text, View } from 'react-native';
4
+
5
+ interface UIListItemType extends ChildType {
6
+ data: any;
7
+ }
8
+
9
+ export default function UIListItem(props: UIListItemType) {
10
+ const scope = props.scope;
11
+ const crud = props.crud;
12
+
13
+ return <View style={styles.item}></View>;
14
+ }
15
+
16
+ const styles = StyleSheet.create({
17
+ container: {
18
+ flex: 1,
19
+ padding: 20,
20
+ backgroundColor: '#fff',
21
+ },
22
+ item: {
23
+ padding: 15,
24
+ marginVertical: 8,
25
+ backgroundColor: '#f9c2ff',
26
+ borderRadius: 8,
27
+ },
28
+ text: {
29
+ fontSize: 18,
30
+ fontWeight: 'bold',
31
+ },
32
+ });
@@ -1,17 +1,17 @@
1
- import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
-
3
- export default function UIOption(props: any) {
4
- const handlePress = () => {
5
- Linking.openURL('https://reactnative.dev/');
6
- };
7
-
8
- return (
9
- <TouchableOpacity onPress={handlePress}>
10
- <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
- </TouchableOpacity>
12
- );
13
- }
14
-
15
- const styles = {
16
- link: {},
17
- };
1
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
+
3
+ export default function UIOption(props: any) {
4
+ const handlePress = () => {
5
+ Linking.openURL('https://reactnative.dev/');
6
+ };
7
+
8
+ return (
9
+ <TouchableOpacity onPress={handlePress}>
10
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
+ </TouchableOpacity>
12
+ );
13
+ }
14
+
15
+ const styles = {
16
+ link: {},
17
+ };
@@ -1,17 +1,17 @@
1
- import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
-
3
- export default function UIRadio(props: any) {
4
- const handlePress = () => {
5
- Linking.openURL('https://reactnative.dev/');
6
- };
7
-
8
- return (
9
- <TouchableOpacity onPress={handlePress}>
10
- <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
- </TouchableOpacity>
12
- );
13
- }
14
-
15
- const styles = {
16
- link: {},
17
- };
1
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
+
3
+ export default function UIRadio(props: any) {
4
+ const handlePress = () => {
5
+ Linking.openURL('https://reactnative.dev/');
6
+ };
7
+
8
+ return (
9
+ <TouchableOpacity onPress={handlePress}>
10
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
+ </TouchableOpacity>
12
+ );
13
+ }
14
+
15
+ const styles = {
16
+ link: {},
17
+ };
@@ -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,39 +1,39 @@
1
- import { useEffect, useState } from 'react';
2
- import { Scope } from 'react-crud-utils';
3
- import { Dimensions, Platform } from 'react-native';
4
-
5
- export function useIsVisible(ref: any, scope: Scope) {
6
- const [isVisible, setIsVisible] = useState(scope.visible === true);
7
-
8
- useEffect(() => {
9
- const checkVisibility = () => {
10
- if (!ref.current || isVisible || !scope.original?.useIsInView) return;
11
-
12
- if (Platform.OS === 'web') {
13
- const rect = ref.current.getBoundingClientRect?.();
14
-
15
- if (rect && typeof window !== 'undefined') {
16
- const windowHeight = window.innerHeight;
17
- const visible = rect.top < windowHeight && rect.bottom > 0;
18
-
19
- if (visible) scope.visible = visible;
20
-
21
- setIsVisible(visible);
22
- }
23
- } else {
24
- ref.current.measureInWindow?.((x, y, width, height) => {
25
- const windowHeight = Dimensions.get('window').height;
26
- const visible = y < windowHeight && y + height > 0;
27
-
28
- if (visible) scope.visible = visible;
29
- setIsVisible(visible);
30
- });
31
- }
32
- };
33
-
34
- const interval = setInterval(checkVisibility, 300); // roda a cada 300ms
35
- return () => clearInterval(interval);
36
- }, [ref]);
37
-
38
- return isVisible;
39
- }
1
+ import { useEffect, useState } from 'react';
2
+ import { Scope } from 'react-crud-utils';
3
+ import { Dimensions, Platform } from 'react-native';
4
+
5
+ export function useIsVisible(ref: any, scope: Scope) {
6
+ const [isVisible, setIsVisible] = useState(scope.visible === true);
7
+
8
+ useEffect(() => {
9
+ const checkVisibility = () => {
10
+ if (!ref.current || isVisible || !scope.original?.useIsInView) return;
11
+
12
+ if (Platform.OS === 'web') {
13
+ const rect = ref.current.getBoundingClientRect?.();
14
+
15
+ if (rect && typeof window !== 'undefined') {
16
+ const windowHeight = window.innerHeight;
17
+ const visible = rect.top < windowHeight && rect.bottom > 0;
18
+
19
+ if (visible) scope.visible = visible;
20
+
21
+ setIsVisible(visible);
22
+ }
23
+ } else {
24
+ ref.current.measureInWindow?.((x, y, width, height) => {
25
+ const windowHeight = Dimensions.get('window').height;
26
+ const visible = y < windowHeight && y + height > 0;
27
+
28
+ if (visible) scope.visible = visible;
29
+ setIsVisible(visible);
30
+ });
31
+ }
32
+ };
33
+
34
+ const interval = setInterval(checkVisibility, 300); // roda a cada 300ms
35
+ return () => clearInterval(interval);
36
+ }, [ref]);
37
+
38
+ return isVisible;
39
+ }
@@ -1,12 +1,12 @@
1
- //import { ThemeUtils, Utils } from 'react-crud-utils';
2
- //import { StatusBar } from 'react-native';
3
-
4
- export default class MobileUtils {
5
- static syncTheme() {
6
- // let current = ThemeUtils.getCurrentTheme();
7
- //let dec: any = { light: 'light-content', dark: 'dark-content' };
8
- //let name = Utils.nvl(dec[current?.theme], dec.light);
9
- //StatusBar.setBarStyle?.(name);
10
- //StatusBar.setBackgroundColor?.(current?.colors?.theme);
11
- }
12
- }
1
+ //import { ThemeUtils, Utils } from 'react-crud-utils';
2
+ //import { StatusBar } from 'react-native';
3
+
4
+ export default class MobileUtils {
5
+ static syncTheme() {
6
+ // let current = ThemeUtils.getCurrentTheme();
7
+ //let dec: any = { light: 'light-content', dark: 'dark-content' };
8
+ //let name = Utils.nvl(dec[current?.theme], dec.light);
9
+ //StatusBar.setBarStyle?.(name);
10
+ //StatusBar.setBackgroundColor?.(current?.colors?.theme);
11
+ }
12
+ }