我正在使用size
设置货币。当我在TextInputMask
元素中使用它时,它与其他元素一起作为“对象”。
示例代码:
ListIstem
输出;
<FlatList
data={teams}
renderItem={({item}) =>
<ListItem
title={item.team}
subtitle={
<TextInputMask
type={'money'}
options={{ precision: 2, separator: ',', delimiter: '.', unit: '' }}
value={parseFloat(item.amount)}
/> + 'Count: ' + item.count
}
bottomDivider={true}
/>
}
keyExtractor={this.keyExtractor}
/>
答案 0 :(得分:0)
尝试:将subtitle
的{{1}}替换为:
ListItem
答案 1 :(得分:0)
您正在向对象添加整数,这就是为什么它像这样显示它。 TextInoutMask组件将suffixUnit作为道具,您可以直接在其中提供item.count的值。
<TextInputMask
type={'money'}
options={{ precision: 2, separator: ',', delimiter: '.', unit: '', suffixUnit: `Count: ${item.count}` }}
value={parseFloat(item.amount)}
/>
答案 2 :(得分:0)
更改为带有返回值的一个。
<FlatList
data={teams}
renderItem={({item}) =>
<ListItem
title={item.team}
subtitle={
MaskService.toMask('money',parseFloat(item.amount), {
unit: '',
precision: 2,
separator: ',',
delimiter: '.'
}) + 'Count: ' + item.count
}
bottomDivider={true}
/>
}
keyExtractor={this.keyExtractor}
/>