如何使水平部分列表从右到左滚动反应本机

Zei*_*_Ns 4 react-native react-native-sectionlist

我想建立一个网上商店,我需要一个反应本机的水平部分列表,包含我的产品。这是我的代码。请帮助我从右向左滚动。衣服是一个包含我的产品详细信息的对象数组。

    export default class MySectionList extends Component{
        render(){
            return(
               <SectionList
                   sections={Clothes} 
                   horizontal={true}
                   showsHorizontalScrollIndicator={false}
                   renderItem={({item})=>(
                       <View>
                           <Image source={{uri:"item.image",width:'65%',height:200}}/>
                           <Text>{item.name}</Text>
                           <Text>{item.price}</Text>
                       </View>
                  )}
                  renderSectionHeader={({section})=>(
                       <Text>{section.title}</Text>)}
              />
       )
    }
}
Run Code Online (Sandbox Code Playgroud)

此部分列表从左到右滚动,我需要另一个从左到右滚动。

Ali*_* Sn 5

我通过添加一些样式来解决这个问题。不幸的是,I18NManager 无法解决我的问题,所以我使用了transform样式,并且对于我应用的所有部分列表transform: [{ scaleX: -1 }],并且由于部分列表中的项目将被反转,我再次为项目包装器应用了此样式。像这样的东西:

    render(){
            return(
               <SectionList
                   sections={Clothes} 
                   horizontal={true}
                   style={{ transform: [{ scaleX: -1 }] }}
                   showsHorizontalScrollIndicator={false}
                   renderItem={({item})=>(
                       <View style={{ transform: [{ scaleX: -1 }] }}>
                           <Image source={{uri:"item.image",width:'65%',height:200}}/>
                           <Text>{item.name}</Text>
                           <Text>{item.price}</Text>
                       </View>
                  )}
                  renderSectionHeader={({section})=>(
                       <Text>{section.title}</Text>)}
              />
           )
       }
    }
Run Code Online (Sandbox Code Playgroud)

这是一种很奇怪的方法,但我没有找到解决我的问题的另一种解决方案。

我希望这可以帮助你