@draftbit/core 46.5.2-b02f9e.2 → 46.6.0
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/commonjs/components/Accordion/AccordionItem.js +23 -4
- package/lib/commonjs/components/AspectRatio.js +1 -17
- package/lib/commonjs/components/Banner.js +23 -4
- package/lib/commonjs/components/Button.js +36 -13
- package/lib/commonjs/components/CardBlock.js +4 -13
- package/lib/commonjs/components/CardContainer.js +13 -4
- package/lib/commonjs/components/CardContainerShortImage.js +15 -4
- package/lib/commonjs/components/Checkbox/Checkbox.js +1 -3
- package/lib/commonjs/components/Checkbox/CheckboxGroup.js +17 -2
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
- package/lib/commonjs/components/Container.js +15 -4
- package/lib/commonjs/components/DatePicker/DatePicker.js +13 -9
- package/lib/commonjs/components/DeprecatedButton.js +3 -27
- package/lib/commonjs/components/DeprecatedCardWrapper.js +15 -1
- package/lib/commonjs/components/DeprecatedFAB.js +3 -22
- package/lib/commonjs/components/Elevation.js +14 -2
- package/lib/commonjs/components/FAB.js +18 -4
- package/lib/commonjs/components/FieldSearchBarFull.js +1 -2
- package/lib/commonjs/components/Image.js +17 -2
- package/lib/commonjs/components/Layout.js +40 -19
- package/lib/commonjs/components/Picker/Picker.js +9 -4
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +36 -11
- package/lib/commonjs/components/Picker/PickerComponent.web.js +20 -3
- package/lib/commonjs/components/Portal/PortalConsumer.js +7 -22
- package/lib/commonjs/components/Portal/PortalManager.js +34 -8
- package/lib/commonjs/components/Pressable.js +50 -0
- package/lib/commonjs/components/ProgressBar.js +37 -7
- package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +9 -1
- package/lib/commonjs/components/ScreenContainer.js +20 -4
- package/lib/commonjs/components/Surface.js +14 -2
- package/lib/commonjs/components/Swiper/Swiper.js +2 -0
- package/lib/commonjs/components/Switch.js +19 -10
- package/lib/commonjs/components/TextField.js +76 -28
- package/lib/commonjs/components/ToggleButton.js +15 -2
- package/lib/commonjs/components/Touchable.js +23 -5
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/mappings/Button.js +39 -10
- package/lib/commonjs/mappings/FlashList.js +45 -2
- package/lib/commonjs/mappings/FlatList.js +12 -0
- package/lib/commonjs/mappings/Swiper.js +2 -0
- package/lib/commonjs/mappings/Touchable.js +47 -7
- package/lib/commonjs/styles/overlay.js +3 -1
- package/lib/module/components/AvatarEdit.js +15 -4
- package/lib/module/components/Button.js +36 -13
- package/lib/module/components/Carousel.js +32 -8
- package/lib/module/components/Checkbox/Checkbox.js +26 -6
- package/lib/module/components/Checkbox/CheckboxGroup.js +16 -2
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +25 -7
- package/lib/module/components/Checkbox/CheckboxRow.js +2 -3
- package/lib/module/components/CircularProgress.js +28 -8
- package/lib/module/components/DatePicker/DatePicker.js +27 -13
- package/lib/module/components/DeprecatedButton.js +24 -30
- package/lib/module/components/DeprecatedFAB.js +2 -3
- package/lib/module/components/Elevation.js +14 -2
- package/lib/module/components/FieldSearchBarFull.js +1 -2
- package/lib/module/components/Image.js +18 -2
- package/lib/module/components/Layout.js +42 -21
- package/lib/module/components/NumberInput.js +12 -3
- package/lib/module/components/Picker/Picker.js +10 -4
- package/lib/module/components/Picker/PickerComponent.ios.js +36 -11
- package/lib/module/components/Picker/PickerComponent.web.js +21 -3
- package/lib/module/components/Portal/PortalConsumer.js +22 -7
- package/lib/module/components/Pressable.js +30 -0
- package/lib/module/components/RadioButton/RadioButtonRow.js +24 -5
- package/lib/module/components/ScreenContainer.js +21 -4
- package/lib/module/components/Swiper/Swiper.js +2 -0
- package/lib/module/components/Switch.js +21 -10
- package/lib/module/components/Text.js +50 -4
- package/lib/module/components/TextField.js +78 -28
- package/lib/module/components/Touchable.js +8 -3
- package/lib/module/constants.js +1 -2
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/Button.js +40 -11
- package/lib/module/mappings/FieldSearchBarFull.js +4 -1
- package/lib/module/mappings/FlashList.js +46 -3
- package/lib/module/mappings/FlatList.js +13 -1
- package/lib/module/mappings/StarRating.js +7 -2
- package/lib/module/mappings/Swiper.js +3 -1
- package/lib/module/mappings/Touchable.js +49 -9
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedButton.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
- package/lib/typescript/src/components/Pressable.d.ts +10 -0
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
- package/lib/typescript/src/components/Swiper/Swiper.d.ts +2 -1
- package/lib/typescript/src/components/Swiper/Swiper.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +5 -6
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Button.d.ts +113 -4
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/FlashList.d.ts +112 -2
- package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/FlatList.d.ts +42 -0
- package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Swiper.d.ts +11 -0
- package/lib/typescript/src/mappings/Swiper.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Touchable.d.ts +59 -5
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/styles/overlay.d.ts +1 -1
- package/lib/typescript/src/styles/overlay.d.ts.map +1 -1
- package/lib/typescript/src/styles/shadow.d.ts +2 -2
- package/package.json +7 -7
- package/src/components/Button.js +3 -3
- package/src/components/Button.tsx +14 -4
- package/src/components/Checkbox/Checkbox.js +2 -3
- package/src/components/Checkbox/Checkbox.tsx +5 -7
- package/src/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
- package/src/components/Checkbox/CheckboxRow.js +2 -3
- package/src/components/Checkbox/CheckboxRow.tsx +3 -3
- package/src/components/DeprecatedButton.js +4 -16
- package/src/components/DeprecatedButton.tsx +7 -31
- package/src/components/DeprecatedFAB.js +2 -3
- package/src/components/DeprecatedFAB.tsx +5 -5
- package/src/components/Pressable.js +12 -0
- package/src/components/Pressable.tsx +44 -0
- package/src/components/Swiper/Swiper.js +2 -2
- package/src/components/Swiper/Swiper.tsx +3 -0
- package/src/components/Touchable.js +3 -3
- package/src/components/Touchable.tsx +11 -7
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/Button.js +39 -10
- package/src/mappings/Button.ts +41 -10
- package/src/mappings/FlashList.js +77 -31
- package/src/mappings/FlashList.ts +82 -30
- package/src/mappings/FlatList.js +13 -1
- package/src/mappings/FlatList.ts +16 -0
- package/src/mappings/Swiper.js +3 -1
- package/src/mappings/Swiper.ts +4 -0
- package/src/mappings/Touchable.js +50 -7
- package/src/mappings/Touchable.ts +53 -6
- package/src/styles/overlay.tsx +2 -2
|
@@ -9,12 +9,12 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _color = _interopRequireDefault(require("color"));
|
|
10
10
|
var _Config = _interopRequireDefault(require("./Config"));
|
|
11
11
|
var _Text = _interopRequireDefault(require("./Text"));
|
|
12
|
-
var _Touchable = _interopRequireDefault(require("./Touchable"));
|
|
13
12
|
var _Elevation = _interopRequireDefault(require("./Elevation"));
|
|
14
13
|
var _theming = require("../theming");
|
|
15
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
18
|
const FAB = _ref => {
|
|
19
19
|
let {
|
|
20
20
|
Icon,
|
|
@@ -106,8 +106,7 @@ const FAB = _ref => {
|
|
|
106
106
|
style: [{
|
|
107
107
|
elevation
|
|
108
108
|
}, style]
|
|
109
|
-
}, /*#__PURE__*/React.createElement(
|
|
110
|
-
...rest,
|
|
109
|
+
}, /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({}, rest, {
|
|
111
110
|
onPress: onPress,
|
|
112
111
|
accessibilityState: {
|
|
113
112
|
disabled
|
|
@@ -115,7 +114,7 @@ const FAB = _ref => {
|
|
|
115
114
|
accessibilityRole: "button",
|
|
116
115
|
disabled: disabled || loading,
|
|
117
116
|
style: buttonStyles
|
|
118
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
117
|
+
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
119
118
|
style: styles.content
|
|
120
119
|
}, icon && loading !== true ? /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
121
120
|
style: iconStyle
|
|
@@ -155,22 +154,4 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
155
154
|
}
|
|
156
155
|
});
|
|
157
156
|
var _default = (0, _theming.withTheme)(FAB);
|
|
158
|
-
exports.default = _default;ow",
|
|
159
|
-
alignItems: "center",
|
|
160
|
-
justifyContent: "center"
|
|
161
|
-
},
|
|
162
|
-
icon: {
|
|
163
|
-
alignItems: "center",
|
|
164
|
-
justifyContent: "center",
|
|
165
|
-
width: _Config.default.buttonIconSize
|
|
166
|
-
},
|
|
167
|
-
fixed: {
|
|
168
|
-
left: 0,
|
|
169
|
-
right: 0,
|
|
170
|
-
bottom: 0,
|
|
171
|
-
height: 64,
|
|
172
|
-
borderRadius: 0
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
var _default = (0, _theming.withTheme)(FAB);
|
|
176
157
|
exports.default = _default;
|
|
@@ -11,7 +11,6 @@ var _theming = require("../theming");
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
14
|
/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
|
|
16
15
|
const Elevation = _ref => {
|
|
17
16
|
let {
|
|
@@ -28,11 +27,24 @@ const Elevation = _ref => {
|
|
|
28
27
|
colors
|
|
29
28
|
} = theme;
|
|
30
29
|
const borderRadius = radius;
|
|
31
|
-
return /*#__PURE__*/React.createElement(_reactNative.Animated.View,
|
|
30
|
+
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
|
|
31
|
+
...rest,
|
|
32
32
|
style: [{
|
|
33
33
|
borderRadius,
|
|
34
34
|
backgroundColor: colors.surface
|
|
35
35
|
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
36
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
37
|
+
style: {
|
|
38
|
+
overflow: "hidden",
|
|
39
|
+
borderRadius
|
|
40
|
+
}
|
|
41
|
+
}, children));
|
|
42
|
+
};
|
|
43
|
+
var _default = (0, _theming.withTheme)(Elevation);
|
|
44
|
+
exports.default = _default;
|
|
45
|
+
borderRadius,
|
|
46
|
+
backgroundColor: colors.surface
|
|
47
|
+
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
36
48
|
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
37
49
|
style: {
|
|
38
50
|
overflow: "hidden",
|
|
@@ -9,7 +9,6 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _theming = require("../theming");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
12
|
const FAB = _ref => {
|
|
14
13
|
let {
|
|
15
14
|
onPress,
|
|
@@ -33,7 +32,7 @@ const FAB = _ref => {
|
|
|
33
32
|
borderRadius: size / 2,
|
|
34
33
|
overflow: "hidden"
|
|
35
34
|
}, style]
|
|
36
|
-
}, /*#__PURE__*/React.createElement(_reactNative.Pressable,
|
|
35
|
+
}, /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
37
36
|
onPress: onPress,
|
|
38
37
|
disabled: loading || disabled,
|
|
39
38
|
android_ripple: {
|
|
@@ -51,8 +50,9 @@ const FAB = _ref => {
|
|
|
51
50
|
borderRadius: size / 2,
|
|
52
51
|
backgroundColor
|
|
53
52
|
}];
|
|
54
|
-
}
|
|
55
|
-
|
|
53
|
+
},
|
|
54
|
+
...props
|
|
55
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, null, loading ? /*#__PURE__*/React.createElement(_reactNative.ActivityIndicator, {
|
|
56
56
|
style: size > 50 ? {
|
|
57
57
|
marginTop: 2,
|
|
58
58
|
marginLeft: 2
|
|
@@ -79,4 +79,18 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
var _default = (0, _theming.withTheme)(FAB);
|
|
82
|
+
exports.default = _default; styles = _reactNative.StyleSheet.create({
|
|
83
|
+
button: {
|
|
84
|
+
backgroundColor: "#5a45ff",
|
|
85
|
+
justifyContent: "center",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
..._reactNative.Platform.select({
|
|
88
|
+
web: {
|
|
89
|
+
cursor: "pointer",
|
|
90
|
+
userSelect: "none"
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
var _default = (0, _theming.withTheme)(FAB);
|
|
82
96
|
exports.default = _default;
|
|
@@ -55,7 +55,6 @@ const FieldSearchBarFull = _ref => {
|
|
|
55
55
|
lineHeight,
|
|
56
56
|
...typeStyles
|
|
57
57
|
} = typography.body2; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
58
|
-
|
|
59
58
|
const handleChangeText = newValue => {
|
|
60
59
|
setInternalValue(newValue);
|
|
61
60
|
if (onChange) {
|
|
@@ -94,4 +93,4 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
94
93
|
}
|
|
95
94
|
});
|
|
96
95
|
var _default = (0, _theming.withTheme)(FieldSearchBarFull);
|
|
97
|
-
exports.default = _default
|
|
96
|
+
exports.default = _default;;
|
|
@@ -9,7 +9,8 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _Config = _interopRequireDefault(require("./Config"));
|
|
10
10
|
var _AspectRatio = _interopRequireDefault(require("./AspectRatio"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
12
|
+
/* README: Internal Image component used for stuff like Card. DO NOT EXPORT! */
|
|
13
|
+
|
|
13
14
|
const generateDimensions = _ref => {
|
|
14
15
|
let {
|
|
15
16
|
aspectRatio,
|
|
@@ -62,13 +63,27 @@ const Image = _ref2 => {
|
|
|
62
63
|
height,
|
|
63
64
|
aspectRatio
|
|
64
65
|
}]
|
|
65
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image,
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
67
|
+
...props,
|
|
66
68
|
source: imageSource,
|
|
67
69
|
resizeMode: resizeMode,
|
|
68
70
|
style: [style, {
|
|
69
71
|
height: "100%",
|
|
70
72
|
width: "100%"
|
|
71
73
|
}]
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
77
|
+
...props,
|
|
78
|
+
source: source,
|
|
79
|
+
resizeMode: resizeMode,
|
|
80
|
+
style: style
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
var _default = Image;
|
|
84
|
+
exports.default = _default; "100%",
|
|
85
|
+
width: "100%"
|
|
86
|
+
}]
|
|
72
87
|
})));
|
|
73
88
|
}
|
|
74
89
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Image, _extends({}, props, {
|
|
@@ -13,7 +13,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _reactNative = require("react-native");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
16
|
function Center(_ref) {
|
|
18
17
|
let {
|
|
19
18
|
width = 240,
|
|
@@ -23,15 +22,16 @@ function Center(_ref) {
|
|
|
23
22
|
style,
|
|
24
23
|
...rest
|
|
25
24
|
} = _ref;
|
|
26
|
-
return /*#__PURE__*/React.createElement(_reactNative.View,
|
|
25
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
27
26
|
style: [{
|
|
28
27
|
justifyContent: "center",
|
|
29
28
|
alignItems: "center",
|
|
30
29
|
width,
|
|
31
30
|
height,
|
|
32
31
|
backgroundColor: bgColor
|
|
33
|
-
}, style]
|
|
34
|
-
|
|
32
|
+
}, style],
|
|
33
|
+
...rest
|
|
34
|
+
}, children);
|
|
35
35
|
}
|
|
36
36
|
function Circle(_ref2) {
|
|
37
37
|
let {
|
|
@@ -42,7 +42,7 @@ function Circle(_ref2) {
|
|
|
42
42
|
...rest
|
|
43
43
|
} = _ref2;
|
|
44
44
|
const borderRadius = 1000;
|
|
45
|
-
return /*#__PURE__*/React.createElement(Center,
|
|
45
|
+
return /*#__PURE__*/React.createElement(Center, {
|
|
46
46
|
width: size,
|
|
47
47
|
height: size,
|
|
48
48
|
bgColor: bgColor,
|
|
@@ -50,8 +50,9 @@ function Circle(_ref2) {
|
|
|
50
50
|
backgroundColor: bgColor,
|
|
51
51
|
borderRadius,
|
|
52
52
|
overflow: "hidden"
|
|
53
|
-
}]
|
|
54
|
-
|
|
53
|
+
}],
|
|
54
|
+
...rest
|
|
55
|
+
}, children);
|
|
55
56
|
}
|
|
56
57
|
function Square(_ref3) {
|
|
57
58
|
let {
|
|
@@ -61,12 +62,13 @@ function Square(_ref3) {
|
|
|
61
62
|
style,
|
|
62
63
|
...rest
|
|
63
64
|
} = _ref3;
|
|
64
|
-
return /*#__PURE__*/React.createElement(Center,
|
|
65
|
+
return /*#__PURE__*/React.createElement(Center, {
|
|
65
66
|
style: style,
|
|
66
67
|
width: size,
|
|
67
68
|
height: size,
|
|
68
|
-
bgColor: bgColor
|
|
69
|
-
|
|
69
|
+
bgColor: bgColor,
|
|
70
|
+
...rest
|
|
71
|
+
}, children);
|
|
70
72
|
}
|
|
71
73
|
function Row(_ref4) {
|
|
72
74
|
let {
|
|
@@ -76,15 +78,14 @@ function Row(_ref4) {
|
|
|
76
78
|
style,
|
|
77
79
|
...rest
|
|
78
80
|
} = _ref4;
|
|
79
|
-
return /*#__PURE__*/React.createElement(_reactNative.View,
|
|
80
|
-
style: [style,
|
|
81
|
-
// style goes first b/c we can't override these
|
|
82
|
-
{
|
|
81
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
82
|
+
style: [style, {
|
|
83
83
|
alignItems,
|
|
84
84
|
flexDirection: "row",
|
|
85
85
|
justifyContent: justifyContent
|
|
86
|
-
}]
|
|
87
|
-
|
|
86
|
+
}],
|
|
87
|
+
...rest
|
|
88
|
+
}, children);
|
|
88
89
|
}
|
|
89
90
|
function Spacer(_ref5) {
|
|
90
91
|
let {
|
|
@@ -96,16 +97,36 @@ function Spacer(_ref5) {
|
|
|
96
97
|
style,
|
|
97
98
|
...rest
|
|
98
99
|
} = _ref5;
|
|
99
|
-
return /*#__PURE__*/React.createElement(_reactNative.View,
|
|
100
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
100
101
|
style: [style, {
|
|
101
102
|
paddingRight: right,
|
|
102
103
|
paddingTop: top,
|
|
103
104
|
paddingLeft: left,
|
|
104
105
|
paddingBottom: bottom
|
|
105
|
-
}]
|
|
106
|
-
|
|
106
|
+
}],
|
|
107
|
+
...rest
|
|
108
|
+
}, children);
|
|
107
109
|
}
|
|
108
110
|
function Stack(_ref6) {
|
|
111
|
+
let {
|
|
112
|
+
children,
|
|
113
|
+
justifyContent = "flex-start",
|
|
114
|
+
alignItems = "flex-start",
|
|
115
|
+
style,
|
|
116
|
+
...rest
|
|
117
|
+
} = _ref6;
|
|
118
|
+
return (
|
|
119
|
+
/*#__PURE__*/
|
|
120
|
+
// style must go first since we don't want justifyContent, alignItems overridden
|
|
121
|
+
React.createElement(_reactNative.View, {
|
|
122
|
+
style: [style, {
|
|
123
|
+
justifyContent,
|
|
124
|
+
alignItems
|
|
125
|
+
}],
|
|
126
|
+
...rest
|
|
127
|
+
}, children)
|
|
128
|
+
);
|
|
129
|
+
}Stack(_ref6) {
|
|
109
130
|
let {
|
|
110
131
|
children,
|
|
111
132
|
justifyContent = "flex-start",
|
|
@@ -46,7 +46,6 @@ const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
|
46
46
|
const disabledColor = "rgb(240, 240, 240)";
|
|
47
47
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
48
48
|
const Picker = _ref => {
|
|
49
|
-
var _find$label, _find;
|
|
50
49
|
let {
|
|
51
50
|
error,
|
|
52
51
|
options = [],
|
|
@@ -68,6 +67,7 @@ const Picker = _ref => {
|
|
|
68
67
|
rightIconName,
|
|
69
68
|
type = "solid"
|
|
70
69
|
} = _ref;
|
|
70
|
+
var _a, _b;
|
|
71
71
|
const androidPickerRef = React.useRef(undefined);
|
|
72
72
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
73
73
|
const [pickerVisible, setPickerVisible] = React.useState(false);
|
|
@@ -85,9 +85,9 @@ const Picker = _ref => {
|
|
|
85
85
|
}
|
|
86
86
|
}, [defaultValue]);
|
|
87
87
|
React.useEffect(() => {
|
|
88
|
+
var _a;
|
|
88
89
|
if (pickerVisible && androidPickerRef.current) {
|
|
89
|
-
|
|
90
|
-
androidPickerRef === null || androidPickerRef === void 0 ? void 0 : (_androidPickerRef$cur = androidPickerRef.current) === null || _androidPickerRef$cur === void 0 ? void 0 : _androidPickerRef$cur.focus();
|
|
90
|
+
(_a = androidPickerRef === null || androidPickerRef === void 0 ? void 0 : androidPickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
91
91
|
}
|
|
92
92
|
}, [pickerVisible, androidPickerRef]);
|
|
93
93
|
const normalizedOptions = normalizeOptions(options);
|
|
@@ -137,7 +137,7 @@ const Picker = _ref => {
|
|
|
137
137
|
...extractedMarginStyles
|
|
138
138
|
};
|
|
139
139
|
const stylesWithoutBordersAndMargins = (0, _lodash.omit)(viewStyles, [..._utilities.borderStyleNames, ..._utilities.marginStyleNames, ...additionalBorderStyles, ...additionalMarginStyles]);
|
|
140
|
-
const selectedLabel = internalValue && ((
|
|
140
|
+
const selectedLabel = internalValue && ((_b = (_a = pickerOptions.find(option => option.value === internalValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : internalValue);
|
|
141
141
|
const labelText = label ? /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
142
142
|
style: {
|
|
143
143
|
textAlign: textStyles.textAlign,
|
|
@@ -324,4 +324,9 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
324
324
|
}
|
|
325
325
|
});
|
|
326
326
|
var _default = (0, _theming.withTheme)(Picker);
|
|
327
|
+
exports.default = _default;: deviceWidth,
|
|
328
|
+
maxHeight: deviceHeight
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
var _default = (0, _theming.withTheme)(Picker);
|
|
327
332
|
exports.default = _default;
|
|
@@ -18,9 +18,7 @@ var _utilities = require("../../utilities");
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
22
21
|
const Picker = _ref => {
|
|
23
|
-
var _options$find$label, _options$find;
|
|
24
22
|
let {
|
|
25
23
|
Icon,
|
|
26
24
|
style,
|
|
@@ -34,6 +32,7 @@ const Picker = _ref => {
|
|
|
34
32
|
},
|
|
35
33
|
...props
|
|
36
34
|
} = _ref;
|
|
35
|
+
var _a, _b;
|
|
37
36
|
const {
|
|
38
37
|
viewStyles: {
|
|
39
38
|
borderRadius,
|
|
@@ -74,26 +73,24 @@ const Picker = _ref => {
|
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
77
|
-
const selectedLabel = selectedValue && ((
|
|
76
|
+
const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
|
|
78
77
|
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
79
78
|
style: [styles.container, viewStyles]
|
|
80
79
|
}, /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
81
80
|
disabled: disabled,
|
|
82
81
|
onPress: toggleVisibility
|
|
83
|
-
}, /*#__PURE__*/React.createElement(_TextField.default,
|
|
82
|
+
}, /*#__PURE__*/React.createElement(_TextField.default, {
|
|
83
|
+
...props,
|
|
84
84
|
value: String(selectedLabel),
|
|
85
|
-
placeholder: placeholder
|
|
85
|
+
placeholder: placeholder,
|
|
86
86
|
// @ts-ignore
|
|
87
|
-
,
|
|
88
|
-
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
89
|
-
,
|
|
87
|
+
ref: textField,
|
|
90
88
|
disabled: disabled,
|
|
91
|
-
pointerEvents: "none"
|
|
89
|
+
pointerEvents: "none",
|
|
92
90
|
// @ts-expect-error
|
|
93
|
-
,
|
|
94
91
|
style: stylesWithoutMargin,
|
|
95
92
|
Icon: Icon
|
|
96
|
-
}))
|
|
93
|
+
})), pickerVisible && /*#__PURE__*/React.createElement(_Portal.default, null, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
97
94
|
style: [styles.picker, {
|
|
98
95
|
backgroundColor: colors.divider
|
|
99
96
|
}]
|
|
@@ -138,4 +135,32 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
138
135
|
}
|
|
139
136
|
});
|
|
140
137
|
var _default = (0, _theming.withTheme)(Picker);
|
|
138
|
+
exports.default = _default;ateElement(_picker.Picker.Item, {
|
|
139
|
+
label: o.label,
|
|
140
|
+
value: o.value,
|
|
141
|
+
key: o.value
|
|
142
|
+
})))))));
|
|
143
|
+
};
|
|
144
|
+
const styles = _reactNative.StyleSheet.create({
|
|
145
|
+
container: {
|
|
146
|
+
alignSelf: "stretch"
|
|
147
|
+
},
|
|
148
|
+
picker: {
|
|
149
|
+
position: "absolute",
|
|
150
|
+
bottom: 0,
|
|
151
|
+
left: 0,
|
|
152
|
+
right: 0,
|
|
153
|
+
flexDirection: "row",
|
|
154
|
+
justifyContent: "center"
|
|
155
|
+
},
|
|
156
|
+
pickerContainer: {
|
|
157
|
+
backgroundColor: "white",
|
|
158
|
+
flexDirection: "column",
|
|
159
|
+
width: "100%"
|
|
160
|
+
},
|
|
161
|
+
closeButton: {
|
|
162
|
+
alignSelf: "flex-end"
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
var _default = (0, _theming.withTheme)(Picker);
|
|
141
166
|
exports.default = _default;
|
|
@@ -15,9 +15,7 @@ var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
18
|
const Picker = _ref => {
|
|
20
|
-
var _options$find$label, _options$find;
|
|
21
19
|
let {
|
|
22
20
|
style,
|
|
23
21
|
options,
|
|
@@ -27,6 +25,7 @@ const Picker = _ref => {
|
|
|
27
25
|
onValueChange: onValueChangeOverride = () => {},
|
|
28
26
|
...props
|
|
29
27
|
} = _ref;
|
|
28
|
+
var _a, _b;
|
|
30
29
|
const {
|
|
31
30
|
viewStyles: {
|
|
32
31
|
borderRadius,
|
|
@@ -71,7 +70,7 @@ const Picker = _ref => {
|
|
|
71
70
|
};
|
|
72
71
|
|
|
73
72
|
const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
74
|
-
const selectedLabel = selectedValue && ((
|
|
73
|
+
const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
|
|
75
74
|
return /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
76
75
|
disabled: disabled,
|
|
77
76
|
onPress: toggleFocus,
|
|
@@ -96,6 +95,24 @@ const Picker = _ref => {
|
|
|
96
95
|
key: o.value
|
|
97
96
|
}))), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
98
97
|
pointerEvents: "none"
|
|
98
|
+
}, /*#__PURE__*/React.createElement(_TextField.default, {
|
|
99
|
+
...props,
|
|
100
|
+
value: selectedLabel,
|
|
101
|
+
placeholder: placeholder,
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
ref: textField,
|
|
104
|
+
disabled: disabled,
|
|
105
|
+
// @ts-expect-error
|
|
106
|
+
style: stylesWithoutMargin
|
|
107
|
+
}))));
|
|
108
|
+
};
|
|
109
|
+
const styles = _reactNative.StyleSheet.create({
|
|
110
|
+
container: {
|
|
111
|
+
alignSelf: "stretch"
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
var _default = (0, _theming.withTheme)(Picker);
|
|
115
|
+
exports.default = _default;pointerEvents: "none"
|
|
99
116
|
}, /*#__PURE__*/React.createElement(_TextField.default, _extends({}, props, {
|
|
100
117
|
value: selectedLabel,
|
|
101
118
|
placeholder: placeholder
|
|
@@ -7,31 +7,16 @@ exports.default = void 0;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
13
|
class PortalConsumer extends React.Component {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
await Promise.resolve();
|
|
15
|
-
this.key = this.props.manager.mount(this.props.children);
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
_defineProperty(this, "key", void 0);
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
this.checkManager();
|
|
19
|
-
this.props.manager.update(this.key, this.props.children);
|
|
20
|
-
}
|
|
21
|
-
componentWillUnmount() {
|
|
18
|
+
async componentDidMount() {
|
|
22
19
|
this.checkManager();
|
|
23
|
-
this.props.manager.unmount(this.key);
|
|
24
|
-
}
|
|
25
|
-
checkManager() {
|
|
26
|
-
if (!this.props.manager) {
|
|
27
|
-
throw new Error("Looks like you forgot to wrap your root component with `Provider` component from `react-native-paper`.\n\n" + "Please read our getting-started guide and make sure you've followed all the required steps.\n\n" + "https://callstack.github.io/react-native-paper/getting-started.html");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
render() {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.default = PortalConsumer;s.checkManager();
|
|
35
20
|
|
|
36
21
|
// Delay updating to prevent React from going to infinite loop
|
|
37
22
|
await Promise.resolve();
|
|
@@ -8,27 +8,24 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
11
|
/**
|
|
15
12
|
* Portal host is the component which actually renders all Portals.
|
|
16
13
|
*/
|
|
17
14
|
class PortalManager extends React.PureComponent {
|
|
18
15
|
constructor() {
|
|
19
16
|
super(...arguments);
|
|
20
|
-
|
|
17
|
+
this.state = {
|
|
21
18
|
portals: []
|
|
22
|
-
}
|
|
23
|
-
|
|
19
|
+
};
|
|
20
|
+
this.mount = (key, children) => {
|
|
24
21
|
this.setState(state => ({
|
|
25
22
|
portals: [...state.portals, {
|
|
26
23
|
key,
|
|
27
24
|
children
|
|
28
25
|
}]
|
|
29
26
|
}));
|
|
30
|
-
}
|
|
31
|
-
|
|
27
|
+
};
|
|
28
|
+
this.update = (key, children) => this.setState(state => ({
|
|
32
29
|
portals: state.portals.map(item => {
|
|
33
30
|
if (item.key === key) {
|
|
34
31
|
return {
|
|
@@ -38,6 +35,35 @@ class PortalManager extends React.PureComponent {
|
|
|
38
35
|
}
|
|
39
36
|
return item;
|
|
40
37
|
})
|
|
38
|
+
}));
|
|
39
|
+
this.unmount = key => this.setState(state => ({
|
|
40
|
+
portals: state.portals.filter(item => item.key !== key)
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return this.state.portals.map(_ref => {
|
|
45
|
+
let {
|
|
46
|
+
key,
|
|
47
|
+
children
|
|
48
|
+
} = _ref;
|
|
49
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
50
|
+
key: key,
|
|
51
|
+
collapsable: false /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */,
|
|
52
|
+
pointerEvents: "box-none",
|
|
53
|
+
style: _reactNative.StyleSheet.absoluteFill
|
|
54
|
+
}, children);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.default = PortalManager;tate.portals.map(item => {
|
|
59
|
+
if (item.key === key) {
|
|
60
|
+
return {
|
|
61
|
+
...item,
|
|
62
|
+
children
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return item;
|
|
66
|
+
})
|
|
41
67
|
})));
|
|
42
68
|
_defineProperty(this, "unmount", key => this.setState(state => ({
|
|
43
69
|
portals: state.portals.filter(item => item.key !== key)
|