2.3.9 Nested Views Codehs [ Must See ]

In this exercise, you typically need to create a large "container" view and then place smaller "child" views inside it, often to create a target design like a box within a box. javascript React, Component StyleSheet, View 'react-native' Component render() // The Main Container View style=styles.container> /* The Nested View */ style=styles.nestedView> > );

button.setPosition(200, 300); Why it fails: If you move the parent view, the button stays behind. Fix: Always calculate position as parent.getX() + offset . 2.3.9 nested views codehs

// 3. Text nested inside Header var headerText = new Text("My App"); headerText.setColor("white"); headerText.setPosition(header.getX() + 15, header.getY() + 32); headerText.setFont("18pt Arial"); add(headerText); In this exercise, you typically need to create

var titleText = new Text("Dashboard"); titleText.setColor("white"); titleText.setPosition(headerView.getX() + 10, headerView.getY() + 30); titleText.setFont("16pt Arial"); add(titleText); In this exercise