Skip to main content

Feature Flags

The useFeatureFlags hook provides boolean toggles for remote feature control. Features can be enabled or disabled from the Stackfront dashboard without deploying a new app version.

Usage

import { useFeatureFlags } from 'react-native-stackfront-sdk';

function ConditionallyShowFeatures() {
  const flags = useFeatureFlags();

  return (
    <View>
      {flags?.storiesEnabled && <StoryHighlights />}
      {flags?.loyaltyEnabled && <LoyaltyCard />}
      {flags?.reviewsEnabled && <ReviewSummary />}
      {flags?.wishlistEnabled && <WishlistButton />}
      {flags?.announcementsEnabled && <AnnouncementBar />}
      {flags?.popupsEnabled && <PopupHandler />}
      {flags?.abandonedCartEnabled && <AbandonedCartReminder />}
      {flags?.liveVisitorCountEnabled && <VisitorCounter />}
      {flags?.recentPurchasePopupEnabled && <RecentPurchaseToast />}
    </View>
  );
}

Hook API

function useFeatureFlags(): SdkFeatureFlags | null

Available Flags

FlagDescription
storiesEnabledStory highlights carousel
loyaltyEnabledLoyalty points and tiers
reviewsEnabledProduct reviews
wishlistEnabledLocal wishlist
announcementsEnabledAnnouncement bar
popupsEnabledOn-screen popups
abandonedCartEnabledAbandoned cart push notifications
liveVisitorCountEnabledLive visitor count display
recentPurchasePopupEnabledRecent purchase notifications
subscriptionsEnabledSubscription/recurring purchase features
All flags default to false when the config hasn’t loaded yet.