callstack / super-app-showcase

Monorepository template for super app development with React Native and Re.Pack
MIT License
382 stars 63 forks source link

mini app with React Native Tab View implementation #66

Closed zeohera closed 9 months ago

zeohera commented 9 months ago

Environment

nodejs 16.14.2 on apple silicon macintosh

Description

I want to use React Native Tab View https://reactnavigation.org/docs/tab-view/ on a mini app but face with "View config getter callback for component RNCViewPager must be a function (received undefined)" Render Error.

i am install with yarn workspace dashboard add react-native-tab-view react-native-pager-view

and put demo component into Dashboard/AccountScreen

Is this an error? or Is there anything wrong with my implementation?

Reproducible Demo

link to the demo issue https://github.com/zeohera/super-app-showcase

run project and go to services tab >> dashboard card >> account tab to see this issue happen.

zeohera commented 9 months ago

https://github.com/callstack/super-app-showcase/assets/47137794/fecbcee3-8104-4630-962e-7ccd6197f603

jbroma commented 9 months ago

Hey @zeohera,

I've checked your issue, was able to reproduce it and found the solution:

you have to add the following imports in host's index.js file:

import 'react-native-pager-view';
import 'react-native-tab-view';

As you are not using react-native-tab-view or react-native-pager-view inside of the host app, webpack detects this dependency as being unused and strips it from the bundle completely. Adding imports like this ensures the whole dependency will be included in the host app and will be made available for consumption by the mini-apps

zeohera commented 9 months ago

it works, thanks @jbroma