模拟器(和设备)上的字符串下划线为绿色,但在设计器窗口上为灰色。 style和colors.xml中没有自定义颜色。那么为什么颜色不同呢?
manifest.xml:
callSomeApis(parameter){
let tempArray1 = [];
let tempArray2 = [];
this.props.dispatch(actions.callApi1(parameter)).then(callApi1Result =>{
let callApi1ResultArray = callApi1Result.data.data;
let PromiseArr1 = callApi1ResultArray.map((callApi1ResultArrayItem) => {
return this.props.dispatch(actions.callApi2(callApi1ResultArrayItem.itemId));
});
let PromiseArr2 = callApi1ResultArray.map((callApi1ResultArrayItem) => {
return this.props.dispatch(actions.callApi3(callApi1ResultArrayItem.itemId,parameter));
});
let PromiseArr3 = callApi1ResultArray.map((callApi1ResultArrayItem) => {
return this.props.dispatch(actions.callApi4(callApi1ResultArrayItem.itemId));
});
Promise.all(PromiseArr1).then((callApi2Result) => {
callApi2Result.map((callApi2ResultItem,index) => {
callApi1ResultArray[index].api2Details = callApi2ResultItem.data.data[0];
tempArray2.push({id: callApi2ResultItem.data.data[0].id, text: callApi2ResultItem.data.data[0].text});
});
this.setState(prevState => {
return{
stateKey1: {
...prevState.stateKey1,
innerStateKey1: {
...prevState.stateKey1.innerStateKey1,
list: tempArray2
}
}
}
});
});
Promise.all(PromiseArr2).then((callApi3Result) => {
callApi3Result.map((callApi3ResultItem, index) => {
callApi1ResultArray[index].api3Result = callApi3ResultItem.data.data;
});
});
Promise.all(PromiseArr3).then(callApi4Result => {
callApi4Result.map((callApi4ResultItem,index) => {
callApi1ResultArray[index].api4Result = callApi4ResultItem.data.data;
});
});
/**need to call this after the thens of PromiseArr1, PromiseArr2 and PromiseArr3 are done executing*/
this.setState({
stateKey2:callApi1ResultArray
})
/** */
})
}
colors.xml:
var test = require("./test");
styles.xml:
//file: test.js
module.exports = function () {
console.log("Hello");
}
console.log("Hello2");
//file: test2.js
import { test } from './test'
test();
PS:对于链接上的图片感到抱歉 - 我没有足够的声誉来直接发布图片。
答案 0 :(得分:0)
嗯......在设计师窗口中它是灰色的,因为它在那里(显然)并没有活跃,而且在模拟器中它是非常活跃的,因为它是Android的#1默认强调色。尝试更改colorAccent
值以将默认颜色更改为其他颜色