我有一个非常基本的应用程序,我使用ex-navigation进行导航。
App.js(注意 #define Add(a, b) (a)+(b)
int add(int a, int b){
return a+b;
}
static inline __attribute__((always_inline)) int in_add(const int& a, const int& b) {
return a+b;
}
int main(){
int a;
high_resolution_clock::time_point start, end;
//Option 1
a = 1;
start = high_resolution_clock::now();
for (int i=0; i<1000000000; i++) if (a%100000){
a = a + 1246;
//repeat 10000 times
a = a + 1246;
}
end = high_resolution_clock::now();
auto duration = duration_cast<microseconds>( end - start ).count();
cout<< "Option 1: Direct compute\ttime\t" << duration << '\n';
//Option 2
a = 1;
start = high_resolution_clock::now();
for (int i=0; i<1000000000; i++) if (a%100000){
a = Add(a, 1246);
//repeat 10000 times
a = Add(a, 1246);
}
end = high_resolution_clock::now();
duration = duration_cast<microseconds>( end - start ).count();
cout<< "Option 2: Macro function\ttime\t" << duration << '\n';
//Option 3
a = 1;
start = high_resolution_clock::now();
for (int i=0; i<1000000000; i++) if (a%100000){
a = add(a, 1246);
//repeat 10000 times
a = add(a, 1246);
}
end = high_resolution_clock::now();
duration = duration_cast<microseconds>( end - start ).count();
cout<< "Option 3: Function call \ttime\t" << duration << '\n';
//Option 4
a = 1;
start = high_resolution_clock::now();
for (int i=0; i<1000000000; i++) if (a%100000){
a = in_add(a, 1246);
//repeat 10000 times
a = in_add(a, 1246);
}
end = high_resolution_clock::now();
duration = duration_cast<microseconds>( end - start ).count();
cout<< "Option 4: Forced inline \ttime\t" << duration << '\n';
return 0;
}
):
backgroundColor
TabEntry:
export default class App extends Component {
render() {
return (
<View style={{flex: 1, backgroundColor: 'lightblue'}}>
<TabEntry/>
</View>
);
}
}
因为父组件中有const Router = createRouter(() => ({
notification: () => Notification,
}));
const defaultRouteConfig = {
navigationBar: {
title: 'notify',
tintColor: 'blue',
backgroundColor: 'green',
},
};
export default class TabEntry extends React.Component {
render() {
return (
<NavigationProvider router={Router}>
<StackNavigation
initialRoute={Router.getRoute('notification')}
defaultRouteConfig={defaultRouteConfig}
/>
</NavigationProvider>
)
}
}
class Notification extends React.Component {
render() {
return (
<View>
<Text>NOTIFICATION!!!</Text>
</View>
)
}
}
,但子组件中没有backgroundColor,它应该显示浅蓝色背景。但相反背景是白色的。我怎样才能让它变得透明?
答案 0 :(得分:0)
您可以尝试在backgroundColor: 'transparent'
样式中添加<Text>
。
这样做:
<Text style={{backgroundColor: 'transparent'}}>NOTIFICATION!!!</Text>