Comments (9)
@chrisk-7777 Thank you, I pushed fix and its available from master branch.
I also think it is more Ionic issue and created new ticket
from panes.
Sorry a bit of a delay, but can confirm that latest commit did solve the issue 👍
from panes.
Addressed to ionic-team/ionic-framework#27984
from panes.
It appears that componentOnReady
is no longer available on document.querySelector('ion-app')
.
When trying to use this panes library, I receive the following error:
I've read through the changelog but can't find anything to suggest that it was removed.
I'm on version 7 of ionic.
As a temporary workaround, I have stubbed out the method so this library doesn't error:
useEffect(() => {
(document.querySelector('ion-app') as any).componentOnReady = () => {};
myPane.current = new CupertinoPane(panelRef.current!, {
parentElement: 'body',
breaks: {
middle: { enabled: true, height: 300, bounce: true },
bottom: { enabled: true, height: 80 },
},
events: {
onDrag: () => console.log('Drag event'),
},
});
}, []);
from panes.
Hello @chrisk-7777
It seems that componentOnReady()
is a stencil function. And I don't see any issues here (example) using it.
You probably won't use componentOnReady()
if you do not initialize the pane instantly on page load. This function is to fix setting event assignation on page load.
You might also replace it with 150ms timeout
, but of course, it is not a perfect way.
I suspect that when you try to call this method inside of useEffect
, the Ionic component is not loaded fully at all, and the method not accessible.
What do you think?
from panes.
Hey @roman-rr thanks for the reply!
Honestly, I'm not too sure - I'm not familiar with stencil at all. This is just a fresh ionic 7 app with only pane installed.
Sorry - to be clear, I'm not using componentOnReady directly. It seems pane uses it under the hood if it detects an ionic app in use (https://github.com/tech-systems/panes/blob/master/src/cupertino-pane.ts#L290).
If I add a breakstop to that line, and inspect this.ionApp
, componentOnReady
isn't on it. Even if I set a timeout of 5000ms
. However, I can see other lifecycle methods, like componentDidLoad
I've tried to hunt around the Stencil docs for componentOnReady
but couldn't find anything (https://stenciljs.com/docs/component-lifecycle).
Typically useEffect
would be the place to mount something like this, so I'm not positive that is the issue. It just seems that componentOnReady
simply doesn't exist on document.querySelector('ion-app')
.
One interesting difference between your fiddle and my react version is ion-app
never receives a class hydrated
.
I'm happy to continue with my workaround, it seems to work. Do you know of any react + ionic + panes simple examples available, I could be missing something painfully obvious.
from panes.
@chrisk-7777 Thank you for details. Are you able to repository with demo code, or create environment with react and simple reproduction on jsfiddle or similar platforms?
from panes.
@chrisk-7777 Thank you for details. Are you able to repository with demo code, or create environment with react and simple reproduction on jsfiddle or similar platforms?
Yup, easy one: https://github.com/chrisk-7777/ionic-7-pane-demo
npm install
npm run dev
Then click the "open pane" button on Tab1.
There are only two commits, commit 1 is the base ionic install, commit 2 is adding pane.
Note that by uncommenting the line here then it works, because the componentOnReady method is stubbed.
from panes.
Awesome, thanks @roman-rr !
from panes.
Related Issues (20)
- [FEAT] Update changelog & Add husky to project HOT 3
- [FEAT] Add husky to project
- [BUG] ion-select-options appear behind the pane, select itself doesnt. HOT 3
- [BUG] z-Index issue or request to set it manually. HOT 2
- [FEAT] Close all panes on hardware back button event HOT 2
- [BUG] modal appears and overlaps screen if parentElement is gone HOT 1
- [BUG] fitHeight not set height HOT 6
- [FEAT]
- [BUG] calcFitHeight need some time to calc correctly HOT 1
- [BUG] Panes cannot be dragged in Chrome HOT 4
- [BUG] swipe down and close pane on iframe HOT 1
- [FEAT] Is it possible to display pane with horizontal offset by default HOT 3
- [BUG] fitHeight + calcFitHeight incorrect size when changed content inside via v-if in vuejs 3
- [BUG] Vite uglify modules names HOT 2
- [FEAT] Sponsorship packages
- [FEAT] AI initiatives
- [FEAT] Space Video
- Vue.js 3 example HOT 5
- [FEAT] Tracking & Analytics for product improvement
- Pane Break Points dont work as expected when changing screen layout HOT 1
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 panes.