question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expo SDK 44: AnimatePresence + MotiView crash

See original GitHub issue

Hi,

a simple

        <AnimatePresence exitBeforeEnter>
          {cameraPosition === 'back' && (
            <MotiView
              key="torch"
              from={{
                opacity: 0,
                scale: 0.9
              }}
              animate={{
                opacity: 1,
                scale: 1
              }}
              exit={{
                opacity: 0,
                scale: 0.9
              }}
            >
              <PressableOpacity
                style={styles.button}
                onPress={onFlashPressed}
                disabledOpacity={0.4}
              >
                <Ionicons
                  name={flash === 'on' ? 'flash' : 'flash-off'}
                  color="white"
                  size={24}
                />
              </PressableOpacity>
            </MotiView>
          )}
        </AnimatePresence>

crashed the app for me. Had to boot XCode in order to get the message:

2021-12-22 10:20:23.980439+0100 development[5573:1639062] [native] Tried to synchronously call anonymous function from a different thread.

Occurred in worklet location: /Users/hirbod/.../node_modules/react-native-reanimated/lib/reanimated2/hook/useAnimatedStyle.js (332:24)

Possible solutions are:
a) If you want to synchronously execute this method, mark it as a Worklet
b) If you want to execute this method on the JS thread, wrap it using runOnJS

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
EvanBaconcommented, Jan 11, 2022

Exotic will skip the moti package name in Metro the same way Webpack auto skips moti. Learn how to fix here.

const { createExoticTransformer } = require('@expo/metro-config/transformer');

module.exports = createExoticTransformer({
  transpileModules: ['moti'],
});
0reactions
cybercriscommented, Feb 3, 2022

Nice @EvanBacon. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Expo SDK 44 expo-camera crashing when Eas ...
Expo SDK 44 : expo-camera is crashing when the application is run on Eas build while it works fine on the normal expo...
Read more >
Installation | Moti
Moti 0.17.x requires Reanimated 2.3.0 or higher. This version is compatible with Expo SDK 44. Moti 0.16.x is compatible ...
Read more >
Reanimated - Expo Documentation
react-native-reanimated provides an API that greatly simplifies the process of creating smooth, powerful, and maintainable animations.
Read more >
Topics tagged Reanimated - Expo Forums
Expo sdk 44 splash screen error on android 5.1 · Expo SDK ... Reanimated 2 compatibility with SDK 44 · Expo SDK ......
Read more >
Expo SDK 45. Today we're announcing the release of…
A race condition would cause prior versions of expo-dev-client to crash the first time they were used on an iOS device has been...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found