Skip to main content
The feature flags module lets you enable or disable features remotely from the AppDNA Console. Flags are evaluated locally from cached config — no network call, no latency.

Check a Flag

if (AppDNA.features.isEnabled("dark_mode")) {
  enableDarkMode();
}
isEnabled() returns false by default if the flag does not exist or config has not loaded.

Module Access

const features = AppDNA.features;

Module Methods

MethodSignatureDescription
isEnabledisEnabled(flag: string): booleanCheck if a feature flag is enabled
getAllFlagsgetAllFlags(): Record<string, boolean>Get all flags and their states

Using Flags with Experiments

Gate a feature behind a flag, then run an experiment to test its impact:
if (AppDNA.features.isEnabled("new_workout_ui")) {
  const variant = AppDNA.experiments.getVariant("workout_ui_test");

  switch (variant) {
    case "compact":
      showCompactWorkoutUI();
      break;
    case "detailed":
      showDetailedWorkoutUI();
      break;
    default:
      showDefaultWorkoutUI();
  }
} else {
  showLegacyWorkoutUI();
}

Listen for Flag Changes

const unsubscribe = AppDNA.features.onFlagChanged((flag: string, enabled: boolean) => {
  if (flag === "maintenance_mode" && enabled) {
    showMaintenanceScreen();
  }
});

// Clean up
unsubscribe();

Full Example

import { AppDNA } from "@appdna/react-native-sdk";

function checkAccess(
  feature: string,
  onLocked: () => void,
  onUnlocked: () => void
) {
  if (AppDNA.features.isEnabled(feature)) {
    onUnlocked();
  } else {
    onLocked();
  }
}

// Usage
checkAccess(
  "ai_suggestions",
  () => {
    AppDNA.paywall.present("premium_paywall", {
      placement: "feature_gate",
    });
  },
  () => {
    showAISuggestions();
  }
);
Feature flags are managed in the Console under Settings > Feature Flags. Toggle a flag and it takes effect on the next SDK config refresh (default 5 minutes).