apache / incubator-weex

Apache Weex (Incubating)
https://weex.apache.org
Apache License 2.0
13.74k stars 1.81k forks source link

[Android] Unexpected behavior in <richtext> Style where weex version is 0.28 #3136

Open zsmjhtn opened 4 years ago

zsmjhtn commented 4 years ago

phenomenon: The code is work:

 <richtext>
        <span style="font-size:42;color:#FF5400;">TAOBAO</span>
 </richtext>

But the code is in vain:

 <richtext>
        <span :style="{'font-size':42, color:'#FF5400'}">TAOBAO</span>
 </richtext>

If I change to this, it works as well:

 <richtext>
        <span :style="{'fontSize':42, color:'#FF5400'}">TAOBAO</span>
 </richtext>

Have found the reason, the BasicComponentData of is very different to :

 <richtext>:
       BasicComponentData--
                     -WXAttr:  value : ["span":xxxxx, style:['font-size':42,xxxx...]xxxxxx ....
                     -WXStyle:null
<text>:
       BasicComponentData--
                     -WXAttr: null 
                     -WXStyle: fontSize:42, xxxxxxx

In the end of logic, the code compareWith "fontSize". The way of Style-Format "font-size" in richtext compared failure. Only "fontSize" can works. And two ways of Style-Format in other Components are all right. But I have not got good idea to fix it.