Provide RTL support for new Navigator -- Make RTL works in NUX

Summary: Provide RTL support in NavigationPager

Reviewed By: fkgozali

Differential Revision: D3536850

fbshipit-source-id: 29890a125dc5e001b4c10208cd53bfeca0d9b5c3
This commit is contained in:
Mengjue Wang
2016-07-11 20:43:57 -07:00
committed by Facebook Github Bot 3
parent 471ee87445
commit 38a6eec0db
2 changed files with 20 additions and 6 deletions

View File

@@ -32,6 +32,8 @@
*/
'use strict';
const I18nManager = require('I18nManager');
import type {
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
@@ -87,11 +89,14 @@ function forHorizontal(props: NavigationSceneRendererProps): Object {
const index = scene.index;
const inputRange = [index - 1, index, index + 1];
const width = layout.initWidth;
const outputRange = I18nManager.isRTL ?
([-width, 0, width]: Array<number>) :
([width, 0, -width]: Array<number>);
const translateX = position.interpolate({
inputRange,
outputRange: ([width, 0, -width]: Array<number>),
outputRange,
});
return {