react-web-native-sketch
Version:
[TODO: We need an overview of how this can be used via npm vs as a local package]
92 lines • 3.83 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var react_redux_1 = require("react-redux");
var __1 = require("../..");
var View_1 = require("../../primitives/View/View");
var Touchable_1 = require("../../primitives/Touchable/Touchable");
var theme_1 = require("../../utils/theme");
var platform_1 = require("../../primitives/platform/platform");
var Image_1 = require("../../primitives/Image/Image");
var Button_1 = require("../Button/Button");
var createStyles_1 = require("../../decorators/createStyles/createStyles");
var styles = function () { return ({
containerImg: {
height: '100%',
paddingLeft: 16,
paddingRight: 16,
justifyContent: 'center',
alignItems: 'center'
},
buttonContainer: {
paddingLeft: 16,
paddingRight: 16,
height: '100%',
justifyContent: 'center',
alignItems: 'center',
elevation: 0,
borderRadius: 0,
},
buttonText: {
color: platform_1.isIOS ? theme_1.appTheme.primaryColor : '#000',
fontSize: 17,
fontWeight: '400',
},
buttonColor: {
color: '#fff'
},
imgSrc: {
width: 24,
height: 24,
tintColor: platform_1.isIOS ? theme_1.appTheme.primaryColor : '#000',
}
}); };
var CTopBarButton = /** @class */ (function (_super) {
__extends(CTopBarButton, _super);
function CTopBarButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
CTopBarButton.prototype.render = function () {
var _a = this.props, onPress = _a.onPress, imgSrc = _a.imgSrc, imgStyle = _a.imgStyle, text = _a.text, goBack = _a.goBack, navigation = _a.navigation, classes = _a.classes;
if (imgSrc) {
return (React.createElement(Touchable_1.Touchable, __assign({ onPress: function () {
goBack && navigation.goBack();
onPress && onPress();
}, useForeground: true }, __1.getTestProps(this.props.testId)),
React.createElement(View_1.View, { style: classes.containerImg },
React.createElement(Image_1.Image, { source: imgSrc, style: [classes.imgSrc, imgStyle] }))));
}
return (React.createElement(Button_1.Button, { styles: { root: classes.buttonColor }, title: text, onPress: function () {
goBack && navigation.goBack();
onPress && onPress();
} }));
};
return CTopBarButton;
}(React.PureComponent));
var componentName = 'TopBarButton';
exports.TopBarButton = react_redux_1.connect(null, function (dispatch, ownProps) { return (__assign({}, ownProps, { onPress: function (args) {
var returnValue = ownProps.onPress && ownProps.onPress.apply(ownProps, (args || {}));
if (!returnValue) {
return;
}
dispatch(returnValue);
} })); })(createStyles_1.createStyles(styles, componentName)(CTopBarButton));
//# sourceMappingURL=TopBarButton.native.js.map