1

Using Javascript with Nativescript and I am loading a page through code rather than XML.

I have it all working, however I want to add a ScrollView and then place a layout with in that.

How would I go about this?

I have tried:

var scroll = new ScrollView();
var stackLay = new StackLayout();

stackLay.addChild(stuff);
....


scroll.addChild(stackLay);

However, I get error "scroll.addChild is not a function"

Thanks.

1 Answer 1

2

ScrollView is not a layout but inherited from ContentView, therefore you can't add more than one child.

Try

scroll.content = stackLay;
Sign up to request clarification or add additional context in comments.

1 Comment

That's the correct answer - As a note - when in doubt you could always check the API references for available methods & properties docs.nativescript.org/api-reference/classes/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.