
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@betomorrow/styled-tagged-text
Advanced tools
Parse your text and split it into multiple components with custom styles
Text component for React and React-Native application. Apply custom styles on specifics parts of your text, by enclosing them with bracket tags. Typically useful when using internationalization.
npm install @betomorrow/styled-tagged-text
// style
const tagsStyle = StyleSheet.create({
b: { fontWeight: "700" },
i: { fontStyle: "italic" },
emph: { color: "#eb4034", fontSize: 16 },
});
// Component
import { StyledTaggedText } from "@betomorrow/styled-tagged-text";
<StyledTaggedText tagsStyle={tagsStyle}>
Normal [b]Bold[/b] [i][b]Bold Italic[/b] Italic[/i] [emph]Emphasize[/emph]
</StyledTaggedText>;
Render:
Use <StyledTaggedText>
exactly like a <Text>
components.
tagsStyle
: A record of style. Keys correspond to the tag name.Text
(span
on web) properties.// Define your style
const tagsStyle = {
b: { fontWeight: "bold" },
i: { fontStyle: "italic" },
emph: { color: "#eb4034", fontSize: 16 },
};
// Component
import { StyledTaggedSpan } from "@betomorrow/styled-tagged-text";
<StyledTaggedSpan tagsStyle={tagsStyle}>
Normal [b]Bold[/b] [i][b]Bold Italic[/b] Italic[/i] [emph]Emphasize[/emph]
</StyledTaggedSpan>;
Use <StyledTaggedSpan>
exactly like a <span>
components.
Underneath, StyledTaggedText
(StyledTaggedSpan
on web) are just nested Text
(span
) components with inline style. They have the exact same behavior, so you can transmit props as well.
<StyledTaggedSpan
tagsStyle={{ b: { fontWeight: "bold" }, i: { fontStyle: "italic" }, emph: { color: "#eb4034", fontSize: 16 } }}>
Normal [b]Bold[/b] [i][b]Bold Italic[/b] Italic[/i] [emph]Emphasize[/emph]
</StyledTaggedSpan>
Will render exactly:
<span>
Normal
<span style="font-weight: bold;">Bold</span>
<span style="font-style: italic;">
<span style="font-weight: bold;">Bold Italic</span>
Italic
</span>
<span style="color: rgb(235, 64, 52); font-size: 16px;">Emphasize</span>
</span>
React-Native and Web demo are available in example
folder
Define a global style and wrap our component to easily re-use the same stylesheet and tags.
import { StyledTaggedText } from "@betomorrow/styled-tagged-text";
import React from "react";
import { StyleSheet, TextProps } from "react-native";
interface StyledTextProps extends TextProps {
children?: string;
}
export const StyledText = (props: StyledTextProps) => {
const { children, ...otherProps } = props;
return (
<StyledTaggedText tagsStyle={tagsStyle} {...otherProps}>
{children}
</StyledTaggedText>
);
};
const tagsStyle = StyleSheet.create({
emph: {
color: "#1b66e4",
},
});
And everywhere else in your app:
<StyledText>Super [emph]cool ![/emph]</StyledText>
FAQs
Parse your text and split it into multiple components with custom styles
The npm package @betomorrow/styled-tagged-text receives a total of 318 weekly downloads. As such, @betomorrow/styled-tagged-text popularity was classified as not popular.
We found that @betomorrow/styled-tagged-text demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.