ui-rn 1.0.2 → 1.0.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 +8 -1
- package/src/Layout.tsx +43 -0
- package/src/Text/index.tsx +42 -0
- package/src/index.tsx +3 -1
- package/src/text/TextApp.tsx +0 -42
- package/src/text/index.tsx +0 -1
- /package/src/{text → Text}/Props.ts +0 -0
- /package/src/{text → Text}/Style.ts +0 -0
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui-rn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"repository": "https://github.com/phamha98/ui-rn",
|
|
5
5
|
"description": "ui-rn",
|
|
6
6
|
"author": "Phamha98",
|
|
7
7
|
"main": "src/index.tsx",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"underscore": "^1.13.6",
|
|
10
|
+
"@types/underscore": "^1.11.15",
|
|
11
|
+
"validate-color": "^2.2.4",
|
|
12
|
+
"react-native-safe-area-view": "^1.1.1",
|
|
13
|
+
"react-native-linear-gradient": "^2.8.3"
|
|
14
|
+
},
|
|
8
15
|
"scripts": {
|
|
9
16
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
17
|
},
|
package/src/Layout.tsx
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import SafeAreaView, { ForceInsetProp } from 'react-native-safe-area-view'
|
|
3
|
+
import { Platform, 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({
|
|
14
|
+
children,
|
|
15
|
+
forceInset = { top: 'always', horizontal: 'never', bottom: 'never' },
|
|
16
|
+
forceInsetBot = { vertical: 'never' },
|
|
17
|
+
styleBot,
|
|
18
|
+
style,
|
|
19
|
+
disable,
|
|
20
|
+
}: LayoutAppProps) {
|
|
21
|
+
if (disable) return <>{children}</>
|
|
22
|
+
return (
|
|
23
|
+
<SafeAreaView
|
|
24
|
+
style={[
|
|
25
|
+
{
|
|
26
|
+
flex: 1,
|
|
27
|
+
},
|
|
28
|
+
style,
|
|
29
|
+
]}
|
|
30
|
+
forceInset={forceInset}>
|
|
31
|
+
<SafeAreaView
|
|
32
|
+
style={[
|
|
33
|
+
{
|
|
34
|
+
flex: 1,
|
|
35
|
+
},
|
|
36
|
+
styleBot,
|
|
37
|
+
]}
|
|
38
|
+
forceInset={forceInsetBot}>
|
|
39
|
+
{children}
|
|
40
|
+
</SafeAreaView>
|
|
41
|
+
</SafeAreaView>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Colors, Language } from '../config'
|
|
2
|
+
import React, { isValidElement } from 'react'
|
|
3
|
+
import { StyleSheet, Text, View } from 'react-native'
|
|
4
|
+
import { Style } from './Style'
|
|
5
|
+
import { Props } from './Props'
|
|
6
|
+
import { isArray, isObject } from 'underscore'
|
|
7
|
+
const TextApp: React.FC<Props> = ({ style, children, ...props }) => {
|
|
8
|
+
const Children = () => {
|
|
9
|
+
const content = props?.lang ? Language(props?.lang) : undefined
|
|
10
|
+
if (typeof content !== 'undefined') {
|
|
11
|
+
if (typeof content == 'string' || typeof content == 'number' || isArray(children)) return content
|
|
12
|
+
if (typeof content == 'function') return "Error content == 'function'"
|
|
13
|
+
if (isObject(children)) return JSON.stringify(children)
|
|
14
|
+
if (isValidElement(content)) return content
|
|
15
|
+
return React.createElement(Text, {})
|
|
16
|
+
}
|
|
17
|
+
if (typeof children !== 'undefined') {
|
|
18
|
+
if (typeof children == 'string' || typeof children == 'number' || isArray(children)) return children
|
|
19
|
+
if (isObject(children)) return JSON.stringify(children)
|
|
20
|
+
if (typeof children == "function") return "Error children == 'function'"
|
|
21
|
+
if (isValidElement(children)) return children
|
|
22
|
+
return React.createElement(Text, {}, children)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return (
|
|
26
|
+
<Text
|
|
27
|
+
// adjustsFontSizeToFit
|
|
28
|
+
// selectable
|
|
29
|
+
style={[styles.default, Style(props), style]}{...props}>
|
|
30
|
+
{Children()}
|
|
31
|
+
</Text>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
export default TextApp
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
default: {
|
|
37
|
+
fontWeight: '300',
|
|
38
|
+
color: Colors('black'),
|
|
39
|
+
fontSize: 15,
|
|
40
|
+
paddingTop: 2
|
|
41
|
+
},
|
|
42
|
+
})
|
package/src/index.tsx
CHANGED
package/src/text/TextApp.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Colors, Language } from '../config'
|
|
2
|
-
import React, { isValidElement } from 'react'
|
|
3
|
-
import { StyleSheet, Text, View } from 'react-native'
|
|
4
|
-
import { Style } from './Style'
|
|
5
|
-
import { Props } from './Props'
|
|
6
|
-
import { isArray, isObject } from 'underscore'
|
|
7
|
-
const TextApp: React.FC<Props> = ({ style, children, ...props }) => {
|
|
8
|
-
const Children = () => {
|
|
9
|
-
const content = props?.lang ? Language(props?.lang) : undefined
|
|
10
|
-
if (typeof content !== 'undefined') {
|
|
11
|
-
if (typeof content == 'string' || typeof content == 'number' || isArray(children)) return content
|
|
12
|
-
if (typeof content == 'function') return "Error content == 'function'"
|
|
13
|
-
if (isObject(children)) return JSON.stringify(children)
|
|
14
|
-
if (isValidElement(content)) return content
|
|
15
|
-
return React.createElement(Text, {})
|
|
16
|
-
}
|
|
17
|
-
if (typeof children !== 'undefined') {
|
|
18
|
-
if (typeof children == 'string' || typeof children == 'number' || isArray(children)) return children
|
|
19
|
-
if (isObject(children)) return JSON.stringify(children)
|
|
20
|
-
if (typeof children == "function") return "Error children == 'function'"
|
|
21
|
-
if (isValidElement(children)) return children
|
|
22
|
-
return React.createElement(Text, {}, children)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return (
|
|
26
|
-
<Text
|
|
27
|
-
// adjustsFontSizeToFit
|
|
28
|
-
// selectable
|
|
29
|
-
style={[styles.default, Style(props), style]}{...props}>
|
|
30
|
-
{Children()}
|
|
31
|
-
</Text>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
export default TextApp
|
|
35
|
-
const styles = StyleSheet.create({
|
|
36
|
-
default: {
|
|
37
|
-
fontWeight: '300',
|
|
38
|
-
color: Colors('black'),
|
|
39
|
-
fontSize: 15,
|
|
40
|
-
paddingTop: 2
|
|
41
|
-
},
|
|
42
|
-
})
|
package/src/text/index.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as TextApp } from './TextApp'
|
|
File without changes
|
|
File without changes
|