2.4.5 • Published 3 years ago

@arlenwang/react-native-swipeout v2.4.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-native-swipeout

iOS-style swipeout buttons that appear from behind a component

swipeout preview

Installation

npm install --save @arlenwang/react-native-swipeout

原项目因为不更新了,因为这个比较简单实用,所以重新修整发包

Usage example

See example/index.ios.js for a more detailed example. See the Wiki usage tips. To use swipeout behind a iOS-style listitem, try react-native-listitem.

import Swipeout from '@arlenwang/react-native-swipeout';

// Buttons
var swipeoutBtns = [
  {
    text: 'Button'
  }
]

// Swipeout component
<Swipeout right={swipeoutBtns}>
  <View>
    <Text>Swipe me left</Text>
  </View>
</Swipeout>

Props

PropTypeOptionalDefaultDescription
autoCloseboolYesfalseauto close on button press
backgroundColorstringYes'#dbddde'
closeboolYesclose swipeout
disabledboolYesfalsewhether to disable the swipeout
leftarrayYes[]swipeout buttons on left
onOpenfuncYes(sectionID, rowId, direction: string) => void
onClosefuncYes(sectionID, rowId, direction: string) => void
rightarrayYes[]swipeout buttons on right
scrollfuncYesprevent parent scroll
stylestyleYesstyle of the container
sensitivitynumberYes50change the sensitivity of gesture
sensitivityBlocknumberYes5x移动需要大于多少倍y轴移动
buttonWidthnumberYeseach button width
Button props
PropTypeOptionalDefaultDescription
backgroundColorstringYes'#b6bec0'background color
colorstringYes'#ffffff'text color
componentReactNodeYesnullpass custom component to button
onPressfuncYesnullfunction executed onPress
textstringYes'Click Me'text
typestringYes'default'default, delete, primary, secondary
underlayColorstringYesnullbutton underlay color on press
disabledboolYesfalsedisable button

To Do

https://github.com/dancormier/react-native-swipeout/issues