React native卡在旧版应用程序中

Ami*_*min 9 react-native

当我运行react-native run-android时,它只在模拟器中安装旧版本的应用程序,并且不会显示更改.

任何建议表示赞赏.

Has*_*aig 24

似乎我们每次将它们编译到android应用程序时都必须重新捆绑资产.这对我有用:

  1. 首先运行这个:react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest andro ID /应用/ src目录/主/ RES

  2. 然后这个:react-native run-android


Sat*_*owo 5

你试过了react-native start --reset-cache吗?

或者,也许您可​​以尝试重置MAX_WAIT_TIME(我在这里找到它)。在文件中,\node_modules\node-haste\lib\FileWatcher\index.js 您应该增加MAX_WAIT_TIME变量(例如:360000)并更改功能_createWatcher.

从:

key: '_createWatcher',
value: function _createWatcher(rootConfig) {
  var watcher = new WatcherClass(rootConfig.dir, {
    glob: rootConfig.globs,
    dot: false
  });
  return new Promise(function (resolve, reject) {
    var rejectTimeout = setTimeout(function () {
      return reject(new Error(timeoutMessage(WatcherClass)));
    }, MAX_WAIT_TIME);
    watcher.once('ready', function () {
      clearTimeout(rejectTimeout);
      resolve(watcher);
    });
  });
}
Run Code Online (Sandbox Code Playgroud)

至:

key: '_createWatcher',
value: function _createWatcher(rootConfig) {
  var watcher = new WatcherClass(rootConfig.dir, {
    glob: rootConfig.globs,
    dot: false
  });

  return new Promise(function (resolve, reject) {

    const rejectTimeout = setTimeout(function() {
      reject(new Error([
        'Watcher took too long to load',
        'Try running `watchman version` from your terminal',
        'https://facebook.github.io/watchman/docs/troubleshooting.html',
      ].join('\n')));
    }, MAX_WAIT_TIME);

    watcher.once('ready', function () {
      clearTimeout(rejectTimeout);
      resolve(watcher);
    });
  });
}
Run Code Online (Sandbox Code Playgroud)

愿它对您有帮助!:D