From 74124320277b211a11ca0ad1409ce6ff66d2543f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=83=E1=85=A9=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=A7=E1=86=AB?= Date: Wed, 15 Aug 2018 00:35:41 +0900 Subject: [PATCH 1/4] Add disabled attribute to NavbarButton component in index.js --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index d132036..a7b645e 100644 --- a/index.js +++ b/index.js @@ -42,6 +42,7 @@ function getButtonElement(data, style) { style={[data.style, style]} tintColor={data.tintColor} handler={data.handler} + disabled={data.disabled} accessible={data.accessible} accessibilityLabel={data.accessibilityLabel} /> From 635712849aa133869f3b10ab4820c928e86d4982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=83=E1=85=A9=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=A7=E1=86=AB?= Date: Wed, 15 Aug 2018 00:43:45 +0900 Subject: [PATCH 2/4] Change disabled button style --- NavbarButton.js | 1 + 1 file changed, 1 insertion(+) diff --git a/NavbarButton.js b/NavbarButton.js index adee186..0be67bb 100644 --- a/NavbarButton.js +++ b/NavbarButton.js @@ -26,6 +26,7 @@ export default function NavbarButton(props) { disabled={disabled} accessible={accessible} accessibilityLabel={accessibilityLabel} + style={disabled ? { opacity: 0.4 } : {}} > {title} From 41643fd20585663fd38a7581883ddd933d7b3537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=83=E1=85=A9=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=A7=E1=86=AB?= Date: Wed, 15 Aug 2018 00:50:18 +0900 Subject: [PATCH 3/4] apply changed style to Text component not TouchableOpacity component --- NavbarButton.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NavbarButton.js b/NavbarButton.js index 0be67bb..a5e3f3c 100644 --- a/NavbarButton.js +++ b/NavbarButton.js @@ -18,6 +18,7 @@ export default function NavbarButton(props) { accessible, accessibilityLabel } = props; + const disabledStyle = disabled ? { opacity: 0.6 } : {}; return ( - {title} + {title} ); From 86e02f398006bc6364faa538b721d7d93b8d37c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=83=E1=85=A9=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=A7=E1=86=AB?= Date: Tue, 21 Aug 2018 16:33:25 +0900 Subject: [PATCH 4/4] Add title component container custom styles prop --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index a7b645e..81dd381 100644 --- a/index.js +++ b/index.js @@ -51,9 +51,9 @@ function getButtonElement(data, style) { ); } -function getTitleElement(data) { +function getTitleElement(data, style) { if (!data || data.props) { - return {data}; + return {data}; } const colorStyle = data.tintColor ? { color: data.tintColor } : null; @@ -88,6 +88,7 @@ export default class NavigationBar extends Component { PropTypes.oneOf([null]), ]), containerStyle: ViewPropTypes.style, + titleStyle: ViewPropTypes.style }; static defaultProps = { @@ -103,6 +104,7 @@ export default class NavigationBar extends Component { showAnimation: 'slide', }, containerStyle: {}, + titleStyle: {} }; componentDidMount() { @@ -131,6 +133,7 @@ export default class NavigationBar extends Component { render() { const { containerStyle, + titleStyle, tintColor, title, leftButton, @@ -153,7 +156,7 @@ export default class NavigationBar extends Component { {statusBar} - {getTitleElement(title)} + {getTitleElement(title, titleStyle)} {getButtonElement(leftButton, { marginLeft: 8 })} {getButtonElement(rightButton, { marginRight: 8 })}