微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

react-native-sideswipe

编程之家收集整理的这个编程导航主要介绍了react-native-sideswipe编程之家,现在分享给大家,也给大家做个参考。

react-native-sideswipe 介绍

一个简单的,跨平台的react Native可滑动组件,具有合理的认值 ,非常灵活的API。

安装

yarn add react-native-sideswipe

使用

import { Dimensions } from 'react-native';

import SideSwipe from 'react-native-sideswipe';

import CustomComponent from '...'

import data from '...'

export default class SweetCarousel extends Component {

state = {

currentIndex: 0,

};

render = () => {

// center items on screen

const { width } = Dimensions.get('window');

const contentOffset = (width - CustomComponent.WIDTH) / 2;

return (

<SideSwipe

index={this.state.currentIndex}

itemWidth={CustomComponent.WIDTH}

{{ width }}

data={data}

contentOffset={contentOffset}

onIndexChange={index =>

this.setState(() => ({ currentIndex: index }))

}

renderItem={({ itemIndex,currentIndex,item,animatedValue }) => (

<CustomComponent

{...item}

index={itemIndex}

currentIndex={currentIndex}

animatedValue={animatedValue}

/>

)}

/>

);

};

}

GitHub:https://github.com/kkemple/react-native-sideswipe

网站描述:简单跨平台的React Native可滑动的组件

react-native-sideswipe

官方网站:

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。