import { ExpoConfig } from '@expo/config-types' ; import { ConfigPlugin } from '../Plugin.types' ; import { withAndroidManifest } from '../plugins/android-plugins' ; import { AndroidManifest , getMainActivityOrThrow } from './Manifest' ; const ANDROID_WINDOW_SOFT_INPUT_MODE = 'android:windowSoftInputMode' ; const MAPPING = { pan : 'adjustPan' , resize : 'adjustResize' } ; export const withWindowSoftInputMode = config => { return withAndroidManifest ( config , async ( config ) => { config . modResults = setWindowSoftInputModeMode ( config , config . modResults ) ; return config ; } ) ; } ; export function setWindowSoftInputModeMode ( config , androidManifest ) { const app = getMainActivityOrThrow ( androidManifest ) ; app . $ [ ANDROID_WINDOW_SOFT_INPUT_MODE ] = getWindowSoftInputModeMode ( config ) ; return androidManifest ; } export function getWindowSoftInputModeMode ( config ) { const value = config . android ?. softwareKeyboardLayoutMode ; if ( ! value ) { return 'adjustResize' ; } return MAPPING [ value ] ?? value ; }