Wrap native module I18nManager with a new RCTI18nManager.js and fix current use of native module I18nManager

Summary: create new RCTI18nManager.js to warp-up native module I18nManager and fix current use of it.

Reviewed By: ericvicenti

Differential Revision: D3547427

fbshipit-source-id: 53a695c94ca6bba2f566d0725c553e58d60bf451
This commit is contained in:
Mengjue Wang 2016-07-11 20:43:53 -07:00 committed by Facebook Github Bot 3
parent d905af4736
commit 471ee87445
3 changed files with 29 additions and 3 deletions

View File

@ -33,10 +33,10 @@
var Dimensions = require('Dimensions');
var PixelRatio = require('PixelRatio');
var I18nManager = require('I18nManager');
var buildStyleInterpolator = require('buildStyleInterpolator');
var I18nManager = require('NativeModules').I18nManager || {};
var IS_RTL = I18nManager.isRTL;
var SCREEN_WIDTH = Dimensions.get('window').width;

View File

@ -25,6 +25,7 @@
const Animated = require('Animated');
const PanResponder = require('PanResponder');
const I18nManager = require('I18nManager');
const React = require('React');
const StyleSheet = require('StyleSheet');
const TimerMixin = require('react-timer-mixin');
@ -34,7 +35,6 @@ const {PropTypes} = React;
const emptyFunction = require('fbjs/lib/emptyFunction');
const I18nManager = require('NativeModules').I18nManager || {};
const IS_RTL = I18nManager.isRTL;
// NOTE: Eventually convert these consts to an input object of configurations
@ -308,7 +308,9 @@ const SwipeableRow = React.createClass({
* When swiping right, we want to bounce back past closed position on release
* so users know they should swipe right to get content.
*/
const swipeBounceBackDistance = IS_RTL ? -RIGHT_SWIPE_BOUNCE_BACK_DISTANCE : RIGHT_SWIPE_BOUNCE_BACK_DISTANCE;
const swipeBounceBackDistance = IS_RTL ?
-RIGHT_SWIPE_BOUNCE_BACK_DISTANCE :
RIGHT_SWIPE_BOUNCE_BACK_DISTANCE;
this._animateTo(
-swipeBounceBackDistance,
duration,

View File

@ -0,0 +1,24 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule I18nManager
* @flow
*/
'use strict';
type I18nManagerStatus = {
isRTL: boolean,
allowRTL: (allowRTL: boolean) => {},
};
const I18nManager : I18nManagerStatus = require('NativeModules').I18nManager || {
isRTL: false,
allowRTL: () => {},
};
module.exports = I18nManager;