说明---当我从github克隆项目时,在npm install react-native run-ios
之后,出现以下错误:undefined不是对象(评估'_reactNative.ViewPropTypes.style')
附加信息
我的主页代码 -
import React, {Component} from 'react';
import {
StyleSheet
} from 'react-native';
import { Actions } from 'react-native-router-flux';
import { Container, Header, Title, Button, Left, Right, Body, Icon } from 'native-base';
import Button1 from './Button';
import StreamStripContainer from '../containers/StreamStripContainer';
import StreamElementsContainer from '../containers/StreamElementsContainer';
class Stream extends Component {
render() {
return (
<Container style={{backgroundColor: '#F5F5F5'}} >
<Header>
<Left>
<Button transparent>
<Icon name='menu' />
</Button>
</Left>
<Body>
<Title>Stream</Title>
</Body>
<Right>
<Button transparent>
<Icon name='search' />
</Button>
</Right>
</Header>
<StreamStripContainer />
<StreamElementsContainer />
{/* <Button1 onPress={Actions.content} title='Go To Next Scene' /> */}
</Container>
);
}
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#F5F5F5'
}
});
export default Stream;
通过将native-base更新为2.1.4解决了错误,因为我的反应原生版本为0.44
不推荐使用View.propTypes,而是使用RN44中的ViewPropTypes,这也是最新版本的NativeBase中引入的。所以对于RN44,去NativeBase v2.1.4和任何低于RN44的东西,你可以使用NB v2.1.3
这是react-native-router-flux的问题,您的react-native版本与react-native-router-flux的版本不兼容。升级您的react-native-router-flux版本。 This可能会有所帮助。