@brijen/react-native-multistep
Version:
A lightweight multi-step view component for React Native with smooth transitions using Reanimated.
62 lines (60 loc) • 1.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _reactNative = require("react-native");
var _jsxRuntime = require("react/jsx-runtime");
/**
* @internal
* A reusable button component used internally within the library.
* Supports `primary` (solid) and `secondary` (outline) variants.
*
* - `primary`: A solid button with a background color.
* - `secondary`: An outline button with a border and transparent background.
*
* @example
* ```tsx
* <Button title="Next" varient="primary" tintColor="#007AFF" />
* <Button title="Back" varient="secondary" tintColor="#007AFF" />
* ```
*/
const Button = props => {
const {
title,
variant,
tintColor,
style,
textStyle,
...rest
} = props;
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
testID: "button-container",
style: [styles.container, {
backgroundColor: variant === 'primary' ? tintColor : 'white',
borderWidth: variant === 'secondary' ? 1 : 0,
borderColor: tintColor
}, style],
...rest,
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
style: [styles.buttonText, {
color: variant === 'primary' ? 'white' : tintColor
}, textStyle],
children: title
})
});
};
var _default = exports.default = Button;
const styles = _reactNative.StyleSheet.create({
container: {
borderRadius: 20,
paddingVertical: 10,
width: 150,
alignItems: 'center',
justifyContent: 'center'
},
buttonText: {
fontWeight: '500'
}
});
//# sourceMappingURL=Button.js.map