Skip to content

Commit

Permalink
Fix bottom insets being affected by the keyboard on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed May 22, 2020
1 parent 93568d0 commit 67c8a39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
return new EdgeInsets(
insets.getSystemWindowInsetTop(),
insets.getSystemWindowInsetRight(),
insets.getSystemWindowInsetBottom(),
// System insets are more reliable to account for notches but the
// system inset for bottom includes the soft keyboard which we don't
// want to be consistent with iOS. In practice it should always be
// correct since there cannot be a notch on this edge.
insets.getStableInsetBottom(),
insets.getSystemWindowInsetLeft());
} else {
Rect visibleRect = new Rect();
Expand Down
5 changes: 4 additions & 1 deletion example/src/HooksExample.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { View, Text, StatusBar, ScrollView } from 'react-native';
import { View, Text, StatusBar, ScrollView, TextInput } from 'react-native';

import {
SafeAreaProvider,
Expand Down Expand Up @@ -63,6 +63,9 @@ function SimpleExampleScreen() {
}}
>
<ScrollView style={{ flex: 1, backgroundColor: '#eee' }}>
<Card title="Input">
<TextInput style={{ backgroundColor: '#eee', borderRadius: 3 }} />
</Card>
<Card title="Provider insets">
<DataView data={insets} />
</Card>
Expand Down

0 comments on commit 67c8a39

Please sign in to comment.