Skip to content

Commit 6fb654f

Browse files
authored
Merge branch 'reactnativecn:master' into master
2 parents cb1b722 + 350bfa0 commit 6fb654f

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

Example/testHotUpdate/.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update",
3-
"version": "10.26.4",
3+
"version": "10.27.0",
44
"description": "react-native hot update",
55
"main": "src/index",
66
"scripts": {

src/provider.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ export const UpdateProvider = ({
100100
return false;
101101
}
102102
stateListener.current && stateListener.current.remove();
103+
104+
if (
105+
options.afterDownloadUpdate &&
106+
(await options.afterDownloadUpdate(info)) === false
107+
) {
108+
log('afterDownloadUpdate returned false, skipping');
109+
return false;
110+
}
103111
if (options.updateStrategy === 'silentAndNow') {
104112
client.switchVersion(hash);
105113
return true;
@@ -131,13 +139,7 @@ export const UpdateProvider = ({
131139
return false;
132140
}
133141
},
134-
[
135-
client,
136-
options.updateStrategy,
137-
alertUpdate,
138-
alertError,
139-
throwErrorIfEnabled,
140-
],
142+
[client, options, alertUpdate, alertError, throwErrorIfEnabled],
141143
);
142144

143145
const downloadAndInstallApk = useCallback(

src/type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export interface ClientOptions {
8888
throwError?: boolean;
8989
beforeCheckUpdate?: () => Promise<boolean>;
9090
beforeDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
91+
afterDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
9192
}
9293

9394
export interface UpdateTestPayload {

0 commit comments

Comments
 (0)