我正在使用 React Native 和 NativeBase。
我只是尝试在条目旁边显示一个图标,并在触发函数后添加 TouchableOpacity,但图标消失了
这是我的代码:
<Item floatingLabel>
<Label>Password</Label>
<Input
autoCorrect={false}
autoCapitalize='none'
secureTextEntry={ this.state.securePass }
onChangeText = { value => this.updateInput('password', value)}
value = { this.state.form.password.value }
type = { this.state.form.password.type }
/>
<TouchableOpacity>
<Icon name='eye' type="FontAwesome" style={ styles.iconFont } />
</TouchableOpacity>
</Item>
如果我将此代码放在 nativeBase 的 Item 之外但不在里面:
<TouchableOpacity>
<Icon name='eye' type="FontAwesome" style={ styles.iconFont } />
</TouchableOpacity>
希望你能帮到我!
谢谢!!
最佳答案
<View style={{flexDirection: 'row'}}>
<TouchableOpacity>
<Icon name='eye' type="FontAwesome" style={ styles.iconFont } />
</TouchableOpacity>
<Item floatingLabel>
<Label>Password</Label>
<Input
autoCorrect={false}
autoCapitalize='none'
secureTextEntry={ this.state.securePass }
onChangeText = { value => this.updateInput('password', value)}
value = { this.state.form.password.value }
type = { this.state.form.password.type }
/>
</Item>
</View>
关于javascript - 为什么我在 React Native 和 Native Base 中使用 TouchableOpacity 时图标消失了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51436220/