Download and update react-native app on android & iOS, customize your own UI.
npm install rn-update-version
# or
yarn add rn-update-version
In Xcode
info.plist
addLSApplicationQueriesSchemes
and set value as array type includeditms-apps
to openAppStore
.
import UpdateVersion from 'rn-update-version';
// ...
const [percent, setPercent] = React.useState(0);
const [errorMessage, setErrorMessage] = React.useState('');
// for Android
UpdateVersion.update({ url: MOCK_URL });
// for iOS
UpdateVersion.update({ appleId: '444934666' });
// android only
UpdateVersion.cancel();
// android only
useEffect(() => {
const remove = UpdateVersion.listen(
(payload) => {
setPercent(payload.percent);
},
(info) => {
setErrorMessage(info.message!);
}
);
return remove;
}, []);
or use
useUpdateVersion
hook
import { useUpdateVersion } from 'rn-update-version';
// ...
const { update, cancel, progress, errorMsg } = useUpdateVersion();
Start update action, donwload and install app.
Cancel the update process.
Event listeners during the update process.
React hooks for the update process.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library