React-Native Lecture 12: Firebase Authentication
Updated Facebook Login Function for 2.js in the Lecture 12.
https://gist.github.com/kobkrit/6ed60d963c343331e9f76c73d82dcd25
Updated Facebook Login Function for 2.js in the Lecture 12.
https://gist.github.com/kobkrit/6ed60d963c343331e9f76c73d82dcd25
React ถูกใช้ด้วย Developer มากกว่า 500,000 กว่าคน (นับโดยจำนวนคนโหลด React Developer Tools Plugins ใน Chrome
React-Native ถูกใช้ใน Production App หลากหลาย App ดังข้างล่าง โดยเฉพาะ Facebook ที่ทุกคนใช้กันอยู่ ตอนแรกทีม Facebook ถกกันว่าจะเขียนใหม่ด้วย React-Native ทั้งหมดดีไหม แต่ทีมคิดว่าการเขียนใหม่ เป็นการลงทุนที่มากเกินไป ได้ไม่คุ้มเสีย แต่การเขียนด้วย React-Native ก็ย่อมดีกว่าเขียนด้วย Native อยู่แล้ว จึงได้ข้อสรุปว่าจะเริ่มเอา React-Native มาใช้ทดแทน Native code (Incrementally adopt) ในตัวแอพ Facebook หลักไปเรื่อยๆ
แต่ก่อน
ตัวใหม่
2. ใช้ Declarative View ไม่ต้อง Complie App ให้เสียเวลาอีกต่อไปแล้ว เป็นอิสระต่อ Xcode และ Android Studio แบบเต็มตัว ดูได้ต่อใน Create-React-Native-App
3. Cross-App Development เมื่อ Facebook และ Instagram สามารถ Share code กันได้
จริงๆแล้ว เราก็คล้ายๆกัน ต่างกันนิดหน่อย ทำไมไม่มาใช้โค้ดร่วมกันละ
สรุป 3 สิ่งเด็ดๆ
React-Native-Interactable เป็น Declarative Physic Engine สำหรับ React-Native สามารถทำให้เราสร้าง Animation ใน React-Native ได้ถึง 60FPS Support มี Animation ที่หลากหลายให้เราเลือกใช้
ปกติ React-Native จะกระตุกเพราะว่า มี Animation อะไรซักอย่างทีต้องวิ่งผ่าน Bridge ที่คุยกันระหว่าง Native กับ JS ทำให้ Bridge มัน Busy, App ก็ Lag กันไป
กดที วิ่งผ่าน Bridge ที
ตัวนี้แก้ปัญหา โดยการให้กำหนด Physic Property (Declare Interaction) มาจากฝั่ง JS มาให้ Native เลย แล้วให้ Native คำนวณการอัพเดท Animation ไปได้เลย ไม่ต้องวิ่งผ่าน Bridge อีก
Bridge ก็โล่ง แอพก็เร็วปื๊ด ทันที
ตัวอย่าง Interaction Declarion
แนะนำให้ลองใช้ React-Native App ของคุณ ราศีจับขึ้นทันที
ลองทดสอบ Performance ได้ที่นี่
อันนี้เด็ดสุดในงาน
บริษัท Exponent ออก Create-React-Native-App เลียนแบบ Create-React-App ของ Dan Abramov ที่เด็ดก็คือ ใช้แค่ NodeJS ในการพัฒนาทั้งหมด ซึ่งก็หมายความว่า เราสามารถใช้ Windows พัฒนา iOS App ได้แล้ววว
เมื่อรันเสร็จก็จะได้ QR Code อันนี้มา ในมือถือทั้ง iOS และ Android ลงแอพชื่อ Expo เสร็จแล้ว Scan QR Code นี้ก็จะเห็น App รัน On-the-fly แบบ Realtime แบบ Hot Reloading เปลี่ยนแปลงตามโค้ดที่เราพัฒนาได้เลยทันที (ขออย่างเดียว ขอให้อยู่ใน Wifi เดียวกันเท่านั้น)
สบายขึ้นเยอะ
ดังภาพ ไม่ต้องมีสายแล้วนะจะ Line Free
Expo บอกว่าไม่ได้มาเล่นๆ Support Native Library ทั้งหลายแหล่ด้วยจ้า
จากเครื่องเปล่าๆ 5 นาที ใช้พัฒนา App ได้เลย ต่อจากนี้ผมจะสอน นักศึกษาได้ง่ายขึ้นแล้ว ไม่ต้องมานั่งลงเป็น 1–2 ชม. อีกต่อไป
ปีนี้ค่อนข้างเด็ด แต่ยังขาด Day 2 อีกวัน รออัพเดทพรุ่งนี้จ้า
6
Can not type password here T_T
$ npm install react-native-keyboard-spacer**import KeyboardSpacer from 'react-native-keyboard-spacer';** class LoginScreen extends React.Component {
...render() {
...
return (
<View style={Styles.container}>
<View style={Styles.yourOldContainerView}>
</View>
**< KeyboardSpacer />**
</View>
);
}
Done.
**import DismissKeyboard from 'dismissKeyboard';** class LoginScreen extends React.Component {
...render() {
...
return (
**< TouchableWithoutFeedback onPress={()=>{DismissKeyboard()}}>** <View style={Styles.container}>
<View style={Styles.yourOldContainerView}>
</View>
<KeyboardSpacer />
</View>** </TouchableWithoutFeedback>**
);
}
Done.
Easy right?
Post นี้สำหรับพนักงาน iApp ใหม่ทุกท่าน ที่ทุกคนต้องได้คือ 0, 1, 7
ถ้าสาย Mobile App ต้อง 2,3 (5 — Optional)
ถ้าสาย Web Front End ต้อง 2 (5 — Optional)
ถ้าสาย Web Back End ต้อง 4,6 (5 — Optional)
Warning สาย Web Back End กำลังจะตกงานนะจ๊ะ (อยากรอดต้องเป็น Firebase จ๊ะ 5)
0. Git
ถ้า Git ยังไม่ได้ไม่ต้องพูดถึงเรื่องอื่นเลย
ก่อนจะเริ่ม React ได้ ต้องเขียนภาษา ES6 ให้โปรเสียก่อน
แนะนำ Course ของ Udemy เป็นหลักและอ่าน Blog ของผมและ AirBnb ผ่านๆ
แนะนำให้ทวนตามใน Blog ของผมด้วย จะได้เขียนถูก Style ตามหลัก Airbnb https://github.com/airbnb/javascript
2. React & Redux
แนะนำอ่านชุดบทความของ babel coder มาก่อน (ทบทวน Webpack และ Babel ด้วย) แล้วต่อด้วยของ Udemy มี 2 เจ้าจะเอาของ Stephen Grider หรือ Leonardo Daniel ก็ได้ ต่อด้วยใช้ BoilerPlate ของ React-Production-Starter ให้เป็น หรือแต่งสดเองก็ได้
3. React-Native + Firebase
ลองเล่นของ Udemy ก่อน แต่ไม่ค่อยครบ แล้วอ่านของ FormInit ให้พื้นฐาน React, Redux ให้แน่น แล้วมาจบด้วยของผมที่เล่น Module ครบถ้วนที่สุด อันสุดท้ายสร้าง App ด้วย IgniteJS ต่อด้วยสามารถทำ Firebase ได้
4. สาย Server, NodeJS, Express, MongoDB, AngularJS
ดูเหมือนของ Code School จะตรงสุด ตามด้วยเรียนรู้ให้ the MEAN stack ให้เป็น เพิ่มพวก MongoDB, Mongoose, AngularJS และ Gulp ด้วยการอ่าน Doc และสุดท้ายใช้ generator-angular-fullstack ให้เป็น
5. สาย Firebase (Serverless)
6. สาย Server
7. Tools ที่บริษัทใช้
Build native mobile app in iOS and Android in Single codebase by JavaScript programming language backed by Facebook.
Course Directory
This is a bit strange that we are talking about the Startup Pitching in the mobile app development course. But believe me, to success in the mobile app business, you need to know a lot about the business, not only the tech parts. This lecture, I summarized how to make the correct pitching deck. The Pitch deck is the core material that you need to send to your prospect investors to get funded. Moreover, it is the main visualizer to your audiences when you are pitching on the stages in the startup pitching competitions. After that, I summarized the core knowledge about tech startup especially in the Lean Startup that every tech-entrepreneur need to know, which help you save the ton of time in exploring about it by yourself.
1
We are doing a step-by-step tutorial how to make mobile application’s local storage by React Native AsyncStorage and Realm Database (Like CoreData, SQLite in both iOS and Android).
When you are develop the app, at one point, you will need to store information permanently for an application (it does not gone after the forced close and re-open). For faster loading time, Line app use a local database to remember all of your conversations. For caching propose, Facebook app use a local database to record all of the previously loaded news feed.
React Native AsyncStorage is a simple, unencrypted, asynchronous, persistent, key-value storage system that is global to the app. On iOS, AsyncStorage is backed by native code that stores small values in a serialized dictionary and larger values in separate files. On Android,React Native AsyncStorage will use either RocksDB or SQLite based on what is available.
To use AsyncStorage, you don’t need to installation any extra library. It comes with React Native by default. AsyncStorage uses key-value pairs so to save data, as show in the following example.
import { AsyncStorage } from 'react-native';
AsyncStorage.setItem('myKey', myValue);
To loaded the saved data, you can do like this…
AsyncStorage.getItem('myKey').then((myValue) => {
this.setState({'myKey':myValue});
});
Since loading data is a time consuming task, It is designed to be a asynchronous operation. So getItem returned the promise, which will invoke the call back function when the read operation is completed.
More information, please see on Slide. TK We are adding soon.
Learn how to write iOS and Android mobile app to take photo (Camera), and selecting image from Phone’s Gallery (Camera Roll) by React Native.