Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The auxiliary element does not animate away when dismissing the context menu by pressing the preview element. #92

Open
GaddiSunshine opened this issue Jan 25, 2024 · 1 comment

Comments

@GaddiSunshine
Copy link

GaddiSunshine commented Jan 25, 2024

Pressing the preview element causes auxiliary element to not animate away. It just waits for the context menu to close and then snaps away

Screen.Recording.2024-01-25.at.14.43.24.mov

Expected behaviour:
The auxiliary element would animate away like it does when pressing outside the preview element.

Actual behaviour:
The auxiliary element does not animate away when dismissing the context menu by pressing the preview element.

Platform:

  • iOS debug configuration build
  • iOS release configuration build

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
@ruairioliverwv
Copy link

ruairioliverwv commented Nov 13, 2024

This patch fixed the issue for me, I apply it with patch-package. I have no need of the code in here but guessing it serves a purpose so I'm not creating a PR for it.

I just commented out all of the code that runs when the users presses on the preview. It still dismiss the preview and the animation works perfectly as if the user tapped the background.

Screenshot 2024-11-13 at 11 22 42

react-native-ios-context-menu+2.5.2.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants