bug: property style doesn't work on root IonPage
See original GitHub issuePrerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- v4.x
- v5.x
- v6.x
Current Behavior
Property style doesn’t passing through an IonPage component
Expected Behavior
Property style should be passing to the actual IonPage element get rendered on the DOM
Steps to Reproduce
minimal ionic-react code
import { IonApp, IonContent, IonHeader, IonPage, IonTitle, IonToolbar, setupIonicReact } from '@ionic/react'
import '@ionic/react/css/core.css'
import { createRoot } from 'react-dom'
setupIonicReact()
createRoot(document.getElementById('root')).render(<IonApp>
<IonPage style={{ backgroundColor: 'black !important' }}>
<IonHeader>
<IonToolbar>
<IonTitle>My Title</IonTitle>
</IonToolbar>
</IonHeader>
<IonContent>
Hello World
</IonContent>
</IonPage>
</IonApp>)
Code Reproduction URL
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
TS2339: Property 'style' does not exist on type 'Element'
You need a typecast: Array.from(document.getElementsByClassName('mat-form-field-infix') as HTMLCollectionOf<HTMLElement>).
Read more >ion-modal: Ionic Mobile App Custom Modal API Component
ion-modal is a dialog that appears on top of mobile app content, and must be dismissed before interaction resumes. Learn more about custom...
Read more >9 Common Problems in Windows 8.1 | Network Wrangler
This problem seems to derive from a bug between the OS and a hardware driver of installed software. The problem usually comes from...
Read more >Ionic Modal In Vue JS, Managing Events - DEV Community
This post is kinda old, there is a full example on using IonModal Here No TS Ionic Vue Example If you have issues...
Read more >Property 'style' does not exist on type 'Element' in TS
The error "Property 'style' does not exist on type 'Element'" occurs when we try to access the `style` property on an element that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@natqe thanks for the reproduction!
This appears to be an issue with the root
IonPageinstance. If you have a nestedIonPage, the inner instance appropriately applies inline styles.This looks to be a flaw with the
IonPagereact implementation.To work around this issue, you can specify
classNameand it will apply correctly:I’ll track this issue as a bug with react & we will prioritize in upcoming sprints or downtime. Thanks!
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.