我使用 react-native-popup-dialog 并收到一些警告
I use react-native-popup-dialog and I get some warns
我安装了 react-native-popup-dialog 并使用它。当我进入带有组件的页面或打开弹出对话框时,我会收到相同的警告。你能帮帮我吗?
错误:"Warning: Failed prop type: Prop 'children' has type 'any' or 'mixed', but was not provided to 'PopupDialog'. Pass undefined or any other value"
<Dialog
visible = {this.state.addVisible}
rounded
width = {0.85}
dialogAnimation={new SlideAnimation({
slideFrom: 'bottom',
})}
footer = {
<DialogFooter>
<DialogButton
onPress = {() => {}}
textStyle = {styles.buttonText}
text = "Add"
/>
<DialogButton
onPress = {() => this.setState({addVisible: false})}
textStyle = {styles.buttonText}
text = "Cancel"
/>
</DialogFooter>
}
>
</Dialog>
根据问题:
It's type warning. children
is required for DialogContent
component.
请像这样添加:
<Dialog
visible={this.state.visible}
onTouchOutside={() => {
this.setState({ visible: false });
}}
>
<DialogContent>
{...}
</DialogContent>
</Dialog>
我安装了 react-native-popup-dialog 并使用它。当我进入带有组件的页面或打开弹出对话框时,我会收到相同的警告。你能帮帮我吗?
错误:"Warning: Failed prop type: Prop 'children' has type 'any' or 'mixed', but was not provided to 'PopupDialog'. Pass undefined or any other value"
<Dialog
visible = {this.state.addVisible}
rounded
width = {0.85}
dialogAnimation={new SlideAnimation({
slideFrom: 'bottom',
})}
footer = {
<DialogFooter>
<DialogButton
onPress = {() => {}}
textStyle = {styles.buttonText}
text = "Add"
/>
<DialogButton
onPress = {() => this.setState({addVisible: false})}
textStyle = {styles.buttonText}
text = "Cancel"
/>
</DialogFooter>
}
>
</Dialog>
根据问题:
It's type warning.
children
is required forDialogContent
component.
请像这样添加:
<Dialog
visible={this.state.visible}
onTouchOutside={() => {
this.setState({ visible: false });
}}
>
<DialogContent>
{...}
</DialogContent>
</Dialog>