Correct android settings #66
-
So which |
Beta Was this translation helpful? Give feedback.
Answered by
mateusz1913
Apr 14, 2022
Replies: 1 comment
-
Hi @osliver , as stated in documentation, you have to set
Example for 1st solution: const Component = () => {
// if you use react-navigation and you want to enable it only in current displayed screen
const onFocusEffect = useCallback(() => {
AvoidSoftInput.setAdjustNothing(); // <------------------- this will do the trick
AvoidSoftInput.setEnabled(true);
return () => {
AvoidSoftInput.setEnabled(false);
AvoidSoftInput.setDefaultAppSoftInputMode(); // <------ this will reset, so other screens won't be affected
};
}, []);
useFocusEffect(onFocusEffect); // <------- run it when screen is focused/unfocused
// ... rest of component
} Example for 2nd solution: <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="<your-package-name>">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/BootTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustNothing" // <--------------------------------------- set value here
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mateusz1913
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @osliver , as stated in documentation, you have to set
adjustNothing
value for android activity. You can do it in 2 ways:setAdjustNothing
(I prefer this one)Example for 1st solution: