how to make ScrollView horizontal in react native

Viewed 109410

I am using ScrollView for scrolling the list how can i make it horizontal it is appearing vertical

I also tried wrapping up in different views but its not working

for eg:

<View>
<ScrollView>
.
.
.
</ScrollView>
<View>

8 Answers
<ScrollView horizontal />

is all you need.

You don't need to write:

<ScrollView horizontal={true} />

because it already is true when you pass the prop in.

You may want to set the props horizontal and showsHorizontalScrollIndicator

<ScrollView
  horizontal={true}
  showsHorizontalScrollIndicator={false}
  pagingEnabled={true}>
  {/* React Component Goes here */}
</ScrollView>
   <View style={{flexDirection: 'row'}}>
        <ScrollView
          horizontal={true}
          showsHorizontalScrollIndicator={false}>
          <Text>asdasdasd</Text>
          <Text>asdasdasd</Text>
          <Text>asdasdasd</Text>
          <Text>asdasdasd</Text>
          <Text>asdasdasd</Text>
          <Text>asdasdasd</Text>
          <Text>asdasdasd</Text>
          <Text>asdasdasd</Text>
          <Text>asdasdasd</Text>
          <Text>asdasdasd</Text>
        </ScrollView>
      </View>

Its worked for me , just need to add horizontal={true} inside the scrollView like

     <ScrollView horizontal={true}>    //This is horizonatl


     If you want Vertical scroll 
    <ScrollView>                       //vertical scroll
    <Text>Am vertical scroll </Text> 
    </ScrollView>  

the horizantal scrollview code is just put horizontal={true} in ScrollView

Related