我正在创建一个 react native 应用程序,我使用 react-native 模态组件来打开一个模态,我可以使用以下代码打开一个完整的模态。我在下面提到了我的代码示例。现在我想打开一个半模态。
这是我尝试过的。
import React from 'react';
import {
StyleSheet,
Text,
View,
ScrollView,
TouchableOpacity,
TextInput,
Image,
Modal,
} from 'react-native';
export default class Test extends React.Component {
constructor(props) {
super(props);
this.state = {
modalVisible: false,
};
}
setModalVisible(visible) {
this.setState({modalVisible: visible});
}
render() {
return (
<View style={styles.container}>
<View style={styles.header}>
<Text style={styles.headerText}>Test Half Modal</Text>
<TouchableOpacity
style={styles.addButton}
onPress={() => {
this.setModalVisible(true);
}}>
<Text style={styles.addButtonText}>Open</Text>
</TouchableOpacity>
</View>
<Modal
animationType="slide"
transparent={false}
visible={this.state.modalVisible}
onRequestClose={() => {
// this.closeButtonFunction()
}}>
<View …
Run Code Online (Sandbox Code Playgroud) 我有一个数据数组,我需要将这些数据过滤到 React js 中的变量中。
这是我的数组
[{idappcontent: "Com_01", idcontenttype: "0", idclient: "5"},
{idappcontent: "Com_02", idcontenttype: "0", idclient: "5"},
{idappcontent: "Com_03", idcontenttype: "0", idclient: "5"},
{idappcontent: "Review1_Ques_01", idcontenttype: "0", idclient: "5"},
{idappcontent: "Review1_Ques_02", idcontenttype: "0", idclient: "5"},
{idappcontent: "Sign_01", idcontenttype: "0", idclient: "5"},
{idappcontent: "Sign_02", idcontenttype: "0", idclient: "5"},
{idappcontent: "Thank_01", idcontenttype: "0", idclient: "5"},
{idappcontent: "Thank_02", idcontenttype: "0", idclient: "5"}
]
Run Code Online (Sandbox Code Playgroud)
我需要获取包含“idappcontent ==”Sign_“”的数据。如何过滤与“Sign_”字符串匹配的数组数据?