-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: add view manager * feat: expose minichart * fix: serialize data for mini charts * fix: crash on null urlPosition Co-authored-by: Vittorio Cellucci <vel@qlik.com>
- Loading branch information
Showing
13 changed files
with
193 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
android/src/main/java/com/qliktrialreactnativestraighttable/MiniChartViewManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.qliktrialreactnativestraighttable; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.os.Build; | ||
import android.util.Log; | ||
import android.view.View; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.annotation.RequiresApi; | ||
|
||
import com.facebook.react.bridge.ReadableArray; | ||
import com.facebook.react.bridge.ReadableMap; | ||
import com.facebook.react.common.MapBuilder; | ||
import com.facebook.react.uimanager.SimpleViewManager; | ||
import com.facebook.react.uimanager.ThemedReactContext; | ||
import com.facebook.react.uimanager.annotations.ReactProp; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class MiniChartViewManager extends SimpleViewManager<View> { | ||
public static final String REACT_CLASS = "MiniChartView"; | ||
public ReadableMap column = null; | ||
public ReadableMap cell = null; | ||
@Override | ||
@NonNull | ||
public String getName() { | ||
return REACT_CLASS; | ||
} | ||
|
||
@SuppressLint("NewApi") | ||
@Override | ||
@NonNull | ||
public View createViewInstance(ThemedReactContext reactContext) { | ||
MiniChartView miniChartView = new MiniChartView(reactContext); | ||
return miniChartView; | ||
} | ||
|
||
@ReactProp(name = "colData") | ||
public void setCol(View view, ReadableMap col) { | ||
MiniChartView miniChartView = (MiniChartView) view; | ||
column = col; | ||
|
||
if (cell != null) { | ||
setupMiniChart(miniChartView); | ||
} | ||
} | ||
|
||
@ReactProp(name = "rowData") | ||
public void setCell(View view, ReadableMap cell) { | ||
MiniChartView miniChartView = (MiniChartView) view; | ||
this.cell = cell; | ||
|
||
if (column != null) { | ||
setupMiniChart(miniChartView); | ||
} | ||
} | ||
|
||
public void setupMiniChart(MiniChartView miniChartView) { | ||
DataColumn dataColumn = new DataColumn(column, 0); | ||
DataCell dataCell = new DataCell(cell, dataColumn); | ||
|
||
miniChartView.setData(dataCell, dataColumn); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters