dominicstop / react-native-ios-context-menu

A react-native component to use context menu's (UIMenu) on iOS 13/14+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Context menu crashes app on exit when rendering auxiliary preview

GaddiSunshine opened this issue · comments

Expected Behavior:
App would not crash when exiting context menu with an auxiliary preview

Actual Behavior:
App crashes when exiting context menu with an auxiliary preview

Platform:

  • iOS

With Auxiliary Preview:

Simulator.Screen.Recording.-.iPhone.15.-.2024-01-25.at.13.21.22.mp4

Without Auxiliary Preview:

Simulator.Screen.Recording.-.iPhone.15.-.2024-01-25.at.13.22.17.mp4

Versions:

"react-native": "0.72.6",
"expo": "49.0.18",
"react-native-ios-context-menu": "2.3.0",
"react-native-ios-utilities": "4.2.3",

Minimal reproducible example:

import React from 'react'
import { StyleSheet, View } from 'react-native'
import { ContextMenuView } from 'react-native-ios-context-menu'

const ContextMenuTest = () => (
  <View style={styles.root}>
    <ContextMenuView
      menuConfig={{
        menuTitle: '',
        menuItems: [
          {
            actionKey: 'cancel',
            actionTitle: 'Cancel',
          },
        ],
      }}
      renderAuxiliaryPreview={() => <View style={styles.auxiliaryElement} />}
    >
      <View style={styles.box} />
    </ContextMenuView>
  </View>
)

const styles = StyleSheet.create({
  root: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  box: {
    height: 50,
    width: 50,
    backgroundColor: 'blue',
  },
  auxiliaryElement: {
    backgroundColor: 'green',
    height: 50,
    width: 200,
  },
})

export default ContextMenuTest

Maybe try the lazy render prop? I also think this is only a dev mode issue

Maybe try the lazy render prop? I also think this is only a dev mode issue

Setting lazyPreview to false fixed the issue for me. Thanks 🙏