Permalink
Browse files

Wrap native module I18nManager with a new RCTI18nManager.js and fix c…

…urrent 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
  • Loading branch information...
1 parent d905af4 commit 471ee87445878bae729550b44421c5bbe6ccb999 @MengjueW MengjueW committed with Facebook Github Bot 3 Jul 12, 2016
@@ -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;
@@ -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,
@@ -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;

0 comments on commit 471ee87

Please sign in to comment.