Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* Author: 墨子
* GitHub: https://github.com/duheng/Mozi
* Email: duheng1100@163.com
*/
import React, { Component, } from 'react';
import { Provider, } from 'react-redux';
import SplashScreen from 'react-native-splash-screen';
import codePush from 'react-native-code-push';
import configureStore from './app/store/configureStore';
import App from './AppNavigationState';
const store = configureStore();
@codePush({
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
installMode: codePush.InstallMode.ON_NEXT_SUSPEND,
})
export default class Root extends Component {
componentDidMount() {
SplashScreen.hide(); // 隐藏启动屏
}
render() {
console.log('store----', store);
return (
);
}
}
import {
AppRegistry,
YellowBox,
} from 'react-native';
import codePush from 'react-native-code-push';
import App from './src/app';
const codePushOptions = {
checkFrequency: (
(!__DEV__) ? codePush.CheckFrequency.ON_APP_RESUME
: codePush.CheckFrequency.MANUAL),
updateDialog: true,
installMode: codePush.InstallMode.IMMEDIATE,
};
// suppress false-positive isMounted() deprecation warning
// proper fix coming from react-native soon:
// https://github.com/facebook/react-native/issues/18868#issuecomment-387627007
if (YellowBox) {
YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader']);
}
AppRegistry.registerComponent(
'Callout',
() => codePush(codePushOptions)(App),
);
import React, { Component } from 'react';
import CodePush from 'react-native-code-push';
import { autobind } from 'core-decorators';
import { Item } from 'components/list';
import { observer } from 'mobx-react/native';
import { computed, observable } from 'mobx';
import store from 'store';
import _get from 'lodash/get';
@CodePush({ checkFrequency: CodePush.CheckFrequency.MANUAL })
@observer
export default class ListItemUpdateVersion extends Component {
componentDidMount() {
this.getUpdateMetadata();
}
@autobind
onPress() {
CodePush.sync({
...store.user.codePush,
}, this.codePushStatusDidChange, this.codePushDownloadDidProgress);
}
async getUpdateMetadata() {
try {
StyleSheet,
View,
Text,
Image,
Platform,
TouchableOpacity,
Alert,
Linking,
ActivityIndicator,
StatusBar,
} from 'react-native';
import { List } from 'antd-mobile';
import codePush from 'react-native-code-push';
import AppInfo from './appInfo.js';
const codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };
const styles = StyleSheet.create({
container: {
backgroundColor: 'white',
flex: 1,
},
logo: {
width: 108,
height: 108,
alignSelf: 'center',
marginTop: 45,
},
logoText: {
alignSelf: 'center',
fontSize: 24,
marginTop: 24,
const styles = (theme = {} as ThemeColors) => StyleSheet.create({
container: {
flex: 1,
backgroundColor: theme.base
},
flashMessageTitle: {
...Typography.FontWeights.Light,
...Typography.FontSizes.Body,
color: ThemeStatic.white
}
});
const CodepushApp = codePush({
deploymentKey: Config.codepush.production,
checkFrequency: codePush.CheckFrequency.ON_APP_START
})(App);
export default CodepushApp;
import React, { Component } from 'react';
import { View, StatusBar, Text } from 'react-native';
import RootScreen from './RootScreen';
import {
ApolloClient,
ApolloProvider,
createNetworkInterface
} from 'react-apollo';
import {
SubscriptionClient,
addGraphQLSubscriptions
} from 'subscriptions-transport-ws';
import codePush from 'react-native-code-push';
const codePushOptions = {
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME
};
const GRAPHQL_ENDPOINT =
'https://api.graph.cool/simple/v1/cj3g3v2hp18ag01621354vr2y';
const GRAPHQL_WEBSOCKET_ENDPOINT =
'wss://subscriptions.graph.cool/v1/cj3g3v2hp18ag01621354vr2y';
const networkInterface = createNetworkInterface({ uri: GRAPHQL_ENDPOINT });
const wsClient = new SubscriptionClient(GRAPHQL_WEBSOCKET_ENDPOINT, {
reconnect: true
});
const networkInterfaceWithSubscriptions = addGraphQLSubscriptions(
networkInterface,
wsClient
);
const client = new ApolloClient({
/** @format */
import React, { PureComponent } from 'react';
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import CodePush from "react-native-code-push";
const codePushOptions = {
//设置检查更新的频率
//ON_APP_RESUME APP恢复到前台的时候
//ON_APP_START APP开启的时候
//MANUAL 手动检查
checkFrequency: CodePush.CheckFrequency.MANUAL
};
AppRegistry.registerComponent(appName, () => CodePush(codePushOptions)(App));
flex: 1,
position: "absolute",
left: 0,
right: 0,
top: 0,
bottom: 0,
justifyContent: "center",
alignItems: "center",
backgroundColor: "rgba(0,0,0,0.3)",
height: SHeight,
width: SWidth,
},
});
const codePushOptions = {
checkFrequency: CodePush.CheckFrequency.MANUAL,
updateDialog: null,
};
export default CodePush(codePushOptions)(HotUpdate);