UNPKG

@ant-design/react-native

Version:

基于蚂蚁金服移动设计规范的 React Native 组件库

1 lines 4.17 kB
"use strict";"use client";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _reactNativeUltimateListview=require("@bang88/react-native-ultimate-listview");var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _icon=_interopRequireDefault(require("../icon"));var _localeProvider=require("../locale-provider");var _getLocale=require("../_util/getLocale");var _zh_CN=_interopRequireDefault(require("./locale/zh_CN"));function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=(0,_getPrototypeOf2.default)(derived);return(0,_possibleConstructorReturn2.default)(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],(0,_getPrototypeOf2.default)(_this).constructor):derived.apply(_this,args));}var __rest=void 0&&(void 0).__rest||function(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++){if(e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i]))t[p[i]]=s[p[i]];}return t;};var ListView=function(_React$PureComponent){function ListView(){var _this2;(0,_classCallCheck2.default)(this,ListView);_this2=_callSuper(this,ListView,arguments);_this2.refresh=function(){if(_this2.ulv){_this2.ulv.refresh();}};return _this2;}(0,_inherits2.default)(ListView,_React$PureComponent);return(0,_createClass2.default)(ListView,[{key:"render",value:function render(){var _this3=this;var _a=this.props,renderItem=_a.renderItem,props=__rest(_a,["renderItem"]);var locale=(0,_getLocale.getComponentLocale)(this.props,this.context,'ListView',function(){return _zh_CN.default;});return _react.default.createElement(_reactNativeUltimateListview.UltimateListView,(0,_extends2.default)({key:"ant-list-view",keyExtractor:function keyExtractor(_,index){return"item-".concat(index);},refreshableMode:_reactNative.Platform.OS==='ios'?'advanced':'basic',numColumns:1,waitingSpinnerText:locale.loading,allLoadedText:locale.done,refreshableTitlePull:locale.refreshableTitlePull,refreshableTitleRelease:locale.refreshableTitleRelease,refreshableTitleRefreshing:locale.refreshableTitleRefreshing,emptyView:function emptyView(){return _this3.props.emptyView?_this3.props.emptyView():_react.default.createElement(_reactNative.View,{style:{flex:1,alignItems:'center',justifyContent:'center'}},_react.default.createElement(_reactNative.Text,{style:{textAlign:'center',padding:'10%'}},locale.noData));},customRefreshView:function customRefreshView(status){return _react.default.createElement(_reactNative.View,{style:{flexDirection:'row'}},status===2?_react.default.createElement(_reactNative.ActivityIndicator,null):_react.default.createElement(_icon.default,{name:status===0?'arrow-down':'arrow-up',size:18}),_react.default.createElement(_reactNative.Text,{style:{marginLeft:5}},status===0?locale.refreshableTitlePull:status===1?locale.refreshableTitleRelease:locale.refreshableTitleRefreshing));}},props,{item:renderItem,ref:function ref(_ref){return _this3.ulv=_ref;}}));}}]);}(_react.default.PureComponent);ListView.contextType=_localeProvider.LocaleContext;var _default=ListView;exports.default=_default;