由于某些愚蠢的原因,以下代码继续呈现TextInput,然后然后成为ImageBackground,因此背景总是掩盖孩子:
return <View>
<ImageBackground
style={{
width: 375,
height: 750,
justifyContent: 'center',
zIndex: -1,
}}
source={require('../../assets/iphonex.png')}
>
<TextInput
onChangeText={(text) => this.studentSearch({ text })}
placeholder="Search"
style={{
backgroundColor: 'transparent',
textAlign: 'center',
fontSize: 30,
padding: 40,
}}
/>
</ImageBackground>
</View>
我必须使用宽度/高度硬编码来使背景图像正确渲染...否则它只是出于某种原因给我一部分图像。也许那是什么造成了麻烦?
谢谢!