You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@tuya-oh/react-native-marquee-ab

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tuya-oh/react-native-marquee-ab

react-native marquee

1.2.6-rc-0.5
latest
npmnpm
Version published
Maintainers
5
Created
Source

模板版本:v0.2.2

react-native-marquee-ab

Supported platforms License

[!TIP] Github 地址

安装与使用

请到三方库的 Releases 发布地址查看配套的版本信息: @tuya-oh/react-native-marquee-ab Releases。对于未发布到npm的旧版本,请参考安装指南安装tgz包。

进入到工程目录并输入以下命令:

npm

npm i @tuya-oh/react-native-marquee-ab --save

yarn

yarn add @tuya-oh/react-native-marquee-ab

下面的代码展示了这个库的基本使用场景:

[!WARNING] 使用时 import 的库名不变。

import React, { Component } from 'react';
import {
    View,
    Text,
    Image,
    Dimensions,
} from 'react-native';
import { MarqueeHorizontal,MarqueeVertical } from 'react-native-marquee-ab';
export default class TestPage extends Component {
    render() {
        let mWidth = Dimensions.get('window').width;
        return (
            <View style={{ flex: 1, backgroundColor: '#FFFFFF' }}>
                <View style={{ height: 50, backgroundColor: '#FFFFFF', width: '100%' }} />
                <MarqueeHorizontal
                    textList={[
                        { label: '1', value: 'item1:一闪一闪亮晶晶满天都是小星星' },
                        { label: '2', value: 'item2:两只老虎跑的快' },
                        { label: '3', value: 'item3:蓝蓝的天上白云飘白云下面小肥羊儿跑' },
                    ]}
                    speed={60}
                    width={mWidth}
                    height={50}
                    direction={'left'}
                    reverse={false}
                    bgContainerStyle={{ backgroundColor: '#FFFF00' }}
                    textStyle={{ fontSize: 16, color: '#FF0000' }}
                    onTextClick={(item) => {
                        alert('' + JSON.stringify(item));
                    }}
                />
            </View>
        )
    }
}

约束与限制

兼容性

本文档内容基于以下版本验证通过:

  • RNOH: 0.72.29; SDK:HarmonyOS NEXT Developer Beta6; IDE:DevEco Studio 5.0.3.706; ROM:NEXT.0.0.65;
  • RNOH:0.72.33; SDK:OpenHarmony 5.0.0.71(API Version 12 Release); IDE:DevEco Studio 5.0.3.900; ROM:NEXT.0.0.71;

属性

[!TIP] "Platform"列表示该属性在原三方库上支持的平台。

[!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。

MarqueeHorizontal props

NameDescriptionTypeRequiredPlatformHarmonyOS Support
duration执行完成整个动画所需要的时间(ms)不常用numberyesiOS/Androidyes
speed平均的滚动速度,跑马灯使用这个属性(建议传入60)numbernoiOS/Androidyes
textList滚动的文字数组,具体数据格式请参照textList.itemarrayyesiOS/Androidyes
width宽度,不能使用flexnumberyesiOS/Androidyes
height高度,不能使用flexnumberyesiOS/Androidyes
direction动画方向(向左向右滚动)left or rightstringyesiOS/Androidyes
reverse是否将整个文本数据倒叙显示booleanyesiOS/Androidyes
separator两个item之间的间隙numberyesiOS/Androidyes
bgContainerStyle背景样式objectnoiOS/Androidyes
textStyle文本样式objectnoiOS/Androidyes
onTextClick点击事件回调(item) => voidyesiOS/Androidyes

MarqueeVertical props

NameDescriptionTypeRequiredPlatformHarmonyOS Support
duration执行完成整个动画所需要的时间(ms)numberyesiOS/Androidyes
textList滚动的文字数组,具体数据格式请参照textList.itemarrayyesiOS/Androidyes
width宽度,不能使用flexnumbernoiOS/Androidyes
height高度,不能使用flexnumbernoiOS/Androidyes
delay文本停顿时间(ms)numberyesiOS/Androidyes
direction动画方向(向上向下滚动)up or downstringyesiOS/Androidyes
numberOfLines同一个数据的文本行数numberyesiOS/Androidyes
headViews在文本最前面加上一个自定义view,效果如图例所示,用法请参照事例用法,length长度与textList必须一致arraynoiOS/Androidyes
viewStyle每一行文本的样式objectyesiOS/Androidyes
bgContainerStyle背景样式objectnoiOS/Androidyes
textStyle文本样式objectnoiOS/Androidyes
onTextClick点击事件回调(item) => voidyesiOS/Androidyes

textList.item props

NameDescriptionTypeRequiredPlatformHarmonyOS Support
label用作点击事件的回调stringyesiOS/Androidyes
value文本显示stringyesiOS/Androidyes
[object]可随意添加数据供自己特殊需求使用[object]noiOS/Androidyes

遗留问题

MarqueeHorizontal的reverse属性在HarmonyOS上会触发生效,而原库在Android/iOS上该属性已经失效。

其他

开源协议

本项目基于 The MIT License (MIT) ,请自由地享受和参与开源。

Keywords

react-native

FAQs

Package last updated on 27 May 2025

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