diff --git a/ios/ReactNativeKeyboardManager/ReactNativeKeyboardManager.m b/ios/ReactNativeKeyboardManager/ReactNativeKeyboardManager.m index b947564..52aeef6 100644 --- a/ios/ReactNativeKeyboardManager/ReactNativeKeyboardManager.m +++ b/ios/ReactNativeKeyboardManager/ReactNativeKeyboardManager.m @@ -1,5 +1,5 @@ // MIT License -// +// // Copyright (c) 2017 Douglas Nassif Roma Junior // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -70,8 +70,10 @@ + (BOOL)requiresMainQueueSetup // UIKeyboard handling RCT_EXPORT_METHOD(setEnable: (BOOL) enabled) { - if (debugging) RCTLogInfo(@"KeyboardManager.setEnable: %d", enabled); - [[IQKeyboardManager sharedManager] setEnable:enabled]; + dispatch_sync(dispatch_get_main_queue(), ^{ + if (debugging) RCTLogInfo(@"KeyboardManager.setEnable: %d", enabled); + [[IQKeyboardManager sharedManager] setEnable:enabled]; + }); } RCT_EXPORT_METHOD(setKeyboardDistanceFromTextField: (CGFloat) distance) { @@ -96,8 +98,10 @@ + (BOOL)requiresMainQueueSetup } RCT_EXPORT_METHOD(setEnableAutoToolbar: (BOOL) enabled) { - if (debugging) RCTLogInfo(@"KeyboardManager.setEnableAutoToolbar: %d", enabled); - [[IQKeyboardManager sharedManager] setEnableAutoToolbar:enabled]; + dispatch_sync(dispatch_get_main_queue(), ^{ + if (debugging) RCTLogInfo(@"KeyboardManager.setEnableAutoToolbar: %d", enabled); + [[IQKeyboardManager sharedManager] setEnableAutoToolbar:enabled]; + }); } RCT_EXPORT_METHOD(setShouldToolbarUsesTextFieldTintColor: (BOOL) enabled) {