Istanbul Paywall

The Istanbul Paywall component is designed to provide a sleek and modern user interface for subscription-based paywalls. This component is fully customizable, allowing you to tailor the design and behavior to suit your app's branding and user needs.


Features

  • Customizable Appearance
    Change colors, text, and dimensions to match your app's style.

  • Flexible Layout
    Includes options for header text, description, pricing, and additional links.

  • Responsive Design
    Adapts to various screen sizes for a seamless user experience.


Props

Here are the available props for the Istanbul Paywall component:

PropTypeDefaultDescription
visiblebooleanfalseControls the visibility of the paywall.
onContinue(index: number)RequiredCallback triggered when the user presses the continue button.
onClose() => voidRequiredCallback triggered when the close button is pressed.
headerTextstring''The main title of the paywall.
descriptionTextstring''The subtitle or description of the paywall.
priceTextstring''The pricing information displayed to the user.
imageComponentReact.ReactNodeRequiredA custom image component to display at the top of the paywall.
textButtonsArray[]Additional buttons with custom actions (e.g., Privacy, Terms, Restore).
backgroundColorstring'#FFFFFF'Background color of the paywall.
closeButtonBgColorstring'rgba(0, 0, 0, 0.5)'Background color of the close button.
closeButtonTextColorstring'#FFFFFF'Text color of the close button.
closeButtonDelaynumber0Delay in milliseconds before the close button appears.
displayCloseButtonbooleantrueControls whether the close button is displayed.
buttonTextstring'Continue'Text displayed on the main button.
buttonBgColorstring'#4CAF50'Background color of the main button.
buttonTextColorstring'#FFFFFF'Text color of the main button.
buttonRadiusnumber55Corner radius of the main button.
buttonWidthPercentagenumber80Width of the button as a percentage of the screen width.
textButtonColorstring'#666666'Text color for additional link buttons.
textButtonUnderlinebooleantrueControls whether additional link buttons are underlined.

Example Usage

Here’s an example of how to use the Istanbul Paywall component:

import React from 'react';
import { View, Button } from 'react-native';
import { usePaywall } from 'react-native-paywall';

const App = () => {
  // Initialize the usePaywall hook
  const { showPaywall, hidePaywall, PaywallComponent } = usePaywall();

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      {/* Button to trigger the paywall */}
      <Button title="Show Paywall" onPress={() => showPaywall('istanbul')} />

      {/* Render the paywall component */}
      <PaywallComponent
        onContinue={(selectedIndex) => {
          console.log(`User continued with plan index: ${selectedIndex}`);
          hidePaywall(); // Hide the paywall after selection
        }}
        headerText="Ignite your child's curiosity"
        descriptionText="Get access to all our educational content trusted by thousands of parents"
        buttonText="Subscribe Now"
        products={[
          {
            identifier: '$rc_monthly',
            product: {
              title: 'Monthly Plan',
              priceString: '$4.99',
            },
          },
          {
            identifier: '$rc_annual',
            product: {
              title: 'Annual Plan',
              priceString: '$39.99',
            },
          },
        ]}
        backgroundColor="#f0f0f0"
        buttonBgColor="#008CBA"
        buttonTextColor="#FFFFFF"
      />
    </View>
  );
};

export default App;

Styling the Component

The Istanbul Paywall provides a default style, but you can customize it through the following props:

  • Button Styling: Adjust colors, text, and dimensions with buttonBgColor, buttonTextColor, buttonRadius, and buttonWidthPercentage.
  • Close Button Styling: Change its appearance with closeButtonBgColor and closeButtonTextColor.
  • Background: Use the backgroundColor prop for a custom background.