我很新與react-native
,並有麻煩,此代碼:錯誤時,與相鄰的元素反應本土
import React, { Component, PropTypes, View } from 'react'
import { connect } from 'react-redux'
import StartupActions from '../Redux/StartupRedux'
import ReduxPersist from '../Config/ReduxPersist'
import { StackNavigator } from 'react-navigation'
import WelcomeContainer from '../Containers/WelcomeContainer'
import SettingsContainer from '../Containers/SettingsContainer'
import About from '../Components/About'
import { Header } from 'react-native-elements'
const AppNavigator = StackNavigator({
Home: {
screen: WelcomeContainer,
navigationOptions: {
title: 'Multi Language Sample App' // we advice using something static like your app's name or company name on the startup screen
}
},
Settings: {
screen: SettingsContainer,
navigationOptions: ({navigation}) => ({
title: navigation.state.params.title
})
},
About: {
screen: About,
navigationOptions: ({navigation}) => ({
title: navigation.state.params.title
})
}
})
class RootContainer extends Component {
componentDidMount() {
if (!ReduxPersist.active) {
this.props.startup()
}
}
render() {
return (
<View>
<AppNavigator />
<AppNavigator />
</View>
)
}
}
const mapStateToDispatch = dispatch => ({
startup:() => dispatch(StartupActions.startup())
})
export default connect(null, mapStateToDispatch)(RootContainer)
RootContainer.propTypes = {
startup: PropTypes.func.isRequired
}
我得到的錯誤:相鄰JSX元素必須在一個封閉的標籤包裹。
我發現同一問題的不同職位,但無法解決我的問題。
視圖組件和'反應-native'不是從'react' – bennygenel