@draftbit/core 47.1.1-cbba04.2 → 47.1.1-ee131b.2
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/Button.js +2 -2
- package/lib/commonjs/components/IconButton.js +4 -2
- package/lib/commonjs/components/Portal/PortalConsumer.js +22 -7
- package/lib/commonjs/components/Pressable.js +2 -2
- package/lib/commonjs/components/Touchable.js +2 -2
- package/lib/commonjs/mappings/Button.js +2 -2
- package/lib/commonjs/mappings/FlashList.js +3 -3
- package/lib/commonjs/mappings/FlatList.js +2 -2
- package/lib/commonjs/mappings/IconButton.js +4 -6
- package/lib/commonjs/mappings/MapView.js +3 -1
- package/lib/commonjs/mappings/ScrollView.js +1 -1
- package/lib/commonjs/mappings/Touchable.js +9 -2
- package/lib/module/components/Banner.js +4 -25
- package/lib/module/components/Button.js +2 -2
- package/lib/module/components/Checkbox/context.js +1 -1
- package/lib/module/components/DeprecatedButton.js +3 -21
- package/lib/module/components/DeprecatedCardWrapper.js +1 -18
- package/lib/module/components/IconButton.js +4 -2
- package/lib/module/components/Layout.js +21 -42
- package/lib/module/components/Pressable.js +4 -17
- package/lib/module/components/ProgressBar.js +7 -39
- package/lib/module/components/StarRating.js +4 -24
- package/lib/module/components/StepIndicator.js +18 -58
- package/lib/module/components/Touchable.js +2 -2
- package/lib/module/mappings/Button.js +2 -2
- package/lib/module/mappings/FlashList.js +3 -3
- package/lib/module/mappings/FlatList.js +2 -2
- package/lib/module/mappings/IconButton.js +5 -7
- package/lib/module/mappings/MapView.js +3 -1
- package/lib/module/mappings/ScrollView.js +1 -1
- package/lib/module/mappings/Touchable.js +10 -3
- package/lib/typescript/src/components/IconButton.d.ts +2 -0
- package/lib/typescript/src/components/IconButton.d.ts.map +1 -1
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/mappings/IconButton.d.ts +20 -10
- package/lib/typescript/src/mappings/IconButton.d.ts.map +1 -1
- package/lib/typescript/src/mappings/MapView.d.ts +2 -0
- package/lib/typescript/src/mappings/MapView.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Touchable.d.ts +20 -0
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/Button.js +1 -1
- package/src/components/Button.tsx +2 -2
- package/src/components/IconButton.js +2 -2
- package/src/components/IconButton.tsx +6 -2
- package/src/components/Pressable.js +1 -1
- package/src/components/Pressable.tsx +2 -2
- package/src/components/Touchable.js +1 -1
- package/src/components/Touchable.tsx +2 -2
- package/src/mappings/Button.js +2 -2
- package/src/mappings/Button.ts +2 -2
- package/src/mappings/FlashList.js +3 -3
- package/src/mappings/FlashList.ts +3 -3
- package/src/mappings/FlatList.js +2 -2
- package/src/mappings/FlatList.ts +2 -2
- package/src/mappings/IconButton.js +5 -7
- package/src/mappings/IconButton.ts +5 -7
- package/src/mappings/MapView.js +2 -0
- package/src/mappings/MapView.ts +2 -0
- package/src/mappings/ScrollView.js +1 -1
- package/src/mappings/ScrollView.ts +1 -1
- package/src/mappings/Touchable.js +10 -3
- package/src/mappings/Touchable.ts +12 -2
|
@@ -16,11 +16,13 @@ const IconButton = _ref => {
|
|
|
16
16
|
icon,
|
|
17
17
|
color: customColor,
|
|
18
18
|
size = 32,
|
|
19
|
-
disabled
|
|
19
|
+
disabled,
|
|
20
20
|
loading = false,
|
|
21
21
|
onPress,
|
|
22
22
|
theme,
|
|
23
23
|
style,
|
|
24
|
+
activeOpacity = 0.8,
|
|
25
|
+
disabledOpacity = 0.8,
|
|
24
26
|
...props
|
|
25
27
|
} = _ref;
|
|
26
28
|
const iconColor = customColor || theme.colors.primary;
|
|
@@ -32,7 +34,7 @@ const IconButton = _ref => {
|
|
|
32
34
|
pressed
|
|
33
35
|
} = _ref2;
|
|
34
36
|
return [styles.container, {
|
|
35
|
-
opacity: pressed
|
|
37
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
36
38
|
width: size,
|
|
37
39
|
height: size,
|
|
38
40
|
alignItems: "center",
|
|
@@ -7,16 +7,31 @@ 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); }
|
|
13
10
|
class PortalConsumer extends React.Component {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
_defineProperty(this, "key", void 0);
|
|
17
|
-
}
|
|
18
11
|
async componentDidMount() {
|
|
19
12
|
this.checkManager();
|
|
13
|
+
// Delay updating to prevent React from going to infinite loop
|
|
14
|
+
await Promise.resolve();
|
|
15
|
+
this.key = this.props.manager.mount(this.props.children);
|
|
16
|
+
}
|
|
17
|
+
componentDidUpdate() {
|
|
18
|
+
this.checkManager();
|
|
19
|
+
this.props.manager.update(this.key, this.props.children);
|
|
20
|
+
}
|
|
21
|
+
componentWillUnmount() {
|
|
22
|
+
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();
|
|
20
35
|
|
|
21
36
|
// Delay updating to prevent React from going to infinite loop
|
|
22
37
|
await Promise.resolve();
|
|
@@ -23,7 +23,7 @@ const SEED_DATA_PROPS = {
|
|
|
23
23
|
activeOpacity: (0, _types.createStaticNumberProp)({
|
|
24
24
|
label: "Active Opacity",
|
|
25
25
|
description: "Opacity of the button when active.",
|
|
26
|
-
defaultValue:
|
|
26
|
+
defaultValue: null,
|
|
27
27
|
min: 0,
|
|
28
28
|
max: 1,
|
|
29
29
|
step: 0.01,
|
|
@@ -33,7 +33,7 @@ const SEED_DATA_PROPS = {
|
|
|
33
33
|
disabledOpacity: (0, _types.createStaticNumberProp)({
|
|
34
34
|
label: "Disabled Opacity",
|
|
35
35
|
description: "Opacity of the button when disabled.",
|
|
36
|
-
defaultValue:
|
|
36
|
+
defaultValue: null,
|
|
37
37
|
min: 0,
|
|
38
38
|
max: 1,
|
|
39
39
|
step: 0.01,
|
|
@@ -46,8 +46,8 @@ const SEED_DATA = [{
|
|
|
46
46
|
}),
|
|
47
47
|
showsHorizontalScrollIndicator: (0, _types.createStaticBoolProp)({
|
|
48
48
|
label: "Show Horizontal Scroll Indicator",
|
|
49
|
-
description: "When true, shows a horizontal scroll indicator. The default value is
|
|
50
|
-
defaultValue:
|
|
49
|
+
description: "When true, shows a horizontal scroll indicator. The default value is true.",
|
|
50
|
+
defaultValue: true
|
|
51
51
|
}),
|
|
52
52
|
showsVerticalScrollIndicator: (0, _types.createStaticBoolProp)({
|
|
53
53
|
label: "Show Vertical Scroll Indicator",
|
|
@@ -105,7 +105,7 @@ const SEED_DATA = [{
|
|
|
105
105
|
showsHorizontalScrollIndicator: (0, _types.createStaticBoolProp)({
|
|
106
106
|
label: "Show Horizontal Scroll Indicator",
|
|
107
107
|
description: "When true, shows a horizontal scroll indicator. The default value is true.",
|
|
108
|
-
defaultValue:
|
|
108
|
+
defaultValue: true
|
|
109
109
|
}),
|
|
110
110
|
showsVerticalScrollIndicator: (0, _types.createStaticBoolProp)({
|
|
111
111
|
label: "Show Vertical Scroll Indicator",
|
|
@@ -45,8 +45,8 @@ const SEED_DATA = {
|
|
|
45
45
|
}),
|
|
46
46
|
showsHorizontalScrollIndicator: (0, _types.createStaticBoolProp)({
|
|
47
47
|
label: "Show Horizontal Scroll Indicator",
|
|
48
|
-
description: "When true, shows a horizontal scroll indicator. The default value is
|
|
49
|
-
defaultValue:
|
|
48
|
+
description: "When true, shows a horizontal scroll indicator. The default value is true.",
|
|
49
|
+
defaultValue: true
|
|
50
50
|
}),
|
|
51
51
|
showsVerticalScrollIndicator: (0, _types.createStaticBoolProp)({
|
|
52
52
|
label: "Show Vertical Scroll Indicator",
|
|
@@ -10,26 +10,24 @@ const SEED_DATA = {
|
|
|
10
10
|
tag: "IconButton",
|
|
11
11
|
category: _types.COMPONENT_TYPES.button,
|
|
12
12
|
layout: {},
|
|
13
|
-
triggers: [_types.Triggers.OnPress],
|
|
13
|
+
triggers: [_types.Triggers.OnPress, _types.Triggers.OnLongPress],
|
|
14
14
|
stylesPanelSections: [_types.StylesPanelSections.Margins, _types.StylesPanelSections.Effects, _types.StylesPanelSections.Position],
|
|
15
15
|
props: {
|
|
16
16
|
onPress: (0, _types.createActionProp)(),
|
|
17
|
+
onLongPress: (0, _types.createActionProp)(),
|
|
18
|
+
disabled: (0, _types.createDisabledProp)(),
|
|
17
19
|
icon: (0, _types.createIconProp)(),
|
|
18
20
|
color: (0, _types.createColorProp)({
|
|
19
21
|
label: "Color",
|
|
20
22
|
group: _types.GROUPS.basic
|
|
21
23
|
}),
|
|
22
|
-
disabled: (0, _types.createBoolProp)({
|
|
23
|
-
label: "Disabled",
|
|
24
|
-
group: _types.GROUPS.basic
|
|
25
|
-
}),
|
|
26
24
|
size: (0, _types.createNumberProp)({
|
|
27
25
|
group: _types.GROUPS.basic,
|
|
28
26
|
label: "Size",
|
|
29
27
|
description: "Width and height of your icon",
|
|
30
28
|
defaultValue: 32,
|
|
31
29
|
min: 16,
|
|
32
|
-
max:
|
|
30
|
+
max: 256,
|
|
33
31
|
step: 1,
|
|
34
32
|
precision: 0
|
|
35
33
|
})
|
|
@@ -23,7 +23,7 @@ const SEED_DATA = {
|
|
|
23
23
|
showsHorizontalScrollIndicator: (0, _types.createStaticBoolProp)({
|
|
24
24
|
label: "Show Horizontal Scroll Indicator",
|
|
25
25
|
description: "When true, shows a horizontal scroll indicator. The default value is true.",
|
|
26
|
-
defaultValue:
|
|
26
|
+
defaultValue: true
|
|
27
27
|
}),
|
|
28
28
|
showsVerticalScrollIndicator: (0, _types.createStaticBoolProp)({
|
|
29
29
|
label: "Show Vertical Scroll Indicator",
|
|
@@ -12,10 +12,11 @@ const SEED_DATA_PROPS = {
|
|
|
12
12
|
props: {
|
|
13
13
|
onPress: (0, _types.createActionProp)(),
|
|
14
14
|
onLongPress: (0, _types.createActionProp)(),
|
|
15
|
+
disabled: (0, _types.createDisabledProp)(),
|
|
15
16
|
activeOpacity: (0, _types.createStaticNumberProp)({
|
|
16
17
|
label: "Active Opacity",
|
|
17
18
|
description: "The opacity when the button is pressed.",
|
|
18
|
-
defaultValue:
|
|
19
|
+
defaultValue: null,
|
|
19
20
|
min: 0,
|
|
20
21
|
max: 1,
|
|
21
22
|
step: 0.01,
|
|
@@ -25,7 +26,7 @@ const SEED_DATA_PROPS = {
|
|
|
25
26
|
disabledOpacity: (0, _types.createStaticNumberProp)({
|
|
26
27
|
label: "Disabled Opacity",
|
|
27
28
|
description: "The opacity when the button is disabled.",
|
|
28
|
-
defaultValue:
|
|
29
|
+
defaultValue: null,
|
|
29
30
|
min: 0,
|
|
30
31
|
max: 1,
|
|
31
32
|
step: 0.01,
|
|
@@ -41,6 +42,12 @@ const SEED_DATA_PROPS = {
|
|
|
41
42
|
label: "Hit Slop",
|
|
42
43
|
description: "Sets additional distance outside of element in which a press can be detected.",
|
|
43
44
|
required: false
|
|
45
|
+
}),
|
|
46
|
+
android_disableSound: (0, _types.createStaticBoolProp)({
|
|
47
|
+
label: "Disable Sound",
|
|
48
|
+
description: "Disable the Android sound effect.",
|
|
49
|
+
defaultValue: null,
|
|
50
|
+
group: _types.GROUPS.android
|
|
44
51
|
})
|
|
45
52
|
}
|
|
46
53
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { Button, Text, View, StyleSheet, Animated } from "react-native";
|
|
3
4
|
import Surface from "./Surface";
|
|
@@ -60,6 +61,7 @@ const Banner = _ref => {
|
|
|
60
61
|
measured: true
|
|
61
62
|
});
|
|
62
63
|
};
|
|
64
|
+
|
|
63
65
|
// The banner animation has 2 parts:
|
|
64
66
|
// 1. Blank spacer element which animates its height to move the content
|
|
65
67
|
// 2. Actual banner which animates its translateY
|
|
@@ -69,10 +71,9 @@ const Banner = _ref => {
|
|
|
69
71
|
// However we can't animated banner's height directly as it'll also resize the content inside
|
|
70
72
|
const height = Animated.multiply(position, layout.height);
|
|
71
73
|
const translateY = Animated.multiply(Animated.add(position, -1), layout.height);
|
|
72
|
-
return /*#__PURE__*/React.createElement(Surface, {
|
|
73
|
-
...rest,
|
|
74
|
+
return /*#__PURE__*/React.createElement(Surface, _extends({}, rest, {
|
|
74
75
|
style: [styles.container, shadow(ELEVATION), style]
|
|
75
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
76
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
76
77
|
style: [styles.wrapper, contentStyle]
|
|
77
78
|
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
78
79
|
style: {
|
|
@@ -153,26 +154,4 @@ const styles = StyleSheet.create({
|
|
|
153
154
|
margin: 8
|
|
154
155
|
}
|
|
155
156
|
});
|
|
156
|
-
export default withTheme(Banner);
|
|
157
|
-
},
|
|
158
|
-
content: {
|
|
159
|
-
flexDirection: "row",
|
|
160
|
-
justifyContent: "flex-start",
|
|
161
|
-
marginHorizontal: 8,
|
|
162
|
-
marginTop: 16,
|
|
163
|
-
marginBottom: 0
|
|
164
|
-
},
|
|
165
|
-
icon: {
|
|
166
|
-
margin: 8
|
|
167
|
-
},
|
|
168
|
-
message: {
|
|
169
|
-
flex: 1,
|
|
170
|
-
margin: 8
|
|
171
|
-
},
|
|
172
|
-
actions: {
|
|
173
|
-
flexDirection: "row",
|
|
174
|
-
justifyContent: "flex-end",
|
|
175
|
-
margin: 8
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
157
|
export default withTheme(Banner);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { ActivityIndicator, View, Text, StyleSheet, Pressable } from "react-native";
|
|
3
4
|
import color from "color";
|
|
@@ -74,8 +75,7 @@ const Button = _ref => {
|
|
|
74
75
|
elevation,
|
|
75
76
|
alignSelf: "stretch"
|
|
76
77
|
}
|
|
77
|
-
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
78
|
-
...rest,
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
|
|
79
79
|
onPress: onPress,
|
|
80
80
|
accessibilityState: {
|
|
81
81
|
disabled
|
|
@@ -83,7 +83,7 @@ const Button = _ref => {
|
|
|
83
83
|
accessibilityRole: "button",
|
|
84
84
|
disabled: disabled || loading,
|
|
85
85
|
style: [styles.button, buttonStyle]
|
|
86
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
86
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
87
87
|
style: styles.content
|
|
88
88
|
}, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
|
|
89
89
|
style: iconStyle
|
|
@@ -114,22 +114,4 @@ const styles = StyleSheet.create({
|
|
|
114
114
|
width: Config.buttonIconSize
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
-
export default withTheme(Button);: 1,
|
|
118
|
-
style: [textStyle, typography.button]
|
|
119
|
-
}, children))));
|
|
120
|
-
};
|
|
121
|
-
const styles = StyleSheet.create({
|
|
122
|
-
button: {
|
|
123
|
-
minWidth: 64,
|
|
124
|
-
borderStyle: "solid"
|
|
125
|
-
},
|
|
126
|
-
content: {
|
|
127
|
-
flexDirection: "row",
|
|
128
|
-
alignItems: "center",
|
|
129
|
-
justifyContent: "center"
|
|
130
|
-
},
|
|
131
|
-
icon: {
|
|
132
|
-
width: Config.buttonIconSize
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
117
|
export default withTheme(Button);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { withTheme } from "../theming";
|
|
3
4
|
import Touchable from "./Touchable";
|
|
@@ -12,24 +13,6 @@ const getWidth = numColumns => {
|
|
|
12
13
|
}
|
|
13
14
|
};
|
|
14
15
|
const Card = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
numColumns = 3,
|
|
17
|
-
children,
|
|
18
|
-
onPress,
|
|
19
|
-
style,
|
|
20
|
-
...rest
|
|
21
|
-
} = _ref;
|
|
22
|
-
const width = getWidth(numColumns);
|
|
23
|
-
return /*#__PURE__*/React.createElement(Touchable, {
|
|
24
|
-
disabled: !onPress,
|
|
25
|
-
onPress: onPress,
|
|
26
|
-
style: [style, {
|
|
27
|
-
width
|
|
28
|
-
}],
|
|
29
|
-
...rest
|
|
30
|
-
}, children);
|
|
31
|
-
};
|
|
32
|
-
export default withTheme(Card);ef => {
|
|
33
16
|
let {
|
|
34
17
|
numColumns = 3,
|
|
35
18
|
children,
|
|
@@ -8,11 +8,13 @@ const IconButton = _ref => {
|
|
|
8
8
|
icon,
|
|
9
9
|
color: customColor,
|
|
10
10
|
size = 32,
|
|
11
|
-
disabled
|
|
11
|
+
disabled,
|
|
12
12
|
loading = false,
|
|
13
13
|
onPress,
|
|
14
14
|
theme,
|
|
15
15
|
style,
|
|
16
|
+
activeOpacity = 0.8,
|
|
17
|
+
disabledOpacity = 0.8,
|
|
16
18
|
...props
|
|
17
19
|
} = _ref;
|
|
18
20
|
const iconColor = customColor || theme.colors.primary;
|
|
@@ -24,7 +26,7 @@ const IconButton = _ref => {
|
|
|
24
26
|
pressed
|
|
25
27
|
} = _ref2;
|
|
26
28
|
return [styles.container, {
|
|
27
|
-
opacity: pressed
|
|
29
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
28
30
|
width: size,
|
|
29
31
|
height: size,
|
|
30
32
|
alignItems: "center",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { View } from "react-native";
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
|
|
3
6
|
export function Center(_ref) {
|
|
4
7
|
let {
|
|
5
8
|
width = 240,
|
|
@@ -9,16 +12,15 @@ export function Center(_ref) {
|
|
|
9
12
|
style,
|
|
10
13
|
...rest
|
|
11
14
|
} = _ref;
|
|
12
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
15
|
+
return /*#__PURE__*/React.createElement(View, _extends({
|
|
13
16
|
style: [{
|
|
14
17
|
justifyContent: "center",
|
|
15
18
|
alignItems: "center",
|
|
16
19
|
width,
|
|
17
20
|
height,
|
|
18
21
|
backgroundColor: bgColor
|
|
19
|
-
}, style]
|
|
20
|
-
|
|
21
|
-
}, children);
|
|
22
|
+
}, style]
|
|
23
|
+
}, rest), children);
|
|
22
24
|
}
|
|
23
25
|
export function Circle(_ref2) {
|
|
24
26
|
let {
|
|
@@ -29,7 +31,7 @@ export function Circle(_ref2) {
|
|
|
29
31
|
...rest
|
|
30
32
|
} = _ref2;
|
|
31
33
|
const borderRadius = 1000;
|
|
32
|
-
return /*#__PURE__*/React.createElement(Center, {
|
|
34
|
+
return /*#__PURE__*/React.createElement(Center, _extends({
|
|
33
35
|
width: size,
|
|
34
36
|
height: size,
|
|
35
37
|
bgColor: bgColor,
|
|
@@ -37,9 +39,8 @@ export function Circle(_ref2) {
|
|
|
37
39
|
backgroundColor: bgColor,
|
|
38
40
|
borderRadius,
|
|
39
41
|
overflow: "hidden"
|
|
40
|
-
}]
|
|
41
|
-
|
|
42
|
-
}, children);
|
|
42
|
+
}]
|
|
43
|
+
}, rest), children);
|
|
43
44
|
}
|
|
44
45
|
export function Square(_ref3) {
|
|
45
46
|
let {
|
|
@@ -49,13 +50,12 @@ export function Square(_ref3) {
|
|
|
49
50
|
style,
|
|
50
51
|
...rest
|
|
51
52
|
} = _ref3;
|
|
52
|
-
return /*#__PURE__*/React.createElement(Center, {
|
|
53
|
+
return /*#__PURE__*/React.createElement(Center, _extends({
|
|
53
54
|
style: style,
|
|
54
55
|
width: size,
|
|
55
56
|
height: size,
|
|
56
|
-
bgColor: bgColor
|
|
57
|
-
|
|
58
|
-
}, children);
|
|
57
|
+
bgColor: bgColor
|
|
58
|
+
}, rest), children);
|
|
59
59
|
}
|
|
60
60
|
export function Row(_ref4) {
|
|
61
61
|
let {
|
|
@@ -65,14 +65,15 @@ export function Row(_ref4) {
|
|
|
65
65
|
style,
|
|
66
66
|
...rest
|
|
67
67
|
} = _ref4;
|
|
68
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
69
|
-
style: [style,
|
|
68
|
+
return /*#__PURE__*/React.createElement(View, _extends({
|
|
69
|
+
style: [style,
|
|
70
|
+
// style goes first b/c we can't override these
|
|
71
|
+
{
|
|
70
72
|
alignItems,
|
|
71
73
|
flexDirection: "row",
|
|
72
74
|
justifyContent: justifyContent
|
|
73
|
-
}]
|
|
74
|
-
|
|
75
|
-
}, children);
|
|
75
|
+
}]
|
|
76
|
+
}, rest), children);
|
|
76
77
|
}
|
|
77
78
|
export function Spacer(_ref5) {
|
|
78
79
|
let {
|
|
@@ -84,36 +85,14 @@ export function Spacer(_ref5) {
|
|
|
84
85
|
style,
|
|
85
86
|
...rest
|
|
86
87
|
} = _ref5;
|
|
87
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
88
|
+
return /*#__PURE__*/React.createElement(View, _extends({
|
|
88
89
|
style: [style, {
|
|
89
90
|
paddingRight: right,
|
|
90
91
|
paddingTop: top,
|
|
91
92
|
paddingLeft: left,
|
|
92
93
|
paddingBottom: bottom
|
|
93
|
-
}]
|
|
94
|
-
|
|
95
|
-
}, children);
|
|
96
|
-
}
|
|
97
|
-
export function Stack(_ref6) {
|
|
98
|
-
let {
|
|
99
|
-
children,
|
|
100
|
-
justifyContent = "flex-start",
|
|
101
|
-
alignItems = "flex-start",
|
|
102
|
-
style,
|
|
103
|
-
...rest
|
|
104
|
-
} = _ref6;
|
|
105
|
-
return (
|
|
106
|
-
/*#__PURE__*/
|
|
107
|
-
// style must go first since we don't want justifyContent, alignItems overridden
|
|
108
|
-
React.createElement(View, {
|
|
109
|
-
style: [style, {
|
|
110
|
-
justifyContent,
|
|
111
|
-
alignItems
|
|
112
|
-
}],
|
|
113
|
-
...rest
|
|
114
|
-
}, children)
|
|
115
|
-
);
|
|
116
|
-
}hildren);
|
|
94
|
+
}]
|
|
95
|
+
}, rest), children);
|
|
117
96
|
}
|
|
118
97
|
export function Stack(_ref6) {
|
|
119
98
|
let {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Pressable as NativePressable } from "react-native";
|
|
3
4
|
export default function Pressable(_ref) {
|
|
@@ -5,29 +6,15 @@ export default function Pressable(_ref) {
|
|
|
5
6
|
children,
|
|
6
7
|
disabled,
|
|
7
8
|
onPress,
|
|
8
|
-
activeOpacity,
|
|
9
|
-
disabledOpacity,
|
|
9
|
+
activeOpacity = 0.8,
|
|
10
|
+
disabledOpacity = 0.8,
|
|
10
11
|
delayLongPress,
|
|
11
12
|
hitSlop,
|
|
12
13
|
style,
|
|
13
14
|
...props
|
|
14
15
|
} = _ref;
|
|
15
|
-
return /*#__PURE__*/React.createElement(NativePressable, {
|
|
16
|
+
return /*#__PURE__*/React.createElement(NativePressable, _extends({
|
|
16
17
|
onPress: onPress,
|
|
17
|
-
disabled: disabled,
|
|
18
|
-
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
19
|
-
hitSlop: hitSlop ? hitSlop : 8,
|
|
20
|
-
style: _ref2 => {
|
|
21
|
-
let {
|
|
22
|
-
pressed
|
|
23
|
-
} = _ref2;
|
|
24
|
-
return [{
|
|
25
|
-
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
26
|
-
}, style];
|
|
27
|
-
},
|
|
28
|
-
...props
|
|
29
|
-
}, children);
|
|
30
|
-
} onPress: onPress,
|
|
31
18
|
disabled: disabled,
|
|
32
19
|
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
33
20
|
hitSlop: hitSlop ? hitSlop : 8,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
|
+
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); }
|
|
1
5
|
import React, { Component } from "react";
|
|
2
6
|
import { Animated, Easing, View, I18nManager } from "react-native";
|
|
3
7
|
const INDETERMINATE_WIDTH_FACTOR = 0.3;
|
|
@@ -5,7 +9,7 @@ const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_
|
|
|
5
9
|
export default class ProgressBar extends Component {
|
|
6
10
|
constructor(props) {
|
|
7
11
|
super(props);
|
|
8
|
-
this
|
|
12
|
+
_defineProperty(this, "handleLayout", event => {
|
|
9
13
|
const {
|
|
10
14
|
width = 150,
|
|
11
15
|
onLayout
|
|
@@ -18,7 +22,7 @@ export default class ProgressBar extends Component {
|
|
|
18
22
|
if (onLayout) {
|
|
19
23
|
onLayout(event);
|
|
20
24
|
}
|
|
21
|
-
};
|
|
25
|
+
});
|
|
22
26
|
const {
|
|
23
27
|
progress: progressP = 0,
|
|
24
28
|
indeterminate = false
|
|
@@ -66,6 +70,7 @@ export default class ProgressBar extends Component {
|
|
|
66
70
|
...animationConfig,
|
|
67
71
|
toValue: progress,
|
|
68
72
|
velocity: 0,
|
|
73
|
+
//adjust this value if animation fails - velocity is required
|
|
69
74
|
useNativeDriver
|
|
70
75
|
}).start();
|
|
71
76
|
} else {
|
|
@@ -134,43 +139,6 @@ export default class ProgressBar extends Component {
|
|
|
134
139
|
})
|
|
135
140
|
}]
|
|
136
141
|
};
|
|
137
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
138
|
-
style: [containerStyle, style],
|
|
139
|
-
onLayout: this.handleLayout,
|
|
140
|
-
...restProps
|
|
141
|
-
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
142
|
-
style: progressStyle
|
|
143
|
-
}), children);
|
|
144
|
-
}
|
|
145
|
-
} width,
|
|
146
|
-
borderWidth,
|
|
147
|
-
borderColor: borderColor || color,
|
|
148
|
-
borderRadius,
|
|
149
|
-
overflow: "hidden",
|
|
150
|
-
backgroundColor: unfilledColor
|
|
151
|
-
};
|
|
152
|
-
const progressStyle = {
|
|
153
|
-
backgroundColor: color,
|
|
154
|
-
// Always take up full height of container.
|
|
155
|
-
height: "100%",
|
|
156
|
-
transform: [{
|
|
157
|
-
translateX: this.state.animationValue.interpolate({
|
|
158
|
-
inputRange: [0, 1],
|
|
159
|
-
outputRange: [innerWidth * -INDETERMINATE_WIDTH_FACTOR, innerWidth]
|
|
160
|
-
})
|
|
161
|
-
}, {
|
|
162
|
-
translateX: this.state.progress.interpolate({
|
|
163
|
-
inputRange: [0, 1],
|
|
164
|
-
outputRange: [innerWidth / (I18nManager.isRTL ? 2 : -2), 0]
|
|
165
|
-
})
|
|
166
|
-
}, {
|
|
167
|
-
// Interpolation a temp workaround for https://github.com/facebook/react-native/issues/6278
|
|
168
|
-
scaleX: this.state.progress.interpolate({
|
|
169
|
-
inputRange: [0, 1],
|
|
170
|
-
outputRange: [0.0001, 1]
|
|
171
|
-
})
|
|
172
|
-
}]
|
|
173
|
-
};
|
|
174
142
|
return /*#__PURE__*/React.createElement(View, _extends({
|
|
175
143
|
style: [containerStyle, style],
|
|
176
144
|
onLayout: this.handleLayout
|