Comments (1)
Hello @PEvgeniya! Thanks for reporting this issue.
This issue is that the values passed to BugReporting.setFloatingButtonEdge
aren't normalized from React Native values to appropriate values to pass to the native side so the way the number passed is treated differs both Android and iOS.
On Android, it expects the value to be in pixel size (px), not in layout size (dp), and React Native uses layout size by default, so the value returned from Dimensions
needs to get scaled to be in pixel size which you can achieve using the PixelRatio
API as below:
const height = Dimensions.get('window').height;
BugReporting.setFloatingButtonEdge(
FloatingButtonPosition.right,
PixelRatio.getPixelSizeForLayoutSize(height * 0.8),
);
On iOS, it expects the value in layout size which is the default in React Native so you can pass the value from Dimensions
as is.
The complete code should look something like this (I'm using Platform
to conditionally normalize the value on Android):
const height = Dimensions.get('window').height;
const offset = 0.8 * height;
BugReporting.setFloatingButtonEdge(
FloatingButtonPosition.right,
Platform.OS === 'android' ? PixelRatio.getPixelSizeForLayoutSize(offset) : offset,
);
We already have it on our radar to make such APIs behave the same on both iOS and Android without the need for manual normalization from the developer's end, but this is how you can achieve it for now. 🙏🏼
I'll close the issue for now but feel free to reopen it if you're still facing any issues with it.
from instabug-react-native.
Related Issues (20)
- Error when using react-native-version HOT 1
- NetworkLogger.setNetworkDataObfuscationHandler not working as expected in iOS (React Native) HOT 8
- Is there any way handle the Beta Welcome Message , like is there any handler for the 'done' button. To do action after clicking on this button HOT 4
- iOS build failing in release mode HOT 4
- Custom fingerprint HOT 8
- Customise strings on Survey Welcome Screen HOT 6
- PhaseScriptExecution [CP-User] HOT 7
- Instabug crashes when init is called in background (Android) HOT 2
- upload_sourcemap.sh: No such file or directory HOT 1
- [Android] Caused by java.lang.IllegalStateException Expected Android API level 21+ but was 33 HOT 1
- Wrong Dutch translations for Android HOT 4
- instabug init not working HOT 2
- Unable to find source map file at: /Users/runner/work/1/s/ios/main.jsbundle.map' HOT 3
- Latest version Instabug plugin getting error PhaseScriptExecution nonzero exit code in Release build iOS HOT 7
- [Android] Cannot add task 'uploadSourcemaps' as a task with that name already exists. HOT 10
- [BUG] this.upload.addEventListener is not a function HOT 2
- [iOS] JS crashes are reported as Native Exception instead of JS Exception HOT 1
- Network logs have a response body as string not a JSON HOT 5
- Jacoco breaks on react native 0.72 HOT 2
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 instabug-react-native.