question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Users cannot change `isIphoneX` variable in custom themes.

See original GitHub issue

I have gone through these following points

Issue Description

I am no able to modify the isIphoneX variable in my custom theme. Since Native Base currently does not support iPhone XS, iPhone XR and iPhone XS Max, may app does not render properly on those phones.

I think this was an oversight and can be corrected by adding an s to three files. People with custom themes should be able to modify this variable.

node, npm, react-native, react and native-base version, expo version if used

node v8.11.1 npm v6.4.1 react-native 0.56 native-base 2.8.0 expo not used

Expected behaviour

Add the following to your local project’s native-base-theme/variables/platform.js:

import DeviceInfo from 'react-native-device-info';
const isIphoneX = DeviceInfo.hasNotch();  // This can be any custom behavior and does not need to rely on DeviceInfo

We would then expect the Header, Footer and Content components to respond appropriately to the value of the isIphoneX variable set above.

Actual behaviour

The Header', 'Footer' and 'Content' components do not response to the overridden value of isIPhoneX`.

Steps to reproduce

Install react-native-device-info

npm install --save react-native-device-info

Add the following to your local project’s native-base-theme/variables/platform.js:

import DeviceInfo from 'react-native-device-info';
const isIphoneX = DeviceInfo.hasNotch();

Run your app in an iPhone XR simulator. You will notice that the Header, Footer and Content components do not provide adequate margins for the newer iPhones.

Is the bug present in both iOS and Android or in any one of them?

It is present in both.

Any other additional info which would help us debug the issue quicker.

The issue is easy to fix. Simple change variable.isIphoneX to variables.isIphoneX in the Header.js, Content.js and Footer.js files.

I will open a PR.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
prrenishcommented, Mar 27, 2019

The merge is affecting the <StyleProvider /> where it is showing the following error 502747695822728574 The code format which it is affecting is pasted below. <StyleProvider> <Content> .................... </Content> </StyleProvider>

1reaction
suvenduchhatoicommented, Feb 8, 2019

#2514 has been merged

Read more comments on GitHub >

github_iconTop Results From Across the Web

Qlik Sense - Make themes a user-selectable option
So I created 2 apps with two different themes. That made me realize - why not bring in the option for users to...
Read more >
Unable to Update Office 365 Theme - Microsoft Community
I have been trying to customize the theme from the admin center and ... Any normal user cannot change the customize theme, only...
Read more >
Advanced Settings: Getting Started with Theme Variables
While editing a theme, click Advanced Settings in the right panel to display the variables panel. ... The content in this panel will...
Read more >
Bootstrap 5 - Custom theme-colors not updating classes
I can't understand why the variables in the scss file are being affected by the change to $theme-colors, but classes are not. Edit:...
Read more >
Themes - MkDocs
The bare minimum required for a custom theme is a main.html Jinja2 template ... path in their docs_dir , then the user's file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found