nativescript-community / ui-label

Alternative to the built-in NativeScript Label but with better performance and additional features such as HTML rendering and more.
Apache License 2.0
19 stars 7 forks source link

Cannot read property 'pointSize' of null #9

Closed vallemar closed 2 years ago

vallemar commented 3 years ago

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

When I try to use HTMLLabel it gives me the following exception:

***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'pointSize' of null
at
updateHTMLString(file: src/webpack:/checkpointcurly/node_modules/@nativescript-community/ui-label/label.ios.js:349:0)
at _setNativeText(file: src/webpack:/checkpointcurly/node_modules/@nativescript-community/ui-label/label.ios.js:443:0)
at onResumeNativeUpdates(file: src/webpack:/checkpointcurly/node_modules/@nativescript-community/ui-label/label-common.js:44:0)
at _resumeNativeUpdates(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:280:0)
at onLoaded(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:235:0)
at onLoaded(file: src/webpack:/checkpointcurly/node_modules/@nativescript-community/ui-label/label.ios.js:159:0)
at (file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
at callFunctionWithSuper(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:312:0)
at callLoaded(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
at loadView(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:458:0)
at (file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:237:0)
at eachChildView(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0)
at eachChild(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view/view-common.js:759:0)
at onLoaded(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:236:0)
at (file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
at callFunctionWithSuper(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:312:0)
at callLoaded(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
at loadView(file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:458:0)
at (file: src/webpack:/checkpointcurly/node_modules/@nativescript/core/ui/core/view-base/index.js:237:0)
at eachChildView(fi<…>

It's only happening to me on iOS, on android it works fine. I am also in NS 8 (I had not tried this plugin before so I could not tell if it only happens in 8). My code:

  <HTMLLabel
          width="100%"
          height="50"
          :autoFontSize="true"
          :textWrap="true"
          :html="username"
          maxFontSize="30"
        />
farfromrefug commented 3 years ago

@vallemar should be fixed in 1.1.11

vallemar commented 3 years ago

@farfromrefug Now the error has been solved but the line skipping does not do well. When the text overflows it jumps to the next line.

farfromrefug commented 3 years ago

it worked here. can you show?

vallemar commented 3 years ago

Hi @farfromrefug, I have tried the following two settings: textWrap=true and textWrap=false. The result is the same. I show an image of how it looks in both cases: (the text is Lorem Ipsum is....)

image

The code:

  <HTMLLabel
                width="100%"
                :autoFontSize="true"
                :textWrap="false"
                :html="username"
                maxFontSize="30"
              />
farfromrefug commented 3 years ago

@vallemar i honestly dont see what s wrong here. What are you expecting?

vallemar commented 3 years ago

Ah OK, the problem is that it does not respect the TextWrap property, the text should resize in 1 line and as seen in the previous image there are 3 lines

farfromrefug commented 3 years ago

what if you use "text" instead of "html" ? don't use "html" if you don't have html code

vallemar commented 3 years ago

ah ok, sorry I hadn't seen the text property. Anyway, the behavior is the same as with html, the textWrap property does not respect it, even with text I don't see that the text is resized

farfromrefug commented 3 years ago

@vallemar should be fixed in 1.1.12