@draftbit/core 50.0.3-c6a8a2.2 → 50.1.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/Markdown.js +1 -1
- package/lib/commonjs/components/ScreenContainer.js +1 -1
- package/lib/typescript/src/components/Markdown.d.ts +2 -2
- package/lib/typescript/src/components/Markdown.js +11 -2
- package/lib/typescript/src/components/Markdown.js.map +1 -1
- package/lib/typescript/src/components/ScreenContainer.d.ts +3 -1
- package/lib/typescript/src/components/ScreenContainer.js +8 -2
- package/lib/typescript/src/components/ScreenContainer.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/Markdown.js +11 -2
- package/src/components/Markdown.js.map +1 -1
- package/src/components/Markdown.tsx +29 -3
- package/src/components/ScreenContainer.js +8 -2
- package/src/components/ScreenContainer.js.map +1 -1
- package/src/components/ScreenContainer.tsx +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "50.0
|
|
3
|
+
"version": "50.1.0",
|
|
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": "
|
|
44
|
+
"@draftbit/types": "50.1.0",
|
|
45
45
|
"@expo/vector-icons": "^14.0.0",
|
|
46
46
|
"@gorhom/bottom-sheet": "5.0.0-alpha.7",
|
|
47
47
|
"@material-ui/core": "^4.11.0",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
],
|
|
115
115
|
"testEnvironment": "node"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "30996f93fbaac367cf545cecef4188a813d2ede2"
|
|
118
118
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StyleSheet } from "react-native";
|
|
2
|
+
import { Text, StyleSheet, } from "react-native";
|
|
3
3
|
import MarkdownComponent from "react-native-markdown-display";
|
|
4
|
+
import { extractStyles } from "../utilities";
|
|
4
5
|
const childToString = (child) => {
|
|
5
6
|
if (typeof child === "undefined" ||
|
|
6
7
|
child === null ||
|
|
@@ -15,10 +16,18 @@ const childToString = (child) => {
|
|
|
15
16
|
const Markdown = ({ children: childrenProp, style, }) => {
|
|
16
17
|
const children = React.Children.toArray(childrenProp);
|
|
17
18
|
const text = children.map(childToString).join("");
|
|
19
|
+
const bodyStyle = StyleSheet.flatten(style);
|
|
20
|
+
const { textStyles } = extractStyles(bodyStyle);
|
|
18
21
|
return (
|
|
19
22
|
//'body' style applies to all markdown components
|
|
20
23
|
//@ts-ignore TS does not like the type of this named style for some reason
|
|
21
|
-
React.createElement(MarkdownComponent, { style: { body:
|
|
24
|
+
React.createElement(MarkdownComponent, { style: { body: bodyStyle }, rules: {
|
|
25
|
+
// By default, strong does not work with custom fonts on iOS. This addresses the issue
|
|
26
|
+
strong: (node) => (React.createElement(Text, { key: node.key, style: {
|
|
27
|
+
...textStyles,
|
|
28
|
+
fontWeight: "bold",
|
|
29
|
+
} }, node.children[0].content)),
|
|
30
|
+
} }, text));
|
|
22
31
|
};
|
|
23
32
|
export default Markdown;
|
|
24
33
|
//# 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,
|
|
1
|
+
{"version":3,"file":"Markdown.js","sourceRoot":"","sources":["Markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK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AQ,CAAC,CAAC,CAAC,CAAC,OAAO,CACpB,CACR;SACF,IAEA,IAAI,CACa,CACrB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Text,
|
|
4
|
+
StyleProp,
|
|
5
|
+
ViewStyle,
|
|
6
|
+
TextStyle,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
} from "react-native";
|
|
3
9
|
import MarkdownComponent from "react-native-markdown-display";
|
|
10
|
+
import { extractStyles } from "../utilities";
|
|
4
11
|
|
|
5
12
|
type MarkdownProps = {
|
|
6
|
-
style?: StyleProp<ViewStyle>;
|
|
13
|
+
style?: StyleProp<ViewStyle & TextStyle>;
|
|
7
14
|
};
|
|
8
15
|
|
|
9
16
|
const childToString = (child?: React.ReactNode): string => {
|
|
@@ -29,10 +36,29 @@ const Markdown: React.FC<React.PropsWithChildren<MarkdownProps>> = ({
|
|
|
29
36
|
const children = React.Children.toArray(childrenProp);
|
|
30
37
|
const text = children.map(childToString).join("");
|
|
31
38
|
|
|
39
|
+
const bodyStyle = StyleSheet.flatten(style);
|
|
40
|
+
const { textStyles } = extractStyles(bodyStyle);
|
|
41
|
+
|
|
32
42
|
return (
|
|
33
43
|
//'body' style applies to all markdown components
|
|
34
44
|
//@ts-ignore TS does not like the type of this named style for some reason
|
|
35
|
-
<MarkdownComponent
|
|
45
|
+
<MarkdownComponent
|
|
46
|
+
style={{ body: bodyStyle }}
|
|
47
|
+
rules={{
|
|
48
|
+
// By default, strong does not work with custom fonts on iOS. This addresses the issue
|
|
49
|
+
strong: (node) => (
|
|
50
|
+
<Text
|
|
51
|
+
key={node.key}
|
|
52
|
+
style={{
|
|
53
|
+
...textStyles,
|
|
54
|
+
fontWeight: "bold",
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
{node.children[0].content}
|
|
58
|
+
</Text>
|
|
59
|
+
),
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
36
62
|
{text}
|
|
37
63
|
</MarkdownComponent>
|
|
38
64
|
);
|
|
@@ -2,16 +2,22 @@ import * as React from "react";
|
|
|
2
2
|
import { StyleSheet, ScrollView, View, } from "react-native";
|
|
3
3
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
4
4
|
import { withTheme } from "../theming";
|
|
5
|
-
function ScreenContainer({ scrollable = false, hasSafeArea = false, hasBottomSafeArea = false, hasTopSafeArea = false, theme, style, children, ...rest }) {
|
|
5
|
+
function ScreenContainer({ scrollable = false, hasSafeArea = false, hasBottomSafeArea = false, hasTopSafeArea = false, hasLeftSafeArea = true, hasRightSafeArea = true, theme, style, children, ...rest }) {
|
|
6
6
|
var _a;
|
|
7
7
|
const backgroundColor = ((_a = StyleSheet.flatten(style)) === null || _a === void 0 ? void 0 : _a.backgroundColor) || theme.colors.background;
|
|
8
|
-
const edges = [
|
|
8
|
+
const edges = [];
|
|
9
9
|
if (hasSafeArea || hasTopSafeArea) {
|
|
10
10
|
edges.push("top");
|
|
11
11
|
}
|
|
12
12
|
if (hasSafeArea || hasBottomSafeArea) {
|
|
13
13
|
edges.push("bottom");
|
|
14
14
|
}
|
|
15
|
+
if (hasSafeArea || hasLeftSafeArea) {
|
|
16
|
+
edges.push("left");
|
|
17
|
+
}
|
|
18
|
+
if (hasSafeArea || hasRightSafeArea) {
|
|
19
|
+
edges.push("right");
|
|
20
|
+
}
|
|
15
21
|
return (React.createElement(SafeAreaView, { edges: edges, style: [
|
|
16
22
|
styles.container,
|
|
17
23
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenContainer.js","sourceRoot":"","sources":["ScreenContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,UAAU,EACV,UAAU,EAGV,IAAI,GACL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,E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AAe;aAChB;SACF,KACG,IAAI,IAEP,UAAU,CAAC,CAAC,CAAC,CACZ,oBAAC,UAAU,IACT,qBAAqB,EAAE;YACrB,MAAM,CAAC,mBAAmB;YAC1B,EAAE,eAAe,EAAE;YACnB,KAAK;SACN,IAEA,QAAQ,CACE,CACd,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,eAAe,EAAE,EAAE,KAAK,CAAC,IACxD,QAAQ,CACJ,CACR,CACY,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,mBAAmB,EAAE;QACnB,QAAQ,EAAE,CAAC;QACX,IAAI,EAAE,SAAS;KAChB;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -16,6 +16,8 @@ type ScreenContainerProps = {
|
|
|
16
16
|
hasSafeArea?: boolean;
|
|
17
17
|
hasTopSafeArea?: boolean;
|
|
18
18
|
hasBottomSafeArea?: boolean;
|
|
19
|
+
hasLeftSafeArea?: boolean;
|
|
20
|
+
hasRightSafeArea?: boolean;
|
|
19
21
|
theme: Theme;
|
|
20
22
|
style?: StyleProp<ViewStyle>;
|
|
21
23
|
children?: React.ReactNode;
|
|
@@ -26,6 +28,8 @@ function ScreenContainer({
|
|
|
26
28
|
hasSafeArea = false,
|
|
27
29
|
hasBottomSafeArea = false,
|
|
28
30
|
hasTopSafeArea = false,
|
|
31
|
+
hasLeftSafeArea = true,
|
|
32
|
+
hasRightSafeArea = true,
|
|
29
33
|
theme,
|
|
30
34
|
style,
|
|
31
35
|
children,
|
|
@@ -34,7 +38,7 @@ function ScreenContainer({
|
|
|
34
38
|
const backgroundColor =
|
|
35
39
|
StyleSheet.flatten(style)?.backgroundColor || theme.colors.background;
|
|
36
40
|
|
|
37
|
-
const edges: Edge[] = [
|
|
41
|
+
const edges: Edge[] = [];
|
|
38
42
|
if (hasSafeArea || hasTopSafeArea) {
|
|
39
43
|
edges.push("top");
|
|
40
44
|
}
|
|
@@ -43,6 +47,14 @@ function ScreenContainer({
|
|
|
43
47
|
edges.push("bottom");
|
|
44
48
|
}
|
|
45
49
|
|
|
50
|
+
if (hasSafeArea || hasLeftSafeArea) {
|
|
51
|
+
edges.push("left");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (hasSafeArea || hasRightSafeArea) {
|
|
55
|
+
edges.push("right");
|
|
56
|
+
}
|
|
57
|
+
|
|
46
58
|
return (
|
|
47
59
|
<SafeAreaView
|
|
48
60
|
edges={edges}
|