-
Notifications
You must be signed in to change notification settings - Fork 139
Fix Expo #332
Fix Expo #332
Conversation
…avigation is deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generated new expo and non-expo apps - both start correctly on simulators.
However, the Expo app's storybook test fails because of misconfiguration of asyncstorage, with a helpful message; it also doesn't `yarn lint` (because it has no `index.js`), nor `yarn compile` (several type errors, only one of which seems to be related to this change)
FAIL iOS test/storyshots.test.ts
● Test suite failed to run
[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
To fix this issue try these steps:
• Run `react-native link @react-native-community/async-storage` in the project root.
• Rebuild and restart the app.
• Run the packager with `--reset-cache` flag.
• If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app.
• If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://github.com/react-native-community/async-storage/blob/LEGACY/docs/Jest-integration.md
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-async-storage/issues
13 | host: "localhost",
14 | onDeviceUI: true,
> 15 | asyncStorage: require("@react-native-community/async-storage"),
| ^
16 | })
17 |
18 | export const StorybookUIRoot: React.FunctionComponent = () => {
at Object.<anonymous> (node_modules/@react-native-community/async-storage/lib/AsyncStorage.js:22:9)
at Object.<anonymous> (node_modules/@react-native-community/async-storage/lib/index.js:5:1)
at Object.<anonymous> (storybook/storybook.tsx:15:17)
at Object.<anonymous> (storybook/index.ts:4:1)
|
|
||
| const Stack = createNativeStackNavigator<RootParamList>() | ||
| <% if(props.useExpo){ %> | ||
| const Stack = createStackNavigator<RootParamList>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added your changes from this PR to a project I created last night. Everything seems to work, but I am getting a type error from line 16/24 below because stackPresentation doesn't exist on Stack.Navigator for @react-navigation/stack.
bryanstearns
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another picky comment, sorry.
| import { createStackNavigator } from "@react-navigation/stack" | ||
| <% } else{ %> | ||
| import { createNativeStackNavigator } from "react-native-screens/native-stack" | ||
| <% } %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'm so picky about spacing, but we can't use Prettier on the template files:
- These imports shouldn't be indented; picture the generated file without the template conditionals, and you'll see that the imports should line up on the left.
- The if line needs more spacing:
if (props.useExpo) { - The else line needs a space too:
else { - If you add a
-to the closing tag (eg<% blah -%>) the templater won't output the newline following the tag. Do this to all three template tags that form this conditional, and things should look right. (Generate a new Expo & non-Expo app to be sure!) - The conditional below and the ones in
root-navigator.tsx.ejsneed the same fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, thank you for catching these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bryanstearns Does the generated app get prettier-ed after generation? If so, would these things be fixed? (I'm not against fixing them here, just wondering.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier doesn't fix extra single blank lines, but might fix indentation
bryanstearns
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 🎉
## [5.0.2](v5.0.1...v5.0.2) (2020-04-22) ### Bug Fixes * **expo:** Rolls back to react-native-screens JS version for Expo ([#332](#332) by [@harrisrobin](https://github.com/harrisrobin)) ([1397749](1397749)) * Resolve require cycle warnings ([#309](#309) by [@harrisrobin](https://github.com/harrisrobin)) ([9945f76](9945f76)) * **tests:** Used default in import community AsyncStorage ([#329](#329) by @KZhidovinov) ([ce91008](ce91008))
|
🎉 This PR is included in version 5.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Expo broke due to a mistake in #330 . Turns out react-native-screens (I've tested 2.2.0 and 2.5.0) wasn't working with expo so I decided to use the JS stack if expo is used. Would you be able to take a look at this @bryanstearns ?
Thanks!