Issue
I am currently using RN to build a component and use this component in an app.
I have followed RN guide to do so. On my iOs side no issue. But on android i have this big empty space below my component, and I don't know how to get rid of this. Here is the expected result (as it is already the case in iOs) : view and button below each others with no blank space
and here is what I have on android : view and button below each others with big blank space
I have tried to investigate on the android native side of the component, but all i was able to end with was a clue in my manager's manuallyLayoutChildren. Here when I multiply the height and width in view.measure it does change the place filled by my view in my component. But it is not a real solution since it has to be fixed everytime you are changing testing device :
public void manuallyLayoutChildren(View view) {
// propWidth and propHeight coming from react-native props
int width = propWidth;
int height = propHeight;
view.measure(
View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY));
view.layout(0, 0, width, height);
}
my xml is really simple and looks like :
<?xml version="1.0" encoding="utf-8"?>
<com.visioglobe.visiomoveessential.VMEMapView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
Do you have any idea on how to fix this ?
Solution
The solution was to update :
view.measure(
View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY));
Answered By - Rémi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.