我在使用此組件時收到警告。嘗試將此組件用作按鈕。我嘗試要求('TouchableNativeFeedback')但沒用。我也嘗試npm安裝TouchableNativeFeedback,但失敗了。它應該如何被納入我反應的原生android代碼?如何在React native android中使用TouchableNativeFeedback?
{
var TouchableNativeFeedback= require('TouchableNativeFeedback');
var Button= require('react-native-button');
var {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TouchableNativeFeedback,
} = React;
var AwesomeProject = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
My first App
</Text>
<Text style={styles.instructions}>
we should get started
</Text>
<Text style={styles.instructions}>
Nice!!
</Text>
<Image source={require('./abc.png')} style={styles.img} >
<Text style={styles.welcome}> Inside an image! </Text>
</Image>
<TouchableNativeFeedback
style={styles.img} >
<View>
<Text style= {styles.instructions}>
Button!
</Text>
</View>
</ TouchableNativeFeedback>
<Button style={styles.img} onClick="this.butclick">
<View>
<Text style={styles.instructions}>
This is a Button
</Text>
</View>
</Button>
</View>
);
}
});
}
嘗試使用來自NativBase的按鈕 –