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.

isTablet in const "isFull" is not getting real value in the physical samsung tab6

See original GitHub issue

We were experiencing a bug in our app that we couldn’t simulate in the android studio emulator. After a lot of time trying to understand the reasons that we couldn’t simulate what tue QA analyst was showing on the physical device, we found that the

useDetectDevice returns a wrong isTablet value for the input, therefore the alignment was completely different in the physical device. We searched a bit deeper and found out that some android widths and heights from Dimensions are not accurate.

To solve the issue we applied a local patch

` import { Platform, Dimensions } from ‘react-native’; import type { IUseDetectDevice } from ‘./model’;

const msp = (dim, limit) => { return (dim.scale * dim.width) >= limit || (dim.scale * dim.height) >= limit; };

const isTablet = () => { const dim = Dimensions.get(‘screen’); return ((dim.scale < 2 && msp(dim, 1000)) || (dim.scale >= 2 && msp(dim, 1900))); };

const useDetectDevice: IUseDetectDevice = { isAndroid: Platform.OS === ‘android’, isIOS: Platform.OS === ‘ios’, isTablet: isTablet(), };

export { useDetectDevice }; `

by changing to it, the problem was solved. Another way that we could solve the problem is to be able to send a property down to the Dropdown and instead of checking const isFull = orientation === 'LANDSCAPE' && !isTablet; We could do const isFull = orientation === 'LANDSCAPE' && ( !customProp || !isTablet);

Is there a way this could be fixed? We don’t want to use a local fix.

pictures of the problem happening:

image

after changing isTablet function the result image

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
thaynarbocommented, Nov 23, 2022

Hello there, sorry for the delay. It didn’t work 😦

It’s still considering it not to be a tablet I guess.

Is there a chance the code below could be implemented? Our patch worked with it. In many emulators as well as in the physical device.

const isTablet = () => { const dim = Dimensions.get(‘screen’); return ((dim.scale < 2 && msp(dim, 1000)) || (dim.scale >= 2 && msp(dim, 1900))); };

image

1reaction
hoaphantn7604commented, Nov 14, 2022

hi @jeandiego @thaynarbo , I have updated function “isTablet” in release 2.4.0. Not sure is it working. Can you help me re-check issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · hoaphantn7604/react-native-element-dropdown
isTablet in const "isFull" is not getting real value in the physical samsung tab6 ... defaulting to value when nothing has been selected....
Read more >
Features not available or limited on the Galaxy Tab S6 Lite
The Galaxy Tab S6 Lite does not come with every feature that is available on other Galaxy tablets or phones. This guide will...
Read more >
Samsung Galaxy Tab Not Charging? 5 Fixes! - YouTube
I show you how to fix a Samsung Galaxy Tab (Tablet) that is not charging or has charging issues. This should work for...
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