- Aug 05 Mon 2019 11:47
-
[life] 台新 優質薪轉儲蓄存款
- Aug 02 Fri 2019 16:29
-
[RN][轉] React入門0x008: 生命週期

最近在寫react native,一直碰到"Warning: Can't call setState on a component that is not yet mounted."這個warning
實在搞不懂怎麼解決,直到找到這篇文章,明白說明react程式甚麼時候會執行甚麼function。
簡單說,在constructor只能定義state,並給初始值,但不能setState
- Aug 01 Thu 2019 11:30
-
[Javascript] arrow function中的this
昨天使用button onPress屬性呼叫function test做別的事
onPress={this.test}
一開始function test是寫成一般呼叫形式,function test(){ ... }
然後function test裏頭用到別的function都會使用this.加上function name,this.otherfunction();
onPress={this.test}
一開始function test是寫成一般呼叫形式,function test(){ ... }
然後function test裏頭用到別的function都會使用this.加上function name,this.otherfunction();
- Aug 01 Thu 2019 11:23
-
[Javascript][轉] ES6篇 - Arrow Function(箭頭函式)

轉自 https://ithelp.ithome.com.tw/articles/10185221
--
本章的目標是對箭頭函式提供一些較為全面性的介紹,除了基本的語法之外,也補充了很多React搭配使用時的實例,此外也提供撰寫的風格建議。當然,箭頭函式並不光只是語法簡短而已,它有一些與原來JavaScript中函式不同的設計,你可以把它當成是原本(傳統)的函式的改進版本。
- Aug 01 Thu 2019 11:14
-
[Javascript][轉] JavaScript ES6 中的箭頭函數(arrow function)及對 this 的影響 in
- Jul 09 Tue 2019 15:00
-
[RN][native base] How to change the active colors of a segment control?
Q: 使用native base的segment元件,想要讓他動態依照點擊哪個按鈕就設那個按鈕的active屬性為true。
A:
1. 在state設定一個變數,用來控制目前要設哪一個button為active
2. 在segment下面每個button的active都加上判斷state的變數內容,符合才設為ture
A:
1. 在state設定一個變數,用來控制目前要設哪一個button為active
2. 在segment下面每個button的active都加上判斷state的變數內容,符合才設為ture
- Jul 08 Mon 2019 21:56
-
[RN][轉] React.js Search搜尋功能使用過濾迴圈 filter()
轉自 www.ucamc.com/e-learning/javascript/276-react-js-search搜尋功能使用過濾迴圈filter.html
--
filter函數特性:
--
filter函數特性:
- Jul 08 Mon 2019 21:54
-
[RN] Difference between onChange vs onChangeText of TextInput
onChangeText is basically a simplified version of onChange, so you can easily use it, without the hassle of going through event.target.value to get changed value.So, when should you use
onChange and when onChangeText?If you have simple form with few textinputs, or simple logic, you can go straight away and use
onChangeText<TextInput value={this.state.name} onChangeText={(text) => this.setState({name: text})}>
If you have more complicated forms and/or you have more logic in handling data (like handling text differently from number) when user changes input, then you are better of with
onChange, because it gives you more flexibility. For example:handleChange(event) {
const {name, type, value} = event.nativeEvent;
let processedData = value;
if(type==='text') {
processedData = value.toUpperCase();
} else if (type==='number') {
processedData = value * 2;
}
this.setState({[name]: processedData})
}
<TextInput name="username" type="text" value={this.state.username} onChange={this.handleChange}}>
<TextInput name="password" type="number" value={this.state.password} onChange={this.handleChange}}>
- Jul 08 Mon 2019 16:00
-
[RN][轉] 同時兼容iOS與Android的Toast組件

轉自 bbs.reactnative.cn/topic/444/同时兼容ios与android的toast组件
--
給大家安利一款可以在iOS和Android上通用的Toast組件: react-native-root-toast
現在開源的Toast組件一大堆,為什麼要選用這個呢?原因如下:
- Jul 05 Fri 2019 11:46
-
[RN][轉] React Native FlatList 多選效果
- Jun 27 Thu 2019 10:09
-
[steam] Super Naughty Maid 2
- Jun 26 Wed 2019 14:49
-
[RN][react-navigation] header按鈕onPress的function未定義function is undefined on headerLeft button onPress
問題:
使用react-navigation接收navigation帶回來的參數,並且在navigationOptions中定義header區塊按鈕onPress時呼叫自訂function時,會直接出現"function is undefined"的錯誤訊息。
EX:
static navigationOptions = ({ navigation }) => ({
headerRight: <RightButton onPress={() => this.removeVehicle()} />
})
使用react-navigation接收navigation帶回來的參數,並且在navigationOptions中定義header區塊按鈕onPress時呼叫自訂function時,會直接出現"function is undefined"的錯誤訊息。
EX:
static navigationOptions = ({ navigation }) => ({
headerRight: <RightButton onPress={() => this.removeVehicle()} />
})
