npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-customized-update

v1.0.1

Published

A library to manage dynamic updates to React Native apps. Available as an NPM Package.clear app cache

Downloads

39

Readme

react-native-customized-update

iOS/Android react-native app boudleJs update or apk update. Support Chinese and English

Result

Import library

import ReactNativeCustomizedUpdate from 'react-native-customized-update';

check update

  componentDidMount(){
      ReactNativeCustomizedUpdate.shouldApkUpdate({})
  }

clear app cache

    ReactNativeCustomizedUpdate.getAppCacheSize(function (value, unit) {
            //console.log(value)
            //console.log(unit)

            //that.setState({cacheSize:value+unit});
     })
    ReactNativeCustomizedUpdate.clearAppCache(function () {

        //that.setState({cacheSize:''});
    })

get app version

    ReactNativeCustomizedUpdate.getAppVersion(function (version) {

        //that.setState({version:version});
    })

Request Object

| Property | Type | Description | | ------------- |:-------------:| :-----| | isUpdateNow | bool (default false) | Enable or disable check update for now | | checkVersionUrl | String | set checkVersionUrl |

method

| name | Description | | ------------- | :-----| | shouldApkUpdate | show apk update |

Install

yarn add react-native-customized-update

###example

https://github.com/shijingsh/react-native-customized-update-example

Install android

  • 1、import class
  • 2、MainActivity extends ReactNativeAppUpdateActivity
  • 3、Override getCheckVersionUrl Check for updates
    {
      "jsUrl": "js downloading url",
      "jsVersion": "1.0.0",
      "url": "apk downloading url",
      "version": "2.0.0"
    } 
  • 4、Override getUpdateFrequency Decide how frequently to check for updates.
    • EACH_TIME - each time the app starts
    • DAILY - maximum once per day
    • WEEKLY - maximum once per week
    • MONTHLY - maximum once per month
  • 5、Override getShowProgress To show progress during the update process.(true/false)
  • 6、add metadata file
    • file name:metadata.android.json
    • direct:root\android\app\src\main\assets
    • content:
       {
           "jsVersion": "1.0.0",
           "url": null
       }

      setting example

      package com.exampleappupdate;
             
      import com.facebook.react.ReactActivity;
      import com.mg.appupdate.*;
      import com.mg.appupdate.ReactNativeAppUpdate.ReactNativeCustomizedUpdateFrequency;
             
      public class MainActivity extends ReactNativeAppUpdateActivity {
             
             
          @Override
          protected String getCheckVersionUrl() {
              /**
               * value example:
               * {"jsUrl":"http://192.168.15.67:10086/yourapp/your.js","jsVersion":"1.0","url":"http://192.168.15.67:10086/yourapp/your.apk","version":"2.0"}
               */
              return "http://192.168.15.67:10086/jajayun/app/updateAndroid.json";
              //return "http://www.jajayun.com/app/updateAndroid.json";
          }
             
          /**
           *  Decide how frequently to check for updates.
           * Available options -
           *  EACH_TIME - each time the app starts
           *  DAILY     - maximum once per day
           *  WEEKLY    - maximum once per week
           * default value - EACH_TIME
           * */
          @Override
          protected ReactNativeCustomizedUpdateFrequency getUpdateFrequency() {
              return ReactNativeCustomizedUpdateFrequency.EACH_TIME;
          }
             
          /**
           *  To show progress during the update process.
           * */
          @Override
          protected boolean getShowProgress() {
              return true;
          }
             
          /**
           * Returns the name of the main component registered from JavaScript.
           * This is used to schedule rendering of the component.
           */
          @Override
          protected String getMainComponentName() {
              return "exampleAppUpdate";
          }
      }
             

License

MIT