我试图用右视图和左视图(图像两端)的Textfield构建搜索组件。文本输入将自身包装为内容的长度,因此组件不覆盖整个父宽度。如何拉伸组件以使整个组件占据父项的全部宽度。使用左视图和右视图模式反应本地文本输入
<View style={{flexDirection:'row', height:40,alignSelf:'stretch',backgroundColor:'red'}}>
<Image source={require('./image_assets_rn/search_rn.png')} style={{alignSelf:'center',}}/>
<TextInput placeholder="Search Jet" style={{backgroundColor:'white',alignSelf:'stretch',}}/>
<Image source={require('./image_assets_rn/search_rn.png')} style={{alignSelf:'center',}}/>
</View>
以下是输出。我想伸展沿主轴线(宽度)的文本框
有趣!文本输入假设推开第二个图标 – Itzdsp