UNPKG

@freakycoder/react-native-text-input

Version:

Modern text input with fully customization options for React Native

29 lines 1.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const react_native_1 = require("react-native"); const react_native_bounceable_1 = tslib_1.__importDefault(require("@freakycoder/react-native-bounceable")); /** * ? Local Imports */ const RNTextInput_style_1 = tslib_1.__importDefault(require("./RNTextInput.style")); const defaultArrowIcon = require("./local-assets/right-arrow.png"); const RNTextInput = ({ style, inputRef, placeholder, buttonStyle, iconComponent, textInputStyle, iconImageStyle, disableButton = false, ImageComponent = react_native_1.Image, onPress, ...props }) => { const [placeholderText, setPlaceholderText] = React.useState(placeholder); React.useEffect(() => { setPlaceholderText(placeholder); }, []); const renderContent = () => (<react_native_1.View style={RNTextInput_style_1.default.contentContainer}> <react_native_1.TextInput placeholderTextColor="#ead4ff" {...props} ref={inputRef} placeholder={placeholderText} style={[RNTextInput_style_1.default.textInputStyle, textInputStyle]}/> {!disableButton && (iconComponent || (<react_native_bounceable_1.default style={[RNTextInput_style_1.default.buttonStyle, buttonStyle]}> <ImageComponent source={defaultArrowIcon} style={[RNTextInput_style_1.default.iconImageStyle, iconImageStyle]}/> </react_native_bounceable_1.default>))} </react_native_1.View>); return (<react_native_bounceable_1.default bounceEffect={0.97} {...props} style={[RNTextInput_style_1.default.container, style]} onPress={onPress}> {renderContent()} </react_native_bounceable_1.default>); }; exports.default = RNTextInput; //# sourceMappingURL=RNTextInput.js.map