重新执行已成功运行的代码时,会发生此错误
本征0.58 反应导航:3.11
import React, {Component} from 'react';
import {createAppContainer, createStackNavigator, createBottomTabNavigator} from 'react-navigation'
import {
View,
BackHandler,
Platform,
} from 'react-native';
import { Provider } from "mobx-react";
export default class App extends Component<Props> {
constructor(props) {
super(props);
}
render() {
return (
<View style={{flex:1}}>
<Provider {...store}>
<AppContainer></AppContainer>
</Provider>
</View>
);
}
}
const Tab = createBottomTabNavigator({
Home: {
screen: HomeScene,
navigationOptions: ({navigation}) => ({
tabBarLabel: '首页',
tabBarIcon: ({focused, tintColor}) => (
<TabBarItem
nomalImg={require('./src/img/icon/Home.png')}
selectedImg={require('./src/img/icon/Home_selected.png')}
focuesd={focused}
tintColor={tintColor}
/>
),
tabBarOnPress: () => {
navigation.navigate('Home', {
'nowGet': true
})
}
})
},
Rank: {
screen: RankScene,
navigationOptions: ({navigation}) => ({
title: '排行榜',
tabBarLabel: '排行榜',
tabBarIcon: ({focused, tintColor}) => (
<TabBarItem
nomalImg={require('./src/img/icon/Rank.png')}
selectedImg={require('./src/img/icon/Rank_selected.png')}
focuesd={focused}
tintColor={tintColor}
/>
)
})
},
},{
tabBarPosition: 'bottom',
lazy: true,
//是否可以滑动切换
swipeEnabled: false,
//切换是否有动画
animationEnabled: false,
tabBarOptions: {
activeTintColor: color.primary,
inactiveTintColor: color.gray,
style : {backgroundColor: 'white',fontSize:10}
}
})
Tab.navigationOptions = ({navigation}) => {
return {
header:null
}
}
const Stack = createStackNavigator({
Home: {
screen: Tab,
navigationOptions: ({navigation}) => ({
gesturesEnabled: false,
})
}
}, {
navigationOptions: {
},
initialRouteName: 'Home'
})
const AppContainer = createAppContainer(Stack)
babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset',"mobx"],
plugins: [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
["@babel/transform-runtime", {
"helpers": true,
"regenerator": false
}],
["@babel/plugin-proposal-class-properties", {"loose":true}]
]
};
TypeError:未定义不是一个对象(正在评估'this._onLayout.bind'), 此错误位于过渡处(位于CardStackTransition.js:55)