Time of Update: 2018-07-25
A import {DeviceEventEmitter} from 'react-native';//註冊這個監聽事件componentDidMount(){ DeviceEventEmitter.addListener('xxxName’, Function);};//在組件銷毀的時候要將其移除componentWillUnmount(){ DeviceEventEmitter.remove();}; B 1 import {2
Time of Update: 2018-07-26
Sublime Text 3 搭建 React.js 開發環境 Sublime有很強的自訂功能,外掛程式庫很龐大,針對新語言外掛程式更新很快,配合使用可以快速搭建適配語言的開發環境。 1. babel-sublime 支援ES6, React.js, jsx代碼高亮,對 JavaScript, jQuery 也有很好的擴充。關於 babel 的更多介紹可以看這裡:為什麼說Babel將推動JavaScript的發展 安裝
Time of Update: 2017-01-19
前言我發現React和AngularJS思想完全不同,AngularJS是基於雙向繫結,在Modal層中定製資料,然後雙向改變。但是React是通過prop和state來改變view層的狀態。下面是我寫的一個輪播圖組件,可以直接看一下。代碼很簡單。原理就是通過React在componentDidMount後改變setState,來動態改變css樣式。說明以下:看gif很卡,但是實際效果還是很好的。以下是範例程式碼LunBo.jsrequire('styles/App.css');require(
Time of Update: 2018-07-24
現在的手機品牌和型號越來越多,導致我們平時寫布局的時候會在個不同的行動裝置上顯示的效果不同, 比如我們的設計稿一個View的大小是300px,如果直接寫300px,可能在當前裝置顯示正常,但到了其他裝置可能就會偏小或者偏大,這就需要我們對螢幕進行適配。 安卓原生的話有自己的適配規則,可以根據不同的尺寸建立不同的檔案夾,系統會根據當前的裝置尺寸取對應的大小的布局。而RN本身並沒有適配規則,而原生的又比較反鎖,這就需要我們自己去對螢幕進行適配。 先看一下剛出爐的螢幕適配工具類:
Time of Update: 2018-07-26
React 組件(Component) 也是一種元素Element,只不過是粒度更大一些的、包含更多子項目。 通過React組件,把一些相關的元素組織起來,形成可以複用的、有多個成員的元素的組合。 舉例 <!DOCTYPE html><html><head> <meta charset="utf-8"> <title>React
Time of Update: 2017-07-18
標籤:nload 環境搭建 show for 新版本 code tail min 不能 跟著慕課網做案例,搭建rn環境遇到很大問題。下面說一下;首先看一下文檔:http://reactnativ
Time of Update: 2017-04-25
標籤:visual height 配置 選擇 版本 mda idt 進階 環境要求 感覺react好難QAQ 一、開發環境搭建要求 在Windows作業系統搭建React
Time of Update: 2016-11-08
標籤:錯誤 例子 3.0 選擇 項目 命令 android src window 1.android/app/build.gradle檔案中,指定了版本:compileSdkVersion 23
Time of Update: 2016-07-05
標籤: React Native 是 Facebook 推出的一個用 Java 語言就能同時編寫 ios,android,以及背景一項技術,它可以做到即時熱更新 。FaceBook 也號稱這們技術是 “Learn Once,Write AnyWhere”,學習成本只有一次,卻完成了所有開發角色的統一。 這意味著: 1.app
Time of Update: 2018-06-15
標籤:執行 強制 reload book 佔用 cas 實驗 手機 comm 在做React Native開發時,少不了的需要對React
Time of Update: 2016-12-29
標籤:code 異常 war ignore 網路請求 exception 選項 網路 開發 ??代碼調試,在程式開發的過程中尤為重要,能協助開發人員快速定位問題。 ??此文重點介紹React
Time of Update: 2016-12-25
標籤:github app const super blog assm targe try end react
Time of Update: 2016-12-01
標籤:border height target doc http cat href ons tab 1.路由的安裝:$ npm install -S
Time of Update: 2016-09-11
標籤:回顧前面的知識props只能進行資料傳遞,不能修改,並且只能通過父組件傳給子組件;state(狀態)用來儲存互動的狀態,每個組件內建state屬性。不能在組件之間傳遞資料。組件之間傳值可以找到這些組件之間共有的父組件,把state屬性設定在父組件上。react可以通過fetch()方法來完成ajax的非同步提交。組件生命週期前兩種:componentWillMount 組件渲染之前載入,在這個周期裡邊修改,不會進行再次渲染。componentDidLMount
Time of Update: 2016-08-09
標籤:黑色框為父,綠色框為子,紅色框為孫子。父向子孫傳值用props;子孫向父傳值,要在父設定接收函數和state,同時用props將函數名傳入子孫。問題來了我不想直接傳值給上級,想在姓名後面加“@china”,性別後面加“人”。請看下一篇var Grandson = React.createClass({ render: function(){ return ( <div
Time of Update: 2016-08-05
標籤:In this final React Native lesson of the series we will finalize the Notes view component and squash a few bugs in the code. import firebase from ‘firebase‘;import React from ‘react‘;import { View, StyleSheet, Text, ListView,
Time of Update: 2016-08-04
標籤:1.react native - expected a component class, got [object Object]組件引用名稱必須是首字母大寫譬如:import Login from ‘./login‘;//檔案名稱和裡面的類名首字母小寫都沒關係,但是引用的別名必須首字母大寫 2.TextInput不顯示必須要設定TextInput的高度,預設是沒有邊框的textInput :{ height : 40, borderColor:
Time of Update: 2016-08-01
標籤:Nav to Repos component from Dashboard.js: goToRepos(){ api.getRepos(this.props.userInfo.login) .then((res)=>{ this.props.navigator.push({ title: ‘Repos‘, component:
Time of Update: 2016-07-05
標籤:Most of the components that you write will be stateless, meaning that they take in props and return what you want to be displayed. In React 0.14, a simpler syntax for writing these kinds of components was introduced, and we began calling these
Time of Update: 2016-06-30
標籤: 啟動並執行時候先報錯說can’t be opened because it is from an unidentified developer,這是osx自己安全設定搞太高,去安全選項改了(allow apps download from anywhere)之後。又報錯說permission問題,於是在終端用(chmod -R 755