【问题标题】:ZIndex overlapping with any react-native-paper component in Android onlyZIndex 仅与 Android 中的任何 react-native-paper 组件重叠
【发布时间】:2021-04-01 06:39:03
【问题描述】:
【问题讨论】:
标签:
javascript
reactjs
typescript
react-native
react-native-paper
【解决方案1】:
我通过将平面列表移到 appbar.header 组件之外解决了这个问题
<View style={{}}>
<Appbar.Header
style={{
backgroundColor: colors.surface,
borderBottomWidth: 1.5,
borderBottomColor: hexToRgbA(colors.primary, 0.3),
}}>
<Appbar.BackAction
style={{
marginHorizontal: 5,
}}
onPress={_searchOff}
/>
<TextInput
underlineColor="transparent"
underlineColorAndroid="transparent"
style={{height: 56, backgroundColor: 'transparent', flex: 1}}
value={searchQuery}
placeholder={'Search...'}
onChangeText={onChangeText}
left={
<TextInput.Icon
name={() => (
<Icon name={'search'} color={colors.primary} size={20} />
)}
disabled={true}
/>
}
right={
<TextInput.Icon
style={{
height: 50,
width: 100,
}}
name={() => (
<Icon
name={'arrow-drop-down-circle'}
color={colors.primary}
size={20}
onPress={() => {
setFilteredArray(searchQuery);
arrowToggle(!arrow);
}}
/>
)}
/>
}
/>
</Appbar.Header>
{arrow ? (
<View
style={{
position: 'absolute',
top: 55,
width: '100%',
zIndex: 123,
}}>
<FlatList
data={filteredArrayList}
style={style.mainlist}
initialNumToRender={6}
nestedScrollEnabled={false}
keyExtractor={(item: any, index: number) => `${item.id}_${index}`}
renderItem={({item}) => <SelectedItemJSX {...item} />}
/>
</View>
) : null}
</View>