已解決:尺寸反應本機

React Native 維度相關的主要問題是它們很難使用。

In React Native, dimensions can be retrieved with the Dimensions API:

const { width, height } = Dimensions.get('window');

這行代碼使用 Dimensions API 來檢索“窗口”的寬度和高度。 然後將寬度和高度存儲在常量中。

使用窗口維度

React Native 允許您使用 useWindowDimension 設置窗口尺寸。 該屬性用於設置 React Native 窗口的寬度和高度。

相關文章:

發表評論