Web Support
Moti works on all platforms, including Web. Make sure you've installed react-native-web
.
Expo Web support
Expo Web should work out of the box.
Expo Router / Metro Web
You'll need to add mjs
to your sourceExts
in metro.config.js
. For example:
const { getDefaultConfig } = require('expo/metro-config');
const config = getDefaultConfig(__dirname);
config.resolver.assetExts.push(
'mjs’
);
module.exports = config;
Troubleshooting
If you get the following Reanimated error in your console: ReferenceError: _frameTimestamp is not defined
, you can add add this to App.js
at the top:
import { Platform } from 'react-native'
if (Platform.OS === 'web') {
global._frameTimestamp = null
}
This should go away in Reanimated v3. See react-native-reanimated#3355.
Vanilla React Native Web
You may need to add a custom webpack.config.js
to your project and export the config from @expo/webpack-config
.