Reactjs 如何创建动态模态
嘿,我有一个数组,里面有对象,我想创建一个模态,所以每个模态中应该只有一个问题Reactjs 如何创建动态模态,reactjs,modal-dialog,native,Reactjs,Modal Dialog,Native,嘿,我有一个数组,里面有对象,我想创建一个模态,所以每个模态中应该只有一个问题 var Question=[ { "type": "QUESTION", "title": "What exactly did you draw?" }, { "type": "QUESTION", "
var Question=[
{
"type": "QUESTION",
"title": "What exactly did you draw?"
},
{
"type": "QUESTION",
"title": "does the image show birds?"
}
]
我想创建我的模态动态,这样每个模态只有一个问题,当点击下一个按钮时,每个模态内部的下一个模态和下一个问题打开,当前模态代码如下
<Modal
visible={visible}
onDismiss={() => navigate('Tasks')}
contentContainerStyle={containerStyle}>
<View style={{alignSelf: 'flex-end'}}>
{/* <IconButton
icon="close"
color={Colors.red500}
size={20}
onPress={() => setVisible(false)}
/> */}
<Text style={{fontWeight: 'bold', fontSize: 20}}>1/3</Text>
</View>
<Title style={{marginVertical: '5%'}}>
Required Documents / Information
</Title>
{questions.map((item: object) => {
return (
<TextInput
style={{
minHeight: '15%',
borderBottomColor: '#DBDBDB',
borderBottomWidth: 2,
fontSize: 15,
paddingHorizontal: 5,
paddingVertical: '1%',
marginVertical: '2%',
}}
placeholder={item.title}
label={item.title}
multiline={true}
placeholderTextColor={'#C9C9C9'}
/>
);
})}
<ButtonCustom
iconColor={'#fff'}
icon="application-export"
title={'Save'}
onPress={() => console.timeLog('pressed')}
/>
<ButtonCustom
iconColor={'#fff'}
style={{marginVertical: '5%'}}
icon="application-export"
title={'Next'}
onPress={stepOne}
/>
</Modal>
导航('Tasks')}
contentContainerStyle={containerStyle}>
{/*setVisible(false)}
/> */}
1/3
所需文件/资料
{questions.map((项目:object)=>{
返回(
);
})}
console.timeLog('pressed')}
/>