@draftbit/core 50.0.2 → 50.0.3-5e5617.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.
@@ -1 +1 @@
1
- var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Markdown.tsx";import*as React from"react";import{StyleSheet}from"react-native";import MarkdownComponent from"react-native-markdown-display";import{jsx as _jsx}from"react/jsx-runtime";var childToString=function childToString(child){if(typeof child==="undefined"||child===null||typeof child==="boolean"){return"";}if(JSON.stringify(child)==="{}"){return"";}return child.toString();};var Markdown=function Markdown(_ref){var childrenProp=_ref.children,style=_ref.style;var children=React.Children.toArray(childrenProp);var text=children.map(childToString).join("");return _jsx(MarkdownComponent,{style:{body:StyleSheet.flatten(style)},children:text});};export default Markdown;
1
+ var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Markdown.tsx";import*as React from"react";import{Text,StyleSheet}from"react-native";import MarkdownComponent from"react-native-markdown-display";import{extractStyles}from"../utilities";import{jsx as _jsx}from"react/jsx-runtime";var childToString=function childToString(child){if(typeof child==="undefined"||child===null||typeof child==="boolean"){return"";}if(JSON.stringify(child)==="{}"){return"";}return child.toString();};var Markdown=function Markdown(_ref){var childrenProp=_ref.children,style=_ref.style;var children=React.Children.toArray(childrenProp);var text=children.map(childToString).join("");var bodyStyle=StyleSheet.flatten(style);var _extractStyles=extractStyles(bodyStyle),textStyles=_extractStyles.textStyles;return _jsx(MarkdownComponent,{style:{body:bodyStyle},rules:{strong:function strong(node){return _jsx(Text,{style:Object.assign({},textStyles,{fontWeight:"bold"}),children:node.children[0].content},node.key);}},children:text});};export default Markdown;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
2
+ import { StyleProp, ViewStyle, TextStyle } from "react-native";
3
3
  declare type MarkdownProps = {
4
- style?: StyleProp<ViewStyle>;
4
+ style?: StyleProp<ViewStyle & TextStyle>;
5
5
  };
6
6
  declare const Markdown: React.FC<React.PropsWithChildren<MarkdownProps>>;
7
7
  export default Markdown;
@@ -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: StyleSheet.flatten(style) } }, text));
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":["../../../../src/components/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;KAC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