Describe the bug
I am encountering a severe UI issue on iOS when the device language is set to Arabic (RTL).
When the screenshot prevention is enabled, the entire application layout shrinks from the bottom. This issue is cumulative: every time I navigate into or out of the screen (triggering enable/disable), the UI gets smaller and smaller until it becomes unusable.
This behavior is exclusive to RTL layouts. The app functions perfectly in LTR (English).
Steps to reproduce
- Set iOS device language to Arabic (or force RTL in the app).
- Use RNScreenshotPrevent.enabled(true) on a screen.
- Navigate to this screen, then go back, then navigate to it again.
- Observe that the bottom of the layout moves up (shrinks) with each navigation event.
Expected behavior
The library should prevent screenshots without affecting the root view's dimensions or constraints, regardless of the layout direction (RTL/LTR).
Technical Insight / Root Cause Analysis
I have investigated this issue across multiple libraries that use the native secureTextEntry / UITextField injection hack to prevent screenshots on iOS. They all exhibit this exact same RTL shrinking bug.
It appears that adding the secure UITextField as a subview interacts poorly with UIWindow constraints when the system is in RTL mode.
Important Observation: I attempted to patch the native iOS code to fix the layout constraints manually. While I successfully stopped the shrinking, the screenshot blocking stopped working. It seems strictly tied:
- If the layer is attached deeply enough to block screenshots, it breaks the RTL layout.
- If the layout is fixed to respect safe areas/bounds, the protection layer is bypassed by the OS.
I am reporting this here hoping for a workaround or a fix in the native iOS implementation for RTL users.
Describe the bug
I am encountering a severe UI issue on iOS when the device language is set to Arabic (RTL).
When the screenshot prevention is enabled, the entire application layout shrinks from the bottom. This issue is cumulative: every time I navigate into or out of the screen (triggering enable/disable), the UI gets smaller and smaller until it becomes unusable.
This behavior is exclusive to RTL layouts. The app functions perfectly in LTR (English).
Steps to reproduce
Expected behavior
The library should prevent screenshots without affecting the root view's dimensions or constraints, regardless of the layout direction (RTL/LTR).
Technical Insight / Root Cause Analysis
I have investigated this issue across multiple libraries that use the native secureTextEntry / UITextField injection hack to prevent screenshots on iOS. They all exhibit this exact same RTL shrinking bug.
It appears that adding the secure UITextField as a subview interacts poorly with UIWindow constraints when the system is in RTL mode.
Important Observation: I attempted to patch the native iOS code to fix the layout constraints manually. While I successfully stopped the shrinking, the screenshot blocking stopped working. It seems strictly tied:
I am reporting this here hoping for a workaround or a fix in the native iOS implementation for RTL users.