React-native-redux 详解,熬夜整理Android面试笔试题

bool

}

}

export

const addList =

(data) => {

return {

type: HOTSHOW_LIST,

data

}

}

// 正在热映 初始请求

export

const initHotshow =

() => {

return hotshowFetch(addList);

}

allReducers.js 整合所有reducer

import { combineReducers }

from

‘redux’;

import { HotShowList, Banner, fetchLoading }

from

‘./hotshow/reducers’

const allReducers = combineReducers({

hotshows: HotShowList,

// 首屏数据列表 listview

banner: Banner,

// 轮播

fetchload: fetchLoading,

//加载中boo

});

export

default allReducers;

hotshowreducer

/**

* @author ling

* @email helloworld3q3q@gmail.com

* @create date 2017-05-12 04:56:34

* @modify date 2017-05-12 04:56:34

* @desc [description]

*/

import { HOTSHOW_BANNER, HOTSHOW_LIST, HOTSHOW_FETCH }

from

‘…/…/actions/types’;

export

const HotShowList =

(state = {}, action) => {

switch (action.type) {

case HOTSHOW_LIST:

return

Object.assign(

{} , state , {

data : action.data

});

default:

return state;

}

}

export

const Banner =

(state = {}, action) => {

switch (action.type) {

case HOTSHOW_BANNER:

let subjects = action.data;

let data = subjects.slice(

0,

5);

// 前五个

return

Object.assign(

{} , state , {

data : data

});

default:

return state;

}

}

export

const fetchLoading =

(state = {}, action) => {

switch (action.type) {

case HOTSHOW_FETCH:

return

Object.assign(

{} , state , {

data : action.bool

});

default:

return state;

}

}

api 数据请求

/**

* @author ling

* @email helloworld3q3q@gmail.com

* @create date 2017-05-16 08:34:36

* @modify date 2017-05-16 08:34:36

* @desc [description]

*/

//const hotshow = ‘https://api.douban.com/v2/movie/in_theaters’;

// const sonshow = ‘https://api.douban.com/v2/movie/coming_soon’;

// const usshow = ‘https://api.douban.com/v2/movie/us_box’;

// const nearcinemas = ‘http://m.maoyan.com/cinemas.json’;

const hotshow =

‘http://192.168.×.9:8080/weixin/hotshow.json’;

const sonshow =

‘http://192.168.×.9:8080/weixin/sonshow.json’;

const usshow =

‘http://192.168.×.9:8080/weixin/usshow.json’;

const nearcinemas =

‘http://192.168.×.9:8080/weixin/nearcinemas.json’;

import { initHotshow, fetchLoading }

from

‘…/actions/hotshow-action’;

export

function hotshowFetch(action) {

return

(dispatch) => {

fetch(hotshow).then(

res => res.json())

.then(

json => {

dispatch(action(json));

dispatch(fetchLoading(

false));

}).catch(

msg =>

console.log(

'hotshowList-err '+ msg));

}

}

containers\hotshow\index

/**

* @author ling

* @email helloworld3q3q@gmail.com

* @create date 2017-05-17 10:44:56

* @modify date 2017-05-17 10:44:56

* @desc [description]

*/

import React, { Component }

from

‘react’;

import { View, ScrollView }

from

‘react-native’;

import { bindActionCreators }

from

‘redux’;

import { connect }

from

‘react-redux’;

import { size }

from

‘…/…/util/style’;

import HotShowList

from

‘./hotshow-list’;

import Loading

from

‘…/…/compoments/comm/loading’

import { fetchLoading, initHotshow }

from

‘…/…/actions/hotshow-action’;

class hotshow extends Component {

componentWillMount() {

let _that =

this;

let time = setTimeout(

function(){

//请求数据

_that.props.initHotshowAction();

clearTimeout(time);

},

1500);

}

render() {

return (

{this.props.fetchbool ?

:

}

</View>);

}

}

function mapStateToProps(state) {

return {

fetchbool: state.fetchload.data,

hotshows: state.hotshows.data

}

}

function macthDispatchToProps(dispatch) {

return bindActionCreators({

initHotshowAction: initHotshow,

}, dispatch);

}

export

default connect(mapStateToProps, macthDispatchToProps)(hotshow);

BannerCtn 轮播用的swiper 插件, 但swiper加入 listview 有个bug就是图片不显示,结尾做答

import React, { Component }

from

‘react’;

import { Text, StyleSheet, View, Image }

from

‘react-native’;

import { connect }

from

‘react-redux’;

import { bindActionCreators }

from

‘redux’;

