react-native-fbads icon indicating copy to clipboard operation
react-native-fbads copied to clipboard

After the video interstitial is closed, there is a new space at the bottom of the KeyboardAvoidingView.

Open JoonDong2 opened this issue 3 years ago • 2 comments

Bug Report

Before opening

  • [v] Did you try the latest release?
  • [v] Did you look for existing issues?

Ad Modules video interstitial

Platforms iOS

Versions 14.4.2

Ads Environment

  • Facebook app installed: yes
  • Happens in test (dev build + device is marked as a test device): yes
  • Happens in production (release build + not a test device): yes
  • Facebook review status: [not submitted | approved]

Current Behaviour If there is a KeyboardAvoidingView component on the screen, after the video interstitial is closed and the keyboard appears, a new space is created. Interstitial ads without video do not.

I tested on react native 0.63.4 and 0.64.0. and I am using latest version of this libaray.

JoonDong2 avatar Apr 15 '21 19:04 JoonDong2

Could you please share a repo where we can easily reproduce this bug ? Thanks in advance :)

TMaszko avatar Apr 15 '21 20:04 TMaszko

Could you please share a repo where we can easily reproduce this bug ? Thanks in advance :)

When the video interstitial is executed and closed, the height value of the status bar in iOS becomes 0.

So, because of this, when the keyboard appears in the KeyboardAvoidingView, there is an empty space as much as the status bar below.

I am temporarily managing keyboardVerticalOffset as a state.

import { NativeModules } from "react-native";
const { StatusBarManager } = NativeModules;

useEffect(() => {
    StatusBarManager.getHeight((statusBarFrameData: any) => {
        console.log(statusBarFrameData.height) // => initial value is 20 on iPhone 6S.
    });
    return () => {}
}, [])

const preloadInterstitialAd = async () => {
    const didClick = await InterstitialAdManager.preloadAd(FacebookAdsPlacementIds['interstitial']);
    if(isIOS) {
        StatusBarManager.getHeight((statusBarFrameData: any) => {
            setKeyboardVerticalOffset(statusBarFrameData.height) // => changed to 0.
        });
    }
    if(didClick) {
        // ...
    }
}

// getStatusBarHeight() returns 20 on iPhone 6S.
return (
    <KeyboardAvoidingView
            enabled 
            behavior={isAndroid ? 'height' : 'padding'}
            keyboardVerticalOffset={getStatusBarHeight()}>
    ...
    </<KeyboardAvoidingView>
)

JoonDong2 avatar Apr 16 '21 17:04 JoonDong2