@arpitbhalla/rneui-base-dev
Version:
Cross Platform React Native UI Toolkit
74 lines (73 loc) • 2.89 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchBar = void 0;
var react_1 = __importDefault(require("react"));
var SearchBar_ios_1 = require("./SearchBar-ios");
var SearchBar_android_1 = require("./SearchBar-android");
var SearchBar_default_1 = require("./SearchBar-default");
var SEARCH_BAR_COMPONENTS = {
ios: SearchBar_ios_1.SearchBarIOS,
android: SearchBar_android_1.SearchBarAndroid,
default: SearchBar_default_1.SearchBarDefault,
};
var SearchBar = (function (_super) {
__extends(SearchBar, _super);
function SearchBar() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.focus = function () {
_this.searchBar.focus();
};
_this.blur = function () {
_this.searchBar.blur();
};
_this.clear = function () {
_this.searchBar.clear();
};
_this.cancel = function () {
var _a;
(_a = _this.searchBar) === null || _a === void 0 ? void 0 : _a.cancel();
};
return _this;
}
SearchBar.prototype.render = function () {
var _this = this;
var Component = SEARCH_BAR_COMPONENTS[this.props.platform] || SearchBar_default_1.SearchBarDefault;
return (react_1.default.createElement(Component, __assign({ ref: function (ref) {
_this.searchBar = ref;
} }, this.props)));
};
SearchBar.defaultProps = {
platform: 'default',
};
return SearchBar;
}(react_1.default.Component));
exports.SearchBar = SearchBar;