在模拟器 iOS 10.3 iPhone 6 上运行应用程序时,没有出现这样的异常问题,但在真实手机上运行时出现此异常:
_reactNative.TouchableNativeFeedback.Ripple is not function. (In '_reactNative.TouchableNativeFeeedback.Ripple(_platform2.default.androidRippleColor)','_reactNative.TochableNativeFeedback.Ripple' is undefined)
当我触摸此组件时发生这种情况:
<View style={styles.centerView}>
<TouchableOpacity style={styles.touch} onPress={this.openCamera} >
<Image
source={require('assets/img/camera.png')}
style={styles.cameraIcon}
>
</Image>
</TouchableOpacity>
<Text style={styles.text}>{translate.t('openCamera')}</Text>
</View>
var styles = StyleSheet.create({
centerView: {
flex: 1,
alignItems: 'center',
justifyContent:'center',
flexDirection: 'column'
},
cameraIcon: {
width:'100%',
height: '100%',
resizeMode: 'contain',
},
touch: {
width:'80%',
height: '50%',
marginBottom: 15,
backgroundColor:"transparent"
},
text: {
color: '#949494',
width:'85%',
alignSelf: 'center',
textAlign: 'center',
fontSize: responsiveFontSize(3),
},
});
onPress 是 react-router-redux-flux 的 Actions.camera() 调用
此代码可在 Android 上以调试和 dist 模式运行。此代码可以在 iOS 模拟器上运行,但不能在设备上运行。
有人可以指出我可能出现的错误吗?
最佳答案
TouchableNativeFeedback 用于使 View 正确响应触摸的包装器(仅限 Android)。在 Android 上,此组件使用 native 状态可绘制来显示触摸反馈。
关于javascript - React-Native TouchableNativeFeedback.Ripple 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43244306/