"立面样式"属性为Android 5.0+启用框阴影.

我是不是做了一些不寻常的"提升"来造成下面截图中的丑陋?还有,有没有办法定义阴影偏移?

The emulator is running 6.0 (> 5.0), so that's not the problem. I'm running react-native 25.1.

  "dependencies": {
    "react": "^0.14.8",
    "react-native": "^0.25.1",
    "react-native-gcm-android": "^0.2.0",
    "react-native-material-design": "^0.3.5",
    "react-native-system-notification": "^0.1.10",
    "react-redux": "^4.4.5",
    "redux": "^3.5.2"
  }

Here's react-native's documentation for View component styling

以下是我的渲染方法:

  render() {
    return (
      <ListView
        dataSource={alertData}
        renderRow={(rowData) =>
          <View style={style.cardContainer}>
            <Text>{rowData.blah}</Text>
            <Text>{"#" + rowData.foo}</Text>
            <Text>{rowData.blah}</Text>
            <Text>{rowData.foo}</Text>
            <Text>{rowData.baz}</Text>
          </View>
        }
      />
    );
  }

风格宣言:

var style = StyleSheet.create({
  cardContainer : {
    elevation   : 3,
    flex        : 1,
    margin      : 10,
    padding     : 10,
    borderWidth : 2,
    borderColor : beeStyles.colors.lightGray
  }
});

这就导致了...

enter image description here

推荐答案

缺少的部分是背景色.将backgroundColor : '<anything>'样式添加到视图容器会使那些奇怪的内部阴影消失.

React-native相关问答推荐

React-Native:请纠正我对状态如何工作的误解 - 动态文本输入

如何在 react-native 中刷新 Flatlist 数据?

React Native - React Native 架构

开发 React Native Apps 时如何在 Android 模拟器窗口中重新加载?

如何将谷歌反向地理编码与 React Native Expo 结合使用?

react-native redux 和 ListView

withNavigation 只能用于导航器的视图层次 struct

React Native 错误:Animated.event now requires a second argument for options

为了回调 URL 的目的,在 Expo 中运行的 React Native 元素的 info.plist 在哪里?

在 React Native 中计算两个 lat+lng 坐标之间的距离?

如何在 React Native 中删除警告

redux-observable Promise 在单元测试中没有得到解决

React Native:fetch request failed with error - TypeError: Network request failed(…)

有没有办法改变 IOS 标题上react-navigation 的默认后退按钮 colored颜色 ?

为什么,确切地说,我们需要 React.forwardRef?

如何将props传递给 React Navigation 导航器中的组件?

React Native Android 负边距(Margins)

在react-native中调试应用程序崩溃

如何在 React Native 中禁用图像淡入效果?

如何将 React-Native 元素集成到 Android-Studio?