mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-11-04 07:13:10 +08:00 
			
		
		
		
	v10.0.0-beta.1
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "react-native-update",
 | 
			
		||||
  "version": "10.0.0-beta.0",
 | 
			
		||||
  "version": "10.0.0-beta.1",
 | 
			
		||||
  "description": "react-native hot update",
 | 
			
		||||
  "main": "src/index.ts",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,19 +12,23 @@ export const defaultContext = {
 | 
			
		||||
  markSuccess: noop,
 | 
			
		||||
  dismissError: noop,
 | 
			
		||||
  downloadUpdate: noop,
 | 
			
		||||
  currentHash: '',
 | 
			
		||||
  packageVersion: '',
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const PushyContext = createContext<{
 | 
			
		||||
  checkUpdate: () => void;
 | 
			
		||||
  switchVersion: () => void;
 | 
			
		||||
  switchVersionLater: () => void;
 | 
			
		||||
  progress?: ProgressData;
 | 
			
		||||
  markSuccess: () => void;
 | 
			
		||||
  dismissError: () => void;
 | 
			
		||||
  downloadUpdate: () => void;
 | 
			
		||||
  currentHash: string;
 | 
			
		||||
  packageVersion: string;
 | 
			
		||||
  client?: Pushy;
 | 
			
		||||
  progress?: ProgressData;
 | 
			
		||||
  updateInfo?: CheckResult;
 | 
			
		||||
  lastError?: Error;
 | 
			
		||||
  dismissError: () => void;
 | 
			
		||||
  client?: Pushy;
 | 
			
		||||
  downloadUpdate: () => void;
 | 
			
		||||
}>(defaultContext);
 | 
			
		||||
 | 
			
		||||
export const usePushy = () => useContext(PushyContext);
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ import {
 | 
			
		||||
  Linking,
 | 
			
		||||
} from 'react-native';
 | 
			
		||||
import { Pushy } from './client';
 | 
			
		||||
import { isFirstTime } from './core';
 | 
			
		||||
import { currentVersion, isFirstTime, packageVersion } from './core';
 | 
			
		||||
import { CheckResult } from './type';
 | 
			
		||||
import { PushyContext } from './context';
 | 
			
		||||
 | 
			
		||||
@@ -176,6 +176,8 @@ export const PushyProvider = ({
 | 
			
		||||
        markSuccess,
 | 
			
		||||
        client,
 | 
			
		||||
        downloadUpdate,
 | 
			
		||||
        packageVersion,
 | 
			
		||||
        currentHash: currentVersion,
 | 
			
		||||
      }}
 | 
			
		||||
    >
 | 
			
		||||
      {children}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user