[{"id":"reactnativeadvanced-001","courseId":"react-native-advanced","domain":"components","topic":"FlatList getItemLayout","prompt":"Your FlatList rows are a fixed 60px tall, and you add a 1px ItemSeparatorComponent between them. Which statement about getItemLayout is correct?","hint":"Consider every element that takes up space in the layout, not just the rows.","explain":"getItemLayout lets a list skip measuring rows, so its numbers must match the layout that is actually drawn. Every element that takes up space in that layout must be accounted for.","source":"https://reactnative.dev/docs/flatlist","interaction":{"type":"single"},"options":[{"id":"a","text":"The separator's length must be added to each row's offset.","why":"Offset gives where a row starts, so every separator before it pushes the offset along: offset = (60 + 1) * index."},{"id":"b","text":"The separator can be ignored; only row lengths belong in getItemLayout.","whyNot":"The docs say to include separator length in the offset calculation, so ignoring it shifts every later row."},{"id":"c","text":"The separator's length belongs in the length field, not the offset.","whyNot":"length describes the item itself; the separator's size is part of how far each offset advances."},{"id":"d","text":"getItemLayout must return a separate entry for each separator.","whyNot":"The function returns one length, offset and index per item, and separators are accounted for inside the offset."}],"answer":"a","explanation":"When ItemSeparatorComponent is used, getItemLayout must include the separator length in each offset calculation, because the offset places every row.","concept":"When ItemSeparatorComponent is used, getItemLayout must include the separator length in each offset calculation, because the offset places every row.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["getItemLayout offsets must include separator sizes, or every later row is placed wrong."]},{"id":"reactnativeadvanced-002","courseId":"react-native-advanced","domain":"components","topic":"FlatList initialNumToRender","prompt":"Judge this statement about FlatList: items in the first initialNumToRender batch are never unmounted by windowed rendering, even after they scroll far out of view.","hint":"Think about which items a user is most likely to jump back to, and what the list needs in place for that.","explain":"Windowed rendering keeps items near the viewport mounted and unmounts the rest as they move away. Scroll-to-top is common, and its speed depends on which items are already mounted.","source":"https://reactnative.dev/docs/flatlist","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","why":"The docs say these items are never unmounted by windowed rendering, which helps scroll-to-top actions feel fast."},{"id":"b","text":"False","whyNot":"The docs say these items are never unmounted by windowed rendering, even after scrolling far out of view, so this claim holds."}],"answer":"a","explanation":"Items in the initialNumToRender batch are exempt from windowed unmounting, which improves the perceived performance of scroll-to-top actions.","concept":"Items in the initialNumToRender batch are exempt from windowed unmounting, which improves the perceived performance of scroll-to-top actions.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["The first initialNumToRender items stay mounted, so scroll-to-top stays responsive."]},{"id":"reactnativeadvanced-003","courseId":"react-native-advanced","domain":"components","topic":"VirtualizedList windowSize","prompt":"A VirtualizedList fills exactly one phone screen and keeps the default windowSize of 21. How much content is rendered above the visible area?","hint":"Notice how the default is divided between the two sides of the viewport.","explain":"A virtualized list measures its render window in visible lengths, not items, and centres it on the screen. A larger window costs memory; a smaller one risks blank areas on fast scrolls.","source":"https://reactnative.dev/docs/virtualizedlist","interaction":{"type":"single"},"options":[{"id":"a","text":"Up to 10 screens above the viewport","why":"The default of 21 covers the visible area plus up to 10 screens above and 10 below."},{"id":"b","text":"Up to 21 screens above the viewport","whyNot":"21 is the total window, shared between the two sides, not an amount per side."},{"id":"c","text":"Up to 21 rows above the viewport","whyNot":"windowSize is measured in visible lengths, not items, so a row count is the wrong unit."},{"id":"d","text":"Nothing; only the visible area is rendered","whyNot":"Virtualization keeps a render window around the viewport, so content just outside it is rendered too."}],"answer":"a","explanation":"windowSize is in units of visible length; the default of 21 renders the visible area plus up to 10 screens above and 10 below.","concept":"windowSize is in units of visible length; the default of 21 renders the visible area plus up to 10 screens above and 10 below.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["windowSize counts screens of visible length, split around the viewport; smaller saves memory, larger reduces blank areas."]},{"id":"reactnativeadvanced-004","courseId":"react-native-advanced","domain":"components","topic":"removeClippedSubviews caveat","prompt":"Which TWO statements about removeClippedSubviews on a long VirtualizedList are accurate?","hint":"Think about what happens to offscreen views, and what the docs warn about.","explain":"Taking off-screen views out of the native tree saves work on large lists, but the trade carries a documented risk. Behaviour of such flags can also differ between platforms.","source":"https://reactnative.dev/docs/virtualizedlist","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"On Android its default value is true.","why":"The docs state that the Android default is true."},{"id":"b","text":"Enabling it can cause missing content in some circumstances.","why":"The docs warn that it may lead to bugs with missing content, so it must be used with care."},{"id":"c","text":"It keeps every offscreen view attached so scrolling back is instant.","whyNot":"The prop does the opposite: offscreen child views are removed from their native backing superview."},{"id":"d","text":"It deletes items from the data prop as they scroll out of view.","whyNot":"The prop acts on child views in the native tree, not on your data array."},{"id":"e","text":"With it on, the list can no longer show blank or missing content.","whyNot":"The docs warn that it can cause missing content, so enabling it does not remove that risk."},{"id":"f","text":"It sets how many items render on first mount.","whyNot":"That job belongs to initialNumToRender; this prop only concerns offscreen child views."}],"answer":"ab","explanation":"removeClippedSubviews detaches offscreen child views from their native superview, which can help performance on large lists but may cause missing content; Android defaults it to true.","concept":"removeClippedSubviews detaches offscreen child views from their native superview, which can help performance on large lists but may cause missing content; Android defaults it to true.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["removeClippedSubviews saves native work on big lists but can drop visible content; test before enabling."]},{"id":"reactnativeadvanced-005","courseId":"react-native-advanced","domain":"components","topic":"maxToRenderPerBatch trade-off","prompt":"A long VirtualizedList shows blank rows during fast flings. A teammate proposes tuning batch settings such as maxToRenderPerBatch. Which trade-off do those settings involve?","hint":"Ask what a list must balance when it renders work in the background.","explain":"Off-screen items are rendered in lower-priority passes rather than all at once, and the pacing of those passes is tunable. Think about what a list gives up while it is busy catching up.","source":"https://reactnative.dev/docs/virtualizedlist","interaction":{"type":"single"},"options":[{"id":"a","text":"Fill rate against responsiveness","why":"The docs describe updateCellsBatchingPeriod as having a fill rate and responsiveness trade-off similar to maxToRenderPerBatch."},{"id":"b","text":"Memory use against blank content","whyNot":"That is windowSize's trade-off; batch settings govern how rendering work is paced."},{"id":"c","text":"Initial load time against scroll position accuracy","whyNot":"Initial items come from initialNumToRender, and batch pacing is not about scroll accuracy."},{"id":"d","text":"Image decode quality against file size","whyNot":"Image quality and file size belong to the Image component, not to list batching."}],"answer":"a","explanation":"Batch pacing trades fill rate against responsiveness: updateCellsBatchingPeriod has a similar fill rate and responsiveness trade-off as maxToRenderPerBatch.","concept":"Batch pacing trades fill rate against responsiveness: updateCellsBatchingPeriod has a similar fill rate and responsiveness trade-off as maxToRenderPerBatch.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["Batch settings like maxToRenderPerBatch trade fill rate against responsiveness."]}]