我建立了一个离子应用程序,最初转换速度很慢.所以,我选择了离子原生过渡插件.现在,应用程序转换变得更加平滑,我正在尝试将这些转换应用于我的离子模态.下面是我用来设置离子模态的函数.
function LoadFilter(){
$ionicModal.fromTemplateUrl('templates/filter.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
$scope.modal.show();
});
$scope.closeFilter = function() {
$scope.modal.hide();
};
$scope.showFilter = function() {
$scope.modal.show();
};
Run Code Online (Sandbox Code Playgroud)
知道如何将转换应用于模态吗?
我正在使用React Native的SectionList。SectionList中的数据看起来像这样
data: [
{
title: "Asia",
data: ["Taj Mahal", "Great Wall of China", "Petra"]
},
{
title: "South America",
data: ["Machu Picchu", "Christ the Redeemer", "Chichen Itza"]
},
{
title: "Europe",
data: ["Roman Colosseum"]
}
]
Run Code Online (Sandbox Code Playgroud)
我有一个文本输入,尝试通过它过滤掉SectionList中的内容。我尝试使用Array.filter(),但似乎没有用。它返回我全部数据,而没有任何过滤。因此,我尝试了Array.some()。现在,即使有一项匹配,也会过滤该部分中的所有数据项。此行为是出于预期的Array.some()。但是我很困惑为什么Array.filter()我的案例不起作用。
我的SectionList看起来像这样,
<SectionList
sections={this.state.data.filter(sectionData => {
sectionData = sectionData.data;
return sectionData.filter(data => {
return data.includes(this.state.searchTerm);
})
})}
renderSectionHeader={({ section: { title } }) => ( <Text style={{ fontWeight: "bold" }}>{title}</Text> )}
renderItem={({ item }) => …Run Code Online (Sandbox Code Playgroud)