欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

React Native實(shí)現(xiàn)簡(jiǎn)單的登錄功能(推薦)

 更新時(shí)間:2016年09月19日 11:04:21   作者:淘_tao  
這篇文章主要介紹了React Native實(shí)現(xiàn)登錄功能的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下

React Native 簡(jiǎn)介:

React Native 結(jié)合了 Web 應(yīng)用和 Native 應(yīng)用的優(yōu)勢(shì),可以使用 JavaScript 來(lái)開(kāi)發(fā) iOS 和 Android 原生應(yīng)用。在 JavaScript 中用 React 抽象操作系統(tǒng)原生的 UI 組件,代替 DOM 元素來(lái)渲染等。

React Native 使你能夠使用基于 JavaScript 和 React 一致的開(kāi)發(fā)體驗(yàn)在本地平臺(tái)上構(gòu)建世界一流的應(yīng)用程序體驗(yàn)。React Native 把重點(diǎn)放在所有開(kāi)發(fā)人員關(guān)心的平臺(tái)的開(kāi)發(fā)效率上——開(kāi)發(fā)者只需學(xué)習(xí)一種語(yǔ)言就能輕易為任何平臺(tái)高效地編寫代碼。Facebook 在多個(gè)應(yīng)用程序產(chǎn)品中使用了 React Native,并將繼續(xù)為 React Native 投資。

學(xué)習(xí)React Native也有2個(gè)月了,從最開(kāi)始的頁(yè)面到點(diǎn)點(diǎn)擊事件,到調(diào)用接口大體都會(huì)了,今天實(shí)現(xiàn)一個(gè)簡(jiǎn)單的登錄功能。

這里需要說(shuō)明幾點(diǎn):

1、<TextInput>組件在React Native中,默認(rèn)是帶一條橫線的,如果想去掉輸入框下面的橫線,需要給<TextInput>指定一個(gè)underlineColorAndroid='transparent',這樣就可以去掉輸入框下面的橫線了;

2、密碼輸入框需要指定屬性:secureTextEntry={true}

3、要顯示圖片,必須為<Image>標(biāo)簽指定寬度和高度,和Android中不同的是,<Image>沒(méi)法自動(dòng)調(diào)整圖片的大小,沒(méi)有類似Android中的wrap_content。

代碼如下:

/** 
* Sample React Native App 
* https://github.com/facebook/react-native 
* @flow 
*/ 
import React, {Component} from 'react'; 
import { 
AppRegistry, 
StyleSheet, 
Text, 
Image, 
View, 
TextInput 
} from 'react-native'; 
class ReactDemo extends Component { 
render() { 
return ( 
<View style={styles.container}> 
<View style={styles.header}> 
<Text style={styles.headtitle}>添加賬號(hào)</Text> 
</View> 
<View style={styles.marginTopview}/> 
<View style={styles.inputview}> 
<TextInput underlineColorAndroid='transparent' style={styles.textinput} placeholder='QQ號(hào)/手機(jī)號(hào)/郵箱'/> 
<View style={styles.dividerview}> 
<Text style={styles.divider}></Text> 
</View> 
<TextInput underlineColorAndroid='transparent' style={styles.textinput} placeholder='密碼' 
secureTextEntry={true}/> 
</View> 
<View style={styles.bottomview}> 
<View style={styles.buttonview}> 
<Text style={styles.logintext}>登 錄</Text> 
</View> 
<View style={styles.bottombtnsview}> 
<View style={styles.bottomleftbtnview}> 
<Text style={styles.bottombtn}>無(wú)法登錄?</Text> 
</View> 
<View style={styles.bottomrightbtnview}> 
<Text style={styles.bottombtn}>新用戶</Text> 
</View> 
</View> 
</View> 
</View> 
); 
} 
} 
const styles = StyleSheet.create({ 
container: { 
flex: 1, 
backgroundColor: '#FFFFFF' 
}, 
header: { 
height: 50, 
backgroundColor: '#12B7F5', 
justifyContent: 'center', 
}, 
headtitle: { 
alignSelf: 'center', 
fontSize: 20, 
color: '#ffffff', 
}, 
avatarview: { 
height: 150, 
backgroundColor: '#ECEDF1', 
justifyContent: 'center', 
}, 
avatarimage: { 
width: 100, 
height: 100, 
alignSelf: 'center' 
}, 
marginTopview: { 
height: 15, 
backgroundColor: '#F7F7F9' 
}, 
inputview: { 
height: 100, 
}, 
textinput: { 
flex: 1, 
fontSize: 16, 
}, 
dividerview: { 
flexDirection: 'row', 
}, 
divider: { 
flex: 1, 
height: 1, 
backgroundColor: '#ECEDF1' 
}, 
bottomview: { 
backgroundColor: '#ECEDF1', 
flex: 1, 
}, 
buttonview: { 
backgroundColor: '#1DBAF1', 
margin: 10, 
borderRadius: 6, 
justifyContent: 'center', 
alignItems: 'center', 
}, 
logintext: { 
fontSize: 17, 
color: '#FFFFFF', 
marginTop: 10, 
marginBottom: 10, 
}, 
emptyview: { 
flex: 1, 
}, 
bottombtnsview: { 
flexDirection: 'row', 
}, 
bottomleftbtnview: { 
flex: 1, 
height: 50, 
paddingLeft: 10, 
alignItems: 'flex-start', 
justifyContent: 'center', 
}, 
bottomrightbtnview: { 
flex: 1, 
height: 50, 
paddingRight: 10, 
alignItems: 'flex-end', 
justifyContent: 'center', 
}, 
bottombtn: { 
fontSize: 15, 
color: '#1DBAF1', 
} 
}); 
AppRegistry.registerComponent('ReactDemo', () => ReactDemo);

以上所述是小編給大家介紹的React Native實(shí)現(xiàn)登錄功能,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

  • 用React-Native+Mobx做一個(gè)迷你水果商城APP(附源碼)

    用React-Native+Mobx做一個(gè)迷你水果商城APP(附源碼)

    這篇文章主要介紹了用React-Native+Mobx做一個(gè)迷你水果商城APP,功能需要的朋友可以參考下
    2017-12-12
  • React 組件渲染和更新的實(shí)現(xiàn)代碼示例

    React 組件渲染和更新的實(shí)現(xiàn)代碼示例

    這篇文章主要介紹了React-組件渲染和更新的實(shí)現(xiàn)代碼示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2019-02-02
  • React實(shí)現(xiàn)復(fù)雜搜索表單的展開(kāi)收起功能

    React實(shí)現(xiàn)復(fù)雜搜索表單的展開(kāi)收起功能

    本節(jié)對(duì)于需要展開(kāi)收起效果的查詢表單進(jìn)行概述,主要涉及前端樣式知識(shí)。對(duì)React實(shí)現(xiàn)復(fù)雜搜索表單的展開(kāi)-收起功能感興趣的朋友一起看看吧
    2021-09-09
  • es6在react中的應(yīng)用代碼解析

    es6在react中的應(yīng)用代碼解析

    這篇文章主要介紹了es6在react中的應(yīng)用代碼解析,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2017-11-11
  • react實(shí)現(xiàn)Modal彈窗效果

    react實(shí)現(xiàn)Modal彈窗效果

    這篇文章主要為大家詳細(xì)介紹了react實(shí)現(xiàn)Modal彈窗效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-08-08
  • React?Server?Component混合式渲染問(wèn)題詳解

    React?Server?Component混合式渲染問(wèn)題詳解

    React?官方對(duì)?Server?Comopnent?是這樣介紹的:?zero-bundle-size?React?Server?Components,這篇文章主要介紹了React?Server?Component:?混合式渲染,需要的朋友可以參考下
    2022-12-12
  • 淺談對(duì)于react-thunk中間件的簡(jiǎn)單理解

    淺談對(duì)于react-thunk中間件的簡(jiǎn)單理解

    這篇文章主要介紹了淺談對(duì)于react-thunk中間件的簡(jiǎn)單理解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • ReactJS入門實(shí)例教程詳解

    ReactJS入門實(shí)例教程詳解

    React.render?是?React?的最基本方法,用于將模板轉(zhuǎn)為?HTML?語(yǔ)言,并插入指定的?DOM?節(jié)點(diǎn),這篇文章主要介紹了ReactJS入門實(shí)例教程,需要的朋友可以參考下
    2022-06-06
  • React Native 環(huán)境搭建的教程

    React Native 環(huán)境搭建的教程

    本篇文章主要介紹了React Native 環(huán)境搭建的教程,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-08-08
  • React如何立即更新DOM

    React如何立即更新DOM

    這篇文章主要介紹了React如何立即更新DOM問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-01-01

最新評(píng)論