1.2.2 • Published 1 year ago

@charmy.tech/react-native-stroke-text v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React Native Stroke/Outline Text

npm version

Allows you to add stylish text with stroke effects to your mobile applications. It is perfect for creating visually appealing text elements with outline effects.

Installation

npm install @charmy.tech/react-native-stroke-text
# or
yarn add @charmy.tech/react-native-stroke-text

Android

min compileSdkVersion is required to be 34

iOS

Go to your ios folder and run:

pod install

Usage

Here's a quick example to get you started with StrokeText:

import React from "react";
import { StrokeText } from "@charmy.tech/react-native-stroke-text";
import { View } from "react-native";

export default function Screen() {
  return (
    <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
      <StrokeText
        text="Test"
        fontSize={50}
        color="#000000"
        strokeColor="#c334eb"
        strokeWidth={20}
        fontFamily="Nunito-Black"
      />
    </View>
  );
}

Props

The following table outlines the props available for the StrokeText component:

PropTypeDescription
textstringThe text content you want to display.
fontSizenumberSize of the text font, defining how large the text will be.
colorstringColor of the text, can use any valid color format.
strokeColorstringColor of the stroke (outline) around the text.
strokeWidthnumberWidth of the stroke, determining the thickness of the outline.
fontFamilystringFont family for the text, should match available project fonts.
alignstringText alignment (default: center)
numberOfLinesnumberNumber of lines (default: 0)
ellipsisbooleanEllipsis (...) (default: false)
widthnumberText width to enable ellipsis (default: undefined)

Ellipsis

<StrokeText
  text="Lorem ipsum"
    width={150} // +
    ellipsis={true} // +
    numberOfLines={1} // +
  fontSize={32}
  color="#FFFFFF"
  strokeColor="#000000"
  strokeWidth={2}
  fontFamily="Nunito-Black"
  align="center"
/>

Custom Font

Bare React Native

Create a react-native.config.js file in the root directory

module.exports = {
  project: {
    ios: {},
    android: {},
  },
  assets: ['/assets/fonts'], // or './src/assets/fonts'
};

Expo (expo-font)

import { useFonts } from "expo-font";
import { Dosis_400Regular } from "@expo-google-fonts/dosis";


const [fontsLoaded, fontError] = useFonts({
  Danfo: require("./src/assets/fonts/Danfo-Regular.ttf"),
  "Dosis-Regular": Dosis_400Regular,
});

Contributing

We welcome contributions to improve this component. Feel free to submit issues and enhancement requests.

License

Please refer to the project's license for usage rights and limitations.

1.2.0

1 year ago

1.2.2

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago