gpt4 book ai didi

android - react-native 证明内容中心导致元素在 android 上跳来跳去

转载 作者:行者123 更新时间:2023-11-28 02:31:53 24 4
gpt4 key购买 nike

我正在尝试构建一个简单的登录屏幕。但是,当我尝试将内容居中时,元素不会停止上下跳动。 .如果我删除 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'
}
}
});

最佳答案

在我自己的应用程序中尝试解决这个问题后,我发现唯一的解决方案是将 React-Native 从 0.50.x 降级到 0.49.x - 至少,这就是我最终解决的问题.

关于android - react-native 证明内容中心导致元素在 android 上跳来跳去,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47646390/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com