2.3.9 Nested Views Codehs __top__ -

Here is an example of nested views in CodeHS using JavaScript:

: Each View must have a different size and a different color . 2.3.9 nested views codehs

// 5. Text nested inside Content var bodyText = new Text("This text is inside a nested view."); bodyText.setColor("#333333"); bodyText.setPosition(content.getX() + 15, content.getY() + 30); bodyText.setFont("12pt Arial"); add(bodyText); Here is an example of nested views in

Sits inside the parent. Its size can be determined by absolute dimensions (e.g., width and height in pixels) or relative flex values. Flexbox Rules in React Native bodyText.setPosition(content.getX() + 15

Combine all the steps:

var mainGroup = new Group(); var innerGroup = new Group();

// Child 2: Username Label var userName = new Text("CodeHS_User"); userName.setPosition(100, 110); // Centered below avatar userName.setColor("black"); userName.setFont("16pt Arial"); userName.setTextAlign("center");