TouchableNativeFeedbackSafe.SelectableBackgroundBorderless 不是函数
TouchableNativeFeedbackSafe.SelectableBackgroundBorderless is not a function
我正在尝试在我的基于 react-native 的应用程序中使用 @exponent/react-native-touchable-native-feedback-safe。我似乎无法在不扰乱 ios 或 android 的情况下设置背景道具。
我做了:
<TouchableNativeFeedbackSafe onPress={this.props.onPress}
background={TouchableNativeFeedbackSafe.SelectableBackgroundBorderless()}>
这适用于 android 但在 iOS 上出错:SelectableBackgroundBorderless 不是函数。
如果我将其从 TouchableNativeFeedbackSafe.SelectableBackgroundBorderless()
更改为 TouchableNativeFeedbackSafe.SelectableBackgroundBorderless
,则 iOS 有效,但 android 会抛出错误:
Error while updating property 'nativeBackgroundAndroid' of a view managed by: RCTView
updateViewProp
ViewManagersPropertyCache.java:89
setProperty
ViewManagerPropertyUpdater.java:123
updateProps
ViewManagerPropertyUpdater.java:42
updateProperties
ViewManager.java:36
createView
NativeViewHierarchyManager.java:227
execute
UIViewOperationQueue.java:148
dispatchPendingNonBatchedOperations
UIViewOperationQueue.java:890
doFrameGuarded
UIViewOperationQueue.java:863
doFrame
GuardedChoreographerFrameCallback.java:32
doFrame
ReactChoreographer.java:131
run
Choreographer.java:872
...
原因是展览包装中的错字。有人分叉并已更正它:https://github.com/netbeast/react-native-touchable-native-feedback-safe
但是,我不认为他们发送了拉取请求,因为原始代码在任何地方都不公开。
编辑:
TouchableNativeFeedbackSafe.SelectableBackgroundBorderless()
是使用上述包的正确方法。
我正在尝试在我的基于 react-native 的应用程序中使用 @exponent/react-native-touchable-native-feedback-safe。我似乎无法在不扰乱 ios 或 android 的情况下设置背景道具。 我做了:
<TouchableNativeFeedbackSafe onPress={this.props.onPress}
background={TouchableNativeFeedbackSafe.SelectableBackgroundBorderless()}>
这适用于 android 但在 iOS 上出错:SelectableBackgroundBorderless 不是函数。
如果我将其从 TouchableNativeFeedbackSafe.SelectableBackgroundBorderless()
更改为 TouchableNativeFeedbackSafe.SelectableBackgroundBorderless
,则 iOS 有效,但 android 会抛出错误:
Error while updating property 'nativeBackgroundAndroid' of a view managed by: RCTView
updateViewProp
ViewManagersPropertyCache.java:89
setProperty
ViewManagerPropertyUpdater.java:123
updateProps
ViewManagerPropertyUpdater.java:42
updateProperties
ViewManager.java:36
createView
NativeViewHierarchyManager.java:227
execute
UIViewOperationQueue.java:148
dispatchPendingNonBatchedOperations
UIViewOperationQueue.java:890
doFrameGuarded
UIViewOperationQueue.java:863
doFrame
GuardedChoreographerFrameCallback.java:32
doFrame
ReactChoreographer.java:131
run
Choreographer.java:872
...
原因是展览包装中的错字。有人分叉并已更正它:https://github.com/netbeast/react-native-touchable-native-feedback-safe 但是,我不认为他们发送了拉取请求,因为原始代码在任何地方都不公开。
编辑:
TouchableNativeFeedbackSafe.SelectableBackgroundBorderless()
是使用上述包的正确方法。