我正在尝试在基于 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
...