Skip to content

Commit

Permalink
Update Apple Pay Button type options to fit AppFolio's needs (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleG43 authored May 20, 2024
1 parent e3d5d54 commit 80024f2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
8 changes: 3 additions & 5 deletions ios/Views/PKPaymentButtonView.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ - (void)setButtonType:(NSString *) buttonType andStyle:(NSString *) buttonStyle
PKPaymentButtonType type;
PKPaymentButtonStyle style;

if ([buttonType isEqualToString: @"buy"]) {
type = PKPaymentButtonTypeBuy;
} else if ([buttonType isEqualToString: @"setUp"]) {
if ([buttonType isEqualToString: @"setUp"]) {
type = PKPaymentButtonTypeSetUp;
} else if ([buttonType isEqualToString: @"continue"]) {
type = PKPaymentButtonTypeContinue;
} else if ([buttonType isEqualToString: @"inStore"]) {
type = PKPaymentButtonTypeInStore;
} else if ([buttonType isEqualToString: @"donate"]) {
type = PKPaymentButtonTypeDonate;
} else {
type = PKPaymentButtonTypePlain;
}
Expand Down
31 changes: 14 additions & 17 deletions js/PKPaymentButton/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
// @flow

import * as React from 'react';
import { NativeModules, requireNativeComponent } from 'react-native';
import * as React from "react";
import { NativeModules, requireNativeComponent } from "react-native";

type PKPaymentButtonType =
// A button with the Apple Pay logo only.
| 'plain'
// A button with the text “Buy with” and the Apple Pay logo.
| 'buy'
// A button prompting the user to set up a card.
| 'setUp'
| "plain"
// A button with the text “Set up” and the Apple Pay logo.
| "setUp"
// A button with the text “Continue with” and the Apple Pay logo.
| "continue"
// A button with the text “Pay with” and the Apple Pay logo.
| 'inStore'
// A button with the text "Donate with" and the Apple Pay logo.
| 'donate';
| "inStore";

type PKPaymentButtonStyle =
// A white button with black lettering (shown here against a gray background to ensure visibility).
| 'white'
| "white"
// A white button with black lettering and a black outline.
| 'whiteOutline'
| "whiteOutline"
// A black button with white lettering.
| 'black';
| "black";

type Props = $Exact<{
style: ButtonStyle,
Expand All @@ -32,18 +30,17 @@ type Props = $Exact<{
onPress: Function,
}>;

const RNPKPaymentButton = requireNativeComponent('PKPaymentButton', null, {
const RNPKPaymentButton = requireNativeComponent("PKPaymentButton", null, {
nativeOnly: { onPress: true },
});


export type ButtonType = PKPaymentButtonType;
export type ButtonStyle = PKPaymentButtonStyle;

export class PKPaymentButton extends React.Component<Props> {
static defaultProps = {
buttonStyle: 'black',
buttonType: 'plain',
buttonStyle: "black",
buttonType: "plain",
height: 44,
cornerRadius: 4,
};
Expand Down

0 comments on commit 80024f2

Please sign in to comment.