Skip to content

Commit

Permalink
Fix title height not being set on Android (#4587)
Browse files Browse the repository at this point in the history
Set topBar title height property
  • Loading branch information
davrosull authored and guyca committed Jan 16, 2019
1 parent 83f69d4 commit 09c8c37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.reactnativenavigation.parse.params.Text;
import com.reactnativenavigation.parse.parsers.ColorParser;
import com.reactnativenavigation.parse.parsers.FractionParser;
import com.reactnativenavigation.parse.parsers.NumberParser;
import com.reactnativenavigation.parse.parsers.TextParser;
import com.reactnativenavigation.utils.TypefaceLoader;

Expand All @@ -30,6 +31,7 @@ public static TitleOptions parse(TypefaceLoader typefaceManager, JSONObject json
options.fontSize = FractionParser.parse(json, "fontSize");
options.fontFamily = typefaceManager.getTypeFace(json.optString("fontFamily", ""));
options.alignment = Alignment.fromString(TextParser.parse(json, "alignment").get(""));
options.height = NumberParser.parse(json, "height");

return options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
public class OptionsTest extends BaseTest {

private static final String TITLE = "the title";
private static final Number TITLE_HEIGHT = new Number(100);
private static final String FAB_ID = "FAB";
private static final String FAB_ALIGN_HORIZONTALLY = "right";
private static final String FAB_ALIGN_VERTICALLY = "bottom";
Expand Down Expand Up @@ -83,6 +84,7 @@ public void parsesJson() throws Exception {
private void assertResult(Options result) {
assertThat(result.topBar.title.text.get()).isEqualTo(TITLE);
assertThat(result.topBar.background.color.get()).isEqualTo(TOP_BAR_BACKGROUND_COLOR);
assertThat(result.topBar.title.height.get()).isEqualTo(TITLE_HEIGHT.get());
assertThat(result.topBar.title.color.get()).isEqualTo(TOP_BAR_TEXT_COLOR);
assertThat(result.topBar.title.fontSize.get()).isEqualTo(TOP_BAR_FONT_SIZE);
assertThat(result.topBar.title.fontFamily).isEqualTo(TOP_BAR_TYPEFACE);
Expand Down Expand Up @@ -134,6 +136,7 @@ private JSONObject createBackground() throws JSONException {
private JSONObject createTitle() throws JSONException {
return new JSONObject()
.put("text", "the title")
.put("height", TITLE_HEIGHT.get())
.put("color", TOP_BAR_TEXT_COLOR)
.put("fontSize", TOP_BAR_FONT_SIZE)
.put("fontFamily", TOP_BAR_FONT_FAMILY);
Expand Down

0 comments on commit 09c8c37

Please sign in to comment.