0.3.0 • Published 2 years ago

rn-update-version v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

rn-update-version

Download and update react-native app on android & iOS, customize your own UI.

Installation

npm install rn-update-version
# or
yarn add rn-update-version

Setup

In Xcode info.plist add LSApplicationQueriesSchemes and set value as array type included itms-apps to open AppStore.

Usage

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();

API

update(config: UpdateConfig)

Start update action, donwload and install app.

cancel

Cancel the update process.

listen(onProgress: (payload: ProgressPayload) => void,onError?: (payload: ErrorPayload) => void)

Event listeners during the update process.

useUpdateVersion

React hooks for the update process.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

0.3.0

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago