Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Expo Web out of the box! #1686

Merged
merged 1 commit into from
May 28, 2021
Merged

Support Expo Web out of the box! #1686

merged 1 commit into from
May 28, 2021

Conversation

markrickert
Copy link
Member

@markrickert markrickert commented May 19, 2021

Please verify the following:

  • yarn ci:test jest tests pass with new tests, if relevant
  • README.md has been updated with your changes, if relevant

Describe your PR

This updates expo in a big way to support expo web out of the box.

  • Upgrade expo and dependencies to 40.0.1
  • Integrate web-compatible reactotron package
  • Added width/height to all boilerplate images to support web rendering
  • removed the yarn.lock file from the boilerplate as its generated automatically during the ignite process.

I tested this multiple time, generating about 20 projects over the course of the evening last night.

It built projects that compile and run:

./ignite/bin/ignite new testapp --overwrite ios & android
./ignite/bin/ignite new testappExpo --expo --overwrite ios, android, and web.

Linting, tests, and CI all passing.

A note about Storybook: Because expo doesn't expose the DevSettings API to add debug menu items, expo native doesn't support toggling storybook with the debug menu. You can invoke expo storybook on the web by appending ?storybook=true to the web url.

@markrickert
Copy link
Member Author

It appears that expo doesn't support adding items from code to the dev menu yet :'( https://forums.expo.io/t/devsettings-addmenuitem-in-devmenu-on-expo-client/47079

@markrickert markrickert force-pushed the expo-web-support branch 8 times, most recently from 7f1915a to c2967dd Compare May 21, 2021 14:19
@markrickert
Copy link
Member Author

This is ready for review. All tests passing.

@markrickert markrickert force-pushed the expo-web-support branch 2 times, most recently from 229f928 to a120a56 Compare May 21, 2021 14:51
@markrickert
Copy link
Member Author

Closes #1428
Closes #1535

Copy link
Member

@jamonholmgren jamonholmgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with some very minor suggestions. Great work @markrickert !!!!

it's beautiful

src/commands/new.ts Outdated Show resolved Hide resolved
boilerplate/test/setup.ts Show resolved Hide resolved
boilerplate/storybook/toggle-storybook.tsx Outdated Show resolved Hide resolved
boilerplate/index.expo.js Outdated Show resolved Hide resolved
@markrickert markrickert requested review from mazenchami and removed request for bryanstearns May 21, 2021 19:25
Copy link
Contributor

@mazenchami mazenchami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to run this without any issues to both an expo app (ios, android, & web) and a non-expo app (ios & android). 🎉

Copy link
Member

@jamonholmgren jamonholmgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One little nit, but we're ready to go otherwise! @markrickert

}, [])

return <RNImage {...props} style={[imageSize, props.style]} />
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that React Native Web is considering a new API for the Image component, which may help us here. But in the meantime, this will do nicely.

necolas/react-native-web#1786

@@ -154,13 +155,14 @@ export default {
.replace(/hello-world/g, projectNameKebab)
let packageJson = JSON.parse(packageJsonRaw)

const merge = require("deepmerge-json")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably move this back into the if statement below, since it's not needed anywhere except there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do this later. I'm merging.

@jamonholmgren jamonholmgren merged commit 2be1dd2 into master May 28, 2021
@jamonholmgren jamonholmgren deleted the expo-web-support branch May 28, 2021 19:38
infinitered-circleci pushed a commit that referenced this pull request May 28, 2021
# [7.0.0](v6.12.2...v7.0.0) (2021-05-28)

### Bug Fixes

* **boilerplate:** add background color to navigators to fix white flash ([#1672](#1672) by [@calendee](https://github.com/calendee)) ([32989d2](32989d2))

### Features

* **web:** Web support when using —expo ([#1686](#1686) by [@markrickert](https://github.com/markrickert)) ([2be1dd2](2be1dd2))

### BREAKING CHANGES

* **web:** We've been getting a lot of questions over the years about supporting web on Ignite.

**It's here!**

For new Ignited apps, if using Expo (`--expo` option), web will be supported out of the box!

We're making this a breaking change because we do change a few things around how AsyncStorage is handled, but the impact should be minor if you're upgrading from a recent version of an Ignited app.

### Additional notes:

* There's a new component, `AutoImage`, that makes images resize automatically even when the source is a URL. It's a drop-in replacement for the built-in React Native `Image` component
* Upgrade expo and dependencies to 40.0.1
* Integrate web-compatible reactotron package
* Removed the yarn.lock file from the boilerplate as its generated automatically during the ignite process
* Web is not currently supported if you're using the non-Expo version of Ignite
@infinitered-circleci
Copy link

🎉 This PR is included in version 7.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants