iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 12
0
Mobile Development

ReactNative 懶人開發之路,薪水小偷練成日記(X系列 第 12

[Day:11] ( •́ _ •̀)?可以不要自己刻 UI 嗎?好煩ლ(゚д゚ლ)好煩

像是這樣看起來基本的畫面,如果要自己做選單會花很多時間

https://ithelp.ithome.com.tw/upload/images/20200925/20104220tJvfmI7Pls.png

但是

我們可以使用 UI kit 。:.゚ヽ(*´∀`)ノ゚.:。

https://github.com/ant-design/ant-design-mobile-rn

https://ithelp.ithome.com.tw/upload/images/20200925/20104220WyH87PrOxB.png

先將範例的APP裝起來,方便我們快速瀏覽能用的元件

https://ithelp.ithome.com.tw/upload/images/20200925/20104220bE4C0ijIeS.jpg

找到今天要用的時間選擇器元件

https://ithelp.ithome.com.tw/upload/images/20200925/20104220fD1tUai9ur.jpghttps://ithelp.ithome.com.tw/upload/images/20200925/2010422084Aozemg3u.jpg

import { Modal, Provider, DatePickerView } from '@ant-design/react-native';
......

<Modal ....>
    <View >
      <DatePickerView
        value={this.state.value24hours}
        onChange={v => {
          this.setState({ value24hours: v })
          console.warn(this.state.value24hours)
        }}
      />
    </View>
</Modal>

記得root元件要用 <Provider> 包起來喔

<Provider>
<View/>
<Provider/>

再加上一些按鈕就搞定啦~ 下班


上一篇
[Day:10] 今晚,我想來點不一樣的聲音(*ˇωˇ*人)
下一篇
[Day:12] 我想用Hook(°ཀ°) ,但是我只會Class.....(◞‸◟)
系列文
ReactNative 懶人開發之路,薪水小偷練成日記(X31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言