import Swiper

from

‘react-native-swiper’;

import { addBanner }

from

‘…/…/actions/hotshow-action’;

import { size }

from

‘…/…/util/style’;

class BannerCtn extends Component {

render() {

let data =

this.props.banner.data;

return (

<View style={{height: 200}}>

{ data !== undefined ?

<Swiper height={200} autoplay={true}>

{

data.map((item, i) => {

return (

<View key={i} style={{flex: 1, height:200}}>

<Image style={{flex: 1}} resizeMode=‘cover’

source=

{{uri:

item.images.large}}/>

<Text style={style.title}> {item.title}

</Text>

</View>)

})

}

</Swiper>:

<Text>loading

</Text>

}

</View>

);

}

}

function mapStateToProps(state) {

return {

banner: state.banner

}

}

let style = StyleSheet.create({

title: {

position: ‘absolute’,

width: size.width,

bottom: 0,

color: ‘#ffffff’,

textAlign: ‘right’,

backgroundColor: ‘rgba(230,69,51,0.25)’

}

})

export default connect(mapStateToProps)(BannerCtn);

hotshow-list

import React, { Component }

from

‘react’;

import { Text, View, ListView, StyleSheet }

from

‘react-native’;

import { connect }

from

‘react-redux’;

import { bindActionCreators }

from

‘redux’;

import { addBanner }

from

‘…/…/actions/hotshow-action’;

import Loading

from

‘…/…/compoments/comm/loading’;

import Item

from

‘…/…/compoments/hotshow/item’;

import Banner

from

‘./banner-ctn’;

import Foot

from

‘…/…/compoments/comm/foot’;

