Skip to content

Commit 0061d7c

Browse files
Merge pull request #740 from BranchMetrics/gdeluna-branch/SDK-1517
[SDK-1517] [ReactNative] customData in track event crash if it's not string
2 parents 4d3b037 + 0fe94df commit 0061d7c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

android/src/main/java/io/branch/rnbranch/RNBranchModule.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,14 @@ public static BranchEvent createBranchEvent(String eventName, ReadableMap params
788788
ReadableMapKeySetIterator it = customData.keySetIterator();
789789
while (it.hasNextKey()) {
790790
String key = it.nextKey();
791-
event.addCustomDataProperty(key, customData.getString(key));
791+
792+
ReadableType readableType = customData.getType(key);
793+
if(readableType == ReadableType.String) {
794+
event.addCustomDataProperty(key, customData.getString(key));
795+
}
796+
else{
797+
Log.w(REACT_CLASS, "customData values must be strings. Value for property " + key + " is not a string type.");
798+
}
792799
}
793800
}
794801

src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class BranchEvent {
7171
description?: string;
7272
searchQuery?: string;
7373
alias?: string;
74-
customData?: Record<string, AnyDataType>;
74+
customData?: Record<string, string>;
7575

7676
/**
7777
* Standard Add to Cart event

0 commit comments

Comments
 (0)