mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Implement gating support for direction-aware API changes
Reviewed By: achen1 Differential Revision: D6045083 fbshipit-source-id: 857a43029ad88d2324ec77145a1e30d92b5e8fae
This commit is contained in:
1 parent
f7888310d4
commit
98547d4bcf
6 files changed
+41
-1
No files matched your search
@@ -29,10 +29,16 @@ RCT_EXPORT_METHOD(forceRTL:(BOOL)value)
|
||||
[[RCTI18nUtil sharedInstance] forceRTL:value];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(makeRTLFlipLeftAndRightStyles:(BOOL)value)
|
||||
{
|
||||
[[RCTI18nUtil sharedInstance] makeRTLFlipLeftAndRightStyles:value];
|
||||
}
|
||||
|
||||
- (NSDictionary *)constantsToExport
|
||||
{
|
||||
return @{
|
||||
@"isRTL": @([[RCTI18nUtil sharedInstance] isRTL])
|
||||
@"isRTL": @([[RCTI18nUtil sharedInstance] isRTL]),
|
||||
@"doesRTLFlipLeftAndRightStyles": @([[RCTI18nUtil sharedInstance] doesRTLFlipLeftAndRightStyles])
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,7 @@
|
||||
- (void)allowRTL:(BOOL)value;
|
||||
- (BOOL)isRTLForced;
|
||||
- (void)forceRTL:(BOOL)value;
|
||||
- (BOOL)doesRTLFlipLeftAndRightStyles;
|
||||
- (void)makeRTLFlipLeftAndRightStyles:(BOOL)value;
|
||||
|
||||
@end
|
||||
@@ -19,6 +19,7 @@
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [self new];
|
||||
[sharedInstance makeRTLFlipLeftAndRightStyles: true];
|
||||
});
|
||||
|
||||
return sharedInstance;
|
||||
@@ -78,6 +79,17 @@
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
- (BOOL)doesRTLFlipLeftAndRightStyles
|
||||
{
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:@"RCTI18nUtil_makeRTLFlipLeftAndRightStyles"];
|
||||
}
|
||||
|
||||
- (void)makeRTLFlipLeftAndRightStyles:(BOOL)value
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setBool:value forKey:@"RCTI18nUtil_makeRTLFlipLeftAndRightStyles"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
// Check if the current device language is RTL
|
||||
- (BOOL)isDevicePreferredLanguageRTL
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user