Usage

Usage

Step 1

Installing the package.

npm i react-native-ios-swipe-actions

Step 2

Navigating inside the ios folder & Installing pods.

cd ios && pod install

Step 3

Using the package

Example

import { Text, SafeAreaView, StyleSheet } from "react-native";
import { List, Section, NativeListProps } from "react-native-ios-swipe-actions";
 
const App = () => {
  const SwipeActionsOptions: NativeListProps = {
    leadingFullSwipeEnabled: true,
    leadingFullSwipeDestructive: false,
    leadingSwipeActions: [
      {
        title: "Wave",
        icon: "hand.wave.fill",
        tint: "#e391f1",
      },
    ],
    trailingFullSwipeDestructive: true,
    trailingFullSwipeEnabled: true,
    trailingSwipeActions: [
      {
        title: "Bye",
        icon: "heart.fill",
        tint: "#bf5bf2",
      },
    ],
  };
 
const onActionClick = (index: number, title?: string) => (
    /** Do something.*/
)
 
  return (
    <SafeAreaView style={styles.container}>
      <List {...SwipeActionsOptions} onActionClick={onActionClick}>
        <Section>
          <Text style={styles.text}>Hello swipe me!</Text>
        </Section>
      </List>
    </SafeAreaView>
  );
};
 
export default App;
 
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#000",
    justifyContent: "center",
    alignItems: "center",
  },
  text: {
    color: "white",
    fontSize: 16.5,
  },
});

Made with ❤️

Copyright © 2024 rit3zh