PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

DropDown option text not displayed in TNS 3.1.0 #107

Closed toddanglin closed 7 years ago

toddanglin commented 7 years ago

It appears that something in TNS 3.1.0 is breaking the text displayed in the item chooser.

Using the demo project in this repo, I upgraded tns-core-modules and tns-ios to 3.1.0 from 3.0.1...and when running on the latest release, the when the drop down is displayed, the text for each item is missing. Only tested on iOS so far.

I haven't jumped-in to the code to see what may be happening, but wanted to flag here as I'm sure people will begin upgrading to 3.1.0 this week.

PeterStaev commented 7 years ago

Hey @toddanglin , thanks for bringing this up. From what I see TNS 3.1 is still not official. Will test and see what changes broke the plugin once 3.1 is officially release.

toddanglin commented 7 years ago

Yeah...I think the final TNS 3.1.0 builds for the runtimes and core modules "officially" shipped today. :) https://github.com/NativeScript/NativeScript/blob/master/CHANGELOG.md

So still VERY fresh, and not yet promoted to @latest on npm (still need @rc to install).

You should be able to begin testing the final build, though. Will be @latest soon.

toddanglin commented 7 years ago

@PeterStaev Do you have any rough ideas what could cause this kind of problem (text not being displayed in the drop down item picker in iOS)?

(NOTE: I checked and this problem does not exist on Android. iOS only.)

I'm trying to release an app that's using 3.1 nightlies (due to other bug fixes in 3.1), so I want to try to "monkey patch" this plugin as a band-aid to get the release out.

It seems like the core logic affecting this should be in pickerViewViewForRowForComponentReusingView. If you can point me at the right rabbit hole, I'm happy to dig to see if I can find a workaround. :) If you have no idea, no worries. I'll spelunk and hopefully find something that reveals what's happening here...

PeterStaev commented 7 years ago

@toddanglin , you care correct about the method as it is responsible for generating the views in the drop down. Sadly i have no idea what they did to break the functionality and the change log does not provide much insights as well 👎 I will try to check it but i cannot give you any ETA right now.

toddanglin commented 7 years ago

@PeterStaev Thanks! I messed around with it last night but didn't find many answers.

Part of me thinks it could be related to the changes made to properly calculate padding margin for text wrapping on iOS. There were changes made to onMeasure for Buttons...but not sure that would impact Drop Down. https://github.com/NativeScript/NativeScript/pull/4326/files

Will keep looking today and will let you know if I find anything else that seems like the culprit. Might just start testing the demo against the 3.1.0 nightlies to see when the break started.

PeterStaev commented 7 years ago

@toddanglin , just a follow up: seems they broke something inside the Label module that breaks when used in a custom plugin. I was using the x-plat module and not a native UILabel / TNSLabel object so I can easily copy the styles. They have a bad habit of doing this as in the previous version they broke the listpicker so I had to revert back to use UIPickerView instead. So seems it is a bad a idea to use the x-plat modules in plugin implementation 😞

I've just tested using a TNSLabel and it seems it is working. So I will have to rewrite the pickerViewViewForRowForComponentReusingView to use a TNSLabel in order to fix this.

toddanglin commented 7 years ago

@PeterStaev Thanks for the quick patch to this plugin! HUGE help.

Sorry to hear you are hitting these x-plat module problems with some frequency. Will see what we can do internally to reduce that kind of churn. Clearly, shouldn't be happening like this.