ui-rn 2.0.7 → 2.0.9
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/Example.tsx +1 -3
- package/package.json +1 -1
- package/src/Icon/index.tsx +1 -0
- package/src/Layout.tsx +21 -16
- package/src/index.tsx +1 -0
- package/dist/Example.d.ts +0 -2
- package/dist/Example.js +0 -11
- package/dist/Icon/PropsStyle.d.ts +0 -15
- package/dist/Icon/PropsStyle.js +0 -1
- package/dist/Icon/index.d.ts +0 -33
- package/dist/Icon/index.js +0 -72
- package/dist/Icon/makeProps.d.ts +0 -37
- package/dist/Icon/makeProps.js +0 -64
- package/dist/Layout.d.ts +0 -13
- package/dist/Layout.js +0 -21
- package/dist/Text/Props.d.ts +0 -29
- package/dist/Text/Props.js +0 -1
- package/dist/Text/Style.d.ts +0 -1
- package/dist/Text/Style.js +0 -17
- package/dist/Text/index.d.ts +0 -4
- package/dist/Text/index.js +0 -44
- package/dist/Text/makeStyle.d.ts +0 -63
- package/dist/Text/makeStyle.js +0 -91
- package/dist/Touch/Block.d.ts +0 -5
- package/dist/Touch/Block.js +0 -11
- package/dist/Touch/Props.d.ts +0 -128
- package/dist/Touch/Props.js +0 -1
- package/dist/Touch/Style.d.ts +0 -31
- package/dist/Touch/Style.js +0 -118
- package/dist/Touch/Touch.d.ts +0 -28
- package/dist/Touch/Touch.js +0 -35
- package/dist/Touch/TouchScale.d.ts +0 -10
- package/dist/Touch/TouchScale.js +0 -30
- package/dist/Touch/makeStyle.d.ts +0 -64
- package/dist/Touch/makeStyle.js +0 -94
- package/dist/Touch/utils.d.ts +0 -5
- package/dist/Touch/utils.js +0 -23
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -5
- package/dist/src/Icon/PropsStyle.d.ts +0 -15
- package/dist/src/Icon/PropsStyle.js +0 -1
- package/dist/src/Icon/index.d.ts +0 -33
- package/dist/src/Icon/index.js +0 -72
- package/dist/src/Icon/makeProps.d.ts +0 -37
- package/dist/src/Icon/makeProps.js +0 -64
- package/dist/src/Layout.d.ts +0 -13
- package/dist/src/Layout.js +0 -21
- package/dist/src/Text/Props.d.ts +0 -29
- package/dist/src/Text/Props.js +0 -1
- package/dist/src/Text/Style.d.ts +0 -1
- package/dist/src/Text/Style.js +0 -17
- package/dist/src/Text/index.d.ts +0 -4
- package/dist/src/Text/index.js +0 -44
- package/dist/src/Text/makeStyle.d.ts +0 -64
- package/dist/src/Text/makeStyle.js +0 -91
- package/dist/src/Touch/Block.d.ts +0 -5
- package/dist/src/Touch/Block.js +0 -11
- package/dist/src/Touch/Props.d.ts +0 -128
- package/dist/src/Touch/Props.js +0 -1
- package/dist/src/Touch/Style.d.ts +0 -31
- package/dist/src/Touch/Style.js +0 -118
- package/dist/src/Touch/Touch.d.ts +0 -28
- package/dist/src/Touch/Touch.js +0 -35
- package/dist/src/Touch/TouchScale.d.ts +0 -10
- package/dist/src/Touch/TouchScale.js +0 -30
- package/dist/src/Touch/makeStyle.d.ts +0 -65
- package/dist/src/Touch/makeStyle.js +0 -94
- package/dist/src/Touch/utils.d.ts +0 -5
- package/dist/src/Touch/utils.js +0 -23
- package/dist/src/index.d.ts +0 -5
- package/dist/src/index.js +0 -5
package/Example.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet, View } from 'react-native'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Text, Block, Icon } from './
|
|
3
|
+
import { Text, Block, Icon } from './src'
|
|
4
4
|
|
|
5
5
|
export default function Example() {
|
|
6
6
|
return (
|
|
@@ -11,5 +11,3 @@ export default function Example() {
|
|
|
11
11
|
</View>
|
|
12
12
|
)
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
const styles = StyleSheet.create({})
|
package/package.json
CHANGED
package/src/Icon/index.tsx
CHANGED
package/src/Layout.tsx
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import SafeAreaView, { ForceInsetProp } from
|
|
3
|
-
import { StyleProp, ViewStyle } from
|
|
4
|
-
export interface
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SafeAreaView, { ForceInsetProp } from 'react-native-safe-area-view';
|
|
3
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
export interface ILayout {
|
|
5
5
|
children?: any;
|
|
6
6
|
forceInset?: ForceInsetProp;
|
|
7
7
|
forceInsetBot?: ForceInsetProp;
|
|
8
|
-
|
|
8
|
+
styleBottom?: StyleProp<ViewStyle> | undefined;
|
|
9
9
|
style?: StyleProp<ViewStyle> | undefined;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
primary?: string;
|
|
11
|
+
bottomInset?: boolean;
|
|
12
|
+
|
|
12
13
|
}
|
|
13
14
|
export default function Layout({
|
|
14
15
|
children,
|
|
15
|
-
forceInset = { top:
|
|
16
|
-
forceInsetBot = { vertical:
|
|
17
|
-
|
|
16
|
+
forceInset = { top: 'always', horizontal: 'never', bottom: 'never' },
|
|
17
|
+
forceInsetBot = { vertical: 'never' },
|
|
18
|
+
styleBottom,
|
|
18
19
|
style,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
primary,
|
|
21
|
+
bottomInset
|
|
22
|
+
}: ILayout) {
|
|
22
23
|
return (
|
|
23
24
|
<SafeAreaView
|
|
24
25
|
style={[
|
|
@@ -26,6 +27,9 @@ export default function Layout({
|
|
|
26
27
|
flex: 1,
|
|
27
28
|
},
|
|
28
29
|
style,
|
|
30
|
+
primary && {
|
|
31
|
+
backgroundColor: primary
|
|
32
|
+
}
|
|
29
33
|
]}
|
|
30
34
|
forceInset={forceInset}
|
|
31
35
|
>
|
|
@@ -33,13 +37,14 @@ export default function Layout({
|
|
|
33
37
|
style={[
|
|
34
38
|
{
|
|
35
39
|
flex: 1,
|
|
40
|
+
backgroundColor: 'white'
|
|
36
41
|
},
|
|
37
|
-
|
|
42
|
+
styleBottom,
|
|
38
43
|
]}
|
|
39
|
-
forceInset={forceInsetBot}
|
|
44
|
+
forceInset={{ ...(bottomInset || styleBottom) && { vertical: 'never', bottom: 'always' }, ...forceInsetBot }}
|
|
40
45
|
>
|
|
41
46
|
{children}
|
|
42
47
|
</SafeAreaView>
|
|
43
|
-
</SafeAreaView>
|
|
48
|
+
</SafeAreaView >
|
|
44
49
|
);
|
|
45
50
|
}
|
package/src/index.tsx
CHANGED
package/dist/Example.d.ts
DELETED
package/dist/Example.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { StyleSheet, View } from 'react-native';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Text, Block, Icon } from './src/index';
|
|
4
|
-
export default function Example() {
|
|
5
|
-
return (<View>
|
|
6
|
-
<Block pad-40/>
|
|
7
|
-
<Text pink color='red'/>
|
|
8
|
-
<Icon name='red'/>
|
|
9
|
-
</View>);
|
|
10
|
-
}
|
|
11
|
-
const styles = StyleSheet.create({});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { RNVectorIcon } from "./index";
|
|
2
|
-
import { FlexStyle, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
-
import { MakeProp } from "./makeProps";
|
|
4
|
-
export interface Props extends MakeProp {
|
|
5
|
-
name: string;
|
|
6
|
-
size?: number;
|
|
7
|
-
type?: keyof typeof RNVectorIcon;
|
|
8
|
-
onPress?: () => void;
|
|
9
|
-
styleContainer?: StyleProp<ViewStyle>;
|
|
10
|
-
style?: StyleProp<TextStyle>;
|
|
11
|
-
alignSelf?: FlexStyle['alignSelf'];
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
activeOpacity?: number;
|
|
14
|
-
color?: string;
|
|
15
|
-
}
|
package/dist/Icon/PropsStyle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/Icon/index.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Ionicons from "react-native-vector-icons/Ionicons";
|
|
3
|
-
import FontAwesome5 from "react-native-vector-icons/FontAwesome5";
|
|
4
|
-
/**
|
|
5
|
-
* Collection of React Native Vector Icons
|
|
6
|
-
* Provides access to various icon sets from react-native-vector-icons
|
|
7
|
-
*/
|
|
8
|
-
export declare const RNVectorIcon: {
|
|
9
|
-
Ionicons: typeof Ionicons;
|
|
10
|
-
AntDesign: typeof Ionicons;
|
|
11
|
-
Entypo: typeof Ionicons;
|
|
12
|
-
EvilIcons: typeof Ionicons;
|
|
13
|
-
MaterialIcons: typeof Ionicons;
|
|
14
|
-
MaterialCommunityIcons: typeof Ionicons;
|
|
15
|
-
FontAwesome: typeof Ionicons;
|
|
16
|
-
FontAwesome5: typeof FontAwesome5;
|
|
17
|
-
SimpleLineIcons: typeof Ionicons;
|
|
18
|
-
Feather: typeof Ionicons;
|
|
19
|
-
Octicons: typeof Ionicons;
|
|
20
|
-
Fontisto: typeof Ionicons;
|
|
21
|
-
};
|
|
22
|
-
export type IconType = keyof typeof RNVectorIcon;
|
|
23
|
-
import { Props } from "./PropsStyle";
|
|
24
|
-
export default class IconApp extends React.PureComponent<Props> {
|
|
25
|
-
static defaultProps: Props;
|
|
26
|
-
res: {
|
|
27
|
-
color: string;
|
|
28
|
-
style: any;
|
|
29
|
-
size: number;
|
|
30
|
-
};
|
|
31
|
-
constructor(props: Props);
|
|
32
|
-
render(): React.JSX.Element | null;
|
|
33
|
-
}
|
package/dist/Icon/index.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, TouchableOpacity } from "react-native";
|
|
3
|
-
import Ionicons from "react-native-vector-icons/Ionicons";
|
|
4
|
-
import EvilIcons from "react-native-vector-icons/EvilIcons";
|
|
5
|
-
import FontAwesome from "react-native-vector-icons/FontAwesome";
|
|
6
|
-
import FontAwesome5 from "react-native-vector-icons/FontAwesome5";
|
|
7
|
-
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
|
|
8
|
-
import MaterialIcons from "react-native-vector-icons/MaterialIcons";
|
|
9
|
-
import Entypo from "react-native-vector-icons/Entypo";
|
|
10
|
-
import AntDesign from "react-native-vector-icons/AntDesign";
|
|
11
|
-
import SimpleLineIcons from "react-native-vector-icons/SimpleLineIcons";
|
|
12
|
-
import Feather from "react-native-vector-icons/Feather";
|
|
13
|
-
import Octicons from "react-native-vector-icons/Octicons";
|
|
14
|
-
import Fontisto from "react-native-vector-icons/Fontisto";
|
|
15
|
-
/**
|
|
16
|
-
* Collection of React Native Vector Icons
|
|
17
|
-
* Provides access to various icon sets from react-native-vector-icons
|
|
18
|
-
*/
|
|
19
|
-
export const RNVectorIcon = {
|
|
20
|
-
Ionicons,
|
|
21
|
-
AntDesign,
|
|
22
|
-
Entypo,
|
|
23
|
-
EvilIcons,
|
|
24
|
-
MaterialIcons,
|
|
25
|
-
MaterialCommunityIcons,
|
|
26
|
-
FontAwesome,
|
|
27
|
-
FontAwesome5,
|
|
28
|
-
SimpleLineIcons,
|
|
29
|
-
Feather,
|
|
30
|
-
Octicons,
|
|
31
|
-
Fontisto,
|
|
32
|
-
};
|
|
33
|
-
import { makeProps } from "./makeProps";
|
|
34
|
-
export default class IconApp extends React.PureComponent {
|
|
35
|
-
static defaultProps = {
|
|
36
|
-
size: 23,
|
|
37
|
-
color: "gray",
|
|
38
|
-
name: "home",
|
|
39
|
-
};
|
|
40
|
-
res;
|
|
41
|
-
constructor(props) {
|
|
42
|
-
super(props);
|
|
43
|
-
this.res = makeProps(props);
|
|
44
|
-
}
|
|
45
|
-
render() {
|
|
46
|
-
const { size, color, style } = this.res;
|
|
47
|
-
if (this.props.name === "none")
|
|
48
|
-
return null;
|
|
49
|
-
const IconView = RNVectorIcon[this.props.type || "Ionicons"];
|
|
50
|
-
if (typeof this.props.onPress != "function") {
|
|
51
|
-
return (<IconView size={size} color={color} style={style} name={this.props.name} onPress={this.props.onPress}/>);
|
|
52
|
-
}
|
|
53
|
-
return (<TouchableOpacity activeOpacity={this.props.activeOpacity || 0.5} disabled={typeof this.props.onPress == "function" ? this.props.disabled : true} style={[
|
|
54
|
-
styles.container,
|
|
55
|
-
{ ...(this.props.alignSelf && { alignSelf: this.props.alignSelf }) },
|
|
56
|
-
this.props.style,
|
|
57
|
-
this.props.styleContainer,
|
|
58
|
-
]}>
|
|
59
|
-
<IconView size={size} color={color} style={style} name={this.props.name} onPress={this.props.onPress}/>
|
|
60
|
-
</TouchableOpacity>);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Default styles for the IconApp component
|
|
65
|
-
*/
|
|
66
|
-
const styles = StyleSheet.create({
|
|
67
|
-
container: {
|
|
68
|
-
alignItems: "center",
|
|
69
|
-
justifyContent: "center",
|
|
70
|
-
alignSelf: "flex-start",
|
|
71
|
-
},
|
|
72
|
-
});
|
package/dist/Icon/makeProps.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ViewStyle } from "react-native";
|
|
2
|
-
declare enum COLORS {
|
|
3
|
-
white = 1,
|
|
4
|
-
red = 2,
|
|
5
|
-
blue = 3,
|
|
6
|
-
black = 4,
|
|
7
|
-
green = 5,
|
|
8
|
-
yellow = 6,
|
|
9
|
-
pink = 7,
|
|
10
|
-
gray = 8,
|
|
11
|
-
primary = 9
|
|
12
|
-
}
|
|
13
|
-
type ColorKey = keyof typeof COLORS;
|
|
14
|
-
type ColorModifiers = Partial<Record<ColorKey, boolean>>;
|
|
15
|
-
declare const PROPS: {
|
|
16
|
-
readonly mar: "margin";
|
|
17
|
-
readonly marH: "marginHorizontal";
|
|
18
|
-
readonly marV: "marginVertical";
|
|
19
|
-
readonly marL: "marginLeft";
|
|
20
|
-
readonly marT: "marginTop";
|
|
21
|
-
readonly marR: "marginRight";
|
|
22
|
-
readonly marB: "marginBottom";
|
|
23
|
-
readonly zIndex: "zIndex";
|
|
24
|
-
readonly opacity: "opacity";
|
|
25
|
-
readonly size: "size";
|
|
26
|
-
};
|
|
27
|
-
export type ShortKey = keyof typeof PROPS;
|
|
28
|
-
export type Convert<T extends string> = Partial<Record<T, boolean | number | string>>;
|
|
29
|
-
export type MakeProp = Convert<ShortKey> & ColorModifiers;
|
|
30
|
-
type Result = {
|
|
31
|
-
size: number;
|
|
32
|
-
color: string;
|
|
33
|
-
name: string;
|
|
34
|
-
style: ViewStyle;
|
|
35
|
-
};
|
|
36
|
-
export declare const makeProps: (props: Record<string, any>) => Result;
|
|
37
|
-
export {};
|
package/dist/Icon/makeProps.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
var COLORS;
|
|
3
|
-
(function (COLORS) {
|
|
4
|
-
COLORS[COLORS["white"] = 1] = "white";
|
|
5
|
-
COLORS[COLORS["red"] = 2] = "red";
|
|
6
|
-
COLORS[COLORS["blue"] = 3] = "blue";
|
|
7
|
-
COLORS[COLORS["black"] = 4] = "black";
|
|
8
|
-
COLORS[COLORS["green"] = 5] = "green";
|
|
9
|
-
COLORS[COLORS["yellow"] = 6] = "yellow";
|
|
10
|
-
COLORS[COLORS["pink"] = 7] = "pink";
|
|
11
|
-
COLORS[COLORS["gray"] = 8] = "gray";
|
|
12
|
-
COLORS[COLORS["primary"] = 9] = "primary";
|
|
13
|
-
})(COLORS || (COLORS = {}));
|
|
14
|
-
const PROPS = {
|
|
15
|
-
mar: "margin",
|
|
16
|
-
marH: "marginHorizontal",
|
|
17
|
-
marV: "marginVertical",
|
|
18
|
-
marL: "marginLeft",
|
|
19
|
-
marT: "marginTop",
|
|
20
|
-
marR: "marginRight",
|
|
21
|
-
marB: "marginBottom",
|
|
22
|
-
zIndex: "zIndex",
|
|
23
|
-
opacity: "opacity",
|
|
24
|
-
size: "size",
|
|
25
|
-
};
|
|
26
|
-
/** type guards */
|
|
27
|
-
const isColorKey = (key) => key in COLORS;
|
|
28
|
-
const isShortKey = (key) => key in PROPS;
|
|
29
|
-
export const makeProps = (props) => {
|
|
30
|
-
const style = {};
|
|
31
|
-
const res = {
|
|
32
|
-
size: props.size ?? 23,
|
|
33
|
-
color: props.color ?? "gray",
|
|
34
|
-
name: props.name ?? "home",
|
|
35
|
-
};
|
|
36
|
-
Object.keys(props).forEach((key) => {
|
|
37
|
-
const match = key.match(/^(\w+)-(\w+)$/);
|
|
38
|
-
// color modifier
|
|
39
|
-
if (isColorKey(key)) {
|
|
40
|
-
res.color = key;
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (match) {
|
|
44
|
-
const rawKey = match[1];
|
|
45
|
-
const rawValue = match[2];
|
|
46
|
-
const value = isNaN(Number(rawValue))
|
|
47
|
-
? rawValue
|
|
48
|
-
: Number(rawValue);
|
|
49
|
-
if (rawKey === "size") {
|
|
50
|
-
res.size = Number(rawValue);
|
|
51
|
-
}
|
|
52
|
-
else if (rawKey === "color") {
|
|
53
|
-
res.color = rawValue;
|
|
54
|
-
}
|
|
55
|
-
else if (isShortKey(rawKey)) {
|
|
56
|
-
style[PROPS[rawKey]] = value;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
return {
|
|
61
|
-
...res,
|
|
62
|
-
style: StyleSheet.create({ style }).style,
|
|
63
|
-
};
|
|
64
|
-
};
|
package/dist/Layout.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ForceInsetProp } from "react-native-safe-area-view";
|
|
3
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
4
|
-
export interface LayoutAppProps {
|
|
5
|
-
children?: any;
|
|
6
|
-
forceInset?: ForceInsetProp;
|
|
7
|
-
forceInsetBot?: ForceInsetProp;
|
|
8
|
-
styleBot?: StyleProp<ViewStyle> | undefined;
|
|
9
|
-
style?: StyleProp<ViewStyle> | undefined;
|
|
10
|
-
isBack?: boolean;
|
|
11
|
-
disable?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export default function Layout({ children, forceInset, forceInsetBot, styleBot, style, disable, }: LayoutAppProps): React.JSX.Element;
|
package/dist/Layout.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import SafeAreaView from "react-native-safe-area-view";
|
|
3
|
-
export default function Layout({ children, forceInset = { top: "always", horizontal: "never", bottom: "never" }, forceInsetBot = { vertical: "never" }, styleBot, style, disable, }) {
|
|
4
|
-
if (disable)
|
|
5
|
-
return <>{children}</>;
|
|
6
|
-
return (<SafeAreaView style={[
|
|
7
|
-
{
|
|
8
|
-
flex: 1,
|
|
9
|
-
},
|
|
10
|
-
style,
|
|
11
|
-
]} forceInset={forceInset}>
|
|
12
|
-
<SafeAreaView style={[
|
|
13
|
-
{
|
|
14
|
-
flex: 1,
|
|
15
|
-
},
|
|
16
|
-
styleBot,
|
|
17
|
-
]} forceInset={forceInsetBot}>
|
|
18
|
-
{children}
|
|
19
|
-
</SafeAreaView>
|
|
20
|
-
</SafeAreaView>);
|
|
21
|
-
}
|
package/dist/Text/Props.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TextProps, TextStyle } from 'react-native';
|
|
3
|
-
import { MakeProp } from './makeStyle';
|
|
4
|
-
interface PropsParent {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
bold?: boolean | TextStyle['fontWeight'];
|
|
7
|
-
center?: boolean;
|
|
8
|
-
italic?: boolean;
|
|
9
|
-
underline?: boolean;
|
|
10
|
-
color?: string;
|
|
11
|
-
toUpperCase?: boolean;
|
|
12
|
-
toLowerCase?: boolean;
|
|
13
|
-
background?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface Props extends TextProps, PropsParent, MakeProp {
|
|
16
|
-
backgroundColor?: string;
|
|
17
|
-
primary?: boolean;
|
|
18
|
-
white?: boolean;
|
|
19
|
-
red?: boolean;
|
|
20
|
-
blue?: boolean;
|
|
21
|
-
green?: boolean;
|
|
22
|
-
yellow?: boolean;
|
|
23
|
-
pink?: boolean;
|
|
24
|
-
gray?: boolean;
|
|
25
|
-
black?: boolean;
|
|
26
|
-
lang?: string;
|
|
27
|
-
content?: string;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
package/dist/Text/Props.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/Text/Style.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Style: any;
|
package/dist/Text/Style.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
import { makeStyle } from "./makeStyle";
|
|
3
|
-
export const Style = (props) => {
|
|
4
|
-
const PropsConvert = StyleSheet.flatten([
|
|
5
|
-
props.color && { color: props.color },
|
|
6
|
-
props.center && { textAlign: 'center' },
|
|
7
|
-
props.italic && { fontStyle: 'italic' },
|
|
8
|
-
props.bold && { fontWeight: typeof props.bold == "boolean" ? '500' : props.bold },
|
|
9
|
-
props.underline && { textDecorationLine: 'underline' },
|
|
10
|
-
props.toUpperCase && { textTransform: 'uppercase' },
|
|
11
|
-
props.toLowerCase && { textTransform: 'lowercase' },
|
|
12
|
-
]);
|
|
13
|
-
return [
|
|
14
|
-
makeStyle(props),
|
|
15
|
-
PropsConvert,
|
|
16
|
-
];
|
|
17
|
-
};
|
package/dist/Text/index.d.ts
DELETED
package/dist/Text/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { isValidElement } from "react";
|
|
2
|
-
import { StyleSheet, Text } from "react-native";
|
|
3
|
-
import { Style } from "./Style";
|
|
4
|
-
import { isArray, isObject } from "underscore";
|
|
5
|
-
const TextApp = ({ style, children, ...props }) => {
|
|
6
|
-
const Children = () => {
|
|
7
|
-
const content = props?.lang ?? undefined;
|
|
8
|
-
if (typeof content !== "undefined") {
|
|
9
|
-
if (typeof content == "string" ||
|
|
10
|
-
typeof content == "number" ||
|
|
11
|
-
isArray(children))
|
|
12
|
-
return content;
|
|
13
|
-
if (typeof content == "function")
|
|
14
|
-
return "Error content == 'function'";
|
|
15
|
-
if (isObject(children))
|
|
16
|
-
return JSON.stringify(children);
|
|
17
|
-
if (isValidElement(content))
|
|
18
|
-
return content;
|
|
19
|
-
return React.createElement(Text, {});
|
|
20
|
-
}
|
|
21
|
-
if (typeof children !== "undefined") {
|
|
22
|
-
if (typeof children == "string" ||
|
|
23
|
-
typeof children == "number" ||
|
|
24
|
-
isArray(children))
|
|
25
|
-
return children;
|
|
26
|
-
if (isObject(children))
|
|
27
|
-
return JSON.stringify(children);
|
|
28
|
-
if (typeof children == "function")
|
|
29
|
-
return "Error children == 'function'";
|
|
30
|
-
if (isValidElement(children))
|
|
31
|
-
return children;
|
|
32
|
-
return React.createElement(Text, {}, children);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
return (<Text style={[styles.default, Style(props), style]} {...props}>
|
|
36
|
-
{Children()}
|
|
37
|
-
</Text>);
|
|
38
|
-
};
|
|
39
|
-
export default TextApp;
|
|
40
|
-
const styles = StyleSheet.create({
|
|
41
|
-
default: {
|
|
42
|
-
fontSize: 14,
|
|
43
|
-
},
|
|
44
|
-
});
|
package/dist/Text/makeStyle.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { TextStyle } from "react-native";
|
|
2
|
-
declare enum COLORS {
|
|
3
|
-
"white" = 1,
|
|
4
|
-
"red" = 2,
|
|
5
|
-
"blue" = 3,
|
|
6
|
-
"black" = 4,
|
|
7
|
-
"green" = 5,
|
|
8
|
-
"yellow" = 6,
|
|
9
|
-
"pink" = 7,
|
|
10
|
-
"gray" = 8,
|
|
11
|
-
"primary" = 9
|
|
12
|
-
}
|
|
13
|
-
declare const PROPS: {
|
|
14
|
-
readonly bg: "backgroundColor";
|
|
15
|
-
readonly background: "backgroundColor";
|
|
16
|
-
readonly color: "color";
|
|
17
|
-
readonly w: "width";
|
|
18
|
-
readonly width: "width";
|
|
19
|
-
readonly minW: "minWidth";
|
|
20
|
-
readonly maxW: "maxWidth";
|
|
21
|
-
readonly h: "height";
|
|
22
|
-
readonly height: "height";
|
|
23
|
-
readonly minH: "minHeight";
|
|
24
|
-
readonly maxH: "maxHeight";
|
|
25
|
-
readonly pad: "padding";
|
|
26
|
-
readonly padH: "paddingHorizontal";
|
|
27
|
-
readonly padV: "paddingVertical";
|
|
28
|
-
readonly padL: "paddingLeft";
|
|
29
|
-
readonly padT: "paddingTop";
|
|
30
|
-
readonly padR: "paddingRight";
|
|
31
|
-
readonly padB: "paddingBottom";
|
|
32
|
-
readonly mar: "margin";
|
|
33
|
-
readonly marH: "marginHorizontal";
|
|
34
|
-
readonly marV: "marginVertical";
|
|
35
|
-
readonly marL: "marginLeft";
|
|
36
|
-
readonly marT: "marginTop";
|
|
37
|
-
readonly marR: "marginRight";
|
|
38
|
-
readonly marB: "marginBottom";
|
|
39
|
-
readonly border: "borderWidth";
|
|
40
|
-
readonly borderW: "borderWidth";
|
|
41
|
-
readonly borderR: "borderRadius";
|
|
42
|
-
readonly borderC: "borderColor";
|
|
43
|
-
readonly borderLW: "borderLeftWidth";
|
|
44
|
-
readonly borderTW: "borderTopWidth";
|
|
45
|
-
readonly borderRW: "borderRightWidth";
|
|
46
|
-
readonly borderBW: "borderBottomWidth";
|
|
47
|
-
readonly flex: "flex";
|
|
48
|
-
readonly zIndex: "zIndex";
|
|
49
|
-
readonly left: "left";
|
|
50
|
-
readonly top: "top";
|
|
51
|
-
readonly bottom: "bottom";
|
|
52
|
-
readonly right: "right";
|
|
53
|
-
readonly opacity: "opacity";
|
|
54
|
-
readonly size: "fontSize";
|
|
55
|
-
};
|
|
56
|
-
export type ColorKey = keyof typeof COLORS;
|
|
57
|
-
export type ShortKey = keyof typeof PROPS;
|
|
58
|
-
export type Convert<T extends string> = Partial<Record<T, boolean | number | string>>;
|
|
59
|
-
export type MakeProp = Partial<Record<ShortKey, number | string>> & Partial<Record<ColorKey, boolean>> & Record<string, any>;
|
|
60
|
-
export declare const makeStyle: (props: {
|
|
61
|
-
[key: string]: any;
|
|
62
|
-
}) => TextStyle;
|
|
63
|
-
export {};
|
package/dist/Text/makeStyle.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
import { isNaN } from "underscore";
|
|
3
|
-
var COLORS;
|
|
4
|
-
(function (COLORS) {
|
|
5
|
-
COLORS[COLORS["white"] = 1] = "white";
|
|
6
|
-
COLORS[COLORS["red"] = 2] = "red";
|
|
7
|
-
COLORS[COLORS["blue"] = 3] = "blue";
|
|
8
|
-
COLORS[COLORS["black"] = 4] = "black";
|
|
9
|
-
COLORS[COLORS["green"] = 5] = "green";
|
|
10
|
-
COLORS[COLORS["yellow"] = 6] = "yellow";
|
|
11
|
-
COLORS[COLORS["pink"] = 7] = "pink";
|
|
12
|
-
COLORS[COLORS["gray"] = 8] = "gray";
|
|
13
|
-
COLORS[COLORS["primary"] = 9] = "primary";
|
|
14
|
-
})(COLORS || (COLORS = {}));
|
|
15
|
-
const PROPS = {
|
|
16
|
-
bg: "backgroundColor",
|
|
17
|
-
background: "backgroundColor",
|
|
18
|
-
color: "color",
|
|
19
|
-
w: "width",
|
|
20
|
-
width: "width",
|
|
21
|
-
minW: "minWidth",
|
|
22
|
-
maxW: "maxWidth",
|
|
23
|
-
h: "height",
|
|
24
|
-
height: "height",
|
|
25
|
-
minH: "minHeight",
|
|
26
|
-
maxH: "maxHeight",
|
|
27
|
-
pad: "padding",
|
|
28
|
-
padH: "paddingHorizontal",
|
|
29
|
-
padV: "paddingVertical",
|
|
30
|
-
padL: "paddingLeft",
|
|
31
|
-
padT: "paddingTop",
|
|
32
|
-
padR: "paddingRight",
|
|
33
|
-
padB: "paddingBottom",
|
|
34
|
-
mar: "margin",
|
|
35
|
-
marH: "marginHorizontal",
|
|
36
|
-
marV: "marginVertical",
|
|
37
|
-
marL: "marginLeft",
|
|
38
|
-
marT: "marginTop",
|
|
39
|
-
marR: "marginRight",
|
|
40
|
-
marB: "marginBottom",
|
|
41
|
-
border: 'borderWidth',
|
|
42
|
-
borderW: 'borderWidth',
|
|
43
|
-
borderR: "borderRadius",
|
|
44
|
-
borderC: "borderColor",
|
|
45
|
-
borderLW: "borderLeftWidth",
|
|
46
|
-
borderTW: "borderTopWidth",
|
|
47
|
-
borderRW: "borderRightWidth",
|
|
48
|
-
borderBW: "borderBottomWidth",
|
|
49
|
-
flex: 'flex',
|
|
50
|
-
zIndex: 'zIndex',
|
|
51
|
-
left: 'left',
|
|
52
|
-
top: 'top',
|
|
53
|
-
bottom: 'bottom',
|
|
54
|
-
right: 'right',
|
|
55
|
-
opacity: 'opacity',
|
|
56
|
-
size: 'fontSize'
|
|
57
|
-
};
|
|
58
|
-
const isColorKey = (key) => {
|
|
59
|
-
return key in COLORS;
|
|
60
|
-
};
|
|
61
|
-
const isShortKey = (key) => {
|
|
62
|
-
return key in PROPS;
|
|
63
|
-
};
|
|
64
|
-
export const makeStyle = (props) => {
|
|
65
|
-
const style = {};
|
|
66
|
-
Object.keys(props).forEach((key) => {
|
|
67
|
-
const match = key.match(/^(\w+)-(\w+)$/);
|
|
68
|
-
if (isColorKey(key)) {
|
|
69
|
-
style.color = key;
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (match) {
|
|
73
|
-
const [, rawKey, rawValue] = match;
|
|
74
|
-
const value = isNaN(Number(rawValue))
|
|
75
|
-
? rawValue
|
|
76
|
-
: Number(rawValue);
|
|
77
|
-
if (isShortKey(rawKey)) {
|
|
78
|
-
style[PROPS[rawKey]] = value;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
style[rawKey] = value;
|
|
82
|
-
}
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
// 🔹 Normal props
|
|
86
|
-
if (isShortKey(key)) {
|
|
87
|
-
style[PROPS[key]] = props[key];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
return StyleSheet.create({ style }).style;
|
|
91
|
-
};
|
package/dist/Touch/Block.d.ts
DELETED
package/dist/Touch/Block.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
import { Style } from "./Style";
|
|
4
|
-
const Block = React.forwardRef(({ style, ...props }, ref) => {
|
|
5
|
-
if (props?.hidden)
|
|
6
|
-
return <></>;
|
|
7
|
-
return (<View ref={ref} style={[Style(props), style]} {...props}>
|
|
8
|
-
{props.children}
|
|
9
|
-
</View>);
|
|
10
|
-
});
|
|
11
|
-
export default Block;
|