-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create event interface #7
Conversation
@@ -108,7 +108,7 @@ dependencies { | |||
// For < 0.71, this will be from the local maven repo | |||
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin | |||
//noinspection GradleDynamicVersion | |||
implementation "com.facebook.react:react-android:0.73.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep a pinned version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yah or maybe a range of versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it
export interface Spec extends TurboModule { | ||
createEvent(event: IEvent): void; | ||
} | ||
export interface KlaviyoSpec extends TurboModule, KlaviyoEventAPI {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may cause a turbo modules issue. I was about to suggest we extract this interface to its own file but I happened on this first which explains some naming conventions involved in turbo modules code gen. It mentions the filename, but doesn't say whether this interface has to be called Spec
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yea here we go https://dev.to/amazonappdev/a-guide-to-turbo-modules-in-react-native-5aa3
This interface type must be named Spec for a Turbo Module.
Maybe lets leave this file as-is from the code generator, and have a IKlaviyo
in a separate file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean sure the naming of the file can be Spec if thats required but i dont see a point in defining another interface that mirrors this spec interface
properties?: Object; | ||
type KlaviyoEventPropertyType = EventProperty | string; | ||
|
||
export interface KlaviyoEventAPI { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
|
||
interface IKlaviyo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll wind up with IKlaviyo again for initialize
, but we can add it back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can just implement Spec instead if thats the case, as long as its a single interface
KlaviyoReactNativeSdk.createEvent(event); | ||
export const Klaviyo: KlaviyoSpec = { | ||
createEvent(name: EventType, properties?: Record<any, Object>): void { | ||
this.createCustomEvent(name, properties); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need .toString()
?
No description provided.