
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-native-dast
Advanced tools
A React Native library for rendering DatoCMS Structured Text (DAST) with full TypeScript support and customizable styles
A React Native library for rendering DatoCMS Structured Text (DAST) with full TypeScript support and customizable styles.
npm install react-native-dast
# or
yarn add react-native-dast
import { StructuredText } from 'react-native-dast';
const data = {
type: 'root',
children: [
{
type: 'paragraph',
children: [
{ type: 'span', value: 'Hello ' },
{ type: 'span', marks: ['strong'], value: 'world' },
{ type: 'span', value: '!' }
]
}
]
};
function App() {
return <StructuredText data={data} />;
}
You can customize any style by passing a customStyles prop:
<StructuredText
data={data}
customStyles={{
// Paragraph styles
paragraphText: {
fontSize: 18,
lineHeight: 28,
color: '#333',
},
// Heading styles
heading1Text: {
fontSize: 36,
fontWeight: 'bold',
color: '#000',
},
// Text marks
strong: {
fontWeight: '700',
color: '#e74c3c',
},
emphasis: {
fontStyle: 'italic',
color: '#3498db',
},
// List styles
listItemText: {
fontSize: 16,
lineHeight: 26,
},
// Link styles
link: {
color: '#3498db',
textDecorationLine: 'underline',
},
// Code block styles
codeBlockText: {
fontFamily: 'Courier',
fontSize: 14,
},
}}
/>
<StructuredText
data={data}
onLinkPress={(url) => {
// Handle link press
console.log('Link pressed:', url);
// You can use Linking, navigation, etc.
}}
/>
<StructuredText
data={data}
// Custom renderer for DatoCMS blocks
renderBlock={(blockId) => {
return <CustomBlockComponent id={blockId} />;
}}
// Custom renderer for inline items
renderInlineItem={(itemId) => {
return <CustomInlineComponent id={itemId} />;
}}
// Custom handler for item links
onItemLinkPress={(itemId) => {
console.log('Item link pressed:', itemId);
}}
/>
<StructuredText> Props| Prop | Type | Description |
|---|---|---|
data | DastDocument | The DAST document to render (required) |
customStyles | Partial<StructuredTextStyles> | Custom styles to override defaults |
style | ViewStyle | Container style for the root view |
onLinkPress | (url: string) => void | Custom link press handler |
onItemLinkPress | (itemId: string) => void | Custom item link press handler |
renderBlock | (blockId: string) => ReactNode | Custom renderer for block items |
renderInlineItem | (itemId: string) => ReactNode | Custom renderer for inline items |
See src/styles.ts for all available style keys. Key categories include:
paragraph, paragraphTextheading1 through heading6, heading1Text through heading6Textlist, orderedList, unorderedList, listItem, listItemText, listItemBullet, listItemNumbercodeBlock, codeBlockTextblockquote, blockquoteText, blockquoteAttributionthematicBreakstrong, emphasis, code, underline, strikethrough, highlightlinkThe library is written in TypeScript and exports all types:
import type {
DastDocument,
DastNode,
Paragraph,
Heading,
StructuredTextStyles,
// ... and more
} from 'react-native-dast';
Check out the example folder for a complete working example with Expo.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library
FAQs
A React Native library for rendering DatoCMS Structured Text (DAST) with full TypeScript support and customizable styles
The npm package react-native-dast receives a total of 0 weekly downloads. As such, react-native-dast popularity was classified as not popular.
We found that react-native-dast demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.