Comments (9)
bundling failed
seems like a weird message, and looks related to building the project, not using it.
Can you explain step by step what you did to receive this error?
from react-native-collapsible-tab-view.
@andreialecu it seems to happen because we are exporting createMaterialCollapsibleTopTabNavigator
and MaterialTopTabsCollapsibleTabView
even if react-navigation
isen't installed. So, if react-navigation
is not added as a dependency, it will break the build.
It's easy to reproduce:
- Create a new expo project
- Add
react-native-collapsible-tab-view
and the peers (withoutreact-navigation
) - Copy the quick start code
expo start
should error- add the
@react-navigation/...
peers expo start
works
Note that the quick start code does not use the navigator. So it should work.
I think the solution is to conditionally export createMaterialCollapsibleTopTabNavigator
and MaterialTopTabsCollapsibleTabView
, but I was not successful.
The other option is to remove the peerDependenciesMeta
, @andreialecu what you think? (thanks for the help)
from react-native-collapsible-tab-view.
I see. I don't use expo so I wasn't familiar with that error signature.
Normally if the material tab files are not imported there shouldn't be any error but I suspect that typescript is interfering. I will take a look in a couple of hours, currently away for a bit.
from react-native-collapsible-tab-view.
Thanks @andreialecu! But don't worry, it's not a priority
from react-native-collapsible-tab-view.
I'm still on mobile but I figured out what the problem is. It's related to these exports:
They should be in a separate file instead of the index. Perhaps one named navigation.tsx
so that end users would import them from "react-native-collapsible-tab-view/navigation" instead.
from react-native-collapsible-tab-view.
Upon further investigation, the problem with my proposed approach above is that because of the path structure of the published package, the imports would end up looking like:
import { createMaterialCollapsibleTopTabNavigator } from "react-native-collapsible-tab-view/lib/module/navigation"
Which isn't a great experience...
There's a proposal here that would allow rewriting the imports so that react-native-collapsible-tab-view/navigation
would work, but I'm not sure if react native and the metro bundler can use it:
https://nodejs.org/api/packages.html#packages_package_entry_points
Alternatives:
-
Could make the peer non optional, but users still need to ensure it's installed in their projects. Peers usually just show a warning while installing, which most users ignore. And having it non-optional isn't a great approach for people that don't need
react-navigation
integration. -
Could publish a separate npm package just with the
react-navigation
integration. Might be do-able, but would need restructuring this project to be a monorepo (via yarn workspaces, for example).
from react-native-collapsible-tab-view.
@andreialecu thanks for the help. Did a quick modification, adding a navigation.tsx
to export the navigator, published the @beta
version to test, and didn't work. Need to import from .../lib/module/navigation
, and something was broken, because the navigator stopped working in my project.
Seems like the best alternative is the 2
you have pointed, I will look into it in the future, but as right now I don't have much time, I will follow the alternative 1
.
from react-native-collapsible-tab-view.
As it isn't an optional dependency anymore (in v1.4.2
), I'm closing. When there is some extra time, I will look into refactoring into a monorepo.
from react-native-collapsible-tab-view.
Good job guys!!!
from react-native-collapsible-tab-view.
Related Issues (20)
- How to modify the width of the indicator
- Getting current scroll position with useCurrentTabScrollY using FlashList
- Bug using FlashList in combination with lazy HOT 1
- App get stuck when switching and scrolling 2-3 time between the Tabs only in android HOT 1
- Invalid onScroll event for Tabs.ScrollView
- Does this work on React Native Web? HOT 1
- Programmatically show header when `revealHeaderOnScroll={true}`
- Make AnimatedPagerView style customizable
- Is there a way to prevent scroll being lost when scrolling through dynamic tabs in collapsed state?
- Is it possible to reveal header on tab change? HOT 1
- Turbo repo - pnpm installation - getting `TypeError: deepEqual is not a function (it is Object)` HOT 3
- Great component! HOT 1
- ExampleComponentSharedPullToRefresh ios bug
- How to make the title slide without having to collapse into a page
- Collapsed header
- How to programatically switch tabs? HOT 2
- Header is reseting when switching to 5th tab from 1st tab HOT 4
- Nested TabViews HOT 1
- change the indicator style HOT 4
- No content rendered when the tab navigation is inside a ScrollView. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-collapsible-tab-view.