Skip to content

UpdateBanner

Animated banner component that appears when OTA updates are available.

Basic Usage

tsx
import { UpdateBanner } from '@ddedic/expo-fancy-ota-updates';

<UpdateBanner />

The banner automatically shows when an update is available and hides when dismissed.

Props

style

  • Type: ViewStyle
  • Required: No

Custom container style.

tsx
<UpdateBanner style={{ marginTop: 20 }} />

visible

  • Type: boolean
  • Required: No

Controlled visibility mode. When provided, you control when the banner shows.

tsx
const [showBanner, setShowBanner] = useState(false);

<UpdateBanner 
  visible={showBanner} 
  onDismiss={() => setShowBanner(false)} 
/>

onDismiss

  • Type: () => void
  • Required: No

Called when the banner is dismissed.

renderBanner

  • Type: (props: RenderBannerProps) => ReactNode
  • Required: No

Custom render function to completely replace the banner UI.

Custom Render

tsx
<UpdateBanner
  renderBanner={({ 
    isDownloaded, 
    isDownloading,
    otaVersion,
    onUpdate, 
    onRestart, 
    onDismiss,
    theme 
  }) => (
    <View style={{ backgroundColor: theme.colors.primary }}>
      <Text>{isDownloaded ? 'Ready!' : `v${otaVersion} available`}</Text>
      <Button 
        title={isDownloaded ? 'Restart' : 'Update'} 
        onPress={isDownloaded ? onRestart : onUpdate} 
      />
      <Button title="Later" onPress={onDismiss} />
    </View>
  )}
/>

RenderBannerProps

PropTypeDescription
isDownloadedbooleanUpdate downloaded and ready
isDownloadingbooleanCurrently downloading
otaVersionstringVersion number
otaChangelogstring[]Changelog items
onUpdate() => voidStart download
onRestart() => voidRestart app
onDismiss() => voidDismiss banner
themeOTAThemeCurrent theme
translationsOTATranslationsCurrent translations

Examples

Controlled Mode

tsx
function MyApp() {
  const [showBanner, setShowBanner] = useState(false);
  const { isUpdateAvailable } = useOTAUpdates();
  
  useEffect(() => {
    if (isUpdateAvailable) {
      setShowBanner(true);
    }
  }, [isUpdateAvailable]);
  
  return (
    <UpdateBanner 
      visible={showBanner}
      onDismiss={() => setShowBanner(false)}
    />
  );
}

Custom Styling

tsx
<UpdateBanner 
  style={{
    marginHorizontal: 16,
    marginTop: 20,
    borderRadius: 12,
  }}
/>

Features

  • Animated entrance/exit with smooth transitions
  • 🎨 Gradient background (if expo-linear-gradient installed)
  • 💫 Pulse animation to draw attention
  • 📱 Safe area aware respects device notches
  • 🎯 Auto-dismissible or controlled mode

Next Steps

Released under the MIT License.