Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

horizantal-marquee-view

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

horizantal-marquee-view

Horizantal Marquee Text for react-native

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

horizantal-marquee-view

A react-native horizantal marquee text component.

If you need a vertical marquee text, please use vertical-marquee-view.

Anchors

  1. Desc
  2. Install
  3. Usage
  4. Props
  5. Update Log

Desc

Skip this part, go to #Install

I needed a marquee text in one of my recent project and I didn't find a good one online, so I decided to create my own marquee text component.

I intended to make it work well on both iOS and Android, still there remains one thing in iOS which I cannot fix. I found that in iOS, when you use View component to wrap child components and don't explicitly set the parent View component width (e.g. use flex), the parent View component will have the same width as it's child.

It becomes a problem in this custom component because I use a child View component to wrap Text component in order to make the text expand and show in one line. I set the text containner View component size to be bigger than the Text so that it will not have multiple lines nor have the overflow text replaced by ellipsis. The default value of text container width is 1000, which is usually larger than the actual label width. This results in the problem mentioned above, the wrapper View width becomes 1000 also.

<View class="marquee-label">
  <View class="marquee-label-text-container">
    <Text class="marquee-label-text">{text}</Text>
  </View>
</View>

Note:

  • In Andorid, you can use both width or flex to layout the view.
  • In iOS, use width to layout the view. flex layout is not supported.

Install

npm install --save horizantal-marquee-view

Usage

  1. Import
import HorizantalMarqueeText from 'horizantal-marquee-view';
  1. Use
<HorizantalMarqueeText
  duration={8000}
  text={'This is a Marquee Label.'}
  textStyle={{ fontSize: 13, color: 'white' }}
/>

or

<HorizantalMarqueeText
  speed={250}
  textStyle={{ fontSize: 13, color: 'white' }}
>
  This is a Marquee Label.
</HorizantalMarqueeText>

Props

  • children: string, the text to show in the marquee. Alternative to text.
  • text: string, the text to show in the marquee. Alternative to children.
  • duration: number(unit: millisecond), the duration for the marquee to run one round. e.g. 6000 (for 6 seconds a round). Alternative to speed.
  • speed: number(unit: px/s, px per second), the speed of the marquee. Alternative to duration.
  • bgViewStyle: stylesheet object, background view component custom styles.
  • textStyle: stylesheet object, text component custom styles.
  • textContainerWidth: number, text container component width. If the text is not shown in one line, increase this value.
  • textContainerHeight: number, text container component height. If the text is not shown in one line, increase this value.
  • textContainerStyle: stylesheet object, not recommended to use, text containner component custom style.

Update Log

2019.08.16 Version 1.0.0

  • Dynamic Text Support: now you can use dynamic text with this component :D

Keywords

FAQs

Package last updated on 16 Oct 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc