@draftbit/core 43.4.5-c2f944.1 → 43.4.5-d68594.1
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/RadioButton/RadioButton.js +9 -8
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +13 -12
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +9 -6
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/RadioButton/index.js.map +1 -1
- package/lib/commonjs/index.js +0 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mappings/RowHeadlineImageCaption.js.map +1 -1
- package/lib/commonjs/mappings/ToggleButton.js.map +1 -1
- package/lib/commonjs/utilities.js +13 -0
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/Divider.js +2 -16
- package/lib/module/components/Divider.js.map +1 -1
- package/lib/module/components/ProgressBar.js +4 -6
- package/lib/module/components/ProgressBar.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +8 -8
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonGroup.js +12 -12
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +10 -7
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/ActionSheetCancel.js.map +1 -1
- package/lib/module/mappings/ToggleButton.js.map +1 -1
- package/lib/module/utilities.js +10 -0
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +2 -2
- package/lib/typescript/src/components/RadioButton/RadioButtonGroup.d.ts +2 -2
- package/lib/typescript/src/components/RadioButton/RadioButtonRow.d.ts +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/utilities.d.ts +1 -0
- package/package.json +3 -5
- package/src/components/RadioButton/RadioButton.js +7 -6
- package/src/components/RadioButton/RadioButton.tsx +11 -12
- package/src/components/RadioButton/RadioButtonGroup.js +10 -10
- package/src/components/RadioButton/RadioButtonGroup.tsx +18 -17
- package/src/components/RadioButton/RadioButtonRow.js +8 -5
- package/src/components/RadioButton/RadioButtonRow.tsx +12 -10
- package/src/index.js +0 -1
- package/src/index.tsx +0 -1
- package/src/utilities.js +12 -0
- package/src/utilities.ts +11 -0
- package/lib/commonjs/components/Youtube.js +0 -74
- package/lib/commonjs/components/Youtube.js.map +0 -1
- package/lib/module/components/Youtube.js +0 -60
- package/lib/module/components/Youtube.js.map +0 -1
- package/lib/typescript/src/components/Youtube.d.ts +0 -44
- package/src/components/Youtube.js +0 -38
- package/src/components/Youtube.tsx +0 -66
|
@@ -13,7 +13,7 @@ import { useRadioButtonGroupContext } from "./context";
|
|
|
13
13
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
14
14
|
import { Direction as GroupDirection } from "./context";
|
|
15
15
|
import Touchable from "../Touchable";
|
|
16
|
-
import { extractStyles } from "../../utilities";
|
|
16
|
+
import { extractStyles, getValueForRadioButton } from "../../utilities";
|
|
17
17
|
|
|
18
18
|
export enum Direction {
|
|
19
19
|
Row = "row",
|
|
@@ -22,7 +22,7 @@ export enum Direction {
|
|
|
22
22
|
|
|
23
23
|
export interface RadioButtonRowProps extends Omit<RadioButtonProps, "onPress"> {
|
|
24
24
|
label: string | React.ReactNode;
|
|
25
|
-
value: string; // A string that this radio button row represents when selected
|
|
25
|
+
value: string | number; // A string (or number that will be parsed String(number)) that this radio button row represents when selected
|
|
26
26
|
color?: string;
|
|
27
27
|
unselectedColor?: string;
|
|
28
28
|
labelContainerStyle: StyleProp<ViewStyle>;
|
|
@@ -60,10 +60,10 @@ const renderLabel = (
|
|
|
60
60
|
const RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({
|
|
61
61
|
Icon,
|
|
62
62
|
label,
|
|
63
|
-
value,
|
|
63
|
+
value = "",
|
|
64
64
|
color,
|
|
65
65
|
unselectedColor,
|
|
66
|
-
onPress
|
|
66
|
+
onPress,
|
|
67
67
|
labelContainerStyle,
|
|
68
68
|
labelStyle,
|
|
69
69
|
radioButtonStyle,
|
|
@@ -79,9 +79,13 @@ const RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({
|
|
|
79
79
|
direction: parentDirection,
|
|
80
80
|
} = useRadioButtonGroupContext();
|
|
81
81
|
|
|
82
|
+
const realValue = getValueForRadioButton(value);
|
|
83
|
+
const realContextValue = getValueForRadioButton(contextValue);
|
|
84
|
+
const isSelected = selected ?? realContextValue === realValue;
|
|
85
|
+
|
|
82
86
|
const handlePress = () => {
|
|
83
|
-
onPress(
|
|
84
|
-
onValueChange
|
|
87
|
+
onPress?.(realValue);
|
|
88
|
+
onValueChange?.(realValue);
|
|
85
89
|
};
|
|
86
90
|
|
|
87
91
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
@@ -112,12 +116,10 @@ const RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({
|
|
|
112
116
|
>
|
|
113
117
|
<RadioButton
|
|
114
118
|
Icon={Icon}
|
|
115
|
-
selected={
|
|
116
|
-
|
|
117
|
-
}
|
|
119
|
+
selected={isSelected}
|
|
120
|
+
value={realValue}
|
|
118
121
|
color={color}
|
|
119
122
|
unselectedColor={unselectedColor}
|
|
120
|
-
onPress={handlePress}
|
|
121
123
|
style={radioButtonStyle}
|
|
122
124
|
/>
|
|
123
125
|
</View>
|
package/src/index.js
CHANGED
|
@@ -48,4 +48,3 @@ export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIc
|
|
|
48
48
|
export { default as Slider } from "./components/Slider";
|
|
49
49
|
export { default as Stepper } from "./components/Stepper";
|
|
50
50
|
export { useAuthState } from "./components/useAuthState";
|
|
51
|
-
export { default as Youtube } from "./components/Youtube";
|
package/src/index.tsx
CHANGED
|
@@ -68,4 +68,3 @@ export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIc
|
|
|
68
68
|
export { default as Slider } from "./components/Slider";
|
|
69
69
|
export { default as Stepper } from "./components/Stepper";
|
|
70
70
|
export { useAuthState } from "./components/useAuthState";
|
|
71
|
-
export { default as Youtube } from "./components/Youtube";
|
package/src/utilities.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
+
import { isString, isNumber } from "lodash";
|
|
2
3
|
export function extractStyles(style) {
|
|
3
4
|
const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...viewStyles } = StyleSheet.flatten(style || {});
|
|
4
5
|
const textStyles = {
|
|
@@ -40,3 +41,14 @@ export function applyStyles(baseStyles, stylesToApply) {
|
|
|
40
41
|
}
|
|
41
42
|
return flattenedStyles;
|
|
42
43
|
}
|
|
44
|
+
export function getValueForRadioButton(value) {
|
|
45
|
+
if (isString(value)) {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
else if (isNumber(value)) {
|
|
49
|
+
return String(value);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
throw new Error(`Invalid value: ${value}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
package/src/utilities.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StyleSheet, StyleProp, TextStyle } from "react-native";
|
|
2
|
+
import { isString, isNumber } from "lodash";
|
|
2
3
|
|
|
3
4
|
export function extractStyles(style: StyleProp<any>) {
|
|
4
5
|
const {
|
|
@@ -63,3 +64,13 @@ export function applyStyles(
|
|
|
63
64
|
|
|
64
65
|
return flattenedStyles;
|
|
65
66
|
}
|
|
67
|
+
|
|
68
|
+
export function getValueForRadioButton(value: string | number) {
|
|
69
|
+
if (isString(value)) {
|
|
70
|
+
return value;
|
|
71
|
+
} else if (isNumber(value)) {
|
|
72
|
+
return String(value);
|
|
73
|
+
} else {
|
|
74
|
+
throw new Error(`Invalid value: ${value}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.SEED_DATA = void 0;
|
|
7
|
-
|
|
8
|
-
var _types = require("@draftbit/types");
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _reactNativeYoutubeIframe = _interopRequireDefault(require("react-native-youtube-iframe"));
|
|
13
|
-
|
|
14
|
-
var _utilities = require("../utilities");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
const Youtube = _ref => {
|
|
19
|
-
let {
|
|
20
|
-
videoId,
|
|
21
|
-
playlist,
|
|
22
|
-
style,
|
|
23
|
-
mute,
|
|
24
|
-
autoplay
|
|
25
|
-
} = _ref;
|
|
26
|
-
const {
|
|
27
|
-
viewStyles: {
|
|
28
|
-
height,
|
|
29
|
-
width
|
|
30
|
-
}
|
|
31
|
-
} = (0, _utilities.extractStyles)(style);
|
|
32
|
-
return /*#__PURE__*/_react.default.createElement(_reactNativeYoutubeIframe.default, {
|
|
33
|
-
height: height,
|
|
34
|
-
width: width,
|
|
35
|
-
play: autoplay,
|
|
36
|
-
videoId: videoId,
|
|
37
|
-
playList: playlist,
|
|
38
|
-
mute: mute
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var _default = Youtube;
|
|
43
|
-
exports.default = _default;
|
|
44
|
-
const SEED_DATA = {
|
|
45
|
-
name: "Youtube",
|
|
46
|
-
tag: "Youtube",
|
|
47
|
-
description: "Youtube Component",
|
|
48
|
-
category: _types.COMPONENT_TYPES.media,
|
|
49
|
-
layout: {
|
|
50
|
-
width: "100%"
|
|
51
|
-
},
|
|
52
|
-
props: {
|
|
53
|
-
videoId: (0, _types.createTextProp)({
|
|
54
|
-
label: "VideoId",
|
|
55
|
-
description: "Youtube Video ID"
|
|
56
|
-
}),
|
|
57
|
-
playlist: (0, _types.createTextProp)({
|
|
58
|
-
label: "PlayList",
|
|
59
|
-
description: "Playlist ID"
|
|
60
|
-
}),
|
|
61
|
-
mute: (0, _types.createBoolProp)({
|
|
62
|
-
label: "Mute",
|
|
63
|
-
description: "Whether to mute video",
|
|
64
|
-
defaultValue: false
|
|
65
|
-
}),
|
|
66
|
-
autoplay: (0, _types.createBoolProp)({
|
|
67
|
-
label: "Autoplay",
|
|
68
|
-
description: "Whether to Autoplay video",
|
|
69
|
-
defaultValue: false
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
exports.SEED_DATA = SEED_DATA;
|
|
74
|
-
//# sourceMappingURL=Youtube.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["Youtube.tsx"],"names":["Youtube","videoId","playlist","style","mute","autoplay","viewStyles","height","width","SEED_DATA","name","tag","description","category","COMPONENT_TYPES","media","layout","props","label","defaultValue"],"mappings":";;;;;;;AAAA;;AAKA;;AAEA;;AACA;;;;AAUA,MAAMA,OAAO,GAAG,QAAyD;AAAA,MAAxD;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqBC,IAAAA,KAArB;AAA4BC,IAAAA,IAA5B;AAAkCC,IAAAA;AAAlC,GAAwD;AACvE,QAAM;AACJC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADR,MAEF,8BAAcL,KAAd,CAFJ;AAIA,sBACE,6BAAC,iCAAD;AACE,IAAA,MAAM,EAAEI,MADV;AAEE,IAAA,KAAK,EAAEC,KAFT;AAGE,IAAA,IAAI,EAAEH,QAHR;AAIE,IAAA,OAAO,EAAEJ,OAJX;AAKE,IAAA,QAAQ,EAAEC,QALZ;AAME,IAAA,IAAI,EAAEE;AANR,IADF;AAUD,CAfD;;eAiBeJ,O;;AAER,MAAMS,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,SADiB;AAEvBC,EAAAA,GAAG,EAAE,SAFkB;AAGvBC,EAAAA,WAAW,EAAE,mBAHU;AAIvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,KAJH;AAKvBC,EAAAA,MAAM,EAAE;AACNR,IAAAA,KAAK,EAAE;AADD,GALe;AAQvBS,EAAAA,KAAK,EAAE;AACLhB,IAAAA,OAAO,EAAE,2BAAe;AACtBiB,MAAAA,KAAK,EAAE,SADe;AAEtBN,MAAAA,WAAW,EAAE;AAFS,KAAf,CADJ;AAKLV,IAAAA,QAAQ,EAAE,2BAAe;AACvBgB,MAAAA,KAAK,EAAE,UADgB;AAEvBN,MAAAA,WAAW,EAAE;AAFU,KAAf,CALL;AASLR,IAAAA,IAAI,EAAE,2BAAe;AACnBc,MAAAA,KAAK,EAAE,MADY;AAEnBN,MAAAA,WAAW,EAAE,uBAFM;AAGnBO,MAAAA,YAAY,EAAE;AAHK,KAAf,CATD;AAcLd,IAAAA,QAAQ,EAAE,2BAAe;AACvBa,MAAAA,KAAK,EAAE,UADgB;AAEvBN,MAAAA,WAAW,EAAE,2BAFU;AAGvBO,MAAAA,YAAY,EAAE;AAHS,KAAf;AAdL;AARgB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createBoolProp,\n createTextProp,\n} from \"@draftbit/types\";\nimport React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\nimport YoutubePlayer from \"react-native-youtube-iframe\";\nimport { extractStyles } from \"../utilities\";\n\ntype Props = {\n videoId: string;\n playlist: string;\n style: StyleProp<ViewStyle>;\n mute: boolean;\n autoplay: boolean;\n};\n\nconst Youtube = ({ videoId, playlist, style, mute, autoplay }: Props) => {\n const {\n viewStyles: { height, width },\n } = extractStyles(style);\n\n return (\n <YoutubePlayer\n height={height}\n width={width}\n play={autoplay}\n videoId={videoId}\n playList={playlist}\n mute={mute}\n />\n );\n};\n\nexport default Youtube;\n\nexport const SEED_DATA = {\n name: \"Youtube\",\n tag: \"Youtube\",\n description: \"Youtube Component\",\n category: COMPONENT_TYPES.media,\n layout: {\n width: \"100%\",\n },\n props: {\n videoId: createTextProp({\n label: \"VideoId\",\n description: \"Youtube Video ID\",\n }),\n playlist: createTextProp({\n label: \"PlayList\",\n description: \"Playlist ID\",\n }),\n mute: createBoolProp({\n label: \"Mute\",\n description: \"Whether to mute video\",\n defaultValue: false,\n }),\n autoplay: createBoolProp({\n label: \"Autoplay\",\n description: \"Whether to Autoplay video\",\n defaultValue: false,\n }),\n },\n};\n"]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createBoolProp, createTextProp } from "@draftbit/types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import YoutubePlayer from "react-native-youtube-iframe";
|
|
4
|
-
import { extractStyles } from "../utilities";
|
|
5
|
-
|
|
6
|
-
const Youtube = _ref => {
|
|
7
|
-
let {
|
|
8
|
-
videoId,
|
|
9
|
-
playlist,
|
|
10
|
-
style,
|
|
11
|
-
mute,
|
|
12
|
-
autoplay
|
|
13
|
-
} = _ref;
|
|
14
|
-
const {
|
|
15
|
-
viewStyles: {
|
|
16
|
-
height,
|
|
17
|
-
width
|
|
18
|
-
}
|
|
19
|
-
} = extractStyles(style);
|
|
20
|
-
return /*#__PURE__*/React.createElement(YoutubePlayer, {
|
|
21
|
-
height: height,
|
|
22
|
-
width: width,
|
|
23
|
-
play: autoplay,
|
|
24
|
-
videoId: videoId,
|
|
25
|
-
playList: playlist,
|
|
26
|
-
mute: mute
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default Youtube;
|
|
31
|
-
export const SEED_DATA = {
|
|
32
|
-
name: "Youtube",
|
|
33
|
-
tag: "Youtube",
|
|
34
|
-
description: "Youtube Component",
|
|
35
|
-
category: COMPONENT_TYPES.media,
|
|
36
|
-
layout: {
|
|
37
|
-
width: "100%"
|
|
38
|
-
},
|
|
39
|
-
props: {
|
|
40
|
-
videoId: createTextProp({
|
|
41
|
-
label: "VideoId",
|
|
42
|
-
description: "Youtube Video ID"
|
|
43
|
-
}),
|
|
44
|
-
playlist: createTextProp({
|
|
45
|
-
label: "PlayList",
|
|
46
|
-
description: "Playlist ID"
|
|
47
|
-
}),
|
|
48
|
-
mute: createBoolProp({
|
|
49
|
-
label: "Mute",
|
|
50
|
-
description: "Whether to mute video",
|
|
51
|
-
defaultValue: false
|
|
52
|
-
}),
|
|
53
|
-
autoplay: createBoolProp({
|
|
54
|
-
label: "Autoplay",
|
|
55
|
-
description: "Whether to Autoplay video",
|
|
56
|
-
defaultValue: false
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=Youtube.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["Youtube.tsx"],"names":["COMPONENT_TYPES","createBoolProp","createTextProp","React","YoutubePlayer","extractStyles","Youtube","videoId","playlist","style","mute","autoplay","viewStyles","height","width","SEED_DATA","name","tag","description","category","media","layout","props","label","defaultValue"],"mappings":"AAAA,SACEA,eADF,EAEEC,cAFF,EAGEC,cAHF,QAIO,iBAJP;AAKA,OAAOC,KAAP,MAAkB,OAAlB;AAEA,OAAOC,aAAP,MAA0B,6BAA1B;AACA,SAASC,aAAT,QAA8B,cAA9B;;AAUA,MAAMC,OAAO,GAAG,QAAyD;AAAA,MAAxD;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqBC,IAAAA,KAArB;AAA4BC,IAAAA,IAA5B;AAAkCC,IAAAA;AAAlC,GAAwD;AACvE,QAAM;AACJC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADR,MAEFT,aAAa,CAACI,KAAD,CAFjB;AAIA,sBACE,oBAAC,aAAD;AACE,IAAA,MAAM,EAAEI,MADV;AAEE,IAAA,KAAK,EAAEC,KAFT;AAGE,IAAA,IAAI,EAAEH,QAHR;AAIE,IAAA,OAAO,EAAEJ,OAJX;AAKE,IAAA,QAAQ,EAAEC,QALZ;AAME,IAAA,IAAI,EAAEE;AANR,IADF;AAUD,CAfD;;AAiBA,eAAeJ,OAAf;AAEA,OAAO,MAAMS,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,SADiB;AAEvBC,EAAAA,GAAG,EAAE,SAFkB;AAGvBC,EAAAA,WAAW,EAAE,mBAHU;AAIvBC,EAAAA,QAAQ,EAAEnB,eAAe,CAACoB,KAJH;AAKvBC,EAAAA,MAAM,EAAE;AACNP,IAAAA,KAAK,EAAE;AADD,GALe;AAQvBQ,EAAAA,KAAK,EAAE;AACLf,IAAAA,OAAO,EAAEL,cAAc,CAAC;AACtBqB,MAAAA,KAAK,EAAE,SADe;AAEtBL,MAAAA,WAAW,EAAE;AAFS,KAAD,CADlB;AAKLV,IAAAA,QAAQ,EAAEN,cAAc,CAAC;AACvBqB,MAAAA,KAAK,EAAE,UADgB;AAEvBL,MAAAA,WAAW,EAAE;AAFU,KAAD,CALnB;AASLR,IAAAA,IAAI,EAAET,cAAc,CAAC;AACnBsB,MAAAA,KAAK,EAAE,MADY;AAEnBL,MAAAA,WAAW,EAAE,uBAFM;AAGnBM,MAAAA,YAAY,EAAE;AAHK,KAAD,CATf;AAcLb,IAAAA,QAAQ,EAAEV,cAAc,CAAC;AACvBsB,MAAAA,KAAK,EAAE,UADgB;AAEvBL,MAAAA,WAAW,EAAE,2BAFU;AAGvBM,MAAAA,YAAY,EAAE;AAHS,KAAD;AAdnB;AARgB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createBoolProp,\n createTextProp,\n} from \"@draftbit/types\";\nimport React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\nimport YoutubePlayer from \"react-native-youtube-iframe\";\nimport { extractStyles } from \"../utilities\";\n\ntype Props = {\n videoId: string;\n playlist: string;\n style: StyleProp<ViewStyle>;\n mute: boolean;\n autoplay: boolean;\n};\n\nconst Youtube = ({ videoId, playlist, style, mute, autoplay }: Props) => {\n const {\n viewStyles: { height, width },\n } = extractStyles(style);\n\n return (\n <YoutubePlayer\n height={height}\n width={width}\n play={autoplay}\n videoId={videoId}\n playList={playlist}\n mute={mute}\n />\n );\n};\n\nexport default Youtube;\n\nexport const SEED_DATA = {\n name: \"Youtube\",\n tag: \"Youtube\",\n description: \"Youtube Component\",\n category: COMPONENT_TYPES.media,\n layout: {\n width: \"100%\",\n },\n props: {\n videoId: createTextProp({\n label: \"VideoId\",\n description: \"Youtube Video ID\",\n }),\n playlist: createTextProp({\n label: \"PlayList\",\n description: \"Playlist ID\",\n }),\n mute: createBoolProp({\n label: \"Mute\",\n description: \"Whether to mute video\",\n defaultValue: false,\n }),\n autoplay: createBoolProp({\n label: \"Autoplay\",\n description: \"Whether to Autoplay video\",\n defaultValue: false,\n }),\n },\n};\n"]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
declare type Props = {
|
|
4
|
-
videoId: string;
|
|
5
|
-
playlist: string;
|
|
6
|
-
style: StyleProp<ViewStyle>;
|
|
7
|
-
mute: boolean;
|
|
8
|
-
autoplay: boolean;
|
|
9
|
-
};
|
|
10
|
-
declare const Youtube: ({ videoId, playlist, style, mute, autoplay }: Props) => JSX.Element;
|
|
11
|
-
export default Youtube;
|
|
12
|
-
export declare const SEED_DATA: {
|
|
13
|
-
name: string;
|
|
14
|
-
tag: string;
|
|
15
|
-
description: string;
|
|
16
|
-
category: string;
|
|
17
|
-
layout: {
|
|
18
|
-
width: string;
|
|
19
|
-
};
|
|
20
|
-
props: {
|
|
21
|
-
videoId: any;
|
|
22
|
-
playlist: any;
|
|
23
|
-
mute: {
|
|
24
|
-
label: string;
|
|
25
|
-
description: string;
|
|
26
|
-
formType: string;
|
|
27
|
-
propType: string;
|
|
28
|
-
defaultValue: boolean;
|
|
29
|
-
editable: boolean;
|
|
30
|
-
required: boolean;
|
|
31
|
-
group: string;
|
|
32
|
-
};
|
|
33
|
-
autoplay: {
|
|
34
|
-
label: string;
|
|
35
|
-
description: string;
|
|
36
|
-
formType: string;
|
|
37
|
-
propType: string;
|
|
38
|
-
defaultValue: boolean;
|
|
39
|
-
editable: boolean;
|
|
40
|
-
required: boolean;
|
|
41
|
-
group: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createBoolProp, createTextProp, } from "@draftbit/types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import YoutubePlayer from "react-native-youtube-iframe";
|
|
4
|
-
import { extractStyles } from "../utilities";
|
|
5
|
-
const Youtube = ({ videoId, playlist, style, mute, autoplay }) => {
|
|
6
|
-
const { viewStyles: { height, width }, } = extractStyles(style);
|
|
7
|
-
return (React.createElement(YoutubePlayer, { height: height, width: width, play: autoplay, videoId: videoId, playList: playlist, mute: mute }));
|
|
8
|
-
};
|
|
9
|
-
export default Youtube;
|
|
10
|
-
export const SEED_DATA = {
|
|
11
|
-
name: "Youtube",
|
|
12
|
-
tag: "Youtube",
|
|
13
|
-
description: "Youtube Component",
|
|
14
|
-
category: COMPONENT_TYPES.media,
|
|
15
|
-
layout: {
|
|
16
|
-
width: "100%",
|
|
17
|
-
},
|
|
18
|
-
props: {
|
|
19
|
-
videoId: createTextProp({
|
|
20
|
-
label: "VideoId",
|
|
21
|
-
description: "Youtube Video ID",
|
|
22
|
-
}),
|
|
23
|
-
playlist: createTextProp({
|
|
24
|
-
label: "PlayList",
|
|
25
|
-
description: "Playlist ID",
|
|
26
|
-
}),
|
|
27
|
-
mute: createBoolProp({
|
|
28
|
-
label: "Mute",
|
|
29
|
-
description: "Whether to mute video",
|
|
30
|
-
defaultValue: false,
|
|
31
|
-
}),
|
|
32
|
-
autoplay: createBoolProp({
|
|
33
|
-
label: "Autoplay",
|
|
34
|
-
description: "Whether to Autoplay video",
|
|
35
|
-
defaultValue: false,
|
|
36
|
-
}),
|
|
37
|
-
},
|
|
38
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COMPONENT_TYPES,
|
|
3
|
-
createBoolProp,
|
|
4
|
-
createTextProp,
|
|
5
|
-
} from "@draftbit/types";
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
8
|
-
import YoutubePlayer from "react-native-youtube-iframe";
|
|
9
|
-
import { extractStyles } from "../utilities";
|
|
10
|
-
|
|
11
|
-
type Props = {
|
|
12
|
-
videoId: string;
|
|
13
|
-
playlist: string;
|
|
14
|
-
style: StyleProp<ViewStyle>;
|
|
15
|
-
mute: boolean;
|
|
16
|
-
autoplay: boolean;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const Youtube = ({ videoId, playlist, style, mute, autoplay }: Props) => {
|
|
20
|
-
const {
|
|
21
|
-
viewStyles: { height, width },
|
|
22
|
-
} = extractStyles(style);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<YoutubePlayer
|
|
26
|
-
height={height}
|
|
27
|
-
width={width}
|
|
28
|
-
play={autoplay}
|
|
29
|
-
videoId={videoId}
|
|
30
|
-
playList={playlist}
|
|
31
|
-
mute={mute}
|
|
32
|
-
/>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default Youtube;
|
|
37
|
-
|
|
38
|
-
export const SEED_DATA = {
|
|
39
|
-
name: "Youtube",
|
|
40
|
-
tag: "Youtube",
|
|
41
|
-
description: "Youtube Component",
|
|
42
|
-
category: COMPONENT_TYPES.media,
|
|
43
|
-
layout: {
|
|
44
|
-
width: "100%",
|
|
45
|
-
},
|
|
46
|
-
props: {
|
|
47
|
-
videoId: createTextProp({
|
|
48
|
-
label: "VideoId",
|
|
49
|
-
description: "Youtube Video ID",
|
|
50
|
-
}),
|
|
51
|
-
playlist: createTextProp({
|
|
52
|
-
label: "PlayList",
|
|
53
|
-
description: "Playlist ID",
|
|
54
|
-
}),
|
|
55
|
-
mute: createBoolProp({
|
|
56
|
-
label: "Mute",
|
|
57
|
-
description: "Whether to mute video",
|
|
58
|
-
defaultValue: false,
|
|
59
|
-
}),
|
|
60
|
-
autoplay: createBoolProp({
|
|
61
|
-
label: "Autoplay",
|
|
62
|
-
description: "Whether to Autoplay video",
|
|
63
|
-
defaultValue: false,
|
|
64
|
-
}),
|
|
65
|
-
},
|
|
66
|
-
};
|