
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
react-flickity-component
Advanced tools
A React.js Flickity component.
npm install react-flickity-component --save
// Or
yarn add react-flickity-component
// Commonjs
const Flickity = require('flickity');
// Or for ES2015 module
import Flickity from 'react-flickity-component'
const flickityOptions = {
initialIndex: 2
}
function Carousel() {
return (
<Flickity
className={'carousel'} // default ''
elementType={'div'} // default 'div'
options={flickityOptions} // takes flickity options {}
disableImagesLoaded={false} // default false
reloadOnUpdate // default false
>
<img src="/images/placeholder.png"/>
<img src="/images/placeholder.png"/>
<img src="/images/placeholder.png"/>
</Flickity>
)
}
The examples folder contains an example use with create-react-app.
cd examples/react-flickity
yarn
yarn start
Property | Type | Default | Description |
---|---|---|---|
className | String | '' | Applied to top level wrapper |
elementType | String | 'div' | Wrapper's element type |
options | Object | {} | Flickity initialization opions |
disableImagesLoaded | Boolean | false | Disable call reloadCells images are loaded |
reloadOnUpdate | Boolean | false | Run reloadCells and resize on componentDidUpdate |
flickityRef | Function | like ref function, get Flickity instance in parent component |
You can access Flickity instance with flickityRef
prop just like ref
, and use this instance to register events and use API.
class Carousel extends React.Component {
componentDidMount = () => {
// You can register events in componentDidMount hook
this.flkty.on('settle', () => {
console.log(`current index is ${this.flkty.selectedIndex}`)
})
}
myCustomNext = () => {
// You can use Flickity API
this.flkty.next()
}
render() {
return (
<Flickity flickityRef={c => this.flkty = c}>
<img src="/images/placeholder.png"/>
<img src="/images/placeholder.png"/>
<img src="/images/placeholder.png"/>
</Flickity>
<Button onClick={myCustomNext}>My custom next button</Button>
)
}
}
Flickity may be used in commercial projects and applications with the one-time purchase of a commercial license. http://flickity.metafizzy.co/license.html
FAQs
react flickity component
The npm package react-flickity-component receives a total of 13,558 weekly downloads. As such, react-flickity-component popularity was classified as popular.
We found that react-flickity-component demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.