Reactjs 反应器边界不工作

Reactjs 反应器边界不工作,reactjs,react-360,Reactjs,React 360,我想在我的文本周围加一个边框 <View style={{ borderRadius: 1, borderWidth: 1, borderColor:'#FF0000',}}> <Text style={{ fontSize: 0.8, fontWeight: '400', layoutOrigin: [0.5, 0.5], p

我想在我的文本周围加一个边框

    <View style={{ borderRadius: 1, borderWidth: 1, borderColor:'#FF0000',}}>
            <Text style={{
               fontSize: 0.8,
               fontWeight: '400',
               layoutOrigin: [0.5, 0.5],
               paddingLeft: 0.2,
               paddingRight: 0.2,
               textAlign: 'center',
               textAlignVertical: 'center',
               transform: [{translate: [0, 0, -3]}],
             }}>
              hello
             </Text>
          </View>

你好

如果我将borderWidth保留为1,我会看到hello,但看不到边框。如果我将borderWidth更改为10,我什么也看不到。如何将边框添加到hello文本?

边框确实有效,但您的视图位于场景的中心,默认情况下相机视图位于该中心。您真正想要做的是在根视图上设置layoutOrigin,以及转换,以便所有组件都在那里正确渲染

这应该做到:

<View style={{ 
    borderRadius: 1, 
    borderWidth: 1, 
    borderColor:'#FF0000',
    transform: [{translate: [0, 0, -3]}],
    layoutOrigin: [0.5, 0.5],
}}>
    <Text style={{
        fontSize: 0.8,
        fontWeight: '400',
        paddingLeft: 0.2,
        paddingRight: 0.2,
        textAlign: 'center',
        textAlignVertical: 'center',
    }}>hello</Text>
</View>

你好

这应该可以正确地显示文本周围的边框,尽管您会注意到边框的宽度太大,因为在3D世界中,单位不是指像素,而是米。

您能创建一个JSFIDLE吗?我不知道如何将它放在JSFIDLE中,但这是git链接。您只需将src/index.vr.js中的代码替换为我发布的代码。遗憾的是,在任何流行的游乐场(codepen、jsbin等)中都无法嵌入React-vr代码,有人应该在Github上对开发人员进行如下调试:)