Skip to content

Commit

Permalink
Use ShadowDecorator
Browse files Browse the repository at this point in the history
  • Loading branch information
dtun committed Aug 12, 2024
1 parent 96daf91 commit 9653782
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions components/MyMenuEdit.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { StyleSheet } from "react-native";
import DraggableFlatList from "react-native-draggable-flatlist";
import DraggableFlatList, {
ShadowDecorator,
} from "react-native-draggable-flatlist";

import { red } from "@/constants";
import { useEvent } from "@/hooks";
Expand Down Expand Up @@ -35,12 +37,14 @@ export function MyMenuEdit({
keyExtractor={({ id }) => id}
onDragEnd={({ data }) => setMenuData(data)}
renderItem={(params) => (
<RenderMenuItem
{...params}
menuData={menuData}
moveMenuItem={moveMenuItem}
toggleMenuItem={toggleMenuItem}
/>
<ShadowDecorator>
<RenderMenuItem
{...params}
menuData={menuData}
moveMenuItem={moveMenuItem}
toggleMenuItem={toggleMenuItem}
/>
</ShadowDecorator>
)}
style={styles.list}
/>
Expand All @@ -49,7 +53,6 @@ export function MyMenuEdit({

function RenderMenuItem({
drag: onLongPress,
isActive,
item: { icon, id, checked, title },
menuData,
toggleMenuItem,
Expand Down Expand Up @@ -86,7 +89,6 @@ function RenderMenuItem({
styles.listItem,
isFirst && styles.listItemTop,
isLast && styles.listItemBottom,
isActive && styles.listItemActive,
]}
>
<View style={styles.iconContainer}>
Expand Down Expand Up @@ -185,15 +187,6 @@ let styles = StyleSheet.create({
height: 48,
padding: 4,
},
listItemActive: {
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 2,
},
shadowOpacity: 0.25,
shadowRadius: 3.84,
},
listItemTop: {
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
Expand Down

0 comments on commit 9653782

Please sign in to comment.