2016-11-25 27 views
0

我正在嘗試在原生反應中寫一個圓圈文本,但是需要使用flex將圓圈放入特定位置。這是可能的嗎?就像我試圖做的那樣,形狀總是變形成一個帶有矩形的半圓。在反應本機中使用帶有flex的形狀

回答

0

Example Image https://rnplay.org/apps/OolZWQ

我扔在一起的這樣的一個例子,它似乎是爲我工作的罰款。

<View style={styles.someLocation}> 
     <View style={styles.circle}> 
     <Text>Test</Text> 
     </View> 
    </View> 

也許比較你對我的?一定要強制你的圈子的大小,應該沒有壓倒一切的風格,可以改變這一點。

circle: { 
    width: 100, 
    height: 100, 
    borderRadius: 100/2, 
    backgroundColor: 'red', 
    alignItems: 'center', 
    justifyContent: 'center' 
    }, 
    someLocation: { 
    backgroundColor: '#0f0', 
    position: 'absolute', 
    right: 0, 
    padding: 10 
    }