React native buttons.slice 不是函数
React native buttons.slice is not a function
我正在尝试使用 Alert.alert 打印一个变量,它可能是我,但我做不到这是我的代码
const [reg, setRegion] = useState('');
Alert.alert(
"Confirm",
"this is just a " + {reg},
[
{
text: "Cancel",
onPress: () => console.log("Cancel Pressed"),
style: "cancel"
},
{ text: "OK", onPress: () => console.log("OK Pressed") }
],
{ cancelable: false }
);
}
如何使用字符串打印 {reg} 变量?
const [reg, setRegion] = useState('');
Alert.alert(
"Confirm",
`this is just a ${reg}`,
[
{
text: "Cancel",
onPress: () => console.log("Cancel Pressed"),
style: "cancel"
},
{ text: "OK", onPress: () => console.log("OK Pressed") }
],
{ cancelable: false }
);
}
如果你在 React native 中使用 Alert 时得到这个,下面的解决方案对我有用。
Alert.alert("错误", "输入一个项目", [{ text: "OK" }]);
我正在尝试使用 Alert.alert 打印一个变量,它可能是我,但我做不到这是我的代码
const [reg, setRegion] = useState('');
Alert.alert(
"Confirm",
"this is just a " + {reg},
[
{
text: "Cancel",
onPress: () => console.log("Cancel Pressed"),
style: "cancel"
},
{ text: "OK", onPress: () => console.log("OK Pressed") }
],
{ cancelable: false }
);
}
如何使用字符串打印 {reg} 变量?
const [reg, setRegion] = useState('');
Alert.alert(
"Confirm",
`this is just a ${reg}`,
[
{
text: "Cancel",
onPress: () => console.log("Cancel Pressed"),
style: "cancel"
},
{ text: "OK", onPress: () => console.log("OK Pressed") }
],
{ cancelable: false }
);
}
如果你在 React native 中使用 Alert 时得到这个,下面的解决方案对我有用。
Alert.alert("错误", "输入一个项目", [{ text: "OK" }]);