mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 12:34:17 +00:00
09680f71df
Summary: In modern Objective-C you should use the `instancetype` keyword for methods which return an instance of the class they are called on. See Apple's [Adopting Modern Objective-C](https://developer.apple.com/library/content/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObjective-C/AdoptingModernObjective-C.html) guide. Because `sharedInstance` was returning an object of type `id`, the returned value needed to be cast before it could be used in Swift. I also changed the implementation of `sharedInstance` to use Grand Central Dispatch, which is the generally accepted best way of creating a singleton in Objective-C. I verified my changes with the "RTLExample" app in RNTester. | LTR | RTL | |---|---| |<img width="300" src="https://user-images.githubusercontent.com/1413388/31155210-6454b4d6-a87a-11e7-9dd7-9a52f3924737.png">|<img width="300" src="https://user-images.githubusercontent.com/1413388/31155233-8702aff6-a87a-11e7-8028-51cf2b3eb0c4.png">| Closes https://github.com/facebook/react-native/pull/16196 Differential Revision: D5971898 Pulled By: shergin fbshipit-source-id: dfa375c89248adfc9fd885cacc6a6d4cbfea6e90
29 lines
788 B
Objective-C
29 lines
788 B
Objective-C
/**
|
|
* 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.
|
|
*/
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
/**
|
|
* @experimental
|
|
* This is a experimental module for to expose constance IsRTL to js about the RTL status.
|
|
* And it allows js to force RLT status for development propose.
|
|
* This will also provide other i18n related utilities in the future.
|
|
*/
|
|
@interface RCTI18nUtil : NSObject
|
|
|
|
+ (instancetype)sharedInstance;
|
|
|
|
- (BOOL)isRTL;
|
|
- (BOOL)isRTLAllowed;
|
|
- (void)allowRTL:(BOOL)value;
|
|
- (BOOL)isRTLForced;
|
|
- (void)forceRTL:(BOOL)value;
|
|
|
|
@end
|