From 8d0943765ec8ada6ab58e1aa598200234de38939 Mon Sep 17 00:00:00 2001 From: Tony Wong <63030915+tonytony2020@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:02:49 +0800 Subject: [PATCH] feat: Added support for custom button text on Android #332 --- lib/AppleButton.android.js | 5 ++++- lib/index.d.ts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/AppleButton.android.js b/lib/AppleButton.android.js index 86744a2f0..5be99d792 100644 --- a/lib/AppleButton.android.js +++ b/lib/AppleButton.android.js @@ -16,6 +16,7 @@ export default function AppleButton(props) { buttonType = ButtonTypes.DEFAULT, onPress, leftView, + buttonText, } = props; const _buttonStyle = [ @@ -30,11 +31,13 @@ export default function AppleButton(props) { textStyle, ]; + const text = buttonText ? buttonText : ButtonTexts[buttonType]; + return ( {!!leftView && leftView} - {ButtonTexts[buttonType]} + {text} ); diff --git a/lib/index.d.ts b/lib/index.d.ts index a13b5234e..03f3fbbeb 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -112,6 +112,11 @@ export interface AppleButtonProps { */ leftView?: React.ReactNode; + /** + * Android-only. Custom button text. + */ + buttonText?: string; + onPress: (event: GestureResponderEvent) => void; }