There is a space between 1.<view></view> error Trying to add unknown View tag
2. Some JS syntax sugar attention points
Http://facebook.github.io/react-native/docs/javascript-environment.html#content
Function-expression Syntax:
() =>xxx equals function () {return xxx;}
Function-expression Syntax:
State={a:1,b:2,c:3}
... state equals
3. Component Onpress Event parameters
Parameter Type Respondersyntheticevent
may get coordinate information structure {identifier,timestamp,locationy, locationx,pagex,pagey,target} via E.nativeevent
Target is a number.
4. Component OnLayout Event parameters
Parameter Type Syntheticevent
Coordinate information structure may be obtained by e.nativeevent.layout {height, width, y.5, x}
5. A component that refers to the JS pair image bug
<View style = {[styles.circle, this._circleStyles]} />
// The style cannot be obtained in this way
this._circleStyles.left = this._previousLeft + gestureState.dx;
this._circleStyles.top = this._previousTop + gestureState.dy;
// You can use this
this._circleStyles = {
left: this._previousLeft + gestureState.dx,
top: this._previousTop + gestureState.dy
};
6.ref and refs
The label generated by render in the component can be set by using the Ref attribute for the field name. The corresponding label can be referenced in the component by this.refs[' myrefstring ') or this.refs.myRefString
render: function () {
return <Text ref = "myInput" />;
},
componentDidMount: function () {
this.refs [‘myInput‘]
this.refs.myInput
}
// ref can also be used as a callback function, the callback parameter is the label reference
render: function () {
return <Text ref = {(c) => this._input = c} />;
},
componentDidMount: function () {
this._input.focus ();
}
React Native Use problem record