Skip to content

Commit 7f0d9cf

Browse files
committed
fix(android): run setReproConfigurations on UI thread
1 parent af58f4e commit 7f0d9cf

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -790,19 +790,24 @@ public void run() {
790790

791791
@ReactMethod
792792
public void setReproStepsConfig(final String bugMode, final String crashMode) {
793-
try {
794-
final Integer resolvedBugMode = ArgsRegistry.reproModes.get(bugMode);
795-
final Integer resolvedCrashMode = ArgsRegistry.reproModes.get(crashMode);
793+
MainThreadHandler.runOnMainThread(new Runnable() {
794+
@Override
795+
public void run() {
796+
try {
797+
final Integer resolvedBugMode = ArgsRegistry.reproModes.get(bugMode);
798+
final Integer resolvedCrashMode = ArgsRegistry.reproModes.get(crashMode);
796799

797-
final ReproConfigurations config = new ReproConfigurations.Builder()
798-
.setIssueMode(IssueType.Bug, resolvedBugMode)
799-
.setIssueMode(IssueType.Crash, resolvedCrashMode)
800-
.build();
800+
final ReproConfigurations config = new ReproConfigurations.Builder()
801+
.setIssueMode(IssueType.Bug, resolvedBugMode)
802+
.setIssueMode(IssueType.Crash, resolvedCrashMode)
803+
.build();
801804

802-
Instabug.setReproConfigurations(config);
803-
} catch (Exception e) {
804-
e.printStackTrace();
805-
}
805+
Instabug.setReproConfigurations(config);
806+
} catch (Exception e) {
807+
e.printStackTrace();
808+
}
809+
}
810+
});
806811
}
807812

808813
/**

0 commit comments

Comments
 (0)