bootstrap-rn 0.4.3 → 0.4.5
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/Body.js +4 -2
- package/lib/module/components/Body.js.map +1 -1
- package/lib/module/components/SafeAreaView.js +44 -0
- package/lib/module/components/SafeAreaView.js.map +1 -0
- package/lib/module/components/close/CloseButton.js +1 -1
- package/lib/module/components/close/CloseButton.js.map +1 -1
- package/lib/module/components/forms/internals/FormCheckInputNative.js +1 -1
- package/lib/module/components/forms/internals/FormCheckInputNative.js.map +1 -1
- package/lib/module/components/forms/internals/FormCheckInputWeb.js +4 -2
- package/lib/module/components/forms/internals/FormCheckInputWeb.js.map +1 -1
- package/lib/module/components/forms/internals/PickerNative.js +1 -1
- package/lib/module/components/forms/internals/PickerNative.js.map +1 -1
- package/lib/module/components/forms/internals/PickerWeb.js +5 -2
- package/lib/module/components/forms/internals/PickerWeb.js.map +1 -1
- package/lib/module/components/helpers/Overlay.js +2 -13
- package/lib/module/components/helpers/Overlay.js.map +1 -1
- package/lib/module/components/modal/Modal.js +5 -2
- package/lib/module/components/modal/Modal.js.map +1 -1
- package/lib/module/components/navbar/NavbarToggler.js +1 -1
- package/lib/module/components/navbar/NavbarToggler.js.map +1 -1
- package/lib/module/components/offcanvas/Offcanvas.js +65 -66
- package/lib/module/components/offcanvas/Offcanvas.js.map +1 -1
- package/lib/module/components/popover/PopoverArrow.js +28 -0
- package/lib/module/components/popover/PopoverArrow.js.map +1 -1
- package/lib/module/components/tooltip/TooltipArrow.js +16 -0
- package/lib/module/components/tooltip/TooltipArrow.js.map +1 -1
- package/lib/module/hooks/useBackground.js +4 -78
- package/lib/module/hooks/useBackground.js.map +1 -1
- package/lib/module/hooks/{useBackground.native.js → useBackgroundNative.js} +2 -2
- package/lib/module/hooks/useBackgroundNative.js.map +1 -0
- package/lib/module/hooks/useBackgroundWeb.js +81 -0
- package/lib/module/hooks/useBackgroundWeb.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/Body.d.ts +2 -2
- package/lib/typescript/components/Body.d.ts.map +1 -1
- package/lib/typescript/components/SafeAreaView.d.ts +13 -0
- package/lib/typescript/components/SafeAreaView.d.ts.map +1 -0
- package/lib/typescript/components/forms/internals/FormCheckInputWeb.d.ts.map +1 -1
- package/lib/typescript/components/forms/internals/PickerNative.d.ts.map +1 -1
- package/lib/typescript/components/forms/internals/PickerWeb.d.ts.map +1 -1
- package/lib/typescript/components/helpers/Overlay.d.ts.map +1 -1
- package/lib/typescript/components/modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/offcanvas/Offcanvas.d.ts.map +1 -1
- package/lib/typescript/components/popover/PopoverArrow.d.ts.map +1 -1
- package/lib/typescript/components/tooltip/TooltipArrow.d.ts.map +1 -1
- package/lib/typescript/hooks/useBackground.d.ts +4 -5
- package/lib/typescript/hooks/useBackground.d.ts.map +1 -1
- package/lib/typescript/hooks/{useBackground.native.d.ts → useBackgroundNative.d.ts} +2 -2
- package/lib/typescript/hooks/useBackgroundNative.d.ts.map +1 -0
- package/lib/typescript/hooks/useBackgroundWeb.d.ts +6 -0
- package/lib/typescript/hooks/useBackgroundWeb.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +87 -85
- package/src/components/Body.tsx +68 -58
- package/src/components/SafeAreaView.tsx +71 -0
- package/src/components/forms/internals/FormCheckInputWeb.tsx +79 -78
- package/src/components/forms/internals/PickerNative.tsx +3 -2
- package/src/components/forms/internals/PickerWeb.tsx +85 -78
- package/src/components/helpers/Overlay.tsx +2 -13
- package/src/components/modal/Modal.tsx +241 -234
- package/src/components/offcanvas/Offcanvas.tsx +247 -245
- package/src/components/popover/PopoverArrow.tsx +192 -164
- package/src/components/tooltip/TooltipArrow.tsx +118 -102
- package/src/hooks/useBackground.tsx +4 -122
- package/src/hooks/{useBackground.native.tsx → useBackgroundNative.tsx} +1 -1
- package/src/hooks/useBackgroundWeb.tsx +123 -0
- package/src/index.ts +3 -0
- package/src/style/transform/index.ts +245 -245
- package/src/theme/variables.ts +1420 -1420
- package/lib/module/hooks/useBackground.native.js.map +0 -1
- package/lib/typescript/hooks/useBackground.native.d.ts.map +0 -1
|
@@ -1,78 +1,85 @@
|
|
|
1
|
-
import React, { useMemo, forwardRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
// @ts-expect-error web only import
|
|
4
|
-
Picker as BasePicker,
|
|
5
|
-
StyleSheet as StyleUtils,
|
|
6
|
-
TextStyle,
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
import useBackground from '../../../hooks/useBackground';
|
|
9
|
-
import PickerWebContext from './PickerWebContext';
|
|
10
|
-
import type { PickerProps } from '../Picker';
|
|
11
|
-
import type { PressableRef } from '../../Pressable';
|
|
12
|
-
|
|
13
|
-
interface PickerWebProps extends PickerProps {
|
|
14
|
-
style: TextStyle[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const PLACEHOLDER = '__PLACEHOLDER__';
|
|
18
|
-
|
|
19
|
-
const getOptionStyle = (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
1
|
+
import React, { useMemo, forwardRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
// @ts-expect-error web only import
|
|
4
|
+
Picker as BasePicker,
|
|
5
|
+
StyleSheet as StyleUtils,
|
|
6
|
+
TextStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import useBackground from '../../../hooks/useBackground';
|
|
9
|
+
import PickerWebContext from './PickerWebContext';
|
|
10
|
+
import type { PickerProps } from '../Picker';
|
|
11
|
+
import type { PressableRef } from '../../Pressable';
|
|
12
|
+
|
|
13
|
+
interface PickerWebProps extends PickerProps {
|
|
14
|
+
style: TextStyle[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const PLACEHOLDER = '__PLACEHOLDER__';
|
|
18
|
+
|
|
19
|
+
const getOptionStyle = (
|
|
20
|
+
style: ReturnType<typeof useBackground>['style'],
|
|
21
|
+
showPlaceholder: boolean,
|
|
22
|
+
) => {
|
|
23
|
+
if (!showPlaceholder) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const flattenedStyle = StyleUtils.flatten(style);
|
|
28
|
+
|
|
29
|
+
if ('color' in flattenedStyle && flattenedStyle.color !== undefined) {
|
|
30
|
+
return flattenedStyle.color;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const PickerWeb = forwardRef<PressableRef, PickerWebProps>((props, ref) => {
|
|
37
|
+
const {
|
|
38
|
+
children,
|
|
39
|
+
selectedValue,
|
|
40
|
+
onValueChange = () => {},
|
|
41
|
+
onFocus = () => {},
|
|
42
|
+
onBlur = () => {},
|
|
43
|
+
placeholder,
|
|
44
|
+
placeholderTextColor,
|
|
45
|
+
disabled,
|
|
46
|
+
style,
|
|
47
|
+
...elementProps
|
|
48
|
+
} = props;
|
|
49
|
+
|
|
50
|
+
const background = useBackground(style);
|
|
51
|
+
|
|
52
|
+
const showPlaceholder = selectedValue === undefined || selectedValue === null;
|
|
53
|
+
|
|
54
|
+
const contextValue = useMemo(
|
|
55
|
+
() => ({
|
|
56
|
+
optionColor: getOptionStyle(background.style, showPlaceholder),
|
|
57
|
+
}),
|
|
58
|
+
[background, showPlaceholder],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<BasePicker
|
|
63
|
+
{...elementProps}
|
|
64
|
+
ref={ref}
|
|
65
|
+
selectedValue={showPlaceholder ? PLACEHOLDER : selectedValue}
|
|
66
|
+
onValueChange={onValueChange}
|
|
67
|
+
onFocus={onFocus}
|
|
68
|
+
onBlur={onBlur}
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
style={[
|
|
71
|
+
background.style,
|
|
72
|
+
showPlaceholder && { color: placeholderTextColor },
|
|
73
|
+
]}
|
|
74
|
+
>
|
|
75
|
+
<option value={PLACEHOLDER} disabled hidden>
|
|
76
|
+
{placeholder}
|
|
77
|
+
</option>
|
|
78
|
+
<PickerWebContext.Provider value={contextValue}>
|
|
79
|
+
{children}
|
|
80
|
+
</PickerWebContext.Provider>
|
|
81
|
+
</BasePicker>
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export default PickerWeb;
|
|
@@ -61,17 +61,7 @@ function Overlay({
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
//
|
|
65
|
-
if (Platform.OS === 'android' && StatusBar.currentHeight) {
|
|
66
|
-
if (typeof overlay.overlayProps.style.top === 'number') {
|
|
67
|
-
overlay.overlayProps.style.top -= StatusBar.currentHeight;
|
|
68
|
-
}
|
|
69
|
-
if (typeof overlay.arrowProps.style.top === 'number') {
|
|
70
|
-
overlay.arrowProps.style.top -= StatusBar.currentHeight;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Workaround for different calculation of height in Android 15
|
|
64
|
+
// Android 15 (edge-to-edge support) adjustments
|
|
75
65
|
// https://github.com/facebook/react-native/issues/47080
|
|
76
66
|
if (
|
|
77
67
|
Platform.OS === 'android' &&
|
|
@@ -79,8 +69,7 @@ function Overlay({
|
|
|
79
69
|
StatusBar.currentHeight
|
|
80
70
|
) {
|
|
81
71
|
if (typeof overlay.overlayProps.style.bottom === 'number') {
|
|
82
|
-
|
|
83
|
-
overlay.overlayProps.style.bottom -= StatusBar.currentHeight + 22;
|
|
72
|
+
overlay.overlayProps.style.bottom -= StatusBar.currentHeight;
|
|
84
73
|
}
|
|
85
74
|
}
|
|
86
75
|
|