Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix Animation Active segmant width in RTL
  • Loading branch information
anastely committed Sep 2, 2020
commit 5eab584b4fe7b298b9e5bb9578821e92250d1b97
5 changes: 3 additions & 2 deletions js/SegmentedControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'use strict';

import * as React from 'react';
import {Animated, Easing, StyleSheet, View} from 'react-native';
import {Animated,I18nManager, Easing, StyleSheet, View} from 'react-native';
import {SegmentedControlTab} from './SegmentedControlTab';

import type {SegmentedControlProps} from './types';
Expand Down Expand Up @@ -43,8 +43,9 @@ const SegmentedControl = ({

React.useEffect(() => {
if (animation && segmentWidth) {
let isRTL = I18nManager.isRTL ? -segmentWidth : segmentWidth;
Animated.timing(animation, {
toValue: segmentWidth * (selectedIndex || 0),
toValue: isRTL * (selectedIndex || 0),
duration: 300,
easing: Easing.out(Easing.quad),
useNativeDriver: true,
Expand Down