我使用react-native-icons个软件包来包含带有按钮的图标.他们有example folder中列出的示例代码.我试图在视图上实现onPress
,但事实证明react native没有<View>
组件的onPress
函数.
我try 使用<TouchableHighlight>
,但它只能有一个子元素,而不是像<Icon>
和<Text>
这样的两个子元素.
我也试过用<Text>
,里面有<Icon>
和<Text>
,但是<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>