From 3785db2fb14c7c236a4823f187ceda98105295e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cst=C3=BCn=20Ergenoglu?= Date: Wed, 14 Dec 2016 10:25:57 -0800 Subject: [PATCH] Add property to force HW acceleration on Android for modal windows Summary: When using React Native on Android on top of a game as an overlay, dialog windows sometimes get created with hardware acceleration disabled. This causes the UI to be unresponsive and anything that uses a TextureView stops working. Added a property for the modal view to make sure hardware acceleration flag is enabled when it's set to true. **Test plan (required)** set `hardwareAccelerated` property for Modal to force hardware acceleration on dialog windows on Android. Does nothing on iOS. Closes https://github.com/facebook/react-native/pull/11421 Differential Revision: D4312912 Pulled By: andreicoman11 fbshipit-source-id: 9db6b2eca361421b92b24234b3501b5de0eecea7 --- Libraries/Modal/Modal.js | 7 +++++++ .../react/views/modal/ReactModalHostManager.java | 5 +++++ .../facebook/react/views/modal/ReactModalHostView.java | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/Libraries/Modal/Modal.js b/Libraries/Modal/Modal.js index 782ec78a334651..064d6481cf8434 100644 --- a/Libraries/Modal/Modal.js +++ b/Libraries/Modal/Modal.js @@ -93,6 +93,11 @@ class Modal extends React.Component { * The `transparent` prop determines whether your modal will fill the entire view. Setting this to `true` will render the modal over a transparent background. */ transparent: PropTypes.bool, + /** + * The `hardwareAccelerated` prop controls whether to force hardware acceleration for the underlying window. + * @platform android + */ + hardwareAccelerated: PropTypes.bool, /** * The `visible` prop determines whether your modal is visible. */ @@ -126,6 +131,7 @@ class Modal extends React.Component { static defaultProps = { visible: true, + hardwareAccelerated: false, }; static contextTypes = { @@ -160,6 +166,7 @@ class Modal extends React.Component {