npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-marquee-ab

v1.2.6

Published

react-native marquee

Downloads

235

Readme

react-native-marquee-ab

npm npm npm npm

ReactNative Marquee,Support iOS and Android。

使用了react-native中的Animated组件,利用纯js代码,实现Marquee(走马灯)组件。

实现功能

  • 支持文本的水平滚动(向左、向右)
  • 支持文本的竖直滚动(向上、向下)
  • 支持多条文本数据
  • 支持每一条文本数据的点击事件
  • 支持自定义滚动速度
  • 支持自定义样式
  • 支持竖直滚动在头部添加自定义view

其他请阅读本组件支持的Api

事例演示

Version 1.2.6

image

Install

npm

npm i react-native-marquee-ab --save

Props

本组件支持以下Api,如需要新的Api欢迎提出新的issues

MarqueeHorizontal props

  • duration (ms) 选填 执行时间 : 传入毫秒数,执行完整个动画的时间,默认为10秒传入10000。
  • speed (px/s) 选填 滚动速度 : 传入一秒钟执行多少像素的动画,用来替代duration,一般使用这个属性来控制滚动速度 默认为0,建议传入60。
  • textList ([{label : '1',value : '这是滚动文本'},...]) 必填 文本数组 : 滚动的文字数组,必须按照固定格式传参,value用作文本显示,label用作点击事件回调。
  • width (num) 选填 整个组件的宽度 !!宽度不能使用flex!!
  • height (num) 选填 整个组件的高度 !!高度不能使用flex!!
  • direction (string) 方向,值有 left、right
  • reverse (boolean) 是否倒叙整个字符串
  • separator (num) 两个item之间的间隙,默认20
  • bgContainerStyle (obj style) 选填 背景样式
  • textStyle (obj style) 选填 文本样式
  • onTextClick (fun) 点击事件回调 : 返回点击的textList中的item

MarqueeVertical props

  • duration (ms) 选填 执行时间 : 传入毫秒数,执行完整个动画的时间,默认为600毫秒。
  • textList ([{label : '1',value : '这是滚动文本'},...]) 必填 文本数组 : 滚动的文字数组,必须按照固定格式传参,value用作文本显示,label用作点击事件回调。
  • width (num) 选填 整个组件的宽度 !!宽度不能使用flex!!
  • height (num) 选填 整个组件的高度 !!高度不能使用flex!!
  • delay (ms) 文本停顿时间,默认1200毫秒
  • direction (string) 方向,值有 up、down
  • numberOfLines (num) 同一个数据的文本行数,默认为1
  • viewStyle (obj style) 每一行文本的样式
  • bgContainerStyle (obj style) 选填 背景样式
  • textStyle (obj style) 选填 文本样式
  • headViews 选填 滚动的header
  • onTextClick (fun) 点击事件回调 : 返回点击的textList中的item

Usage

1.import

import { MarqueeHorizontal,MarqueeVertical } from 'react-native-marquee-ab';

2.Use

详细事例代码:

https://github.com/ZhangTaoK/react-native-marquee-ab/blob/master/example/src/pages/TestPage.js

注意事项:

由于宽度只能使用数值所以如果想要宽度满屏的话需要这样使用,这样获取到宽度再赋值给width就可以了

import { Dimensions } from 'react-native';

...
 mWidth = Dimensions.get('window').width;  //整个屏幕的宽度
...

博客地址:https://blog.csdn.net/sinat_30949835/article/details/87919455