Export assets for easy caching in Expo
This commit is contained in:
parent
a69a4e3c04
commit
0ad814c529
|
@ -1,8 +1,11 @@
|
|||
import React from 'react';
|
||||
import Expo from 'expo';
|
||||
import { FlatList, I18nManager } from 'react-native';
|
||||
import { createSwitchNavigator } from '@react-navigation/core';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { createSwitchNavigator } from 'react-navigation';
|
||||
import {
|
||||
Assets as StackAssets,
|
||||
createStackNavigator,
|
||||
} from 'react-navigation-stack';
|
||||
import { ListSection, Divider } from 'react-native-paper';
|
||||
|
||||
import SimpleStack from './src/SimpleStack';
|
||||
|
@ -41,12 +44,8 @@ const data = [
|
|||
},
|
||||
];
|
||||
|
||||
Expo.Asset.loadAsync(
|
||||
require('react-navigation/src/views/assets/back-icon.png')
|
||||
);
|
||||
Expo.Asset.loadAsync(
|
||||
require('react-navigation/src/views/assets/back-icon-mask.png')
|
||||
);
|
||||
// Cache images
|
||||
Expo.Asset.loadAsync(StackAssets);
|
||||
|
||||
class Home extends React.Component {
|
||||
static navigationOptions = {
|
||||
|
|
10
src/index.js
10
src/index.js
|
@ -1,4 +1,5 @@
|
|||
/* eslint-disable import/no-commonjs */
|
||||
import { Platform } from 'react-native';
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
|
@ -11,6 +12,15 @@ module.exports = {
|
|||
/**
|
||||
* Views
|
||||
*/
|
||||
get Assets() {
|
||||
return Platform.select({
|
||||
ios: [
|
||||
require('./views/assets/back-icon.png'),
|
||||
require('./views/assets/back-icon-mask.png'),
|
||||
],
|
||||
android: [require('./views/assets/back-icon.png')],
|
||||
});
|
||||
},
|
||||
get Header() {
|
||||
return require('./views/Header/Header').default;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue