You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Not returning a view on the view parameter of the creatingView event handler of the placeholder crash the application #343
How to reproduce:
Create an xml page with the following nested elements:
Page
StackLayout
Placehodler
Add an event handler to the creatingView placeholder event named creatingImageView such as:
function creatingImageView(args) {
console.log("Creating View called");
}
exports.creatingImageView = creatingImageView;
Run the application it will crash with the following error:
/app/tns_modules/ui/core/view.js:85:116: JS ERROR Error: onMeasure() did not set the measured dimension by calling setMeasuredDimension()
replace the event handler with the following code and the application will start
function creatingImageView(args) {
console.log("Creating View called");
var nativeView = new UILabel();
nativeView.text = "Native";
args.view = nativeView;
}
exports.creatingImageView = creatingImageView;
I am not sure that I understand why would I want to use a placeholder, if I don't want to supply a view to show. What will show there if there is not view supplied. What are you trying to achieve? Please, elaborate? Perhaps you should use something else and not a placeholder. For example some layout?
Thanks for the feedback. you guys are doing an amazing work with Native Script.
I'm writing a poc application that should run on Ios and Android. I'm sharing the same xml for both application. On this XML I have one place holder.
At the moment only the android application has a proper implementation that returns a view on the creatingView Eventhandler. the ios does not. It simply returns null. This makes the all ios application crash with the message I mentionned previously :(
I would expect the placeHolder that has a creatingView event handler that do not return anything to simply not show anything on the screen. Not crash :)
Think about the stacklayout or the gridlayout... will they make the application crash if there is no other views inside them? Would you say "Why would you put a stack layout on the screen if there is nothing in it?...". ;)
Use one of the Layouts. You can put a layout on the screen with many purposes. For example you might want to paint it red. Or out can add children later on programmatically on a button click for example. Anyway, I will see whether I can catch the exception.
Activity
hamorphis commentedon Jun 25, 2015
Why would one use a placeholder if he does not intend to hold anything in this place?
AlexandreRoba commentedon Jun 25, 2015
You could have it visible and filled on ios and not in android...
hamorphis commentedon Jun 25, 2015
I am not sure that I understand why would I want to use a placeholder, if I don't want to supply a view to show. What will show there if there is not view supplied. What are you trying to achieve? Please, elaborate? Perhaps you should use something else and not a placeholder. For example some layout?
AlexandreRoba commentedon Jun 25, 2015
Thanks for the feedback. you guys are doing an amazing work with Native Script.
I'm writing a poc application that should run on Ios and Android. I'm sharing the same xml for both application. On this XML I have one place holder.
At the moment only the android application has a proper implementation that returns a view on the creatingView Eventhandler. the ios does not. It simply returns null. This makes the all ios application crash with the message I mentionned previously :(
I would expect the placeHolder that has a creatingView event handler that do not return anything to simply not show anything on the screen. Not crash :)
Think about the stacklayout or the gridlayout... will they make the application crash if there is no other views inside them? Would you say "Why would you put a stack layout on the screen if there is nothing in it?...". ;)
hamorphis commentedon Jun 25, 2015
Use one of the Layouts. You can put a layout on the screen with many purposes. For example you might want to paint it red. Or out can add children later on programmatically on a button click for example. Anyway, I will see whether I can catch the exception.
Resolved issue #343.
Merge pull request #371 from NativeScript/issue-343
hamorphis commentedon Jun 30, 2015
Fixed!
lock commentedon Aug 29, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.