diff --git a/Example/testHotUpdate/package.json b/Example/testHotUpdate/package.json index baacd74..c0dddf2 100644 --- a/Example/testHotUpdate/package.json +++ b/Example/testHotUpdate/package.json @@ -18,7 +18,7 @@ "react-native": "0.69.8", "react-native-paper": "^5.12.1", "react-native-safe-area-context": "^4.8.2", - "react-native-update": "^10.2.6", + "react-native-update": "^10.5.3", "react-native-vector-icons": "^10.0.3" }, "devDependencies": { diff --git a/package.json b/package.json index 997ca01..7bde1f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-update", - "version": "10.5.3", + "version": "10.5.4", "description": "react-native hot update", "main": "src/index", "scripts": { diff --git a/src/client.ts b/src/client.ts index c98d035..4810f40 100644 --- a/src/client.ts +++ b/src/client.ts @@ -50,8 +50,10 @@ export class Pushy { version = cInfo.pushy; constructor(options: PushyOptions) { - if (!options.appKey) { - throw new Error('appKey is required'); + if (Platform.OS === 'ios' || Platform.OS === 'android') { + if (!options.appKey) { + throw new Error('appKey is required'); + } } this.setOptions(options); } diff --git a/src/provider.tsx b/src/provider.tsx index 518d997..5389c8f 100644 --- a/src/provider.tsx +++ b/src/provider.tsx @@ -120,6 +120,9 @@ export const PushyProvider = ({ showAlert('更新检查失败', e.message); return; } + if (!info) { + return; + } updateInfoRef.current = info; setUpdateInfo(info); if (info.expired) {