create-expo-cljs-app
Version:
Create a react native application with Expo and Shadow-CLJS!
56 lines (51 loc) • 1.33 kB
Flow
/**
* Copyright (c) Nicolas Gallagher.
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
type I18nManagerStatus = {
allowRTL: (allowRTL: boolean) => void,
forceRTL: (forceRTL: boolean) => void,
getConstants: () => Constants,
setPreferredLanguageRTL: (setRTL: boolean) => void,
swapLeftAndRightInRTL: (flipStyles: boolean) => void,
};
type Constants = {
doLeftAndRightSwapInRTL: boolean,
isRTL: boolean,
};
let doLeftAndRightSwapInRTL = true;
let isPreferredLanguageRTL = false;
let isRTLAllowed = true;
let isRTLForced = false;
declare var isRTL: () => any;
declare var onDirectionChange: () => any;
const I18nManager: I18nManagerStatus = {
allowRTL(bool) {
isRTLAllowed = bool;
onDirectionChange();
},
forceRTL(bool) {
isRTLForced = bool;
onDirectionChange();
},
getConstants(): Constants {
return {
doLeftAndRightSwapInRTL,
isRTL: isRTL()
};
},
setPreferredLanguageRTL(bool) {
isPreferredLanguageRTL = bool;
onDirectionChange();
},
swapLeftAndRightInRTL(bool) {
doLeftAndRightSwapInRTL = bool;
}
};
export default I18nManager;