Configuration issues:
(1) The SDK path could not be found, or there is no SDK version: SDK must be android-23 (Update SDK)
WORKAROUND: Environment variable, must be set Android_home
(2) ADB devices command: No phone found, solution: Use the Phone assistant to install the phone driver, the phone opens the USB debugging (developer) mode, after the installation of the driver must uninstall the phone assistant
(3) Build is red after success, no connection to server JS server
Workaround: Look at Port 8081, tcp:8081 is not occupied, set the run IP address and port 8081:
1. Question one: In general, you need to initialize in constructorstate,为什么?
The Super keyword appears in the constructor method and the ToString method; It represents the constructor of the parent class here;
The This object that is used to create a new parent class;
The subclass must call the Super method in the constructor method, or the new instance will be error-free because the subclass does not have its own this object;
Instead, inherit the This object of the parent class and then process it. If you do not call the Super method, the subclass will not get the This object.
The inheritance of ES5 is to create the instance object of the subclass first, and then add the method of the parent class to this; the inheritance mechanism of ES6 is completely different;
ES6; The essence is to first create an instance object of the parent class this, and then modify this with the constructor of the child class;
2. Question two:
let display = this.state.showText ? this.props.text : ‘ ‘;
In here? What is the role?
For conditional expression B? X:y, the condition B is evaluated first and then judged. If the value of B is true, the value of x is computed, the result of the operation is the value of x, otherwise, the value of Y is evaluated and the result of the operation is Y.
< expression 1>? < expression 2>: < expression 3>; "?" The meaning of the operator is: the value of expression 1 is evaluated first, if true, the expression 2 is executed, and the result of expression 2 is returned, and if the value of expression 1 is false, the expression 3 is executed and the result of expression 3 is returned.
3. Question three: onchangetext={(text) = this.setstate ({text:text})}, how to understand?
Using the Onchangetext property, the value of this property is a function, and theflag is a new syntax for ECMAScript 6, and you can find the data yourself without knowing it.
The ///SetState () method notifies the interface to render again, and the parameters in it represent the state----text in the constructor.
4. Question four: {This.state.text.split ("). Map ((word) =>word&& '?? '). Join (')}, how to understand?
1. The split () method of the string in JavaScript returns an array, and the length of the array is not 0 (even if the length of the string is 0) .
// 2, the map () method of an array is equivalent to a for loop or foreach in Java, the parameter is a function, the return value type or an array
3,= = Symbol, represents a function, the left parenthesis represents the function of the parameters, the right represents the function of the function body returned something
/// 4, the Join () method is a method of turning the string into an array, such as [1,2,3].join (' 0 ') as a result of the string 102030
5. Question five: Picture path problem: Correct method
The foundation for developing react-native with Webstorm