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

[v4] [Reanimated] Tried to modify key reduceMotion of an object which has been already passed to a worklet #1854

Closed
Willham12 opened this issue Jun 4, 2024 · 37 comments
Labels
bug Something isn't working

Comments

@Willham12
Copy link

Willham12 commented Jun 4, 2024

Bug

[Reanimated] Tried to modify key reduceMotion of an object which has been already passed to a worklet. See
https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#tried-to-modify-key-of-an-object-which-has-been-converted-to-a-shareable

Environment info

Library Version
@gorhom/bottom-sheet 4.6.3
react-native 0.74.1
react-native-reanimated 3.12.0
react-native-gesture-handler 2.16.2

Steps To Reproduce

Open a Bottomsheet

Describe what you expected to happen:

Reproducible sample code

@Willham12 Willham12 added the bug Something isn't working label Jun 4, 2024
@fahad86
Copy link

fahad86 commented Jun 6, 2024

#1848

@pixellet14
Copy link

any solution yet?

@MonishReddyDev
Copy link

ANY SOLUTION

@paulschreiber
Copy link

paulschreiber commented Jul 2, 2024

@MonishReddyDev @pixellet14 The PR was just approved a few hours ago. Give them time to release a new version.

@ebere-hoag
Copy link

Its still showing up for me.

@duyrk
Copy link

duyrk commented Jul 5, 2024

I have the same problem

@ebere-hoag
Copy link

@paulschreiber because its not showing up for you doesn't mean you should put a thumbs down on others comments.

It happens when i open the bottomsheetmodal

@paulschreiber
Copy link

@ebere-hoag I am still seeing the problem. I am putting the 👎 because the people are being impatient. The fix has been approved, but not merged or released. Piling on "me too" comments at this point is not helpful.

@larsmunkholm
Copy link

@paulschreiber Anyone can approve the pull requests, so I'm not sure that really means anything. It hasn't been approved by @gorhom yet :)

@emrekilavuz
Copy link

if I downgrade to 4.6.1, will this warning be gone?

@sayan-wholewave
Copy link

sayan-wholewave commented Jul 8, 2024

if I downgrade to 4.6.1, will this warning be gone?

nothing works till yet.

any update? neither have to use yellowbox/logbox for now.

@Nurulloh01
Copy link

did someone resolve it

@shymaaMohmed
Copy link

I have the same problem

@mrtawil
Copy link

mrtawil commented Jul 9, 2024

+1

@Willham12
Copy link
Author

There is a PR #1848

@hdvinhhoang
Copy link

I have the same problem

@duyrk
Copy link

duyrk commented Jul 10, 2024

#1848
Apply the patch that mentioned in this issue, everything will work just fine.

@sayan-wholewave
Copy link

There is a PR #1848

thanks. it's working .

@kashkashio
Copy link

Merging anytime soon?

@H4mxa
Copy link

H4mxa commented Jul 14, 2024

+1

6 similar comments
@shuo-hiwintech
Copy link

+1

@ksevil
Copy link

ksevil commented Jul 16, 2024

+1

@LeandroAlberti
Copy link

+1

@Zergus-s
Copy link

+1

@darkartur
Copy link

+1

@thianphat
Copy link

+1

@1mike12
Copy link

1mike12 commented Jul 20, 2024

another quick workaround without having to fiddle with patches is to set the installation to the proposed PR for now

{
"dependencies": {
    "@gorhom/bottom-sheet": "pafry7/react-native-bottom-sheet#fix/config-reducerMotion-in-worklet",
    }
}

@tboy44wiz
Copy link

@1mike12 How do I go about with this your suggestion. Which of the app dependencies?

@bgever
Copy link

bgever commented Jul 20, 2024

Thanks for the tip @1mike12, and thanks for the fix @pafry7!

For yarn, add the following to the root package.json (leave your existing dependencies unchanged):

  "resolutions": {
    "@gorhom/bottom-sheet": "github:pafry7/react-native-bottom-sheet#fix/config-reducerMotion-in-worklet"
  },

See https://yarnpkg.com/configuration/manifest#resolutions for what it does.

Then run yarn from the root package:

bart%Barts-MBP2 ~/repos/myapp ➜ yarn                                                                                                                                                                                                                                                                                         
➤ YN0000: · Yarn 4.3.1
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + @gorhom/bottom-sheet@https://github.com/pafry7/react-native-bottom-sheet.git#commit=9c4c6eba41197a92990e79591dc9e6546ab9edbb
➤ YN0085: │ - @gorhom/bottom-sheet@npm:4.6.3
➤ YN0000: └ Completed in 33s 710ms
[...]

I had to clear the Metro cache before it started to work.

@LukasMod
Copy link

LukasMod commented Jul 24, 2024

Any idea why even with this fix I get this warning after modal is opened second time?

First open / close is working fine, but next time when I try to open the same or another BottomSheetModal it shows warning with reduceMotion info. Is it something wrong with implementation here? I use same HOC for all my modals. In children it's usually BottomSheetScrollView. Tried both patch-package and this solution. I can see these code changes in my node_modules so fix is there.

const animationConfig: WithSpringConfig | WithTimingConfig = { duration: 400 };

const DrawerModal: React.FC<DrawerModalPropsType> = ({
    visible,
    children,
    onDismiss,
    snapPoints = ['70%'],
    ...rest
}) => {
    const styles = theme();

    const modalRef = useRef<BottomSheetModal>(null);

    if (modalRef) {
        useBottomSheetBack(visible, modalRef, onDismiss);
    }

    useEffect(() => {
        if (visible) {
            InteractionManager.runAfterInteractions(() => {
                modalRef.current?.present();
            });
        } else {
            if (modalRef.current) {
                modalRef.current.close();
            }
        }
    }, [visible]);

    const handleSheetChanges = useCallback((index: number) => {
        if (index === -1) {
            onDismiss?.();
        }
    }, []);

    const renderBackdrop = useCallback(
        (props: BottomSheetBackdropProps) => (
            <BottomSheetBackdrop
                {...props}
                disappearsOnIndex={-1}
                appearsOnIndex={0}
                pressBehavior='close'
            />
        ),
        [],
    );

    return (
        <BottomSheetModal
            ref={modalRef}
            index={0}
            snapPoints={snapPoints}
            onChange={handleSheetChanges}
            animationConfigs={animationConfig}
            enableDismissOnClose
            backdropComponent={renderBackdrop}
            enableContentPanningGesture={false}
            {...rest}>
            {children}
        </BottomSheetModal>
    );
};

export default DrawerModal;

@Willham12
Copy link
Author

fixed with #1848

@LukasMod
Copy link

@gorhom Can we reopen this issue or should I create a new one? There is still some problem with reopening bottom sheet, same warnings even with 4.6.4. Not only for me #1848 (comment)

@sumin0gig
Copy link

I have the same issue

@bahadiraraz
Copy link

same

@tushe-tv
Copy link

tushe-tv commented Oct 15, 2024

When enableDynamicSizing=false, the warning appears. This is on 5.0.2.

@Willham12
Copy link
Author

related to: #1974

@LukasMod
Copy link

There is no more warnings in my app after upgrading to 5.0.4 (from 4.6.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests