-
Notifications
You must be signed in to change notification settings - Fork 1
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
My observations so far on Android #2
Comments
To recap: This renders but does not hot reload: // Class: screens.Scene1
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
var __map_reserved = {};
// Imports
var $hxClasses = require("./../hxClasses_stub").default;
var $import = require("./../import_stub").default;
var $bind = require("./../bind_stub").default;
var $extend = require("./../extend_stub").default;
const React = require('react');
const { Component } = require('react');
const { View, Text } = require('react-native');
const { Navigation } = require('react-native-navigation');
function Scene1(){
return (
<View>
<Text>Hello 442</Text>
</View>
);
}
// Export
module.exports = Scene1;
// exports.default = Scene1; This renders but does not hot reload: // Class: screens.Scene1
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
// $global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../hxClasses_stub").default;
var $import = require("./../import_stub").default;
var $bind = require("./../bind_stub").default;
var $extend = require("./../extend_stub").default;
function React_Component() {return require("react");}
// function tools_NavigationUtils() {return require("./../tools/NavigationUtils");}
function React() {return require("react");}
function react__$ReactType_ReactType_$Impl_$() {return require("./../react/_ReactType/ReactType_Impl_");}
// function comps_Row() {return require("./../comps/Row");}
function react_native_component_Text() {return require("react-native");}
function react_native_component_View() {return require("react-native");}
// class Scene1 extends Component {
class Scene1 extends (React_Component().Component) {
render() {
var msg = this.props.text != null ? (React()).createElement((react__$ReactType_ReactType_$Impl_$().default).fromComp((react_native_component_Text().Text)),{ },this.props.text) : null;
return (React()).createElement((react__$ReactType_ReactType_$Impl_$().default).fromComp((react_native_component_View().View)),{ },(React()).createElement((react__$ReactType_ReactType_$Impl_$().default).fromComp((react_native_component_Text().Text)),{ },"This is Scene1 111",msg));
}
}
// Export
module.exports = Scene1;
// exports.default = Scene1; This renders AND hot reloads: // Class: screens.Scene1
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
// $global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../hxClasses_stub").default;
var $import = require("./../import_stub").default;
var $bind = require("./../bind_stub").default;
var $extend = require("./../extend_stub").default;
// Constructor
const React = require('react');
const { Component } = require('react');
const { View, Text } = require('react-native');
class Scene1 extends Component {
render() {
return (
<View>
<Text>Hello 4234567</Text>
</View>
);
}
}
// Export
module.exports = Scene1;
// exports.default = Scene1; Go and figure :S... Maybe it does not like that in I'll make further tests and try to check the RNN sources if we can find something there... |
I think it is as dumb as that. This also works and hot reload: // Class: screens.Scene1
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
// $global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../hxClasses_stub").default;
var $import = require("./../import_stub").default;
var $bind = require("./../bind_stub").default;
var $extend = require("./../extend_stub").default;
// function React_Component() {return require("react");}
const { Component } = require("react");
// function tools_NavigationUtils() {return require("./../tools/NavigationUtils");}
function React() {return require("react");}
function react__$ReactType_ReactType_$Impl_$() {return require("./../react/_ReactType/ReactType_Impl_");}
// function comps_Row() {return require("./../comps/Row");}
function react_native_component_Text() {return require("react-native");}
function react_native_component_View() {return require("react-native");}
// class Scene1 extends Component {
class Scene1 extends Component {
render() {
var msg = this.props.text != null ? (React()).createElement((react__$ReactType_ReactType_$Impl_$().default).fromComp((react_native_component_Text().Text)),{ },this.props.text) : null;
return (React()).createElement((react__$ReactType_ReactType_$Impl_$().default).fromComp((react_native_component_View().View)),{ },(React()).createElement((react__$ReactType_ReactType_$Impl_$().default).fromComp((react_native_component_Text().Text)),{ },"This is Scene1 112",msg));
}
}
// Export
module.exports = Scene1;
// exports.default = Scene1; |
This for example, does not hot reload anymore: const React_Component = require("react");
// class Scene1 extends Component {
class Scene1 extends React_Component.Component {
render() {
var msg = this.props.text != null ? (React()).createElement((react__$ReactType_ReactType_$Impl_$().default).fromComp((react_native_component_Text().Text)),{ },this.props.text) : null;
return (React()).createElement((react__$ReactType_ReactType_$Impl_$().default).fromComp((react_native_component_View().View)),{ },(React()).createElement((react__$ReactType_ReactType_$Impl_$().default).fromComp((react_native_component_Text().Text)),{ },"This is Scene1 1123",msg));
}
} It is like it would expect a literal |
Tested on iOS, with exactly the same behavior (that's a good point). |
That's an excellent news ! |
@kiroukou that's exactly what I told you. A Babel plugin recognises some code patterns to add the hmr wrapper code. Generating JS code that Babel would recognise is one option, the other is to generate the wrapper code ourselves (see recent hxgenjs issue created by Kevin). |
Very good find though if there is a difference with RNN. Maybe a different Babel configuration? |
Here's my reverse engineering of the HMR wrapper code: kevinresol/hxgenjs#27 |
hi, |
I've tested on Android and the issue is the same.
I think that RNN enables hot reload only for React Component.
I've replaced Scene1.js with a ES6 implementation and hot reload start working on that screen !
Also, if I implement Scene1.js as a function (instead of
class Scene1 extends Component
), then the behavior is the same as with haxe.The text was updated successfully, but these errors were encountered: