1.0.0 • Published 3 years ago
react-native-ios-bottom-sheet v1.0.0
IOS Bottom Sheet
Usage
import React from "react";
import { Button, StyleSheet, View } from "react-native";
import BottomSheet from "./react-native-ios-bottom-sheet";
import { BottomSheetContext } from "./react-native-ios-bottom-sheet/context";
export default function Home() {
// Extract open and close methods from BottomSheetContext
const { open, close } = React.useContext(BottomSheetContext);
const onPress = () => console.log("Pressed");
return (
<>
<View style={styles.container}>
<Button title="open" onPress={open} />
</View>
<BottomSheet
items={[
{
label: "open new tab",
action: onPress,
color: "default",
},
{
label: "close tab",
action: onPress,
color: "default",
},
{
label: "bookmark",
action: onPress,
color: "default",
},
{
label: "save",
action: onPress,
color: "default",
},
{
label: "cancel",
action: close,
color: "accent",
},
]}
/>
</>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});
1.0.0
3 years ago