bootstrap-rn 0.4.7 → 0.4.8
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/lib/module/components/forms/Picker.js +1 -1
- package/lib/module/components/helpers/Portal.web.js +16 -1
- package/lib/module/components/helpers/Portal.web.js.map +1 -1
- package/lib/typescript/components/helpers/Portal.web.d.ts.map +1 -1
- package/package.json +92 -92
- package/src/components/Body.tsx +68 -68
- package/src/components/forms/Picker.tsx +1 -1
- package/src/components/helpers/Portal.web.tsx +21 -1
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { useLayoutEffect, useState } from 'react';
|
|
3
4
|
import { createPortal } from 'react-dom';
|
|
4
5
|
const DEFAULT_PORTAL_HOST = 'INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME';
|
|
5
6
|
function Portal({
|
|
6
7
|
hostName = DEFAULT_PORTAL_HOST,
|
|
7
8
|
children
|
|
8
9
|
}) {
|
|
9
|
-
const element = document.getElementById(hostName);
|
|
10
|
+
const [element, setElement] = useState(() => document.getElementById(hostName));
|
|
11
|
+
|
|
12
|
+
// Retry lookup after mount, before paint, in case the host element
|
|
13
|
+
// was not yet committed to the DOM during the initial render.
|
|
14
|
+
useLayoutEffect(() => {
|
|
15
|
+
if (!element) {
|
|
16
|
+
const host = document.getElementById(hostName);
|
|
17
|
+
if (host) {
|
|
18
|
+
setElement(host);
|
|
19
|
+
} else {
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
console.warn(`Portal: No host element found with id "${hostName}". Make sure <PortalHost /> is rendered in the component tree.`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}, [hostName]);
|
|
10
25
|
if (!element) {
|
|
11
26
|
return null;
|
|
12
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createPortal","DEFAULT_PORTAL_HOST","Portal","hostName","children","element","document","getElementById"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/helpers/Portal.web.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,WAAW;AASxC,MAAMC,mBAAmB,GAAG,sCAAsC;AAElE,SAASC,MAAMA,CAAC;EAAEC,QAAQ,GAAGF,mBAAmB;EAAEG;AAAsB,CAAC,EAAE;EACzE,
|
|
1
|
+
{"version":3,"names":["useLayoutEffect","useState","createPortal","DEFAULT_PORTAL_HOST","Portal","hostName","children","element","setElement","document","getElementById","host","console","warn"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/helpers/Portal.web.tsx"],"mappings":";;AAAA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,OAAO;AACjD,SAASC,YAAY,QAAQ,WAAW;AASxC,MAAMC,mBAAmB,GAAG,sCAAsC;AAElE,SAASC,MAAMA,CAAC;EAAEC,QAAQ,GAAGF,mBAAmB;EAAEG;AAAsB,CAAC,EAAE;EACzE,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGP,QAAQ,CAAC,MACrCQ,QAAQ,CAACC,cAAc,CAACL,QAAQ,CAClC,CAAC;;EAED;EACA;EACAL,eAAe,CAAC,MAAM;IACpB,IAAI,CAACO,OAAO,EAAE;MACZ,MAAMI,IAAI,GAAGF,QAAQ,CAACC,cAAc,CAACL,QAAQ,CAAC;MAE9C,IAAIM,IAAI,EAAE;QACRH,UAAU,CAACG,IAAI,CAAC;MAClB,CAAC,MAAM;QACL;QACAC,OAAO,CAACC,IAAI,CACV,0CAA0CR,QAAQ,gEACpD,CAAC;MACH;IACF;EACF,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,IAAI,CAACE,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EAEA,oBAAOL,YAAY,CAACI,QAAQ,EAAEC,OAAO,CAAC;AACxC;AAEA,eAAeH,MAAM","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.web.d.ts","sourceRoot":"","sources":["../../../../src/components/helpers/Portal.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Portal.web.d.ts","sourceRoot":"","sources":["../../../../src/components/helpers/Portal.web.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAE1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAID,iBAAS,MAAM,CAAC,EAAE,QAA8B,EAAE,QAAQ,EAAE,EAAE,WAAW,sCA2BxE;AAED,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "bootstrap-rn",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Bootstrap RN provides Bootstrap components for React Native.",
|
|
5
|
-
"author": "Markus Wetzel <markuswetzel@gmx.net>",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"react",
|
|
9
|
-
"native",
|
|
10
|
-
"react-native",
|
|
11
|
-
"bootstrap",
|
|
12
|
-
"ui",
|
|
13
|
-
"style"
|
|
14
|
-
],
|
|
15
|
-
"repository": "https://github.com/examunity/bootstrap-rn.git",
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://github.com/examunity/bootstrap-rn/issues"
|
|
18
|
-
},
|
|
19
|
-
"main": "lib/module/index.js",
|
|
20
|
-
"module": "lib/module/index.js",
|
|
21
|
-
"source": "src/index.ts",
|
|
22
|
-
"types": "./lib/typescript/index.d.ts",
|
|
23
|
-
"scripts": {
|
|
24
|
-
"check-types": "tsc --noEmit",
|
|
25
|
-
"build": "bob build",
|
|
26
|
-
"prepare": "packsy validate && yarn build",
|
|
27
|
-
"lint": "packsy pre-commit && yarn check-types"
|
|
28
|
-
},
|
|
29
|
-
"files": [
|
|
30
|
-
"src",
|
|
31
|
-
"lib"
|
|
32
|
-
],
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"@floating-ui/react": "^0.27.16",
|
|
35
|
-
"@react-aria/focus": "^3.21.3",
|
|
36
|
-
"@rn-primitives/hooks": "^1.3.0",
|
|
37
|
-
"@rn-primitives/portal": "^1.3.0",
|
|
38
|
-
"css-to-react-native": "^3.2.0",
|
|
39
|
-
"tiny-invariant": "^1.3.1"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@types/react": "~19.1.10",
|
|
43
|
-
"@types/react-dom": "~19.1.10",
|
|
44
|
-
"packsy": "^0.2.5",
|
|
45
|
-
"react": "19.1.0",
|
|
46
|
-
"react-dom": "19.1.0",
|
|
47
|
-
"react-native": "0.81.5",
|
|
48
|
-
"react-native-builder-bob": "^0.40.17",
|
|
49
|
-
"react-native-safe-area-context": "~5.6.0",
|
|
50
|
-
"react-native-svg": "15.12.1",
|
|
51
|
-
"react-native-web": "^0.21.0",
|
|
52
|
-
"typescript": "~5.9.2"
|
|
53
|
-
},
|
|
54
|
-
"peerDependencies": {
|
|
55
|
-
"react": ">=19",
|
|
56
|
-
"react-dom": ">=19",
|
|
57
|
-
"react-native": ">=0.78",
|
|
58
|
-
"react-native-safe-area-context": ">=5",
|
|
59
|
-
"react-native-svg": ">=15",
|
|
60
|
-
"react-native-web": ">=0.20"
|
|
61
|
-
},
|
|
62
|
-
"peerDependenciesMeta": {
|
|
63
|
-
"react-dom": {
|
|
64
|
-
"optional": true
|
|
65
|
-
},
|
|
66
|
-
"react-native-web": {
|
|
67
|
-
"optional": true
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
"husky": {
|
|
71
|
-
"hooks": {
|
|
72
|
-
"pre-commit": "packsy pre-commit"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"react-native-builder-bob": {
|
|
76
|
-
"source": "src",
|
|
77
|
-
"output": "lib",
|
|
78
|
-
"targets": [
|
|
79
|
-
[
|
|
80
|
-
"module",
|
|
81
|
-
{
|
|
82
|
-
"esm": true
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
"typescript"
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
"engines": {
|
|
89
|
-
"node": ">= 16",
|
|
90
|
-
"npm": ">= 8"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "bootstrap-rn",
|
|
3
|
+
"version": "0.4.8",
|
|
4
|
+
"description": "Bootstrap RN provides Bootstrap components for React Native.",
|
|
5
|
+
"author": "Markus Wetzel <markuswetzel@gmx.net>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"react",
|
|
9
|
+
"native",
|
|
10
|
+
"react-native",
|
|
11
|
+
"bootstrap",
|
|
12
|
+
"ui",
|
|
13
|
+
"style"
|
|
14
|
+
],
|
|
15
|
+
"repository": "https://github.com/examunity/bootstrap-rn.git",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/examunity/bootstrap-rn/issues"
|
|
18
|
+
},
|
|
19
|
+
"main": "lib/module/index.js",
|
|
20
|
+
"module": "lib/module/index.js",
|
|
21
|
+
"source": "src/index.ts",
|
|
22
|
+
"types": "./lib/typescript/index.d.ts",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"check-types": "tsc --noEmit",
|
|
25
|
+
"build": "bob build",
|
|
26
|
+
"prepare": "packsy validate && yarn build",
|
|
27
|
+
"lint": "packsy pre-commit && yarn check-types"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"src",
|
|
31
|
+
"lib"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@floating-ui/react": "^0.27.16",
|
|
35
|
+
"@react-aria/focus": "^3.21.3",
|
|
36
|
+
"@rn-primitives/hooks": "^1.3.0",
|
|
37
|
+
"@rn-primitives/portal": "^1.3.0",
|
|
38
|
+
"css-to-react-native": "^3.2.0",
|
|
39
|
+
"tiny-invariant": "^1.3.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/react": "~19.1.10",
|
|
43
|
+
"@types/react-dom": "~19.1.10",
|
|
44
|
+
"packsy": "^0.2.5",
|
|
45
|
+
"react": "19.1.0",
|
|
46
|
+
"react-dom": "19.1.0",
|
|
47
|
+
"react-native": "0.81.5",
|
|
48
|
+
"react-native-builder-bob": "^0.40.17",
|
|
49
|
+
"react-native-safe-area-context": "~5.6.0",
|
|
50
|
+
"react-native-svg": "15.12.1",
|
|
51
|
+
"react-native-web": "^0.21.0",
|
|
52
|
+
"typescript": "~5.9.2"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"react": ">=19",
|
|
56
|
+
"react-dom": ">=19",
|
|
57
|
+
"react-native": ">=0.78",
|
|
58
|
+
"react-native-safe-area-context": ">=5",
|
|
59
|
+
"react-native-svg": ">=15",
|
|
60
|
+
"react-native-web": ">=0.20"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"react-dom": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"react-native-web": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"husky": {
|
|
71
|
+
"hooks": {
|
|
72
|
+
"pre-commit": "packsy pre-commit"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"react-native-builder-bob": {
|
|
76
|
+
"source": "src",
|
|
77
|
+
"output": "lib",
|
|
78
|
+
"targets": [
|
|
79
|
+
[
|
|
80
|
+
"module",
|
|
81
|
+
{
|
|
82
|
+
"esm": true
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"typescript"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": ">= 16",
|
|
90
|
+
"npm": ">= 8"
|
|
91
|
+
}
|
|
92
|
+
}
|
package/src/components/Body.tsx
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
-
import StyleSheet from '../style/StyleSheet';
|
|
4
|
-
import css from '../style/css';
|
|
5
|
-
import { getStyles } from '../utils';
|
|
6
|
-
import TextStyleContext from '../style/TextStyleContext';
|
|
7
|
-
import useMedia from '../hooks/useMedia';
|
|
8
|
-
import useStyle from '../hooks/useStyle';
|
|
9
|
-
import View, { ViewProps, ViewRef } from './View';
|
|
10
|
-
|
|
11
|
-
export interface BodyProps extends ViewProps {}
|
|
12
|
-
|
|
13
|
-
const styles = StyleSheet.create({
|
|
14
|
-
body: css`
|
|
15
|
-
background-color: $body-bg;
|
|
16
|
-
flex-grow: 1; // added for bootstrap-rn
|
|
17
|
-
flex-shrink: 1; // added for bootstrap-rn
|
|
18
|
-
`,
|
|
19
|
-
'body --text': css`
|
|
20
|
-
color: $body-color;
|
|
21
|
-
text-align: $body-text-align;
|
|
22
|
-
`,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const Body = React.forwardRef<ViewRef, BodyProps>((props, ref) => {
|
|
26
|
-
const { children, style, textStyle, styleName, ...elementProps } = props;
|
|
27
|
-
|
|
28
|
-
const classes = getStyles(styles, ['body']);
|
|
29
|
-
const textClasses = getStyles(styles, ['body --text']);
|
|
30
|
-
|
|
31
|
-
const media = useMedia();
|
|
32
|
-
|
|
33
|
-
const insets = useSafeAreaInsets();
|
|
34
|
-
|
|
35
|
-
const resolveStyle = useStyle(
|
|
36
|
-
[
|
|
37
|
-
classes,
|
|
38
|
-
{
|
|
39
|
-
marginTop: insets.top,
|
|
40
|
-
marginBottom: insets.bottom,
|
|
41
|
-
marginRight: insets.right,
|
|
42
|
-
marginLeft: insets.left,
|
|
43
|
-
},
|
|
44
|
-
style,
|
|
45
|
-
],
|
|
46
|
-
styleName,
|
|
47
|
-
);
|
|
48
|
-
const resolveTextStyle = useStyle([textClasses, textStyle]);
|
|
49
|
-
|
|
50
|
-
const contextValue = useMemo(
|
|
51
|
-
() => ({
|
|
52
|
-
style: resolveTextStyle({ media }),
|
|
53
|
-
}),
|
|
54
|
-
[resolveTextStyle, media],
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<View {...elementProps} ref={ref} style={resolveStyle({ media })}>
|
|
59
|
-
<TextStyleContext.Provider value={contextValue}>
|
|
60
|
-
{children}
|
|
61
|
-
</TextStyleContext.Provider>
|
|
62
|
-
</View>
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
Body.displayName = 'Body';
|
|
67
|
-
|
|
68
|
-
export default Body;
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
+
import StyleSheet from '../style/StyleSheet';
|
|
4
|
+
import css from '../style/css';
|
|
5
|
+
import { getStyles } from '../utils';
|
|
6
|
+
import TextStyleContext from '../style/TextStyleContext';
|
|
7
|
+
import useMedia from '../hooks/useMedia';
|
|
8
|
+
import useStyle from '../hooks/useStyle';
|
|
9
|
+
import View, { ViewProps, ViewRef } from './View';
|
|
10
|
+
|
|
11
|
+
export interface BodyProps extends ViewProps {}
|
|
12
|
+
|
|
13
|
+
const styles = StyleSheet.create({
|
|
14
|
+
body: css`
|
|
15
|
+
background-color: $body-bg;
|
|
16
|
+
flex-grow: 1; // added for bootstrap-rn
|
|
17
|
+
flex-shrink: 1; // added for bootstrap-rn
|
|
18
|
+
`,
|
|
19
|
+
'body --text': css`
|
|
20
|
+
color: $body-color;
|
|
21
|
+
text-align: $body-text-align;
|
|
22
|
+
`,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const Body = React.forwardRef<ViewRef, BodyProps>((props, ref) => {
|
|
26
|
+
const { children, style, textStyle, styleName, ...elementProps } = props;
|
|
27
|
+
|
|
28
|
+
const classes = getStyles(styles, ['body']);
|
|
29
|
+
const textClasses = getStyles(styles, ['body --text']);
|
|
30
|
+
|
|
31
|
+
const media = useMedia();
|
|
32
|
+
|
|
33
|
+
const insets = useSafeAreaInsets();
|
|
34
|
+
|
|
35
|
+
const resolveStyle = useStyle(
|
|
36
|
+
[
|
|
37
|
+
classes,
|
|
38
|
+
{
|
|
39
|
+
marginTop: insets.top,
|
|
40
|
+
marginBottom: insets.bottom,
|
|
41
|
+
marginRight: insets.right,
|
|
42
|
+
marginLeft: insets.left,
|
|
43
|
+
},
|
|
44
|
+
style,
|
|
45
|
+
],
|
|
46
|
+
styleName,
|
|
47
|
+
);
|
|
48
|
+
const resolveTextStyle = useStyle([textClasses, textStyle]);
|
|
49
|
+
|
|
50
|
+
const contextValue = useMemo(
|
|
51
|
+
() => ({
|
|
52
|
+
style: resolveTextStyle({ media }),
|
|
53
|
+
}),
|
|
54
|
+
[resolveTextStyle, media],
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<View {...elementProps} ref={ref} style={resolveStyle({ media })}>
|
|
59
|
+
<TextStyleContext.Provider value={contextValue}>
|
|
60
|
+
{children}
|
|
61
|
+
</TextStyleContext.Provider>
|
|
62
|
+
</View>
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
Body.displayName = 'Body';
|
|
67
|
+
|
|
68
|
+
export default Body;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLayoutEffect, useState } from 'react';
|
|
1
2
|
import { createPortal } from 'react-dom';
|
|
2
3
|
|
|
3
4
|
export interface PortalProps {
|
|
@@ -10,7 +11,26 @@ export interface PortalProps {
|
|
|
10
11
|
const DEFAULT_PORTAL_HOST = 'INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME';
|
|
11
12
|
|
|
12
13
|
function Portal({ hostName = DEFAULT_PORTAL_HOST, children }: PortalProps) {
|
|
13
|
-
const element =
|
|
14
|
+
const [element, setElement] = useState(() =>
|
|
15
|
+
document.getElementById(hostName),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// Retry lookup after mount, before paint, in case the host element
|
|
19
|
+
// was not yet committed to the DOM during the initial render.
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
if (!element) {
|
|
22
|
+
const host = document.getElementById(hostName);
|
|
23
|
+
|
|
24
|
+
if (host) {
|
|
25
|
+
setElement(host);
|
|
26
|
+
} else {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.warn(
|
|
29
|
+
`Portal: No host element found with id "${hostName}". Make sure <PortalHost /> is rendered in the component tree.`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [hostName]);
|
|
14
34
|
|
|
15
35
|
if (!element) {
|
|
16
36
|
return null;
|