How to use xdl - 10 common examples

To help you get started, we’ve selected a few xdl 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 expo / xde / src / ui / App.js View on Github external
componentDidMount() {
    UserSettings.getAsync('sendTo').then((sendTo) => {
      this.setState({sendTo});
    }, (err) => {
      // Probably means that there's no saved value here; not a huge deal
      // console.error("Error getting sendTo:", err);
    });

    Exp.recentValidExpsAsync().then((recentExps) => {
      this.setState({recentExps});
    }, (err) => {
      console.error("Couldn't get list of recent Exps :(", err);
    });

    // this._versionStringAsync().then((vs) => {
    //   this.setState({versionString: vs});
    // }, (err) => {
    //   console.error("Couldn't get version string :(", err);
github react-community / create-react-native-app / react-native-scripts / src / util / packager.js View on Github external
async function cleanUpPackager(projectDir) {
  const result = await Promise.race([
    Project.stopAsync(projectDir),
    new Promise((resolve, reject) => setTimeout(resolve, 1000, 'stopFailed')),
  ]);

  if (result === 'stopFailed') {
    // find RN packager pid, attempt to kill manually
    try {
      const { packagerPid } = await ProjectSettings.readPackagerInfoAsync(projectDir);
      process.kill(packagerPid);
    } catch (e) {
      process.exit(1);
    }
  }
}
github NervJS / taro / packages / taro-rn-runner / src / util / packager.js View on Github external
async function cleanUpPackager (projectDir) {
  const result = await Promise.race([
    Project.stopAsync(projectDir),
    new Promise((resolve, reject) => setTimeout(resolve, 1000, 'stopFailed'))
  ])

  if (result === 'stopFailed') {
    // find RN packager pid, attempt to kill manually
    try {
      const { packagerPid } = await ProjectSettings.readPackagerInfoAsync(projectDir)
      process.kill(packagerPid)
    } catch (e) {
      process.exit(1)
    }
  }
}
github NervJS / taro / packages / taro-rn-runner / src / util / packager.js View on Github external
// Subscribe to device updates separately from packager/server updates
  ProjectUtils.attachLoggerStream(projectDir, {
    stream: {
      write: chunk => {
        if (chunk.tag === 'device') {
          handleLogChunk(chunk)
        }
      }
    },
    type: 'raw'
  })

  installExitHooks(projectDir, isInteractive)
  log.withTimestamp('Starting packager...')

  Project.startAsync(projectDir, options).then(
    () => {},
    reason => {
      log.withTimestamp(chalk.red(`Error starting packager: ${reason.stack}`))
      process.exit(1)
    }
  )
}
github react-community / create-react-native-app / react-native-scripts / src / util / packager.js View on Github external
// Subscribe to device updates separately from packager/server updates
  ProjectUtils.attachLoggerStream(projectDir, {
    stream: {
      write: chunk => {
        if (chunk.tag === 'device') {
          handleLogChunk(chunk);
        }
      },
    },
    type: 'raw',
  });

  installExitHooks(projectDir, isInteractive);
  log.withTimestamp('Starting packager...');

  Project.startAsync(projectDir, options).then(
    () => {},
    reason => {
      log.withTimestamp(chalk.red(`Error starting packager: ${reason.stack}`));
      process.exit(1);
    }
  );
}
github react-community / create-react-native-app / react-native-scripts / src / scripts / ios.js View on Github external
// @flow

import { Config, ProjectSettings, Simulator, UrlUtils } from 'xdl';

import chalk from 'chalk';
import indent from 'indent-string';
import path from 'path';
import pathExists from 'path-exists';
import qr from 'qrcode-terminal';
import log from '../util/log';
import { hasYarn } from '../util/pm';

import packager from '../util/packager';

Config.validation.reactNativeVersionWarnings = false;
Config.developerTool = 'crna';
Config.offline = true;

const command: string = hasYarn(process.cwd()) ? 'yarnpkg' : 'npm';

if (!Simulator.isPlatformSupported()) {
  log(
    chalk.red(
      '\nThis command only works on macOS computers with Xcode and the iOS simulator installed.'
    )
  );
  log(
    chalk.yellow(
      `If you run \`${chalk.cyan(command + ' start')}\` then you can view your app on a physical device.\n`
    )
  );
  process.exit(1);
github NervJS / taro / packages / taro-rn-runner / src / util / packager.js View on Github external
async function cleanUpPackager (projectDir) {
  const result = await Promise.race([
    Project.stopAsync(projectDir),
    new Promise((resolve, reject) => setTimeout(resolve, 1000, 'stopFailed'))
  ])

  if (result === 'stopFailed') {
    // find RN packager pid, attempt to kill manually
    try {
      const { packagerPid } = await ProjectSettings.readPackagerInfoAsync(projectDir)
      process.kill(packagerPid)
    } catch (e) {
      process.exit(1)
    }
  }
}
github react-community / create-react-native-app / react-native-scripts / src / util / packager.js View on Github external
async function cleanUpPackager(projectDir) {
  const result = await Promise.race([
    Project.stopAsync(projectDir),
    new Promise((resolve, reject) => setTimeout(resolve, 1000, 'stopFailed')),
  ]);

  if (result === 'stopFailed') {
    // find RN packager pid, attempt to kill manually
    try {
      const { packagerPid } = await ProjectSettings.readPackagerInfoAsync(projectDir);
      process.kill(packagerPid);
    } catch (e) {
      process.exit(1);
    }
  }
}
github NervJS / taro / packages / taro-rn-runner / src / index.js View on Github external
async function printServerInfo () {
  await ProjectSettings.readPackagerInfoAsync(projectDir)
  // who knows why qrcode-terminal takes a callback instead of just returning a string
  const address = await UrlUtils.constructManifestUrlAsync(projectDir)
  let emulatorHelp
  if (process.platform === 'darwin') {
    emulatorHelp = `Press ${chalk.bold('a')} (Android) or ${chalk.bold('i')} (iOS) to start an emulator.`
  } else {
    emulatorHelp = `Press ${chalk.bold('a')} to start an Android emulator.`
  }
  qr.generate(address, qrCode => {
    log(`
${indent(qrCode, 2)}
Your app is now running at URL: ${chalk.underline(chalk.cyan(address))}
${chalk.bold('View your app with live reloading:')}
  ${chalk.underline('Android device:')}
    -> Point the Expo app to the QR code above.
       (You'll find the QR scanner on the Projects tab of the app.)
  ${chalk.underline('iOS device:')}
    -> Press ${chalk.bold('s')} to email/text the app URL to your phone.
github react-community / create-react-native-app / react-native-scripts / src / scripts / start.js View on Github external
async function printServerInfo() {
  const settings = await ProjectSettings.readPackagerInfoAsync(process.cwd());
  // who knows why qrcode-terminal takes a callback instead of just returning a string
  const address = await UrlUtils.constructManifestUrlAsync(process.cwd());
  let emulatorHelp;
  if (process.platform === 'darwin') {
    emulatorHelp = `Press ${chalk.bold('a')} (Android) or ${chalk.bold('i')} (iOS) to start an emulator.`;
  } else {
    emulatorHelp = `Press ${chalk.bold('a')} to start an Android emulator.`;
  }
  qr.generate(address, qrCode => {
    log(`
${indent(qrCode, 2)}

Your app is now running at URL: ${chalk.underline(chalk.cyan(address))}

${chalk.bold('View your app with live reloading:')}

  ${chalk.underline('Android device:')}
    -> Point the Expo app to the QR code above.