【发布时间】:2015-11-20 13:36:23
【问题描述】:
我正在使用 NavigatorIOS 在带有图像标签的页面之间进行转换。在每次“向前”转换之前,所有图像都会闪烁。如何摆脱它?
在模拟器和设备 (iPhone 5) 上的 React Native 0.11.0(在更高版本上未经测试)上发生。
演示:
代码:
var React = require('react-native');
var {
AppRegistry,
Image,
NavigatorIOS,
Text,
TouchableOpacity,
View,
} = React;
var NavigatorRoot = React.createClass({
render(){
return (
<NavigatorIOS
style={{flex: 1,}}
ref="navigator"
initialRoute={{
component: TestPage,
title: 'Test Page',
}}
/>
)
},
});
var TestPage = React.createClass({
render(){
return (
<View >
<Image
style={{width: 340, height: 300,}}
source={{uri: "http://dummyimage.com/320/300/090&text=test_image"}}
/>
<Text >
This is a page with intentionally unstyled content. Note that before each "forward" transition the image blinks. Other components (like this text) are not affected.
</Text>
<TouchableOpacity
onPress={()=>{
this.props.navigator.push({
component: TestPage,
title: 'Test Page',
});
}}
>
<View>
<Text >TEST BUTTON</Text>
</View>
</TouchableOpacity>
</View>
);
}
});
AppRegistry.registerComponent('reference', ()=> NavigatorRoot );
【问题讨论】:
标签: javascript reactjs react-native