class HotShowList extends Component {

constructor(props) {

super(props);

}

componentWillMount() {

//顶部轮播

let { hotshows, bannerAction } =

this.props;

let subs = hotshows.data.subjects;

bannerAction(subs);

}

_renderList() {

let { hotshows } =

this.props;

let ary = hotshows.data.subjects, subsAry = [], row=[];

row.push(

);

for(

let i =

0, item; item = ary[i++]😉 {

//一行两个

subsAry.push(

);

if(subsAry.length == 2) {

row.push(subsAry);

subsAry = [];

}

}

return row;

}

_renderRow(data) {

return(

<View style={{marginTop: 1, flexWrap:‘wrap’, flexDirection: ‘row’, justifyContent: ‘space-between’}}>{data}

);

}

render() {

let ds = new ListView.DataSource({

rowHasChanged: (r1, r2) => r1 !== r2

});

let data = this._renderList();

this.state = {

dataSource: ds.cloneWithRows(data),

}

//removeClippedSubviews 处理 banner 图片不显示

return (

);

}

}

function mapStateToProps(state) {

return {

hotshows: state.hotshows

}

}

function macthDispatchToProps(dispatch) {

return bindActionCreators({ bannerAction: addBanner}, dispatch);

}

let style = StyleSheet.create({

listbox: {

marginBottom: 45,

}

});

export default connect(mapStateToProps, macthDispatchToProps)(HotShowList);

剩下 便是foot tab 和单个item的编写

/**

* @author ling

* @email helloworld3q3q@gmail.com

* @create date 2017-05-19 08:38:19

* @modify date 2017-05-19 08:38:19

* @desc [description]

*/

import React, { Component }

from

‘react’;

import { Text, View, Image, StyleSheet }

from

‘react-native’;

import { size }

from

‘…/…/util/style’;

const width = size.width/

2

-0.2;

class item extends Component{

render() {

let data =

this.props.data;

return(

<View style={style.box}>

<Image resizeMode=‘cover’ style={style.avatar} source={{uri:data.images.large}}/>

<View style={style.rank}>

<Text style={style.rankTxt}>Top{this.props.rank}

</Text>

</View>

<View style={style.msgbox}>

<View style={style.msgrow}>

<Text style={style.msgrowl}>{data.title}

</Text>

<Text style={style.msgrowr}>评分:{data.rating.average}

</Text>

</View>

<View style={style.msgrow}>

<Text style={style.msgrowl}>

{data.genres.map((item, i)=> {

if(i > 1) return;

i == 1 ? null : item += ‘,’;

return item;

})}

</Text>

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

img

img

img

img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Android)

尾声

最后,我再重复一次,如果你想成为一个优秀的 Android 开发人员,请集中精力,对基础和重要的事情做深度研究。

对于很多初中级Android工程师而言,想要提升技能,往往是自己摸索成长,不成体系的学习效果低效漫长且无助。 整理的这些架构技术希望对Android开发的朋友们有所参考以及少走弯路,本文的重点是你有没有收获与成长,其余的都不重要,希望读者们能谨记这一点。

最后想要拿高薪实现技术提升薪水得到质的飞跃。最快捷的方式,就是有人可以带着你一起分析,这样学习起来最为高效,所以为了大家能够顺利进阶中高级、架构师,我特地为大家准备了一套高手学习的源码和框架视频等精品Android架构师教程,保证你学了以后保证薪资上升一个台阶。

当你有了学习线路,学习哪些内容,也知道以后的路怎么走了,理论看多了总要实践的。

进阶学习视频

附上:我们之前因为秋招收集的二十套一二线互联网公司Android面试真题 (含BAT、小米、华为、美团、滴滴)和我自己整理Android复习笔记(包含Android基础知识点、Android扩展知识点、Android源码解析、设计模式汇总、Gradle知识点、常见算法题汇总。)

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!

render() {

let ds = new ListView.DataSource({

rowHasChanged: (r1, r2) => r1 !== r2

});

let data = this._renderList();

this.state = {

dataSource: ds.cloneWithRows(data),

}

//removeClippedSubviews 处理 banner 图片不显示

return (

);

}

}

function mapStateToProps(state) {

return {

hotshows: state.hotshows

}

}

function macthDispatchToProps(dispatch) {

return bindActionCreators({ bannerAction: addBanner}, dispatch);

}

let style = StyleSheet.create({

listbox: {

marginBottom: 45,

}

});

export default connect(mapStateToProps, macthDispatchToProps)(HotShowList);

剩下 便是foot tab 和单个item的编写

/**

* @author ling

* @email helloworld3q3q@gmail.com

* @create date 2017-05-19 08:38:19

* @modify date 2017-05-19 08:38:19

* @desc [description]

*/

import React, { Component }

from

‘react’;

import { Text, View, Image, StyleSheet }

from

‘react-native’;

import { size }

from

‘…/…/util/style’;

const width = size.width/

2

-0.2;

class item extends Component{

render() {

let data =

this.props.data;

return(

<View style={style.box}>

<Image resizeMode=‘cover’ style={style.avatar} source={{uri:data.images.large}}/>

<View style={style.rank}>

<Text style={style.rankTxt}>Top{this.props.rank}

</Text>

</View>

<View style={style.msgbox}>

<View style={style.msgrow}>

<Text style={style.msgrowl}>{data.title}

</Text>

<Text style={style.msgrowr}>评分:{data.rating.average}

</Text>

</View>

<View style={style.msgrow}>

<Text style={style.msgrowl}>

{data.genres.map((item, i)=> {

if(i > 1) return;

i == 1 ? null : item += ‘,’;

return item;

})}

</Text>

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

[外链图片转存中…(img-VJAVUZec-1712793203669)]

[外链图片转存中…(img-NvfpwZhZ-1712793203670)]

[外链图片转存中…(img-4TmOLNQ2-1712793203670)]

[外链图片转存中…(img-Mxg30Jx5-1712793203671)]

[外链图片转存中…(img-wCt6CFww-1712793203671)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Android)

尾声

最后,我再重复一次,如果你想成为一个优秀的 Android 开发人员,请集中精力,对基础和重要的事情做深度研究。

对于很多初中级Android工程师而言,想要提升技能,往往是自己摸索成长,不成体系的学习效果低效漫长且无助。 整理的这些架构技术希望对Android开发的朋友们有所参考以及少走弯路,本文的重点是你有没有收获与成长,其余的都不重要,希望读者们能谨记这一点。

最后想要拿高薪实现技术提升薪水得到质的飞跃。最快捷的方式,就是有人可以带着你一起分析,这样学习起来最为高效,所以为了大家能够顺利进阶中高级、架构师,我特地为大家准备了一套高手学习的源码和框架视频等精品Android架构师教程,保证你学了以后保证薪资上升一个台阶。

当你有了学习线路,学习哪些内容,也知道以后的路怎么走了,理论看多了总要实践的。

进阶学习视频

[外链图片转存中…(img-LYM0qNTm-1712793203671)]

附上:我们之前因为秋招收集的二十套一二线互联网公司Android面试真题 (含BAT、小米、华为、美团、滴滴)和我自己整理Android复习笔记(包含Android基础知识点、Android扩展知识点、Android源码解析、设计模式汇总、Gradle知识点、常见算法题汇总。)

[外链图片转存中…(img-zLI57gFI-1712793203671)]

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!

  • 19
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值