Skip to content

Commit

Permalink
fix(QB-23259): check for valid data when rows are submitted (#291)
Browse files Browse the repository at this point in the history
* fix(QB-23259): check for valid data when rows are submitted

* fix(QB-23259): check for valid data when rows are submitted

* chore: swift lint

* chore: diable gradle version check
  • Loading branch information
vcellu committed Nov 13, 2023
1 parent 9aa0442 commit 3f64470
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ buildscript {
mavenCentral()
}
dependencies {
//noinspection AndroidGradlePluginVersion
classpath("com.android.tools.build:gradle:7.1.0")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ public View createViewInstance(ThemedReactContext reactContext) {
return new TableView(reactContext);
}

private void processRows(TableView tableView, ReadableMap rows) {
private boolean processRows(TableView tableView, ReadableMap rows) {
ReadableArray dataRows = rows.getArray("rows");
if(dataRows != null) {
boolean resetData = rows.getBoolean("reset");
RowFactory factory = new RowFactory(dataRows, tableView.getColumns());
List<DataRow> transformedRows = factory.getRows();
tableView.setRows(transformedRows, resetData);
return true;
}
return false;
}

private List<DataColumn> processColumns(TableView tableView, ReadableMap cols) {
Expand Down Expand Up @@ -132,7 +134,10 @@ public void setRows(View view, @Nullable ReadableMap source) {
}

TableView tableView = (TableView) (view);
processRows(tableView, source);
if(!processRows(tableView, source)) {
// prevent table from being initialized if data is invalid.
return;
}
if(tableView.needsReset) {
tableView.initialize();
}
Expand Down
4 changes: 0 additions & 4 deletions ios/LastColumnResizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

import Foundation
class LastColumnResizer: MultiColumnResizer {
override init(_ columnWidths: ColumnWidths, index: Int, bindTo bindedTableView: TableView) {
super.init(columnWidths, index: index, bindTo: bindedTableView)
}

override func didPan(_ translation: CGPoint) {
guard let tableView = self.tableView else { return }
guard let data = tableView.dataCollectionView else { return }
Expand Down
4 changes: 0 additions & 4 deletions ios/MulitColumnResizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ class MultiColumnResizer: ColumnResizerView {

var adjacentGrabber: MultiColumnResizer?

override init( _ columnWidths: ColumnWidths, index: Int, bindTo bindedTableView: TableView) {
super.init(columnWidths, index: index, bindTo: bindedTableView)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand Down

0 comments on commit 3f64470

Please sign in to comment.