From 4362d2b904d8d61518c0dc290faa428b0fb74c7a Mon Sep 17 00:00:00 2001 From: Haithem Date: Tue, 10 Oct 2023 18:16:52 +0300 Subject: [PATCH] Add RTL support --- src/hooks.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks.ts b/src/hooks.ts index 82083c8..2c5b079 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from "react"; -import { Animated } from "react-native"; +import { Animated, I18nManager } from "react-native"; import { SIZE_DEFAULT } from "./constants"; import { ThumbButton, ThumbChildrenPlacement, TrackBar } from "./types"; @@ -45,7 +45,7 @@ export const useToggleValue = ( const toValue = toggleState ? distance : 0; Animated.timing(fadeAnim, { - toValue, + toValue: I18nManager.isRTL ? -toValue : toValue, duration: animationDuration, useNativeDriver: true, }).start();