我正在尝试构建一个简单的登录屏幕。但是,当我试图证明内容为中心的合理性时,元素不会停止上下跳跃。。如果我删除Flex或JustifyContent属性,则停止跳跃。我的代码看起来像这样
export default class LoginScreen extends React.Component {
render() {
return (
<View style={Styles.container} >
<Text>Hello world</Text>
</View>
)}
let Styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
// padding: 15,
// backgroundColor: 'red',
justifyContent: 'center',
alignItems: 'center',
},
)
我的app.js看起来像
import { Platform } from 'react-native';
import { Navigation } from 'react-native-navigation';
import registerScreens from './app/Screens';
import {
AppRegistry,
Text,
} from 'react-native';
registerScreens();
let tabs = [
{
label: 'Login',
screen: 'tasks.LoginScreen', // this is a registered name for a screen
icon: require('./assets/account_circle.png'),
// selectedIcon: require('../img/one_selected.png'), // iOS only
title: 'Hello world'
},
{
label: 'Two',
screen: 'tasks.CreateUserScreen',
icon: require('./assets/account_circle.png'),
// selectedIcon: require('../img/two_selected.png'), // iOS only
title: 'Screen Two'
}
]
Navigation.startTabBasedApp({
tabs,
animationType: Platform.OS === 'ios' ? 'slide-down' : 'fade',
tabsStyle: {
tabBarBackgroundColor: '#003a66',
tabBarButtonColor: '#ffffff',
tabBarSelectedButtonColor: '#ff505c',
tabFontFamily: 'BioRhyme-Bold',
},
appStyle: {
tabBarBackgroundColor: '#003a66',
navBarButtonColor: '#ffffff',
tabBarButtonColor: '#ffffff',
navBarTextColor: '#ffffff',
tabBarSelectedButtonColor: '#ff505c',
navigationBarColor: '#003a66',
navBarBackgroundColor: '#003a66',
statusBarColor: '#002b4c',
tabFontFamily: 'BioRhyme-Bold',
},
drawer: {
left: {
screen: 'tasks.LoginScreen'
}
}
});
尝试在我自己的应用程序中解决此问题后,我来到了唯一的解决方案是将反应从0.50.x降级至0.49.x-至少至少,这就是将其固定在我末端的原因。