2015年4月4日 星期六

gulp coffee react jsx轉換的 bug

目前Project是以gulp做管理,寫的是ReactJS的JSX
當然還是要用Coffee來寫
但要可以正確compile 也就需要
先讓jsx可以在coffee內可以先轉換過
再把coffee compile成js
因此就需要用到coffee-react-transform來處理
再把它整到gulp的task內
又找到有人再把coffee-react-transform
再包裝成gulp-coffee-react-transform這樣的plugin
不過今天使用發現一個bug
是這plugin內與coffee-react-transform相依的版本太舊
會造成轉換錯誤
該轉成
React.createElement("div",..)
都變成了
eact.createElement(React.DOM.div,...
自然就掛了
解決的方法 其實只要進node_modules內
把gulp-coffee-react-transform內所用的
coffee-react-transform 版本換掉就可以了
不過還是發了個pull-request給作者

2015年3月12日 星期四

modal hide 在ios上的bug

使用bootstrap modal
當modal上有input field 在focus狀態時
若將modal hide
在android上同時會自動讓input field 失去focus
但在ios上 focus還是會繼續讓focus留在input上
而造成在ios上有modal關閉不完全的狀況

這部分需處裡在modal hide時
強制讓input field失去focus
也就是
$('input[type=text]').blur()

2015年3月10日 星期二

window.innerHeigh for ios bug

window.innerHeigh在android上可以抓到當時設備方向的高度
ios設備上則不管拿水平垂直,都會抓到device的高度
只要加上以下meta
即可正確取得當時方向的height
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no">

2015年3月4日 星期三

nodejs update gulp error

更新ndejs版本到0.12
gulp出現v8flags json 找不到的錯誤
只要重新安裝gulp即可解決

npm uninstall gulp -g
npm install gulp -g

2015年2月13日 星期五

html select tag 在 cordova build bug

1.selectsize無效
若要select 顯示多筆,在web上可透過size設定要顯示的數量
<select size='5'>
但在build apk後,會造成select無法看到option選項
clcik select後才看得到選項
拿掉size後 select會顯示單筆option

2.option selected無效
在web上可以透過設定option的selected達到選取效果
#$(_option).attr 'selected','selected'<br />
但這在cordova上無效須改成在
select上設定value才會讓web與cordova都可常使用
$('._select').val $(_option).val()