npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-app-restart

v1.0.0-alpha.23

Published

A simple and efficient way to restart your React Native app programmatically

Downloads

99

Readme

React Native Restart App

A lightweight and efficient React Native library that provides native app restart functionality for both iOS and Android platforms. Perfect for scenarios where you need to completely reset your app's state or handle critical errors.

npm npm GitHub

Features

  • 🔄 Native implementation for both iOS and Android
  • ⚡️ Lightweight and performant
  • 🎯 Simple and intuitive API
  • 🔧 Zero additional dependencies
  • 📱 Cross-platform support
  • 🛠 TypeScript support

Installation

# Using npm
npm install react-native-restart-app

# Using yarn
yarn add react-native-restart-app

iOS Setup

After installing the package, navigate to your iOS directory and install the pods:

cd ios && pod install && cd ..

Android Setup

Add the package to your MainApplication.java:

import com.reactnativerestartapp.RestartAppPackage;

// Inside getPackages() method
@Override
protected List<ReactPackage> getPackages() {
  List<ReactPackage> packages = new PackageList(this).getPackages();
  packages.add(new RestartAppPackage());
  return packages;
}

Usage

Basic Usage

import RestartApp from "react-native-restart-app";

// Restart the app
RestartApp.restart();

Example Component

import React from 'react';
import { View, Button, StyleSheet } from 'react-native';
import RestartApp from 'react-native-restart-app';

const App = () => {
  const handleRestart = () => {
    RestartApp.restart();
  };

  return (
    <View style={styles.container}>
      <Button
        title="Restart App"
        onPress={handleRestart}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

export default App;

How It Works

iOS Implementation

The iOS implementation recreates the root view controller, effectively restarting the app from scratch. This ensures a clean state and proper memory management.

Android Implementation

The Android implementation uses the package manager to launch a fresh instance of the app with the FLAG_ACTIVITY_CLEAR_TOP flag, which clears the activity stack and starts a new instance.

Platform-Specific Behavior

iOS

  • Performs a complete app restart
  • Clears all view controllers
  • Resets the root window
  • Maintains system-level state

Android

  • Launches a fresh instance of the app
  • Clears the activity stack
  • Maintains background state
  • Preserves system-level configurations

Best Practices

  1. Error Handling: Use this library as part of your error recovery strategy
  2. State Management: Consider saving critical state before restarting
  3. User Experience: Provide feedback to users before restarting
  4. Testing: Test thoroughly in both debug and release modes

Contributing

We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

  1. Fork the repository
  2. Clone your fork
  3. Install dependencies: npm install
  4. Make your changes
  5. Run tests: npm test
  6. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

[Your Name] - @yourtwitter

Support

If you find this library useful, please consider:

  • ⭐️ Starring the repository
  • 📝 Opening issues for bugs or feature requests
  • 💪 Contributing to the project
  • ☕️ Buy me a coffee

Acknowledgments

  • React Native team for the amazing framework
  • All contributors who have helped improve this library
  • The open-source community for inspiration and support