1.0.7 • Published 4 months ago

react-native-mybuttonlibrary v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

CustomButton Component

The CustomButton is a highly customizable React Native button component that supports text, icons, and various styling options. It is designed to be flexible and easy to integrate into your React Native projects.

Installation

To use the CustomButton component in your project, you can install it via npm:

npm install 'react-native-mybuttonlibrary'

Usage

To use the CustomButton component, simply import it into your React Native project and include it in your JSX:

import React from 'react';

import { View } from 'react-native';

import CustomButton from 'custom-button';

const App = () => {

const handlePress = () => { console.log('Button Pressed!');

};

return (

<View>

  <CustomButton
    buttonText="Click Me"
    onPress={handlePress}
    buttonStyle={{ backgroundColor: 'green' }}
    textStyle={{ color: 'white' }}
  />

</View>

); };

export default App;

Props

Prop NameTypeDescriptionDefault Value
onPress() => voidFunction to be called when the button is pressed.Required
buttonTextstringThe text to be displayed inside the button.Required
iconSourceImageSourcePropTypeThe source of the icon to be displayed alongside the text.undefined
buttonStyleStyleProp<ViewStyle>Custom styles for the button container.undefined
iconStyleStyleProp<ImageStyle>Custom styles for the icon.undefined
textStyleStyleProp<TextStyle>Custom styles for the button text.undefined
isButtonDisabledbooleanIf true, the button will be disabled and styled accordingly.false

Styles

const styles = StyleSheet.create({

disabledButton:

{ backgroundColor: 'white', alignItems: 'center', justifyContent: 'center', alignSelf: 'center', width: '85%', marginTop: 44, borderRadius: 10, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.8, shadowRadius: 3, elevation: 5, paddingVertical: 15, },

submitButton: { flexDirection: 'row', backgroundColor: '#5698D3', alignItems: 'center', justifyContent: 'center', alignSelf: 'center', width: '85%', marginTop: 44, borderRadius: 10, paddingVertical: 15, },

submitButtonText: { color: 'white', fontSize: 16, fontWeight: 'bold', },

disabledButtonText: { color: '#ccc', fontSize: 16, fontWeight: 'bold', },

icon: { width: 28, height: 28, resizeMode: 'contain', },

});

Example

Here’s an example of how you can use the CustomButton with an icon and custom styles:

import React from 'react'; import { View } from 'react-native'; import CustomButton from 'custom-button'; import Icon from 'react-native-vector-icons/FontAwesome';

const App = () => { const handlePress = () => { console.log('Button with Icon Pressed!'); };

return (

<View>

  <CustomButton
    buttonText="Click Me"
    onPress={handlePress}
    iconSource={Icon}
    buttonStyle={{ backgroundColor: 'purple', paddingHorizontal: 20 }}
    textStyle={{ color: 'white', fontSize: 18 }}
    iconStyle={{ tintColor: 'white', marginRight: 10 }}
  />

</View>

); };

export default App;

Contributing

If you'd like to contribute to this project, please fork the repository and submit a pull request. We welcome contributions of all kinds, including bug fixes, feature additions, and documentation improvements.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have any questions, please open an issue on the GitHub repository.

This version has been structured using appropriate headers, code blocks, tables for props, and sections for installation, usage, styling, and contribution in the standard README.md format.

abort-controlleracceptsacornanseransi-regexansi-stylesanymatchargparseasapast-typesasync-limiterbabel-corebabel-jestbabel-plugin-istanbulbabel-plugin-jest-hoistbabel-plugin-polyfill-corejs2babel-plugin-polyfill-corejs3babel-plugin-polyfill-regeneratorbabel-plugin-syntax-hermes-parserbabel-plugin-transform-flow-enumsbabel-preset-current-node-syntaxbabel-preset-jestbalanced-matchbase64-jsbrace-expansionbracesbrowserslistbserbuffer-fromcaller-callsitecaller-pathcallsitescamelcasecaniuse-litechalkchrome-launcherchromium-edge-launcherci-infocliuiclone-deepcolor-convertcolor-namecommandercommondirconcat-mapconnectconvert-source-mapcore-js-compatcosmiconfigcross-spawncsstypedebugdepddestroyee-firstelectron-to-chromiumemoji-regexencodeurlerror-exerror-stack-parserescaladeescape-htmlescape-string-regexpesprimaesutilsetagevent-target-shimexecaexponential-backofffast-json-stable-stringifyfb-watchmanfill-rangefinalhandlerfind-cache-dirfind-upflow-enums-runtimeflow-parserfreshfs.realpathfunction-bindgensyncget-caller-fileget-package-typeget-streamglobglobalsgraceful-fshas-flaghasownhermes-estreehermes-parserhttp-errorshuman-signalsimage-sizeimport-freshimurmurhashinflightinheritsinvariantis-arrayishis-core-moduleis-directoryis-dockeris-fullwidth-code-pointis-numberis-plain-objectis-streamis-wslisexeisobjectistanbul-lib-coverageistanbul-lib-instrumentjest-environment-nodejest-get-typejest-haste-mapjest-message-utiljest-mockjest-regex-utiljest-utiljest-validatejest-workerjs-tokensjs-yamljsc-androidjsc-safe-urljscodeshiftjsescjson-parse-better-errorsjson5kind-oflevenlighthouse-loggerlocate-pathlodash.debouncelodash.throttleloose-envifylru-cachemake-dirmakeerrormarkymemoize-onemerge-streammetrometro-babel-transformermetro-cachemetro-cache-keymetro-configmetro-coremetro-file-mapmetro-minify-tersermetro-resolvermetro-runtimemetro-source-mapmetro-symbolicatemetro-transform-pluginsmetro-transform-workermicromatchmimemime-dbmime-typesmimic-fnminimatchminimistmkdirpmsnegotiatorneo-asyncnode-dirnode-fetchnode-forgenode-int64node-releasesnormalize-pathnpm-run-pathnullthrowsob1on-finishedonceonetimeopenp-limitp-locatep-tryparse-jsonparseurlpath-existspath-is-absolutepath-keypath-parsepicocolorspicomatchpifypiratespkg-dirpretty-formatpromisequeuerange-parserreactreact-devtools-corereact-isreact-nativereact-refreshreadlinerecastregenerateregenerate-unicode-propertiesregenerator-runtimeregenerator-transformregexpu-coreregjsgenregjsparserrequire-directoryresolveresolve-fromrimrafschedulerselfsignedsemversendserialize-errorserve-staticsetprototypeofshallow-cloneshebang-commandshebang-regexshell-quotesignal-exitslashsource-mapsource-map-supportsprintf-jsstack-utilsstackframestacktrace-parserstatusesstring-widthstrip-ansistrip-final-newlinesupports-colorsupports-preserve-symlinks-flagtemptersertest-excludethroattmplto-regex-rangetoidentifiertr46tslibtype-detecttype-festundici-typesunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascriptunpipeupdate-browserslist-dbutils-mergevlqwalkerwebidl-conversionswhatwg-fetchwhatwg-urlwhichwrap-ansiwrappywrite-file-atomicwsy18nyallistyargsyargs-parser
1.0.7

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago