Skip to content

Commit

Permalink
feat: Added support for custom button text on Android #332
Browse files Browse the repository at this point in the history
  • Loading branch information
tony95271 committed Oct 25, 2023
1 parent 029ce50 commit 7309c8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/AppleButton.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function AppleButton(props) {
buttonType = ButtonTypes.DEFAULT,
onPress,
leftView,
buttonText,
} = props;

const _buttonStyle = [
Expand All @@ -30,11 +31,13 @@ export default function AppleButton(props) {
textStyle,
];

const text = buttonText ? buttonText : ButtonTexts[buttonType];

return (
<TouchableOpacity onPress={onPress} activeOpacity={0.8} style={_buttonStyle}>
<View style={{ flexDirection: 'row' }}>
{!!leftView && leftView}
<Text style={_textStyle}>{ButtonTexts[buttonType]}</Text>
<Text style={_textStyle}>{text}</Text>
</View>
</TouchableOpacity>
);
Expand Down
5 changes: 5 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ export interface AppleButtonProps {
*/
leftView?: React.ReactNode;

/**
* Android-only. Custom button text.
*/
buttonText?: string;

onPress: (event: GestureResponderEvent) => void;
}

Expand Down

0 comments on commit 7309c8e

Please sign in to comment.