JustifyTextView

最低版本: 1.14.1最后更新: 2020/10/26

组件功能

       可以多行滚动显示,高亮当前行的TextView

支持平台

平台是否支持
豹小秘
豹大/花瓶
豹小秘 Mini

参数

属性JS类型Java类型默认值必填说明最低版本
onChange(event: any) => void undefined内容变化回调事件1.14.1
params

{ maxWidth: number; 

text: string;

 textSize: number;

 startTextColor?: string; 

endTextColor?: string}

 null

参数:{

maxWidth: 最大宽度;,默认值-1 

text: 显示的内容;

 textSize: text 大小,默认值 70;

 startTextColor?: 渐变色,开始颜色,默认值 “#4BFFFFFF”; 

endTextColor?: 渐变色,结束颜色,默认值"#FFFFFFFF"}

1.14.1
onAnimationStart(event: any) => void undefined开始动画回调1.14.1
onAnimationRepeat(event: any) => void undefined结束动画回调1.14.1

 

示例代码

    <TouchableOpacity
       activeOpacity={1.0} onPressIn={() => {
         console.log("onPressIn");
       }}>
   <JustifyTextView
       ref={(ref) => this.textRef = ref}
       params={{maxWidth: width, text: item}}
       style={{ height: this.state.realHeight }}
       onChange={(event: any) => {
           let realHeight = event.nativeEvent.height;
           this.lineCount = event.nativeEvent.lineCount;
           console.log('event-- realHeight=' + realHeight);
           console.log('event-- lineCount=' + this.lineCount);
           this.setState({
               realHeight: realHeight / 3.5
           });
           if (!this.props.isReply) {
               //全部高亮
               this._dispatchCommand(JustifyTextType.SET_ALL_HIGH_LIGHT);
           } else {
               if (chatModel.isStopClickAutoTalk()
                   && this.props.item.intent === Intent.chat) {
                   //全部高亮
                   this._dispatchCommand(JustifyTextType.SET_ALL_HIGH_LIGHT);
               }
           }
       }}
       onAnimationStart={(event: any) => {
           console.log(TAG, 'onAnimationStart');
           this._scrollToTop();
           this.scrollY = 0;
       }}
       onAnimationRepeat={(event: any) => {
           console.log(TAG, 'onAnimationRepeat');
           this._startScrollAnimation();
       }}
       />
</TouchableOpacity>