Closed adorum closed 2 years ago
Until it's fixed, you could re-export an empty view inside of your own file, such as: context-menu.android.tsx
:
context-menu.tsx
export { ContextMenuView } from 'react-native-ios-context-menu'
context-menu.android.tsx
import { View } from 'react-native'
export const ContextMenuView = View
And then, in any file, just do:
import { ContextMenuView } from './context-menu'
Thanks @nandorojo. Worked like a charm! Just can't find out why its working on android by default (w/o your suggestion) in the example project of this repo. Anyway thanks :)
hi, thanks for creating this issue ✨
sorry it took so long @adorum, but i implemented @nandorojo recommendation in the latest 1.7.1 patch haha
i used to use *.ios.js
/*.android.js
in an older version of this library (i.e. v1.3.0), but i forgot to add it back during the typescript re-write (due to metro + typescript-related bugs).
hopefully the latest patch fixes this (unfortunately, i don't have enough space to install android studio, so i can't verify if this fixes the bug haha)
Edit: So it turns out that platform extensions + typescript can get pretty messy real quick. In the next patch I'll be using platform specific exports instead to fix this bug.
this has now been fixed in v1.7.2 patch ✨
screenshot:
please re-open this issue if this patch doesn't fix the issue haha
@dominicstop Based on docs,
ContextMenuView
should render regular View component on Android. My android app crash with an errorTypeError: Cannot read property 'Commands' of undefined
at the moment ofimport {ContextMenuView} from 'react-native-ios-context-menu'
. I conditionally render the component which contains this import statement only for ios platform.Any suggestions?