Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

fix(mobile): drop the usage of react-native-awesome-slider

Mohamed Bassemdfa56a7db0d4
diff --git a/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx b/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx
index 9474c5e8..309924e1 100644
--- a/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx
@@ -9,8 +9,7 @@ import {
TextInput,
View,
} from "react-native";
-import { Slider } from "react-native-awesome-slider";
-import { useSharedValue } from "react-native-reanimated";
+import Slider from "@react-native-community/slider";
import Constants from "expo-constants";
import { Link } from "expo-router";
import { UserProfileHeader } from "@/components/settings/UserProfileHeader";
@@ -41,13 +40,11 @@ export default function Settings() {
} = useAppSettings();
const api = useTRPC();
- const imageQuality = useSharedValue(0);
- const imageQualityMin = useSharedValue(0);
- const imageQualityMax = useSharedValue(100);
+ const [imageQuality, setImageQuality] = useState<number | null>(null);
useEffect(() => {
- imageQuality.value = settings.imageQuality * 100;
- }, [settings]);
+ setImageQuality(settings.imageQuality * 100);
+ }, [settings.imageQuality]);
const { data, error } = useQuery(api.users.whoami.queryOptions());
const {
@@ -216,19 +213,26 @@ export default function Settings() {
<Text>Upload Image Quality</Text>
<View className="flex flex-1 flex-row items-center justify-center gap-2">
<Text className="text-foreground">
- {Math.round(settings.imageQuality * 100)}%
+ {Math.round(imageQuality ?? 0)}%
</Text>
- <Slider
- onSlidingComplete={(value) =>
- setSettings({
- ...settings,
- imageQuality: Math.round(value) / 100,
- })
- }
- progress={imageQuality}
- minimumValue={imageQualityMin}
- maximumValue={imageQualityMax}
- />
+
+ {imageQuality === null ? (
+ <ActivityIndicator size="small" />
+ ) : (
+ <Slider
+ style={{ height: 40, flex: 1 }}
+ onSlidingComplete={(value) =>
+ setSettings({
+ ...settings,
+ imageQuality: Math.round(value) / 100,
+ })
+ }
+ onValueChange={(value) => setImageQuality(value)}
+ value={imageQuality}
+ minimumValue={0}
+ maximumValue={100}
+ />
+ )}
</View>
</View>
</View>
diff --git a/apps/mobile/app/dashboard/settings/reader-settings.tsx b/apps/mobile/app/dashboard/settings/reader-settings.tsx
index 31a8f914..4215abbd 100644
--- a/apps/mobile/app/dashboard/settings/reader-settings.tsx
+++ b/apps/mobile/app/dashboard/settings/reader-settings.tsx
@@ -1,7 +1,6 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { Pressable, ScrollView, View } from "react-native";
-import { Slider } from "react-native-awesome-slider";
-import { runOnJS, useSharedValue } from "react-native-reanimated";
+import Slider from "@react-native-community/slider";
import {
ReaderPreview,
ReaderPreviewRef,
@@ -40,23 +39,6 @@ export default function ReaderSettingsPage() {
fontFamily: effectiveFontFamily,
} = settings;
- // Shared values for sliders
- const fontSizeProgress = useSharedValue<number>(effectiveFontSize);
- const fontSizeMin = useSharedValue<number>(
- READER_SETTING_CONSTRAINTS.fontSize.min,
- );
- const fontSizeMax = useSharedValue<number>(
- READER_SETTING_CONSTRAINTS.fontSize.max,
- );
-
- const lineHeightProgress = useSharedValue<number>(effectiveLineHeight);
- const lineHeightMin = useSharedValue<number>(
- READER_SETTING_CONSTRAINTS.lineHeight.min,
- );
- const lineHeightMax = useSharedValue<number>(
- READER_SETTING_CONSTRAINTS.lineHeight.max,
- );
-
// Display values for showing rounded values while dragging
const [displayFontSize, setDisplayFontSize] = useState(effectiveFontSize);
const [displayLineHeight, setDisplayLineHeight] =
@@ -71,7 +53,7 @@ export default function ReaderSettingsPage() {
// Ref for the WebView preview component
const previewRef = useRef<ReaderPreviewRef>(null);
- // Functions to update preview styles via IPC (called from worklets via runOnJS)
+ // Functions to update preview styles
const updatePreviewFontSize = useCallback(
(fontSize: number) => {
setDisplayFontSize(fontSize);
@@ -96,14 +78,12 @@ export default function ReaderSettingsPage() {
[effectiveFontFamily],
);
- // Sync slider progress and display values with effective settings
+ // Sync display values with effective settings
useEffect(() => {
- fontSizeProgress.value = effectiveFontSize;
setDisplayFontSize(effectiveFontSize);
}, [effectiveFontSize]);
useEffect(() => {
- lineHeightProgress.value = effectiveLineHeight;
setDisplayLineHeight(effectiveLineHeight);
}, [effectiveLineHeight]);
@@ -193,21 +173,16 @@ export default function ReaderSettingsPage() {
<Text className="text-muted-foreground">
{READER_SETTING_CONSTRAINTS.fontSize.min}
</Text>
- <View className="flex-1">
- <Slider
- progress={fontSizeProgress}
- minimumValue={fontSizeMin}
- maximumValue={fontSizeMax}
- renderBubble={() => null}
- onValueChange={(value) => {
- "worklet";
- runOnJS(updatePreviewFontSize)(Math.round(value));
- }}
- onSlidingComplete={(value) =>
- handleFontSizeChange(Math.round(value))
- }
- />
- </View>
+ <Slider
+ style={{ height: 40, flex: 1 }}
+ value={displayFontSize}
+ minimumValue={READER_SETTING_CONSTRAINTS.fontSize.min}
+ maximumValue={READER_SETTING_CONSTRAINTS.fontSize.max}
+ onValueChange={(value) => updatePreviewFontSize(Math.round(value))}
+ onSlidingComplete={(value) =>
+ handleFontSizeChange(Math.round(value))
+ }
+ />
<Text className="text-muted-foreground">
{READER_SETTING_CONSTRAINTS.fontSize.max}
</Text>
@@ -226,19 +201,16 @@ export default function ReaderSettingsPage() {
<Text className="text-muted-foreground">
{READER_SETTING_CONSTRAINTS.lineHeight.min}
</Text>
- <View className="flex-1">
- <Slider
- progress={lineHeightProgress}
- minimumValue={lineHeightMin}
- maximumValue={lineHeightMax}
- renderBubble={() => null}
- onValueChange={(value) => {
- "worklet";
- runOnJS(updatePreviewLineHeight)(Math.round(value * 10) / 10);
- }}
- onSlidingComplete={handleLineHeightChange}
- />
- </View>
+ <Slider
+ style={{ height: 40, flex: 1 }}
+ value={displayLineHeight}
+ minimumValue={READER_SETTING_CONSTRAINTS.lineHeight.min}
+ maximumValue={READER_SETTING_CONSTRAINTS.lineHeight.max}
+ onValueChange={(value) =>
+ updatePreviewLineHeight(Math.round(value * 10) / 10)
+ }
+ onSlidingComplete={handleLineHeightChange}
+ />
<Text className="text-muted-foreground">
{READER_SETTING_CONSTRAINTS.lineHeight.max}
</Text>
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 384eaddc..c8528629 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -27,6 +27,7 @@
"@karakeep/shared-react": "workspace:^0.1.0",
"@karakeep/trpc": "workspace:^0.1.0",
"@react-native-async-storage/async-storage": "2.2.0",
+ "@react-native-community/slider": "^5.1.2",
"@react-native-menu/menu": "^2.0.0",
"@react-navigation/native": "^7.1.8",
"@rn-primitives/hooks": "^1.3.0",
@@ -61,7 +62,6 @@
"react": "^19.2.1",
"react-dom": "^19.2.1",
"react-native": "0.81.5",
- "react-native-awesome-slider": "^2.5.3",
"react-native-blob-util": "^0.21.2",
"react-native-css-interop": "0.2.1",
"react-native-gesture-handler": "~2.28.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9f356dda..e1bd1740 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -320,6 +320,9 @@ importers:
'@react-native-async-storage/async-storage':
specifier: 2.2.0
+ '@react-native-community/slider':
+ specifier: ^5.1.2
+ version: 5.1.2
'@react-native-menu/menu':
specifier: ^2.0.0
@@ -422,9 +425,6 @@ importers:
react-native:
specifier: 0.81.5
version: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected])
- react-native-awesome-slider:
- specifier: ^2.5.3
react-native-blob-util:
specifier: ^0.21.2
@@ -5394,6 +5394,9 @@ packages:
peerDependencies:
react-native: ^0.0.0-0 || >=0.65 <1.0
+ '@react-native-community/[email protected]':
+ resolution: {integrity: sha512-UV/MjCyCtSjS5BQDrrGIMmCXm309xEG6XbR0Dj65kzTraJSVDxSjQS2uBUXgX+5SZUOCzCxzv3OufOZBdtQY4w==}
+
'@react-native-menu/[email protected]':
resolution: {integrity: sha512-hb8Mirw6aKPGONhgo52IiNpwHtISVrgCT3rMdFX1qS7eOFNzOcQh8d2UDnaH5zVpxN+QuvWtaaiRMGFpIjzdtA==}
peerDependencies:
@@ -13427,15 +13430,6 @@ packages:
react: ^0.14.0 || ^15.0.0 || ^16 || ^17 || ^18 || ^19
react-dom: ^0.14.0 || ^15.0.0 || ^16 || ^17 || ^18 || ^19
- resolution: {integrity: sha512-dKgwcKz2hobR1xd0FFdxP99vcPhVJK6sZgTyjwbGBK97cnFB8mB5WhIRXzPLnSgrNMABPS6IbdseLRNhpp57gQ==}
- engines: {node: '>= 18.0.0'}
- peerDependencies:
- react: '*'
- react-native: '*'
- react-native-gesture-handler: '>=2.0.0'
- react-native-reanimated: '>=3.0.0'
-
resolution: {integrity: sha512-4DsF+zzBEJmLww12PsUjwqjSaUrz7gdL5MeduSRn9fv5M8GLRIk5WHcgc7n+fzorGhbbL9QtB/QLTL6dMKjYUw==}
peerDependencies:
@@ -16743,7 +16737,7 @@ snapshots:
'@babel/traverse': 7.27.4
'@babel/types': 7.27.6
convert-source-map: 2.0.0
- debug: 4.4.1([email protected])
+ debug: 4.4.1
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@@ -17857,7 +17851,7 @@ snapshots:
'@babel/parser': 7.27.5
'@babel/template': 7.27.2
'@babel/types': 7.27.6
- debug: 4.4.1([email protected])
+ debug: 4.4.1
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@@ -21495,6 +21489,8 @@ snapshots:
merge-options: 3.0.4
react-native: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected])
+ '@react-native-community/[email protected]': {}
+
dependencies:
react: 19.2.3
@@ -24878,6 +24874,10 @@ snapshots:
dependencies:
ms: 2.1.3
+ dependencies:
+ ms: 2.1.3
+
dependencies:
ms: 2.1.3
@@ -26851,6 +26851,13 @@ snapshots:
quick-lru: 5.1.1
resolve-alpn: 1.2.1
+ dependencies:
+ agent-base: 7.1.3
+ debug: 4.4.1
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
agent-base: 7.1.3
@@ -28446,7 +28453,7 @@ snapshots:
dependencies:
exponential-backoff: 3.1.2
flow-enums-runtime: 0.0.6
- https-proxy-agent: 7.0.6([email protected])
+ https-proxy-agent: 7.0.6
metro-core: 0.83.3
transitivePeerDependencies:
- supports-color
@@ -31156,13 +31163,6 @@ snapshots:
react-lifecycles-compat: 3.0.4
warning: 4.0.3
- dependencies:
- react: 19.2.3
- react-native: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected])
- react-native-gesture-handler: 2.28.0([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected])
-
dependencies:
base-64: 0.1.0