0

I was wondering how I would render some Shoutem extension, for simplicity I am going to render it as my only component like so:

import 'es6-symbol/implement';

import React from 'react';
import {
  AppRegistry,
  View
} from 'react-native';

import { AppBuilder } from '@shoutem/core';
import { NavigationBar } from '@shoutem/ui';
import { createStore } from 'redux';
import { Provider } from 'react-redux';

import extensions from './extensions.js';
import { screens } from './extensions/kevinyclu.restaurants/app/index';

const List = screens.List;
const store = createStore((state, action) => state);
const App = () => <Provider store={store}><View><List /></View></ Provider>;


// noinspection JSCheckFunctionSignatures
AppRegistry.registerComponent('Restaurant', () => App);

But this gives me an error that says: enter image description here

Though if I replace the const App = ... with the code that was initially there when I did shoutem configure

const App = new AppBuilder()
  .setExtensions(extensions)
  .setRenderNavigationBar(renderNavigationBar)
  .build();

Then everything works fine, so I was wondering how would I use a Shoutem extension? Or am I missing the point of the extension completely?

YellowPillow
  • 4,100
  • 6
  • 31
  • 57

1 Answers1

0

You simply add it in the Builder by adding a screen. The flow is explained in our getting started docs. You create an extension, create a screen with a shortcut and then upload it to the Shoutem servers and install it in one of your apps on the Builder.

After that, you can go to the app in the Builder and add that new extension's screen by clicking the + button next to Screens. You can easily find your new extension by selecting the Custom category.

Remember that after installing a new app, you should run shoutem configure in the cloned app's directory. This will set up the new configuration you have after you've installed a new extension on the Builder.

Some advice; if you ever uninstall an extension on the Builder, it's good to re-clone your app completely, because shoutem configure will not remove the extension's from the directory, which may "hide" errors. For example, you could be importing something from that extension that you uninstalled, but you won't get an error because the files are all still there, even though they're uninstalled.