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

[interpolate] Exception NSException * "Mouting block is expected to not be set" #2764

Closed
1 task
chareefdev opened this issue Dec 18, 2021 · 2 comments
Closed
1 task

Comments

@chareefdev
Copy link

Description

I'm trying to implement collapsible header , it works on android without crashing but not ios,
On ios if i scrolled to top agian it crashed
Exception NSException * "Mouting block is expected to not be set" 0x0000600003805dd0
For android -> facebook/react-native#21801 [exactly like this one]

Expected behavior

without app crashing

Actual behavior & steps to reproduce

Check details below

Snack or minimal code example

This works

const TestReanimated = () => {
    const scrollY = useSharedValue(0);
    const scrollHandler = useAnimatedScrollHandler({
        onScroll: e => {
            scrollY.value = e.contentOffset.y;
        },
    });
    const animatedStyles = useAnimatedStyle(() => {
        const height = interpolate(scrollY.value, [0, 200], [230, 0], {
            extrapolateRight: Extrapolate.CLAMP,
        });

        return {
            height,
        };
    });

    return (
        <SafeAreaView flex={1}>
            <Animated.View
                style={[
                    animatedStyles,
                    {
                        backgroundColor: 'blue',
                    },
                ]}
            />
            <View style={{height:300}}>
                <Animated.ScrollView
                    scrollEventThrottle={16}
                    style={[
                        {
                            backgroundColor: 'green',
                        },
                    ]}
                    onScroll={scrollHandler}>
                    {new Array(100).fill().map(() => {
                        return (
                            <View>
                                <Text>sad</Text>
                            </View>
                        );
                    })}
                </Animated.ScrollView>
            </View>
            <View>
                <Text>footer</Text>
            </View>
        </SafeAreaView>
    );
};

This doesn't work

  <SafeAreaView flex={1}>
            <Animated.View
                style={[
                    animatedStyles,
                    {
                        backgroundColor: 'blue',
                    },
                ]}
            />
            <Animated.ScrollView
                scrollEventThrottle={16}
                style={[
                    {
                        backgroundColor: 'green',
                    },
                ]}
                onScroll={scrollHandler}>
                {new Array(100).fill().map(() => {
                    return (
                        <View>
                            <Text>sad</Text>
                        </View>
                    );
                })}
            </Animated.ScrollView>
            <View>
                <Text>footer</Text>
            </View>
        </SafeAreaView>

Package versions

  • React Native:0.66.4
  • React Native Reanimated:2.3.1
  • NodeJS:14.18.0
  • Xcode:13.0
  • Java & Gradle:

Affected platforms

  • Android
  • iOS
  • Web
@github-actions
Copy link

Issue validator

The issue is valid!

@piaskowyk piaskowyk linked a pull request Dec 28, 2021 that will close this issue
6 tasks
@piaskowyk piaskowyk self-assigned this Dec 28, 2021
@piaskowyk
Copy link
Member

Hey, thanks for your report! This is the same issue as here: #2285 and I'm working on a solution.

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

Successfully merging a pull request may close this issue.

2 participants