question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AdIconView and MediaView are very laggy in Flatlist.(iOS)

See original GitHub issue

AdIconView in Flatlist Without AdIconView

It works very good, without AdIconView in Flatlist. Facebook Audience Network SDK 5.0.2 My react-native-fbads lib use Github version.

const styles = StyleSheet.create({
  container: {
    marginVertical: 5,
    marginHorizontal: 10,
    height: 52,
    flexDirection: 'row',
    alignItems: 'center'
  },
  img: {
    width: 92,
    height: 52,
    ...BackgroundColor.ImageBG
  },
  text: {
    fontSize: 13,
    lineHeight: 18,
    ...FontColors.Main,
    marginHorizontal: 8,
    flex: 1
  },
  callActionText: {
    fontSize: 10,
    paddingVertical: 2,
    paddingHorizontal: 5,
    ...FontColors.Main,
    borderRadius: 8,
    ...BorderColor.Main,
    borderWidth: 1
  },
  adText: {
    fontSize: 10,
    ...FontColors.Third,
    position: 'absolute',
    right: 3,
    bottom: 3,
    borderRadius: 5,
    paddingHorizontal: 5,
    overflow: 'hidden',
    ...BackgroundColor.SearchPlaylistTime
  }
})

let adsManager = new NativeAdsManager(FB_NATIVE_ADS_BANNER_ID)
let FBNativeAdsRowView = ({style, nativeAd}) => {
  return (
    <View style={[styles.container, style]}>
      <AdChoicesView style={{ position: 'absolute', right: -10, top: -5 }} location={'topRight'} expandable />
      <View style={styles.img}>
        <AdIconView style={styles.img} /> // without this works fine either
        <TriggerableView style={styles.adText} numberOfLines={1}>
          {nativeAd.sponsoredTranslation}
        </TriggerableView>
      </View>
      <TriggerableView style={styles.text} numberOfLines={3}>
        {nativeAd.advertiserName + '\n' + nativeAd.socialContext}
      </TriggerableView>
      <TriggerableView style={styles.callActionText} numberOfLines={1}>
        {nativeAd.callToActionText}
      </TriggerableView>
    </View>
  )
}

let FBNativeAdsView = withNativeAd(FBNativeAdsRowView)

class FBNativeAdsRow extends React.Component {
  componentWillMount () {
    if (!adsManager.isValid) {
      adsManager = new NativeAdsManager(FB_NATIVE_ADS_BANNER_ID) // Facebook Native Ads Banner ID
    }
  }

  render () {
    return (
      <FBNativeAdsView
        onAdLoaded={() => {
        }}
        adsManager={adsManager}
      />
    )
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dblazeskicommented, Feb 9, 2019

Had the same issue, wasn’t able to track down why it happens. Can confirm MediaView is definitely laggy. Temp fix is to apply removeclippedsubviews={true} on the FlatList component.

0reactions
TMaszkocommented, Apr 10, 2021

Please check out v7 available now ! 😃 if it hasn’t been fixed yet then please reopen it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add new `oneOf` compound scope type - IssueHint
AdIconView and MediaView are very laggy in Flatlist.(iOS), 12, 2018-10-30, 2022-10-21 ; Library doesn't support context managers for patch.object ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found