Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to building a universal app with R...

Introduction to building a universal app with React Native and Expo

Avatar for Brent Vatne

Brent Vatne

January 23, 2020

More Decks by Brent Vatne

Other Decks in Technology

Transcript

  1. Install the latest Node LTS release from nodejs.org. $ npm

    i -g expo-cli Install “Expo client” on your phone from Apple App Store or Google Play Store. 1 2 3 Local development environment
  2. Optional: install “Expo client” on your phone from App or

    Play Store. You can use in- browser simulator instead if you prefer. 1 2 Go to https://snack.expo.io on a desktop web browser. Web-based development environment
  3. $ expo init image-share $ cd image-share $ yarn start

    --tunnel The tunnel option is sometimes necessary to access your computer from your phone on public wifi networks, but full app reloads are slower than a direct LAN connection. You could alternatively use a simulator or switch networks (eg: tether).
  4. Any text you want to present in your app needs

    to be inside of a Text component. <View>Some text</View> is not valid, for example.
  5. Changes will be highlighted in yellow. If it’s not highlighted,

    assume it didn’t change - even if it’s not on the slide.
  6. http://bit.ly/share-logo Download this to the assets directory in your project

    An "asset" is any file that your project uses that is not code. Images, videos, sounds, and fonts are all considered to be assets.
  7. What units are width and height in? A useful simplification

    is to treat the units for numbers in styles as pixels, so you can think of 305 as equivalent to 305px. In fact, that is exactly what it compiles to for web. The same goes for font sizes, but there are no ems or rems here.
  8. What's a URI? Is that like a URL? Yes, you

    can use the terms interchangeably. Technically there are some subtle differences in meaning, but this won't matter for your usage with React Native and Expo. Documentation will tell you whether to use uri or url.
  9. $ expo install expo-image-picker expo install will run npm install

    or yarn add for you to install a version of the given library that is compatible with your project
  10. You might expect that because we gave our image an

    equal width and height it would be a square, but it’s possible to be rectangular. resizeMode lets us control how the image is resized to fit the given dimensions.
  11. * It’s actually technically possible to share files in the

    latest versions of Chrome for Android to share files, but it's very new and not yet supported by expo-sharing, so we will ignore that here for now. 1. Not supported by every browser 2. Can’t share files* Sharing limitations on web
  12. $ expo install anonymous-sharing expo install will pass through to

    npm or yarn without specifying a version if we don’t know which version is supported. In this case, anonymous-sharing is just some random npm package that is not part of Expo SDK, so no version is added.
  13. http://bit.ly/share-splash Download this to the assets directory in your project

    and name it splash.png. Overwrite the existing file.
  14. http://bit.ly/share-appicon Download this to the assets directory in your project

    and name it icon.png. Overwrite the existing file. We will use a single app icon for all platforms here for convenience. You will likely want to use a different icon for iOS and Android in practice.
  15. $ expo publish You can use the release-channel flag if

    you don’t want to push directly to production