Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add continue apple pay button type option #16

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading