gpt4 book ai didi

javascript - 更新由 : RCTView TypeError: expected dynamic type 'accessibilityLabel' , 管理但类型为 `string' 的 View 的属性 `object' 时出错

转载 作者:行者123 更新时间:2023-11-30 08:26:13 25 4
gpt4 key购买 nike

我想创建一些带有堆栈和选项卡导航器的屏幕,但它似乎不起作用,它收到这样的错误消息 error on virtual device ...

这是因为导航还是什么?

这是我的代码

ConfirmActivation.js

import React, { Component } from 'react';
import { StyleSheet, Image } from 'react-native';
import { Container, Header, Content, Left, Right, Body, Text, StyleProvider,
Form, Item, Input, Label, Button, View } from 'native-base';
import { StackNavigator } from 'react-navigation';
import Icon from 'react-native-vector-icons/FontAwesome';
import getTheme from '../../../native-base-theme/components';
import material from '../../../native-base-theme/variables/material';

import Index from '../tabs/Index';

export default class sharpcs extends React.Component {
static navigationOptions = {
title: <Image source={require('../../assets/img/sharp_logo.png')} style={{width: 200, height: 50}} />,
header: null
}
render() {
return (
<AppNavigation/>
);
}
}

class ConfirmActivation extends Component{
static navigationOptions = {
title: <Image source={require('../../assets/img/sharp_logo.png')} style={{width: 200, height: 50}} />,
header: null
}
render() {
const { navigate } = this.props.navigation;
return (
<StyleProvider style={getTheme(material)}>
<Container style={styles.container} >
<Form style={styles.form} >
<Item floatingLabel>
<Label>Masukkan kode verifikasi</Label>
<Input keyboardType = 'numeric' maxLength = {13} />
</Item>
<View style={styles.buttonContainer} >
<Button
onPress={() =>
navigate('MainScreen')
} success style={{width: 125}} >
<Label style={{color: '#FFF', marginLeft: 24}} >
Lanjut
</Label>
</Button>
</View>
</Form>
</Container>
</StyleProvider>
);
}
}

const App = StackNavigator({
ThisScreen: { screen: ConfirmActivation },
MainScreen: { screen: Index }
});

const AppNavigation = () => (
<App />
);

const styles = StyleSheet.create({
form: {
flex: 2,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center'
},
container: {
padding: 20
},
buttonContainer: {
marginTop: 20,
flexDirection: 'row',
alignSelf: 'flex-end'
}
});

Index.js

import React, { Component } from 'react';

export default class Index extends React.Component {
render() {
return null;
}
}

最佳答案

错误原因是sharpcs类中navigationOptions中的title。它需要一个字符串。您已经为它提供了一个图像组件。虽然出现图像,但导航时出现此错误。所以使用 headerTitle 代替标题

关于javascript - 更新由 : RCTView TypeError: expected dynamic type 'accessibilityLabel' , 管理但类型为 `string' 的 View 的属性 `object' 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45280976/

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