-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
react-native-web 0.12.0+ doesn't work with storybook due to deprecated components #120
Comments
Same error here too. I hope we will be able to use Storybook on web for React Native project as soon as possible ! |
This is an issue with the latest version of expo/react-native-web they included a new version of react native web which deprecated many of the components we are using. Currently expo 39 for web specifically won't work because of the update to react native web in that version. See the breaking changes of version 0.12.0 https://github.com/necolas/react-native-web/releases/tag/0.12.0, both DatePickerAndroid and DatePickerIOS are removed from react native web whilst only being deprecated in the current react native release. This is a difficult fix to make because it would be a breaking change forcing people to install the Datepicker library and other where previously they wouldn't need to. I was hoping to delay this change for a 6.0 release rather than making a 5.4. If this is a concern for the community I would be open to merging the fix which is not really a lot of work but would cause new dependencies for ondevice-knobs. Also if anyone can think of a way to make this change not be require the user to install extra dependencies please let me know. |
Also apologies for the slow response I've been really busy recently. Another thing If anyone wants to create a pr for this, the fix is to change the ondevice-knobs package to use the packages that have been made to replace the deprecated components in react native and remove the deprecated components from the code. In the case of the datepicker the version of the modal datepicker package needs to be updated and the datepicker package added to the dependencies. |
Thanx for your answer on this ! |
@filozofer I guess that might be a possible solution however I worry that the problem stems from the import and not the usage. I need to spend a weekend or something to really dig into this issue and try out a few things. I'll definitely update here if I find out anything new. |
@dannyhw You may already know that but you can adapt the import base on the OS. In my project I've got sometimes two files : |
I've changed the name of this so that others can find it more easily when having issue with react native web. Also an update, I had tried all weekend to update the expo example in the project and I kept running into dependency issues from yarn/node modules. I might have to recreate the example project to get it working properly. |
HI @dannyhw, may I ask if this issue is resolved in 6.0, will the issue for web launching in storybook-reactnative be resolved? |
@icaru88 yes this will be resolved in 6.0. I'd like to find a temporary solution for 5.3 without making breaking changes however I've got some doubts about whether its possible. Looking at my previous comment I had some issues with the tooling in the repo to test any changes the last time around. I'll take another look as soon as I can. |
Thank you so much @dannyhw. your quick response is very much appreciated. |
…don't break Expo's "yarn web"
Opened #190 to try to tackle this. Note the list of known issues and limitations, any improvements & fixes are most welcome! |
…don't break Expo's "yarn web"
The "dist" output in the v6 alpha packages contains JSX and ESNext constructs. Browsers can't handle these natively, so "yarn web" fails on Expo. Fix by using slightly less modern constructs in our dist outputs.
The "dist" output in the v6 alpha packages contains JSX and ESNext constructs. Browsers can't handle these natively, so "yarn web" fails on Expo. Fix by using slightly less modern constructs in our dist outputs.
This is probably fixed but we need to test all the controls before confirming this is done |
App will now run correctly in web with the controls addon (knobs replacement) however has the following issues. Since the deprecated components issue is now gone I will be opening separate issues for these problems and then closing this one.
|
I would love to resolve this for 5.3 however my focus is currently on 6.0 and due to limited time for now the plan is to focus all bug fixes into 6.0. If there is a overall demand for this fix in 5.3 I can re-think this approach though so let me know. |
This might not be the right issue to make this comment, if so I can open up another issue. But with version 5.3, the DateTimePicker from @react-native-community/datetimepicker does not fire its onChange callback when the component is rendered in a story on a emulated Android device. Is this something that is fixed in 6.0 or is there a workaround/hack I'm missing to get this working in 5.3 |
@scousino I think this is unrelated to this issue however since we've moved to the datepicker library in 6.0 and previously the built in component was used then it's likely been resolved in 6.0 |
Got it, thank you for the quick response @dannyhw! |
I'm closing this issue since react native web now works correctly in the current alpha build of 6.0 |
…okjs#251) Changes tsconfig to target es6.
Describe the bug
In React Native, while i run the command 'yarn web' storybook gives the following warnings:
Attempted import error: 'ViewPropTypes' is not exported from 'react-native-web/dist/index' (imported as 'RNViewPropTypes').
Attempted import error: 'TimePickerAndroid' is not exported from 'react-native-web/dist/index'.
Attempted import error: 'TimePickerAndroid' is not exported from 'react-native-web/dist/index'.
Attempted import error: 'TimePickerAndroid' is not exported from 'react-native-web/dist/index'.
Attempted import error: 'DatePickerIOS' is not exported from 'react-native-web/dist/index'.
Attempted import error: 'DatePickerAndroid' is not exported from 'react-native-web/dist/index'.
Attempted import error: 'AsyncStorage' is not exported from 'react-native-web/dist/index'.
And on the browser it gives the error
To Reproduce
Steps to reproduce the behavior:
expo init appName
npx -p @storybook/cli sb init --type react_native
yarn add @storybook/addon-ondevice-actions @storybook/addon-ondevice-knobs @storybook/addon-actions @storybook/addon-knobs
yarn add @storybook/react-native-server
yarn start-storybook
yarn web
Code snippets
In App.js
export {default} from './storybook';
Package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@storybook/addon-actions": "^6.0.26",
"@storybook/addon-knobs": "^6.0.26",
"@storybook/addon-ondevice-actions": "^5.3.23",
"@storybook/addon-ondevice-knobs": "^5.3.23",
"@storybook/react-native": "^5.3.23",
"@storybook/react-native-server": "^5.3.23",
"babel-loader": "^8.1.0",
"expo": "~39.0.2",
"expo-status-bar": "~1.0.2",
"formik": "^2.2.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz",
"react-native-web": "~0.13.12",
"yup": "^0.29.3"
},
"devDependencies": {
"@babel/core": "~7.9.0"
},
"private": true
}
System:
Additional context
May be the issue is with the version of react-native-web
The text was updated successfully, but these errors were encountered: