react-native-hold-menu icon indicating copy to clipboard operation
react-native-hold-menu copied to clipboard

Synchronously call function

Open productdevbook opened this issue 3 years ago • 29 comments

Screen Shot 2021-03-09 at 20 07 30

Screen Shot 2021-03-09 at 20 08 58

Originally posted by @productfrontenddeveloper in https://github.com/enesozturk/react-native-hold-menu/issues/9#issuecomment-794175410

productdevbook avatar Mar 09 '21 17:03 productdevbook

Could you please share other details in bug issue template for your example?

HoldMenuProvideis should be used in root of your app (App.js) by the way. And what kind a usage are you trying? If you want to use touchable or pressable with HoldMenu you can check this usage.

enesozturk avatar Mar 09 '21 18:03 enesozturk

Screens tsx

import { Box, StyledText } from 'components';

import * as React from 'react';

import { useNavigation } from '@react-navigation/native';
import { useDispatch } from 'react-redux';

import I18n from 'lang/languages';

import { ListInterface } from 'store/types';
import { Pressable } from 'react-native';
import { HoldItem } from 'react-native-hold-menu';

interface Props {
  item: ListInterface;
  isFirstElement?: boolean;
  isLastElement?: boolean;
  onPress?: () => void;
}

export const MeListItem = (props: Props) => {
  const MenuItems = [
    { text: 'Actions', isTitle: true, onPress: () => {} },
    { text: 'Action 1', onPress: () => {} },
    { text: 'Action 2', withSeperator: true, onPress: () => {} },
    { text: 'Action 3', isDestructive: true, onPress: () => {} },
  ];

  return (
    <Box>
      <HoldItem items={MenuItems}>
        <Pressable onPress={() => console.log('test')}>
          <StyledText fontSize={25}>{props.item.emoji}</StyledText>
        </Pressable>
      </HoldItem>
    </Box>
  );
};

app.tsx

 <HoldMenuProvider theme="light">
              <Navigator />
            </HoldMenuProvider>

productdevbook avatar Mar 09 '21 18:03 productdevbook

Are we going to go one by one? Which versions are you using?

enesozturk avatar Mar 09 '21 18:03 enesozturk

Are we going to go one by one? Which versions are you using?

oo sorry :(

Package versions

React: 17.0.1
React Native: 0.64.0-rc.4
React Native Reanimated: 2.0.0

productdevbook avatar Mar 09 '21 18:03 productdevbook

And the Hold Menu version? Is it v0.0.8? This might because of your Reanimated setup as well. Be sure Reanimated it is working fine.

enesozturk avatar Mar 09 '21 18:03 enesozturk

And the Hold Menu version? Is it v0.0.8? This might because of your Reanimated setup as well. Be sure Reanimated it is working fine.

yes, v0.0.8, Reanimated I've been using it for a long time, but let me check again.

productdevbook avatar Mar 09 '21 19:03 productdevbook

I see, I have to reproduce problem to solve and will try. Any help would be great to reproduce it.

enesozturk avatar Mar 09 '21 19:03 enesozturk

I see, I have to reproduce problem to solve and will try. Any help would be great to reproduce it.

Reanimated no problem, add react-native-hold-menu some problem https://user-images.githubusercontent.com/38668796/110529174-f8a2e780-8129-11eb-90ca-b65ca7e33ea5.mov

productdevbook avatar Mar 09 '21 19:03 productdevbook

https://github.com/software-mansion/react-native-reanimated/releases/tag/2.0.0

Can it test this with the stable version just released? I wonder if the library does not work steadily

productdevbook avatar Mar 10 '21 05:03 productdevbook

I have not tested with stable version yet but was working with rc-3 that last version before the stable. No breaking changes after rc-3 (maybe this). Will try it today with 2.0.0.

enesozturk avatar Mar 10 '21 06:03 enesozturk

@enesozturk Can it run ? I have the same error. I use react-native init to create a project and follow react-native-unimodules installing. Do I need try create-react-native-app to create a project ?

llr101 avatar Mar 17 '21 11:03 llr101

Hi @BooYeu, I am trying to fix another more important issue for now, after that this must be solved with new release. It is important which React Native and Reanimated version you are using. You can check the expo project or clone this repo and run the example project.

enesozturk avatar Mar 17 '21 21:03 enesozturk

@enesozturk thank you very much ^^ . And I want to know dose it also need expo in the new release ? My app will be bigger when I choice add react-native-unimodules to enable expo function

llr101 avatar Mar 18 '21 01:03 llr101

@enesozturk thank you very much ^^ . And I want to know dose it also need expo in the new release ? My app will be bigger when I choice add react-native-unimodules to enable expo function

You don't have to use Expo. You can use bare RN setup with unimodules. It is needed for blurview and haptic feedback. We may make it optional further releases.

enesozturk avatar Mar 18 '21 05:03 enesozturk

@enesozturk ok ok , thank you . I really really like this project and appreciate . And want to know maybe when it can use in [email protected] and [email protected] stable version ?

llr101 avatar Mar 18 '21 05:03 llr101

@enesozturk ok ok , thank you . I really really like this project and appreciate . And want to know maybe when it can use in [email protected] and [email protected] stable version ?

Not sure. Thanks for let me know the versions. I will check it 👍🏽

enesozturk avatar Mar 18 '21 05:03 enesozturk

I fix the problem by set _leftOrRight from object to value, and edit "..._leftOrRight" to "left:_leftOrRight" but now , I found items onPress error . Maybe also because of react-native-reanimated stable version?

llr101 avatar Mar 27 '21 10:03 llr101

There must be something missing. _leftOrRight is returning an object are you sure? And what if it is opening from right? Yes there is an issue I am following it. https://github.com/software-mansion/react-native-reanimated/issues/1758 Reanimated team also worked on int an releases in v2.0.1 but still exist -> https://github.com/software-mansion/react-native-reanimated/pull/1844

enesozturk avatar Mar 27 '21 11:03 enesozturk

I see the object _leftOrRight just has one param . So I change _leftOrRight to number, and edit it like "left:_leftOrRight". Then it can run and shows ok. Do you have error when click the item . I give an onPress param , But it shows like this 41616844434_ pic

llr101 avatar Mar 27 '21 11:03 llr101

and it seems your doc write a wrong props . holditems your doc shows styles , but it is containerStyles in codes~~

llr101 avatar Mar 27 '21 11:03 llr101

and it seems your doc write a wrong props . holditems your doc shows styles , but it is containerStyles in codes~~

Oh I see, will fix it 👍🏽

enesozturk avatar Mar 27 '21 12:03 enesozturk

and item text prop doesn't support Chinese like " 你好". It shows error code.I review the code the whole day. But I don't know why...Do you have any idea ? Thank you very much !!!! 11616846767_ pic

llr101 avatar Mar 27 '21 12:03 llr101

That is weird. No idea why. Maybe it is related the same issue. Text is passing through Shared Value. That might breake something.

enesozturk avatar Mar 27 '21 12:03 enesozturk

I am experiencing this exact same error, any fix for it yet?

cayasso avatar Apr 23 '21 22:04 cayasso

As @BooYeu pointed out the solution, that works because object spread is not supported in worklets, its a known problem, as mentioned in the reanimated docs here https://docs.swmansion.com/react-native-reanimated/docs/next/#known-problems-and-limitations

cayasso avatar May 04 '21 14:05 cayasso

Maybe you guys could release this to npm? We're having to point to the develop branch because the npm version is broken and I don't think it's going to work for anyone.

bfischer1121 avatar Jul 29 '21 11:07 bfischer1121

For anyone encountering this issue, the simplest thing I found is to fork the repo, build the develop branch, remove lib from the .gitignore and commit it, then point to your fork in the package.json

bfischer1121 avatar Aug 05 '21 00:08 bfischer1121

Having the exact same issue here too. Using react-native: 0.65.1 And last version of this package

riamon-v avatar Sep 16 '21 16:09 riamon-v

For anyone encountering this issue, the simplest thing I found is to fork the repo, build the develop branch, remove lib from the .gitignore and commit it, then point to your fork in the package.json

Not working for me

riamon-v avatar Sep 16 '21 17:09 riamon-v