我想設計這個設計react-native
。這是我編寫的代碼,但這不是我想要的。這隻適用於一個屏幕,如果我改變屏幕尺寸,那麼事情不起作用。如何設計屏幕反應原生兼容所有設備
這看起來像絕對佈局。我應該做出什麼樣的改變才能使其適用於所有屏幕尺寸。
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from "react";
import {
AppRegistry,
Image,
View,
Text,
Button,
StyleSheet
} from "react-native";
class SplashScreen extends Component {
render() {
console.disableYellowBox = true;
return (
<View style={styles.container}>
<Image
source={require("./img/talk_people.png")}
style={{ width: 300, height: 300 }}
/>
<Text style={{ fontSize: 22, textAlign: "center", marginTop: 30 }}>
Never forget to stay in touch with the people that matter to you.
</Text>
<View style={{ marginTop: 60, width: 240 }}>
<Button title="CONTINUE" color="#FE434C" />
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
backgroundColor: "#FFFFFF",
margin: 50,
alignItems: "center",
flex: 1,
flexDirection: "column"
}
});
AppRegistry.registerComponent("Scheduled",() => SplashScreen);
預期狀態:
現狀:
的Nexus 4 - 768x1280
有沒有處理這個問題的軟件包?對於RN開發者來說,這似乎是一項非常普遍的任務。 –