Challenge - 5 Problems
Separator Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate2:00remaining
What is the output of this FlatList with a custom separator?
Consider this React Native FlatList code snippet. What will you see rendered on the screen between each item?
React Native
import React from 'react'; import { FlatList, Text, View } from 'react-native'; const data = [{key: 'A'}, {key: 'B'}, {key: 'C'}]; export default function App() { return ( <FlatList data={data} renderItem={({item}) => <Text>{item.key}</Text>} ItemSeparatorComponent={() => <View style={{height: 2, backgroundColor: 'red'}} />} /> ); }
Attempts:
2 left
💡 Hint
Look at the style of the View returned by ItemSeparatorComponent.
✗ Incorrect
The ItemSeparatorComponent renders a View with height 2 and red background color, so red horizontal lines appear between items.
❓ ui_behavior
intermediate2:00remaining
How many separators will appear for this FlatList?
Given a FlatList with 4 items and a custom ItemSeparatorComponent, how many separator lines will be rendered?
React Native
import React from 'react'; import { FlatList, Text, View } from 'react-native'; const data = [{key: '1'}, {key: '2'}, {key: '3'}, {key: '4'}]; export default function App() { return ( <FlatList data={data} renderItem={({item}) => <Text>{item.key}</Text>} ItemSeparatorComponent={() => <View style={{height: 1, backgroundColor: 'gray'}} />} /> ); }
Attempts:
2 left
💡 Hint
Separators appear only between items, not before the first or after the last.
✗ Incorrect
For 4 items, separators appear only between them, so 3 separators show up.
❓ lifecycle
advanced2:00remaining
Why might your custom separator not appear in FlatList?
You added an ItemSeparatorComponent to your FlatList but no separator shows. Which reason below explains this behavior?
React Native
import React from 'react'; import { FlatList, Text, View } from 'react-native'; const data = [{key: 'x'}, {key: 'y'}]; export default function App() { return ( <FlatList data={data} renderItem={({item}) => <Text>{item.key}</Text>} ItemSeparatorComponent={null} /> ); }
Attempts:
2 left
💡 Hint
Check the value assigned to ItemSeparatorComponent.
✗ Incorrect
Setting ItemSeparatorComponent to null disables separators, so none appear.
📝 Syntax
advanced2:00remaining
Which option correctly defines a separator with padding in FlatList?
You want a separator with 10 pixels vertical padding and a 1 pixel black line. Which code snippet is correct?
Attempts:
2 left
💡 Hint
React Native styles use borderBottomWidth and borderBottomColor, not CSS strings.
✗ Incorrect
Option A uses correct React Native style properties for padding and border bottom line.
🧠 Conceptual
expert2:00remaining
What is the main difference between ItemSeparatorComponent and ListFooterComponent in FlatList?
Choose the statement that best describes the difference between ItemSeparatorComponent and ListFooterComponent in React Native FlatList.
Attempts:
2 left
💡 Hint
Think about where each component appears in the list layout.
✗ Incorrect
ItemSeparatorComponent shows between each item, while ListFooterComponent appears once after all items.