Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backdrop opacity sometimes seems to flicker at full opacity #732

Open
megantaylor opened this issue Feb 1, 2023 · 5 comments
Open

backdrop opacity sometimes seems to flicker at full opacity #732

megantaylor opened this issue Feb 1, 2023 · 5 comments
Labels

Comments

@megantaylor
Copy link

megantaylor commented Feb 1, 2023

Description

Using react-native-modal for a modal component with a backdropColor of #1d2441 and a backdropOpacity of 0.2. A button in the modal starts an expo sendSMSAsync action. During the transition to/from the SMS app, the backdrop of the modal is briefly displayed with (what looks like) full opacity.

Screenshot

Potential Solution?

I replaced every instance of this.backdropRef.transitionTo in modal.js with this.backdropRef.transition and passed in {opacity: this.props.backdropOpacity} as the fromValues. This seemed to fix my problem, but I'm not 100% sure it doesn't also create new ones. So far, in testing, it's been good.

Environment

System:
OS: macOS 12.6.2
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 199.63 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.10.0 - /var/folders/1d/q81r_4ns49s0ydl_w32ygtp00000gn/T/yarn--1675268313113-0.9465853772770727/node
Yarn: 1.22.17 - /var/folders/1d/q81r_4ns49s0ydl_w32ygtp00000gn/T/yarn--1675268313113-0.9465853772770727/yarn
npm: 7.24.0 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7935034
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 16.0.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.5 => 0.70.5
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Platforms

Both Android and iOS

Versions

  • Android: 13
  • iOS: 16
  • react-native-modal: 13.0.1
  • react-native: 0.70.5
  • react: 18.1.0
@megantaylor megantaylor added the bug label Feb 1, 2023
@megantaylor
Copy link
Author

update: this seems to be working pretty well on android, but still getting a brief flash of the solid bg color on iOS. continuing to dig into it.

@megantaylor
Copy link
Author

final solution handles both ios and android: patch with transition changes mentioned above, plus modified backdrop props:

backdropColor={color.baseOpacity20}
backdropOpacity={1}

instead of

backdropColor={color.base}
backdropOpacity={0.2}

@rviramotnes001
Copy link

@megantaylor did you find out a solution for IOS on the issue when Modal closes there is a flicker?

@ngochituong
Copy link

add this
backdropTransitionOutTiming={0}

@finnmerlett
Copy link

finnmerlett commented Jul 13, 2023

add this backdropTransitionOutTiming={0}

Oh damn! This totally fixed the backdrop flicker on modal dismiss issue I was having on android 😲 I wasn't using any custom backdrop or background color either, just the default. Man I can't tell you how much of a difference no flicker makes. So smooth, so professional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants