mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-14 23:18:06 +08:00
Summary:Changed the implementation of `setTranslucent` because the old one used the view flag SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN which has the sad side effect of making the ScrollViews not adjust properly when the keyboard is opened. Instead I use `setOnApplyWindowInsetsListener` to hook in the insets calculation process and consume the top offset so the decor view doesn't add top padding for the status bar. I also limited the translucent prop to API 21+ because `setOnApplyWindowInsetsListener` is not available before that and anyway the translucent prop is only useful with a semi-transparent status bar color which only works on API 21+. **Test plan** Reproduced the bug using this code in UIExplorer. https://gist.github.com/janicduplessis/217b9994e35f960a1793 Tapping a text field that would be hidden by the soft keyboard should scroll the view so it is not hidden. Also tested that setting the translucent prop on and off still works as before. Fixes #6455 Closes https://github.com/facebook/react-native/pull/6481 Differential Revision: D3067199 Pulled By: mkonicek fb-gh-sync-id: aa115f8688ac7e461e62c18ebb8ab77350d000f8 shipit-source-id: aa115f8688ac7e461e62c18ebb8ab77350d000f8