Comments (7)
Could you attach your package.json
, .babelrc
and the functional component you'd like to use in storyboard? Could you also verify that HMR is enabled in the simulators/emulator?
from babel-plugin-functional-hmr.
Hi thanks a lot for the help. So everything is pretty standard:
package.json
{
...
"dependencies": {
...
"react": "16.0.0-alpha.12",
"react-native": "0.47.2",
"styled-components": "^2.1.1"
},
"devDependencies": {
"@storybook/addon-actions": "^3.2.11",
"@storybook/addon-links": "^3.2.10",
"@storybook/react-native": "^3.2.11",
"babel-eslint": "^7.2.3",
"babel-plugin-functional-hmr": "^1.0.21",
"babel-plugin-transform-react-jsx-source": "^6.22.0",
"babel-preset-react-native-stage-0": "^1.0.1",
"lint-staged": "^4.0.3",
"react-dom": "16.0.0-alpha.12",
"react-native-dotenv": "^0.1.0",
"react-native-scripts": "^1.1.0",
"react-test-renderer": "16.0.0-alpha.12",
...
},
"rnpm": {
"assets": [
"./cinuru-design/assets/fonts/"
]
},
"lint-staged": {
"*.js": [
"prettier --write",
"git add"
]
}
}
.babelrc
{
"presets": ["babel-preset-react-native-stage-0/decorator-support", "react-native-dotenv"],
"env": {
"development": {
"plugins": ["functional-hmr", "transform-react-jsx-source"]
}
}
}
HMR is definitely enabled and it works with classes as well. I'm just having the automatically set up components from storybook. the Welcome is a class and works fine. But the Button is a functional component and it doesn't change.
from babel-plugin-functional-hmr.
Is there any way to see in the react native debugger wether the component actually got transformed?
from babel-plugin-functional-hmr.
Ok, I think I got it to work. The problem is, that editing the .babelrc
won't actually change the setup, unless you start the packager with yarn start --reset-cache
to clean the transform cache. Super confusing, cost me several hours.
from babel-plugin-functional-hmr.
Sorry for the inconvenience and thanks for getting back. I had a busy week I planned to fix tonight! Anyway I've updated the readme with your finding! Thanks.
from babel-plugin-functional-hmr.
I found out why cache reset did not come into my mind: RN packager is so different from React's webpack whenever I have any trouble (warnings, red screens, missing transforms) I immediately run the following script before debugging:
#!/bin/sh
rm -rf node_modules/
yarn install
watchman watch-del-all
rm -rf $TMPDIR/react-*
from babel-plugin-functional-hmr.
Yes it’s really f* up, so much undeterministic behavior. I really love React Native, but the dev experience is so much worse as compared to web. I’ll copy your script!
from babel-plugin-functional-hmr.
Related Issues (14)
- Bundling app does not work HOT 3
- Error in React Native 0.53 HOT 8
- Support for higher-order-components such as recompose HOT 5
- Issue with HMR with fragment syntax HOT 2
- Not working on react-native 0.57.7 HOT 1
- Any idea why unit tests are failing after enabling HMR?
- Won't work with hooks HOT 1
- Couldn't find preset "functional-hmr" relative to directory "MyApp/storybook" HOT 6
- Deprecating the package HOT 2
- support for non-jsx react components HOT 1
- Property property of MemberExpression expected node to be of a type [\"Identifier\"] but instead got null HOT 7
- Component is not rendered correctly if its stored in variable named 'Item' HOT 1
- [RN 0.52.0] Unknown named module: 'react' HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-functional-hmr.