我正在尝试访问native-base Item组件中的prop并抛出
Error while updating property 'placeholder' of a view managed
by:AndroidTextInput
TypeError: expected dynamic type `string', but had type `int64'
这里是返回此错误的代码
import React, { Component } from 'react';
import { Container, Content, Form, Item, Input, Button, Text } from 'native-base';
export default class EditProduct extends Component {
componentDidMount() {
Actions.refresh({
title: 'Edit Product',
leftTitle: '<',
onLeft: () => {},
});
}
render() {
const id = this.props.id || 'No ID';
const min = this.props.min || 'No Min';
const max = this.props.max || 'No Max';
return (
<Container>
<Content>
<Form>
<Item>
<Input placeholder=id />
</Item>
<Item>
<Input placeholder=max />
</Item>
<Item last>
<Input placeholder=min />
</Item>
<Button block>
<Text>Confirm</Text>
</Button>
</Form>
</Content>
</Container>
);
}
}
如何从int64转换字符串?除了转换之外还有其他选择吗?
答案 0 :(得分:1)
输入的道具占位符接收字符串,只需将其转换为字符串即可。
const id = this.props.id + ""