From 1e58e58fc1ae49e2691e4d8cf613148173945525 Mon Sep 17 00:00:00 2001 From: Olufeyimi Gbenga Date: Wed, 15 Mar 2023 11:54:25 +0100 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..5c03bbf 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();