所以我使用的是Flatlist,使用数组中的数据,并在屏幕上显示了它。 这就是我要说的。
我希望我的输出像红色框中显示的那样。
这是我的代码。
<R> R retryForResult( Supplier<R> functionToCall, Function<R,Boolean> resultValidationFunction, long maxTimeMs, Iterable<Long> retryDelays );
答案 0 :(得分:2)
从代码中删除平面列表:
用以下代码替换渲染方法:
constructor(props) {
super(props)
this.state = {
data: [{ law_practice_description: 'Administration Administration' },
{ law_practice_description: 'Administration Agency Prctice' },
{ law_practice_description: 'Administration hearing and appeals' },
{ law_practice_description: 'Administration Administration' },
{ law_practice_description: 'Administration Agency Prctice' },
{ law_practice_description: 'Administration hearing and appeals' },
{ law_practice_description: 'Administration Administration' },
{ law_practice_description: 'Administration Agency Prctice' },
{ law_practice_description: 'Administration hearing and appeals' }],
};
}
render() {
let str = ''
this.state.data.map((item, index) => {
if (index == 0) {
str = item.law_practice_description
} else {
str = str + ', ' + item.law_practice_description
}
})
return (
<View style={{ flex: 1 }} >
<Text style={styles.titleTxt}>Administrative Law</Text>
<Text style={{ fontSize: 16, color: 'black', }}>
{str}
</Text>
</ View>
);
}