mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-08 22:42:05 +08:00
Add zIndex support
Summary: Adds zIndex support :) **Test Plan** Tested the following components by adding two of each, overlapping them, and setting a high zIndex on the first of the two: ActivityIndicator Image MapView Picker ScrollView Slider Switch Text TextInput View WebView Tested on Android 4.1 and iOS 8.4. Also tested updating zIndexes on Views in my own app. <img width="359" alt="ios activityindicator" src="https://cloud.githubusercontent.com/assets/4349082/15633473/88f842cc-257b-11e6-8539-c41c0b179f80.png"> <img width="330" alt="android activityindicator" src="https://cloud.githubusercontent.com/assets/4349082/15633475/88f95784-257b-11e6-80c0-2bf3ed836503.png"> <img width="357" alt="ios image" src="https://cloud.githubusercontent.com/assets/4349082/15633474/88f93d80-257b-11e6-9e54-4ff8e4d25f71.png"> <img width="340" alt="android image" src="https://cloud.githubusercontent.com/assets/4349082/15633478/88fd2788-257b-11e6-8c80-29078e65e808.png"> <img width="342" alt="android picker" src="ht Closes https://github.com/facebook/react-native/pull/7825 Differential Revision: D3469374 Pulled By: lexs fbshipit-source-id: b2b74b71d968ebf73ecfd457ace3f35f8f7c7658
This commit is contained in:
committed by
Facebook Github Bot 3
parent
3085b35e63
commit
3d3b067f6f
@@ -5,6 +5,7 @@ package com.facebook.react.uimanager;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
@@ -21,6 +22,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
private static final String PROP_TRANSFORM = "transform";
|
||||
private static final String PROP_OPACITY = "opacity";
|
||||
private static final String PROP_ELEVATION = "elevation";
|
||||
private static final String PROP_Z_INDEX = "zIndex";
|
||||
private static final String PROP_RENDER_TO_HARDWARE_TEXTURE = "renderToHardwareTextureAndroid";
|
||||
private static final String PROP_ACCESSIBILITY_LABEL = "accessibilityLabel";
|
||||
private static final String PROP_ACCESSIBILITY_COMPONENT_TYPE = "accessibilityComponentType";
|
||||
@@ -70,6 +72,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
// Do nothing on API < 21
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_Z_INDEX)
|
||||
public void setZIndex(T view, float zIndex) {
|
||||
int integerZIndex = Math.round(zIndex);
|
||||
ViewGroupManager.setViewZIndex(view, integerZIndex);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_RENDER_TO_HARDWARE_TEXTURE)
|
||||
public void setRenderToHardwareTexture(T view, boolean useHWTexture) {
|
||||
view.setLayerType(useHWTexture ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE, null);
|
||||
|
||||
Reference in New Issue
Block a user