diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java index 8e1e20ce9cd..b5c60c1ce35 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java @@ -317,7 +317,7 @@ private List getOrCreateButtonControllers(@Nullable Map {} diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarButtonControllerTest.java b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarButtonControllerTest.java index 80e11681c08..340bac43161 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarButtonControllerTest.java +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarButtonControllerTest.java @@ -30,7 +30,7 @@ public void beforeEach() { ButtonOptions button = createComponentButton(); uut = new ButtonController( activity, - new ButtonPresenter(button, new IconResolver(activity, ImageLoaderMock.mock())), + new ButtonPresenter(activity, button, new IconResolver(activity, ImageLoaderMock.mock())), button, new TitleBarButtonCreatorMock(), Mockito.mock(ButtonController.OnClickListener.class) diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarTest.java b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarTest.java index 98d5c83d9d1..b9fe7587896 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarTest.java +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarTest.java @@ -123,7 +123,7 @@ public void setTitleFontSize_usesDpInsteadofSp() { private ButtonController createButtonController(ButtonOptions b) { return new ButtonController( activity, - new ButtonPresenter(b, new IconResolverFake(activity)), + new ButtonPresenter(activity, b, new IconResolverFake(activity)), b, mock(TitleBarButtonCreator.class), mock(ButtonController.OnClickListener.class) diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarButtonControllerTest.java b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarButtonControllerTest.java index 66804e465d4..998c7bec60a 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarButtonControllerTest.java +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarButtonControllerTest.java @@ -47,7 +47,7 @@ public void beforeEach() { stackController.getTopBar().layout(0, 0, 1080, 200); getTitleBar().layout(0, 0, 1080, 200); - optionsPresenter = spy(new ButtonPresenter(button, new IconResolverFake(activity))); + optionsPresenter = spy(new ButtonPresenter(activity, button, new IconResolverFake(activity))); uut = new ButtonController(activity, optionsPresenter, button, buttonCreatorMock, (buttonId) -> {}); stackController.ensureViewIsCreated(); diff --git a/lib/src/interfaces/Options.ts b/lib/src/interfaces/Options.ts index a4b847d5973..1efc5525071 100644 --- a/lib/src/interfaces/Options.ts +++ b/lib/src/interfaces/Options.ts @@ -393,6 +393,10 @@ export interface OptionsTopBarButton { * #### (iOS specific) */ fontWeight?: FontWeight; + /** + * Set the font size in dp + */ + fontSize?: number; /** * Set the button enabled or disabled * @default true diff --git a/playground/src/screens/ButtonsScreen.tsx b/playground/src/screens/ButtonsScreen.tsx index bb8da269b71..268ed8e3dbf 100644 --- a/playground/src/screens/ButtonsScreen.tsx +++ b/playground/src/screens/ButtonsScreen.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { NavigationComponentProps } from 'react-native-navigation'; +import { NavigationComponent, Options } from 'react-native-navigation'; import Root from '../components/Root'; import Button from '../components/Button'; import Navigation from '../services/Navigation'; @@ -18,8 +18,8 @@ const { CHANGE_BUTTON_PROPS, } = testIDs; -export default class Options extends React.Component { - static options() { +export default class ButtonOptions extends NavigationComponent { + static options(): Options { return { fab: { id: 'fab', diff --git a/website/api/options-button.mdx b/website/api/options-button.mdx index ec949a6ebbd..3fe0c22b45d 100644 --- a/website/api/options-button.mdx +++ b/website/api/options-button.mdx @@ -25,6 +25,14 @@ This option will set whether characters are all capitalized or not. | ------- | -------- | -------- | ------- | | boolean | No | Android | true | +### `fontSize` + +If the button has text, this option is used to set font size in DP. + +| Type | Required | Platform | +| ------ | -------- | -------- | +| number | No | Both | + ### `id` Buttons are identified by their id property. When a button is clicked, a buttonPress event is emitted to js, containing the id of the clicked button.