【发布时间】:2023-01-21 21:35:19
【问题描述】:
标签: react-native
标签: react-native
这样的 css 技巧应该有效:
import React from 'react'
import { View, Dimensions } from "react-native";
const App = () => {
const DEVICE_WIDTH = Dimensions.get("window").width; // could use hooks for this too.
return (
<View style={{ backgroundColor: 'red', flex: 1 }}>
<View style={{position: 'absolute', bottom: 100, backgroundColor: 'white', width: '100%', height: 50, flexDirection: 'row'}} >
<View style={{left: -25, backgroundColor: 'red', height: 50, width: 50, borderRadius: 90}} />
<View style={{left: -75 + DEVICE_WIDTH, backgroundColor: 'red', height: 50, width: 50, borderRadius: 90}} />
</View>
</View>
);
}
export default App;
【讨论】: