88package com .facebook .react .modules .i18nmanager ;
99
1010import android .content .Context ;
11- import com .facebook .react . bridge . ContextBaseJavaModule ;
11+ import com .facebook .fbreact . specs . NativeI18nManagerSpec ;
1212import com .facebook .react .bridge .NativeModule ;
13- import com .facebook .react .bridge .ReactMethod ;
13+ import com .facebook .react .bridge .ReactApplicationContext ;
1414import com .facebook .react .common .MapBuilder ;
1515import com .facebook .react .module .annotations .ReactModule ;
1616import java .util .Locale ;
1717import java .util .Map ;
1818
1919/** {@link NativeModule} that allows JS to set allowRTL and get isRTL status. */
2020@ ReactModule (name = I18nManagerModule .NAME )
21- public class I18nManagerModule extends ContextBaseJavaModule {
21+ public class I18nManagerModule extends NativeI18nManagerSpec {
2222
2323 public static final String NAME = "I18nManager" ;
2424
2525 private final I18nUtil sharedI18nUtilInstance = I18nUtil .getInstance ();
2626
27- public I18nManagerModule (Context context ) {
27+ public I18nManagerModule (ReactApplicationContext context ) {
2828 super (context );
2929 }
3030
@@ -34,8 +34,8 @@ public String getName() {
3434 }
3535
3636 @ Override
37- public Map <String , Object > getConstants () {
38- final Context context = getContext ();
37+ public Map <String , Object > getTypedExportedConstants () {
38+ final Context context = getReactApplicationContext ();
3939 final Locale locale = context .getResources ().getConfiguration ().locale ;
4040
4141 final Map <String , Object > constants = MapBuilder .newHashMap ();
@@ -46,18 +46,18 @@ public Map<String, Object> getConstants() {
4646 return constants ;
4747 }
4848
49- @ ReactMethod
49+ @ Override
5050 public void allowRTL (boolean value ) {
51- sharedI18nUtilInstance .allowRTL (getContext (), value );
51+ sharedI18nUtilInstance .allowRTL (getReactApplicationContext (), value );
5252 }
5353
54- @ ReactMethod
54+ @ Override
5555 public void forceRTL (boolean value ) {
56- sharedI18nUtilInstance .forceRTL (getContext (), value );
56+ sharedI18nUtilInstance .forceRTL (getReactApplicationContext (), value );
5757 }
5858
59- @ ReactMethod
59+ @ Override
6060 public void swapLeftAndRightInRTL (boolean value ) {
61- sharedI18nUtilInstance .swapLeftAndRightInRTL (getContext (), value );
61+ sharedI18nUtilInstance .swapLeftAndRightInRTL (getReactApplicationContext (), value );
6262 }
6363}
0 commit comments