Reactjs 如何在React Native中滚动页面
我无法滚动我的页面。怎么了Reactjs 如何在React Native中滚动页面,reactjs,react-native,Reactjs,React Native,我无法滚动我的页面。怎么了 export default class CustomersTab extends Component { constructor(props) { super(props); this.state = { token: "", isLoading: true, dataSource: null }; } componentWillMount() { MY APİ CODES - HERE İS
export default class CustomersTab extends Component {
constructor(props) {
super(props);
this.state = {
token: "",
isLoading: true,
dataSource: null
};
}
componentWillMount() { MY APİ CODES - HERE İS NOT İMPORTANT
)
.then(response => response.json())
.then(responseData => {
this.setState({
isLoading: false,
dataSource: responseData.result
});
});
})
.catch(error => console.warn(error));
}
static navigationOptions = {
title: "Firmaların Listesi",
tabBarIcon: <Icon name="ios-people" style={{}} />
};
render() {
if (this.state.isLoading) {
return (
<View style={styles.container}>
<ActivityIndicator />
</View>
);
} else {
return this.state.dataSource.map((val, key) => {
return (
<List key={key}>
<ListItem
roundAvatar
avatar={{ uri: "url/notimportant" }}
key={key}
title={val.name+" "+val.surname}
subtitle={val.customerType}
/>
</List>
);
});
}
}
}
我尝试了不同的代码,但没有改进。如何查看页面中的所有数据?加载其他按钮也可以工作。有人有主意吗??
注:数据正常。问题是滚动。您的渲染元素应该用滚动视图包装
您可以使用和。记得导入它们。如果你看到并阅读它,你可以使用它。另一个标签,您可以像查看不滚动一样使用它。您的渲染应该在“请参阅此处->不工作”中。可能是因为我正在使用的映射功能吗?您是否参考了scrollview文档?你能发布你的更新代码吗?不工作。可能是因为我使用的映射功能吗?可能是,控制台和检查,我正在擦除该功能并恢复。你能检查一下吗?发生了什么?
return (
<ScrollView>
{this.state.dataSource.map((val, key) => {
return (
<List key={key}>
<ListItem
roundAvatar
avatar={{ uri: "url/notimportant" }}
key={key}
title={val.name + " " + val.surname}
subtitle={val.customerType}
/>
</List>
);
})}
</ScrollView>
);