Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin?
See original GitHub issueBug
Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated’s babel plugin? shows me when i tried to run this lib in expo project.
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | Release 3.6.6 |
react-native | 0.64 |
react-native-reanimated | 2.2.0 |
react-native-gesture-handler | 1.10.3 |
Steps To Reproduce
- Copy and paste code in example and got error Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated’s babel plugin?
Describe what you expected to happen:
1.Expected to run example in github
Reproducible sample code
My code so far:
import React, { useCallback, useRef, useMemo } from "react";
import { StyleSheet, View, Text, Button } from "react-native";
import BottomSheet, { BottomSheetFlatList } from "@gorhom/bottom-sheet";
const App = () => {
// hooks
const sheetRef = useRef(null);
// variables
const data = useMemo(
() =>
Array(50)
.fill(0)
.map((_, index) => `index-${index}`),
[]
);
const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
// callbacks
const handleSheetChange = useCallback((index) => {
console.log("handleSheetChange", index);
}, []);
const handleSnapPress = useCallback((index) => {
sheetRef.current?.snapTo(index);
}, []);
const handleClosePress = useCallback(() => {
sheetRef.current?.close();
}, []);
// render
const renderItem = useCallback(
({ item }) => (
<View style={styles.itemContainer}>
<Text>{item}</Text>
</View>
),
[]
);
return (
<View style={styles.container}>
<Button title="Snap To 90%" onPress={() => handleSnapPress(2)} />
<Button title="Snap To 50%" onPress={() => handleSnapPress(1)} />
<Button title="Snap To 25%" onPress={() => handleSnapPress(0)} />
<Button title="Close" onPress={() => handleClosePress()} />
<BottomSheet
ref={sheetRef}
snapPoints={snapPoints}
onChange={handleSheetChange}
>
<BottomSheetFlatList
data={data}
keyExtractor={(i) => i}
renderItem={renderItem}
contentContainerStyle={styles.contentContainer}
/>
</BottomSheet>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 200,
},
contentContainer: {
backgroundColor: "white",
},
itemContainer: {
padding: 6,
margin: 6,
backgroundColor: "#eee",
},
});
export default App;
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
Reanimated 2 failed to create a worklet, maybe you forgot to ...
Description Getting Issue in build compilation- Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin?
Read more >Reanimated 2 failed to create a worklet, maybe you forgot to ...
The error is: Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin? react-native ...
Read more >Error: Reanimated 2 failed to create a worklet
Error : Reanimated 2 failed to create a worklet — Maybe You Forgot to Add Reanimated's babel Plugin? The solution… Photo by Richard...
Read more >Reanimated 2 failed to create a worklet, maybe you ... - Reddit
When I add this imports I get title error. import Animated, { useAnimatedStyle, useSharedValue, withDelay, withRepeat, withTiming, ...
Read more >Installation | React Native Reanimated - Software Mansion
After adding the react-native-reanimated/plugin to your project you may encounter a false-positive "Reanimated 2 failed to create a worklet" error.
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
expo install
expo start --clear
May this helpful
Have you followed expo’s install guide? Configured babel config?