Home Tutorial React Native React Native – Bài 3: Ứng dụng

React Native – Bài 3: Ứng dụng

2 min read
0
123

Nếu bạn mở ứng dụng mặc định, bạn có thể quan sát thấy tệp app.js trông giống như

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default class App extends React.Component {
   render() {
      return (
         <View style = {styles.container}>
            <Text>Open up App.js to start working on your app!</Text>
            <Text>Changes you make will automatically reload.</Text>
            <Text>Shake your phone to open the developer menu.</Text>
         </View>
      );
   }
}

const styles = StyleSheet.create({
   container: {
      flex: 1,
      backgroundColor: '#fff',
      alignItems: 'center',
      justifyContent: 'center',
   },
});

kết quả

Làm việc trên ứng dụng

Hello World

Để hiển thị một thông báo đơn giản có nội dung “Chào mừng bạn đến với Tutorialspoint”, hãy xóa phần CSS và chèn thông báo sẽ được in bao bọc bởi các thẻ <text></text> bên trong <view></view> như hình bên dưới.

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default class App extends React.Component {
   render() {
      return (
         <View>
            <Text>Welcome to Tutorialspoint</Text>
         </View>
      );
   }
}

Chào thế giới

Load More Related Articles
Load More By quangvu
Load More In React Native

Check Also

Tự làm web chatGPT đơn giản cho phép dùng nhiều OpenAI key

Trong thời đại công nghệ phát triển như hiện nay, chatbot đang dần trở thành một giải pháp…