我正在使用react-native-icons包来包含带有按钮的图标。他们在示例文件夹中列出了示例代码。我试图onPress
在 View 上实现,但结果 react-native 没有组件onPress
功能<View>
。
我尝试使用<TouchableHighlight>
,但它只能有一个子元素,而不是两个喜欢<Icon>
和<Text>
里面。
我也尝试使用<Text>
with<Icon>
和<Text>
inside,但里面<Text>
只能有<Text>
元素。
有没有人有运气实现类似的功能?
<View onPress={this.onBooking}
style={styles.button}>
<Icon
name='fontawesome|facebook-square'
size={25}
color='#3b5998'
style={{height:25,width:25}}/>
<Text style={styles.buttonText}>Sign In with Facebook</Text>
</View>