[v4] TypeError: global.performance.now is not a function
See original GitHub issueBug
TypeError: global.performance.now is not a function
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | ^4.1.5 |
react-native | ^0.66.3 |
react-native-reanimated | ^2.3.0 |
react-native-gesture-handler | ^2.1.0 |
Steps To Reproduce
- All installation steps for reanimated and gesture-handler have been done
Describe what you expected to happen:
- It works =)
Reproducible sample code
import React, {useCallback, useMemo, useRef} from 'react';
import {View, Text, StyleSheet, Button} from 'react-native';
import {BottomSheetModal, BottomSheetModalProvider} from '@gorhom/bottom-sheet';
import {
gestureHandlerRootHOC,
GestureHandlerRootView,
NativeViewGestureHandler,
} from 'react-native-gesture-handler';
const App = () => {
// ref
const bottomSheetModalRef = useRef<BottomSheetModal>(null);
// variables
const snapPoints = useMemo(() => ['25%', '50%'], []);
// callbacks
const handlePresentModalPress = useCallback(() => {
bottomSheetModalRef.current?.present();
}, []);
const handleSheetChanges = useCallback((index: number) => {
console.log('handleSheetChanges', index);
}, []);
// renders
return (
<BottomSheetModalProvider>
<View style={styles.container}>
<Button
onPress={handlePresentModalPress}
title="Present Modal"
color="black"
/>
<BottomSheetModal
ref={bottomSheetModalRef}
index={1}
snapPoints={snapPoints}
onChange={handleSheetChanges}>
<View style={styles.contentContainer}>
<Text>Awesome 🎉</Text>
</View>
</BottomSheetModal>
</View>
</BottomSheetModalProvider>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
justifyContent: 'center',
backgroundColor: 'grey',
},
contentContainer: {
flex: 1,
alignItems: 'center',
},
});
export default gestureHandlerRootHOC(App);
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:22 (1 by maintainers)
Top Results From Across the Web
global.performance.now is not a function in react native ...
Unable to find any solution to this query. TypeError: global.performance.now is not a function at node_modules/expo/build/ ...
Read more >TypeError: global.performance.now is not a function
1. make change to this file: node_modules/react-native-reanimated/src/reanimated2/core.ts Line 386, remove this: ; 2. ; 3. global.performance = { ; 4. now: ...
Read more >How to solve the issue that arise while using performance. ...
This is a very simple technique to measure the performance of a function. This time is not fixed, it may change every time...
Read more >[Solved] TypeError: global.performance.now is not a function
How to Fix “TypeError: global.performance.now is not a function”? Ranjith Changed status to publish June 17, 2022 ...
Read more >performance.now() - Web APIs - MDN Web Docs
The performance.now() method returns a DOMHighResTimeStamp, measured in milliseconds.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
V2.3.1 Use patch-package and apply this patch:
Or make change to this file:
node_modules/react-native-reanimated/src/reanimated2/core.ts
Line 386, remove this:then add this:
Hope that help, cheers!
This is reanimated issue , fix will be released soon https://github.com/software-mansion/react-native-reanimated/commit/aef72c0875b559eecb7e10abaf00e49186d7ae55, for now I would advise to downgrade it to 2.2.4