From e5d16e4963d868cde1c029a81535f1e09d5a9e6f Mon Sep 17 00:00:00 2001 From: Stephen Zhou Date: Mon, 9 Sep 2024 19:24:48 +0800 Subject: [PATCH] refactor: remove lucide react native from dependency --- example/package.json | 1 - package.json | 2 - src/gestures.tsx | 12 +++--- src/icons.tsx | 88 ++++++++++++++++++++++++++++++++++++++++++++ src/toast.tsx | 8 +--- yarn.lock | 14 ------- 6 files changed, 95 insertions(+), 30 deletions(-) create mode 100644 src/icons.tsx diff --git a/example/package.json b/example/package.json index a8ff42c..7907c41 100644 --- a/example/package.json +++ b/example/package.json @@ -16,7 +16,6 @@ "@react-navigation/native-stack": "^6.9.12", "expo": "~51.0.32", "expo-status-bar": "~1.12.1", - "lucide-react-native": "^0.438.0", "nativewind": "4.1.6", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/package.json b/package.json index abd7354..bfacca6 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,6 @@ "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.1", "jest": "^29.7.0", - "lucide-react-native": "^0.438.0", "nativewind": "^4.1.6", "prettier": "^3.3.3", "react": "18.2.0", @@ -99,7 +98,6 @@ "@types/react": "^18.2.44" }, "peerDependencies": { - "lucide-react-native": ">=0", "nativewind": "*", "react": "*", "react-native": "*", diff --git a/src/gestures.tsx b/src/gestures.tsx index 672dcea..a30952f 100644 --- a/src/gestures.tsx +++ b/src/gestures.tsx @@ -44,16 +44,16 @@ export const ToastSwipeHandler: React.FC< const pan = Gesture.Pan() .onBegin(() => { - "worklet"; - + 'worklet'; + if (!enabled) { return; } runOnJS(onBegin)(); }) .onChange((event) => { - "worklet"; - + 'worklet'; + if (!enabled) { return; } @@ -65,8 +65,8 @@ export const ToastSwipeHandler: React.FC< } }) .onFinalize(() => { - "worklet"; - + 'worklet'; + if (!enabled) { return; } diff --git a/src/icons.tsx b/src/icons.tsx new file mode 100644 index 0000000..a3f9f07 --- /dev/null +++ b/src/icons.tsx @@ -0,0 +1,88 @@ +import Svg, { type SvgProps, Circle, Path } from 'react-native-svg'; + +interface IconProps extends SvgProps { + size?: number; +} + +export const CircleCheck = ({ size, ...props }: IconProps) => ( + + + + +); + +export const CircleX = ({ size, ...props }: IconProps) => ( + + + + +); + +export const Info = ({ size, ...props }: IconProps) => ( + + + + +); + +export const TriangleAlert = ({ size, ...props }: IconProps) => ( + + + +); + +export const X = ({ size, ...props }: IconProps) => ( + + + +); diff --git a/src/toast.tsx b/src/toast.tsx index 9528e12..613cefc 100644 --- a/src/toast.tsx +++ b/src/toast.tsx @@ -1,10 +1,4 @@ -import { - CircleCheck, - CircleX, - Info, - TriangleAlert, - X, -} from 'lucide-react-native'; +import { CircleCheck, CircleX, Info, TriangleAlert, X } from './icons'; import * as React from 'react'; import { ActivityIndicator, Pressable, Text, View } from 'react-native'; import Animated from 'react-native-reanimated'; diff --git a/yarn.lock b/yarn.lock index d5b9e89..e1fd6db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13943,17 +13943,6 @@ __metadata: languageName: node linkType: hard -"lucide-react-native@npm:^0.438.0": - version: 0.438.0 - resolution: "lucide-react-native@npm:0.438.0" - peerDependencies: - react: ^16.5.1 || ^17.0.0 || ^18.0.0 - react-native: "*" - react-native-svg: ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 - checksum: f3d7a0c3b0e910ac88df3db10e13bbe7154640d1da53ca06b7a59209b17772b4e972e6f050d0fe8b3b0be30934597f0536edafb2f5719260176c85e5bfcdb096 - languageName: node - linkType: hard - "macos-release@npm:^3.1.0": version: 3.3.0 resolution: "macos-release@npm:3.3.0" @@ -19331,7 +19320,6 @@ __metadata: "@react-navigation/native-stack": ^6.9.12 expo: ~51.0.32 expo-status-bar: ~1.12.1 - lucide-react-native: ^0.438.0 nativewind: 4.1.6 react: 18.2.0 react-dom: 18.2.0 @@ -19364,7 +19352,6 @@ __metadata: eslint-config-prettier: ^9.0.0 eslint-plugin-prettier: ^5.0.1 jest: ^29.7.0 - lucide-react-native: ^0.438.0 nativewind: ^4.1.6 prettier: ^3.3.3 react: 18.2.0 @@ -19378,7 +19365,6 @@ __metadata: release-it: ^17.6.0 typescript: ^5.5.4 peerDependencies: - lucide-react-native: ">=0" nativewind: "*" react: "*" react-native: "*"