Offline resources cache


#1

Hello,

I have the following assetBundlePatterns definition in my app.json file (with SDK 26):

"assetBundlePatterns": [
  "assets/**",
  "node_modules/react-navigation/src/**/*.png",
  "node_modules/@expo/vector-icons/fonts/{MaterialIcons,MaterialCommunityIcons}.ttf",
]

I’d like to know if I still need to use the following routine:

return Promise.all([
  Asset.loadAsync([
    require('./assets/images/logo.png'),
    require('react-navigation/src/views/assets/back-icon.png')
  ]),
  Font.loadAsync({
    ...MaterialIcons.font,
    ...MaterialCommunityIcons.font
  })
]);

or I can just reference my assets without loadAsync() previously.

I posted some months ago a similar question (Trying to understand assetBundlePatterns) but I didn’t get a clear answer about how resources are resolved to local bundle hash names using require (@janic).

Thanks !!!


#2

Hey @outatime,

I believe this answer covers your question. Is prefetching assets considered harmful when using assetBundlePatterns?

Cheers,

Adam


#3

Yup @adamjnav, thanks !!!


closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.