UNPKG

react-native-instant-restart

Version:

A lightweight and reliable React Native library to restart your application on both iOS and Android platforms

40 lines (39 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.restart = void 0; const react_native_1 = require("react-native"); const LINKING_ERROR = `The package 'react-native-instant-restart' doesn't seem to be linked. Make sure: \n\n` + react_native_1.Platform.select({ ios: "- Run 'pod install' in the ios/ directory\n", default: '', }) + '- You rebuilt the app after installing the package\n' + '- If you are using Expo, the module is not available in Expo Go\n'; const AppRestart = react_native_1.NativeModules.AppRestartModule ? react_native_1.NativeModules.AppRestartModule : new Proxy({}, { get() { throw new Error(LINKING_ERROR); }, }); /** * Restarts the application * * On iOS: Triggers a JS bundle reload * On Android: Completely restarts the whole app by relaunching the main activity * * @example * ```typescript * import AppRestart from 'react-native-instant-restart'; * * // Restart the app * AppRestart.restart(); * ``` */ function restart() { AppRestart.reload(); } exports.restart = restart; exports.default = { restart, };