Complete the code to import the ScrollView component from React Native.
import { [1] } from 'react-native';
The ScrollView component must be imported from 'react-native' to use it in your app.
Complete the code to wrap content inside a ScrollView component.
return ( <[1]> <Text>Scrollable content</Text> </[1]> );
Wrapping content inside ScrollView makes it scrollable vertically by default.
Fix the error in the ScrollView usage by completing the missing prop to enable horizontal scrolling.
<ScrollView [1]>
<Text>Swipe horizontally</Text>
</ScrollView>Setting horizontal={true} makes the ScrollView scroll horizontally instead of vertically.
Fill both blanks to create a ScrollView with a fixed height and enable vertical scrolling.
const styles = StyleSheet.create({
container: {
height: [1],
backgroundColor: 'lightgray'
}
});
return (
<ScrollView style={styles.container} [2]>
<Text>Lots of content here</Text>
</ScrollView>
);Setting a fixed height like 300 limits the ScrollView's visible area. The prop scrollEnabled={true} ensures scrolling is active.
Fill all three blanks to create a ScrollView that scrolls horizontally, hides the scroll indicator, and snaps to page.
<ScrollView [1] [2] [3]> <View style={{width: 300, height: 200, backgroundColor: 'red'}} /> <View style={{width: 300, height: 200, backgroundColor: 'blue'}} /> </ScrollView>
To create a horizontal scroll that snaps pages and hides the scroll bar, use horizontal={true}, showsHorizontalScrollIndicator={false}, and pagingEnabled={true}.