How to use the react-native-code-push.CheckFrequency function in react-native-code-push

To help you get started, we’ve selected a few react-native-code-push examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github duheng / Mozi / src / root.js View on Github external
/**
 * 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 (
      
        
      
    );
  }
}
github NSWSESMembers / availability-poc / client / index.js View on Github external
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),
);
github birkir / kvikmyndr-app / src / components / list-item-update-version / ListItemUpdateVersion.js View on Github external
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 {
github ant-design / ant-design-mobile / rn-kitchen-sink / components / Home.js View on Github external
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,
github karanpratapsingh / Proximity / App.tsx View on Github external
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;
github cball / ChainReactPhotobomb / App / Containers / App.js View on Github external
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({
github XboxYan / DYTT / index.js View on Github external
/** @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));
github duheng / Mozi / src / components / CodepushUpdate / index.js View on Github external
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);