我使用metro ui表单并尝试更改metro listview的黑暗主题样式。但我不知道为什么地铁列表查看它们时,我运行
总是一个轻松的主题当我运行它时,它总是一种轻巧的主题风格。
metro listview是否有任何错误
答案 0 :(得分:0)
使用<View
style={{
flex: 1,
flexDirection: "column",
flexWrap: "wrap",
borderTopWidth: 5,
borderBottomWidth: 5,
backgroundColor: "#F8F9F9"
}}
>
<Logo />
<Text style={styles.titleText1}>
Daily Attendance Section A Class 11th
</Text>
<ActivityIndicator
animating={animating}
color="#bc2b78"
size="large"
style={styles.activityIndicator}
/>
<View style={styles.container}>
<Text style={styles.titleText}>Roll & Name Present Or Absent</Text>
</View>
<FlatList
data={this.state.data}
showsVerticalScrollIndicator={false}
renderItem={({ item }) => (
<View
style={{
flex: 1,
flexDirection: "row",
height: 50,
backgroundColor: "#D1F2EB",
borderRadius: 4,
borderWidth: 1,
borderColor: "#008000",
marginLeft: "1%"
}}
>
<Text
style={{
flex: 2,
fontSize: 15,
// fontFamily: "Roboto",
// justifyContent: "space-between",
width: 150
}}
>
{item.rollno}
--
{item.name}
{/* onChangeText={(rollno) => this.setState({rollno: rollno})} */}
{/* this.setState({ item.rollno }); */}
</Text>
<RadioForm
animation={true}
buttonColor={"#C2E3A9"}
formHorizontal={true}
labelHorizontal={true}
buttonStyle={{ marginRight: 20 }}
radioStyle={{ paddingRight: 20 }}
// labelHorizontal={false}
style={{
flex: 1,
paddingRight: 20,
flexDirection: "row",
//padding: 10,
width: 30
}}
radio_props={radio_props}
initial={this.state.value}
onPress={value => {
this.setState({ value: value });
}}
ItemSeparatorComponent={this.renderSeparator}
/>
data1={[{"rollno": item.rollno}, {"typeofattendence": this.state.value}]}
<Button title="Submit" onPress={() => this.insert(item)} />
</View>
)}
// keyExtractor={(x, i) => i}
keyExtractor={(item, index) => index.toString()}
/>
<Button title="Submit" onPress={() => this.insert()} />
</View>`
and here I json stringfy code for posting
`insert = (item) => {
/* */
//alert(this.state.username);
fetch("http://192.168.1.139:8082/Attendence/add", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify([{
rollno: item.rollno,
typeofattendence: this.state.value
}])
})
.then(response => response.json())
.then(res => {
if (res.success === true) {
alert(res.message);
} else {
alert(res.message);
}
})
.catch(error => {
console.error(error);
});
};
方法可能会导致主题更改!