software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.86k stars 1.29k forks source link

TypeError: global.performance.now is not a function #2730

Closed baveku closed 2 years ago

baveku commented 2 years ago

Description

App crash when we start animation TypeError: global.performance.now is not a function

Expected behavior

Scroll Without Crashed

Actual behavior & steps to reproduce

<FlatList style={{ flex: 1 }}
                contentInset={{ top: 24 }}
                data={posts}
                renderScrollComponent={props => <Animated.ScrollView {...props} />}
                renderItem={({ item, index }) => <FeedCell post={item} imageIndex={item.id} onRemove={() => onRemove(item.id)} />}
                keyExtractor={(item, ind) => `${item.id}`}
                // Performance settings
                removeClippedSubviews={true} // Unmount components when outside of window
                initialNumToRender={6} // Reduce initial render amount
                maxToRenderPerBatch={2} // Reduce number in each render batch
                updateCellsBatchingPeriod={100} // Increase time between renders
                windowSize={6}
                scrollIndicatorInsets={{ top: 0 }}
            />

Package versions

Affected platforms

github-actions[bot] commented 2 years ago

Issue validator

The issue is valid!

Crysp commented 2 years ago

same issue, when use useAnimatedStyle

chrisnojima commented 2 years ago

this is due to https://github.com/software-mansion/react-native-reanimated/blob/main/src/reanimated2/core.ts#L386 clobbering the values

enesozturk commented 2 years ago

Same here with v2.3.1 in Expo app. Trying to use it with Storybook RN. I have a basic stack:

<Stack.Navigator>
  <Stack.Screen name="Home" component={TabNavigator} />
  <Stack.Screen name="Storybook" component={Story} />
</Stack.Navigator>

When I navigate to Storybook page, it is ok but when press go back. I got the issue.

Screen Shot 2021-12-17 at 21 18 50

Packages:

{
  "expo": "^44.0.0",
  "react-native-reanimated": "~2.3.1",
}

Should I share any other details?

Edit: Looks like it has nothing to do with react navigation. When I try to unmount Storybook, it throws this error.

enesozturk commented 2 years ago

I think we can close this too, it is fixed in https://github.com/software-mansion/react-native-reanimated/pull/2761 by @michaelknoch and @piaskowyk.