Skip to content

Commit da43fed

Browse files
committed
add more complex example for custom events
1 parent 70d188c commit da43fed

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

examples/RNOneSignalTS/OSButtons.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,17 @@ class OSButtons extends React.Component<Props> {
435435
loggingFunction('Tracking event: ', 'ReactNative');
436436
const platform = Platform.OS; // This will be 'ios' or 'android'
437437
OneSignal.User.trackEvent(`ReactNative-${platform}`, {
438-
DEF: '456',
438+
someNum: 123,
439+
someString: 'abc',
440+
someBool: true,
441+
someObject: {
442+
abc: '123',
443+
nested: {
444+
def: '456',
445+
},
446+
},
447+
someArray: [1, 2, 3],
448+
someNull: null,
439449
});
440450
});
441451

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,8 @@ export namespace OneSignal {
614614
if (!isNativeModuleLoaded(RNOneSignal)) return;
615615

616616
if (!isObjectSerializable(properties)) {
617-
return console.error('Properties must be JSON-serializable');
617+
console.error('Properties must be JSON-serializable');
618+
return;
618619
}
619620

620621
RNOneSignal.trackEvent(name, properties);

0 commit comments

Comments
 (0)