mirror of
https://github.com/VibedByKaKi/t3-code-android-nightly.git
synced 2026-10-10 20:31:16 +02:00
102 lines
3.4 KiB
Swift
102 lines
3.4 KiB
Swift
import ExpoModulesCore
|
|
|
|
public class T3ReviewDiffModule: Module {
|
|
public func definition() -> ModuleDefinition {
|
|
Name("T3ReviewDiffSurface")
|
|
|
|
View(T3ReviewDiffView.self) {
|
|
Prop("tokensResetKey") { (view: T3ReviewDiffView, tokensResetKey: String) in
|
|
view.setTokensResetKey(tokensResetKey)
|
|
}
|
|
|
|
Prop("contentResetKey") { (view: T3ReviewDiffView, contentResetKey: String) in
|
|
view.setContentResetKey(contentResetKey)
|
|
}
|
|
|
|
Prop("collapsedFileIdsJson") { (view: T3ReviewDiffView, collapsedFileIdsJson: String) in
|
|
view.setCollapsedFileIdsJson(collapsedFileIdsJson)
|
|
}
|
|
|
|
Prop("viewedFileIdsJson") { (view: T3ReviewDiffView, viewedFileIdsJson: String) in
|
|
view.setViewedFileIdsJson(viewedFileIdsJson)
|
|
}
|
|
|
|
Prop("selectedRowIdsJson") { (view: T3ReviewDiffView, selectedRowIdsJson: String) in
|
|
view.setSelectedRowIdsJson(selectedRowIdsJson)
|
|
}
|
|
|
|
Prop("collapsedCommentIdsJson") { (view: T3ReviewDiffView, collapsedCommentIdsJson: String) in
|
|
view.setCollapsedCommentIdsJson(collapsedCommentIdsJson)
|
|
}
|
|
|
|
Prop("appearanceScheme") { (view: T3ReviewDiffView, appearanceScheme: String) in
|
|
view.setAppearanceScheme(appearanceScheme)
|
|
}
|
|
|
|
Prop("themeJson") { (view: T3ReviewDiffView, themeJson: String) in
|
|
view.setThemeJson(themeJson)
|
|
}
|
|
|
|
Prop("styleJson") { (view: T3ReviewDiffView, styleJson: String) in
|
|
view.setStyleJson(styleJson)
|
|
}
|
|
|
|
Prop("rowHeight") { (view: T3ReviewDiffView, rowHeight: Double) in
|
|
view.setRowHeight(CGFloat(rowHeight))
|
|
}
|
|
|
|
Prop("contentWidth") { (view: T3ReviewDiffView, contentWidth: Double) in
|
|
view.setContentWidth(CGFloat(contentWidth))
|
|
}
|
|
|
|
Prop("contentInsetTop") { (view: T3ReviewDiffView, inset: Double) in
|
|
view.setContentInsetTop(CGFloat(inset))
|
|
}
|
|
|
|
Prop("contentInsetBottom") { (view: T3ReviewDiffView, inset: Double) in
|
|
view.setContentInsetBottom(CGFloat(inset))
|
|
}
|
|
|
|
Prop("initialRowIndex") { (view: T3ReviewDiffView, initialRowIndex: Double) in
|
|
view.setInitialRowIndex(initialRowIndex)
|
|
}
|
|
|
|
Prop("refreshing") { (view: T3ReviewDiffView, refreshing: Bool) in
|
|
view.setRefreshing(refreshing)
|
|
}
|
|
|
|
Events(
|
|
"onDebug",
|
|
"onVisibleFileChange",
|
|
"onToggleFile",
|
|
"onToggleViewedFile",
|
|
"onPressLine",
|
|
"onToggleComment",
|
|
"onPullToRefresh"
|
|
)
|
|
|
|
AsyncFunction("scrollToFile") { (view: T3ReviewDiffView, fileId: String, animated: Bool) in
|
|
view.scrollToFile(fileId, animated: animated)
|
|
}
|
|
|
|
AsyncFunction("scrollToTop") { (view: T3ReviewDiffView, animated: Bool) in
|
|
view.scrollToTop(animated: animated)
|
|
}
|
|
|
|
// Large, frequently changing JSON values cannot be regular Fabric props. Expo's
|
|
// prop adapter compares strings on the main thread before invoking a setter, which
|
|
// makes a syntax-token patch capable of blocking a frame by itself.
|
|
AsyncFunction("setRowsJson") { (view: T3ReviewDiffView, rowsJson: String) in
|
|
view.setRowsJson(rowsJson)
|
|
}
|
|
|
|
AsyncFunction("setTokensJson") { (view: T3ReviewDiffView, tokensJson: String) in
|
|
view.setTokensJson(tokensJson)
|
|
}
|
|
|
|
AsyncFunction("setTokensPatchJson") { (view: T3ReviewDiffView, tokensPatchJson: String) in
|
|
view.setTokensPatchJson(tokensPatchJson)
|
|
}
|
|
}
|
|
}
|
|
}
|