@draftbit/core 49.4.2-183f10.2 → 49.4.2-6b199f.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "49.4.2-183f10.2+183f102",
3
+ "version": "49.4.2-6b199f.2+6b199f8",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "types": "lib/typescript/src/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^49.4.2-183f10.2+183f102",
44
+ "@draftbit/types": "^49.4.2-6b199f.2+6b199f8",
45
45
  "@expo/vector-icons": "^13.0.0",
46
46
  "@gorhom/bottom-sheet": "5.0.0-alpha.7",
47
47
  "@material-ui/core": "^4.11.0",
@@ -113,5 +113,5 @@
113
113
  ],
114
114
  "testEnvironment": "node"
115
115
  },
116
- "gitHead": "183f1027182789e12e8d1a404315979809e85134"
116
+ "gitHead": "6b199f88af4f4dd56e502670478c8e12922e00b8"
117
117
  }
@@ -1,11 +1,24 @@
1
1
  import * as React from "react";
2
2
  import { StyleSheet } from "react-native";
3
3
  import MarkdownComponent from "react-native-markdown-display";
4
- const Markdown = ({ children, style, }) => {
4
+ const childToString = (child) => {
5
+ if (typeof child === "undefined" ||
6
+ child === null ||
7
+ typeof child === "boolean") {
8
+ return "";
9
+ }
10
+ if (JSON.stringify(child) === "{}") {
11
+ return "";
12
+ }
13
+ return child.toString();
14
+ };
15
+ const Markdown = ({ children: childrenProp, style, }) => {
16
+ const children = React.Children.toArray(childrenProp);
17
+ const text = children.map(childToString).join("");
5
18
  return (
6
19
  //'body' style applies to all markdown components
7
20
  //@ts-ignore TS does not like the type of this named style for some reason
8
- React.createElement(MarkdownComponent, { style: { body: StyleSheet.flatten(style) } }, children));
21
+ React.createElement(MarkdownComponent, { style: { body: StyleSheet.flatten(style) } }, text));
9
22
  };
10
23
  export default Markdown;
11
24
  //# sourceMappingURL=Markdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.js","sourceRoot":"","sources":["Markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAwB,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAM9D,MAAM,QAAQ,GAAqD,CAAC,EAClE,QAAQ,EACR,KAAK,GACN,EAAE,EAAE;IACH,OAAO;IACL,iDAAiD;IACjD,0EAA0E;IAC1E,oBAAC,iBAAiB,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAC1D,QAAQ,CACS,CACrB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Markdown.js","sourceRoot":"","sources":["Markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAwB,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAM9D,MAAM,aAAa,GAAG,CAAC,KAAuB,EAAU,EAAE;IACxD,IACE,OAAO,KAAK,KAAK,WAAW;QAC5B,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,SAAS,EAC1B;QACA,OAAO,EAAE,CAAC;KACX;IAED,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,CAAC;KACX;IAED,OAAQ,KAAyB,CAAC,QAAQ,EAAE,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAqD,CAAC,EAClE,QAAQ,EAAE,YAAY,EACtB,KAAK,GACN,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAElD,OAAO;IACL,iDAAiD;IACjD,0EAA0E;IAC1E,oBAAC,iBAAiB,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAC1D,IAAI,CACa,CACrB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -6,15 +6,34 @@ type MarkdownProps = {
6
6
  style?: StyleProp<ViewStyle>;
7
7
  };
8
8
 
9
+ const childToString = (child?: React.ReactNode): string => {
10
+ if (
11
+ typeof child === "undefined" ||
12
+ child === null ||
13
+ typeof child === "boolean"
14
+ ) {
15
+ return "";
16
+ }
17
+
18
+ if (JSON.stringify(child) === "{}") {
19
+ return "";
20
+ }
21
+
22
+ return (child as number | string).toString();
23
+ };
24
+
9
25
  const Markdown: React.FC<React.PropsWithChildren<MarkdownProps>> = ({
10
- children,
26
+ children: childrenProp,
11
27
  style,
12
28
  }) => {
29
+ const children = React.Children.toArray(childrenProp);
30
+ const text = children.map(childToString).join("");
31
+
13
32
  return (
14
33
  //'body' style applies to all markdown components
15
34
  //@ts-ignore TS does not like the type of this named style for some reason
16
35
  <MarkdownComponent style={{ body: StyleSheet.flatten(style) }}>
17
- {children}
36
+ {text}
18
37
  </MarkdownComponent>
19
38
  );
20
39
  };
@@ -1,14 +1,14 @@
1
1
  import React from "react";
2
2
  import { TextInput as NativeTextInput, Platform, } from "react-native";
3
3
  import { useDebounce, useOnUpdate } from "../hooks";
4
- const TextInput = React.forwardRef(({ onChangeTextDelayed, changeTextDelay = 500, webShowOutline = true, style, disabled, value, ...rest }, ref) => {
4
+ const TextInput = React.forwardRef(({ onChangeTextDelayed, changeTextDelay = 500, webShowOutline = true, style, disabled = false, editable = true, value, ...rest }, ref) => {
5
5
  const delayedValue = useDebounce(value, changeTextDelay);
6
6
  useOnUpdate(() => {
7
7
  if (delayedValue !== undefined) {
8
8
  onChangeTextDelayed === null || onChangeTextDelayed === void 0 ? void 0 : onChangeTextDelayed(delayedValue);
9
9
  }
10
10
  }, [delayedValue]);
11
- return (React.createElement(NativeTextInput, { testID: "native-text-input", ref: ref, value: value, editable: !disabled, style: [
11
+ return (React.createElement(NativeTextInput, { testID: "native-text-input", ref: ref, value: value, editable: !disabled && editable, style: [
12
12
  //@ts-ignore Web specific prop. Removes default blue outline that appears on the hidden TextInput
13
13
  Platform.OS === "web" && !webShowOutline ? { outlineWidth: 0 } : {},
14
14
  style,
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.js","sourceRoot":"","sources":["TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,SAAS,IAAI,eAAe,EAE5B,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AASpD,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAChC,CACE,EACE,mBAAmB,EACnB,eAAe,GAAG,GAAG,EACrB,cAAc,GAAG,IAAI,EACrB,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IAEzD,WAAW,CAAC,GAAG,EAAE;QACf,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,YAAY,CAAC,CAAC;SACrC;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,oBAAC,eAAe,IACd,MAAM,EAAC,mBAAmB,EAC1B,GAAG,EAAE,GAA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,EAAE,KAAK,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;YACnE,KAAK;SACN,KACG,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -20,7 +20,8 @@ const TextInput = React.forwardRef<NativeTextInput, TextInputProps>(
20
20
  changeTextDelay = 500,
21
21
  webShowOutline = true,
22
22
  style,
23
- disabled,
23
+ disabled = false,
24
+ editable = true,
24
25
  value,
25
26
  ...rest
26
27
  },
@@ -39,7 +40,7 @@ const TextInput = React.forwardRef<NativeTextInput, TextInputProps>(
39
40
  testID="native-text-input"
40
41
  ref={ref}
41
42
  value={value}
42
- editable={!disabled}
43
+ editable={!disabled && editable}
43
44
  style={[
44
45
  //@ts-ignore Web specific prop. Removes default blue outline that appears on the hidden TextInput
45
46
  Platform.OS === "web" && !webShowOutline ? { outlineWidth: 0 } : {},