diff --git a/packages/react-native-avoid-softinput/package.json b/packages/react-native-avoid-softinput/package.json index 2c39853..f3a21f6 100644 --- a/packages/react-native-avoid-softinput/package.json +++ b/packages/react-native-avoid-softinput/package.json @@ -55,6 +55,9 @@ "build-library": "bob build", "release-library": "release-it" }, + "dependencies": { + "react-native-is-edge-to-edge": "^1.1.6" + }, "devDependencies": { "@release-it/conventional-changelog": "8.0.2", "@types/react": "18.3.12", diff --git a/packages/react-native-avoid-softinput/src/AvoidSoftInput.ts b/packages/react-native-avoid-softinput/src/AvoidSoftInput.ts index c2b8315..12cb8f1 100644 --- a/packages/react-native-avoid-softinput/src/AvoidSoftInput.ts +++ b/packages/react-native-avoid-softinput/src/AvoidSoftInput.ts @@ -1,9 +1,12 @@ import type { EmitterSubscription } from 'react-native'; import { NativeEventEmitter, Platform } from 'react-native'; +import { controlEdgeToEdgeValues, isEdgeToEdge } from 'react-native-is-edge-to-edge'; import module from './AvoidSoftInputModule'; import type { SoftInputAppliedOffsetEventData, SoftInputEasing, SoftInputEventData } from './types'; +const EDGE_TO_EDGE = isEdgeToEdge(); + const eventEmitter = new NativeEventEmitter(Platform.OS !== 'ios' ? undefined : module); /** @@ -50,8 +53,12 @@ function setShouldMimicIOSBehavior(shouldMimic: boolean) { if (Platform.OS !== 'android') { return; } - - module.setShouldMimicIOSBehavior(shouldMimic); + if (__DEV__) { + controlEdgeToEdgeValues({ shouldMimic }); + } + if (!EDGE_TO_EDGE) { + module.setShouldMimicIOSBehavior(shouldMimic); + } } /** diff --git a/yarn.lock b/yarn.lock index dd97c82..01bedad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13100,6 +13100,7 @@ __metadata: react: "npm:18.3.1" react-native: "npm:0.76.0" react-native-builder-bob: "npm:0.30.2" + react-native-is-edge-to-edge: "npm:^1.1.6" release-it: "npm:17.6.0" typescript: "npm:5.0.4" peerDependencies: @@ -13155,6 +13156,16 @@ __metadata: languageName: node linkType: hard +"react-native-is-edge-to-edge@npm:^1.1.6": + version: 1.1.6 + resolution: "react-native-is-edge-to-edge@npm:1.1.6" + peerDependencies: + react: ">=18.2.0" + react-native: ">=0.73.0" + checksum: 10/4e07c1e34c01c8d50fd7c1d0460db06f6f0515197405230386a8ffb950cb724b10743af032310d1384df0a90059bfb8992ba2d93344ce86315315f0493feccc2 + languageName: node + linkType: hard + "react-native-reanimated@npm:3.16.1": version: 3.16.1 resolution: "react-native-reanimated@npm:3.16.1"