在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:jmurzy/react-native-foldview开源软件地址:https://github.com/jmurzy/react-native-foldview开源编程语言:JavaScript 100.0%开源软件介绍:React Native FoldViewFoldingCell implementation in JavaScript. This project was inspired by the folding cell animation seen on Dribbble. Questions?Feel free to reach out to me on Twitter @jmurzy. Read it on MediumTo learn more about how FoldView was implemented, check out the article on Medium: Implementing FoldView in React Native. ExampleThe demo app from the GIF can be found at To build and run the example app: git clone https://github.com/jmurzy/react-native-foldview
cd react-native-foldview/examples/Simple
npm install To deploy to iOS simulator: npm run ios InstallationUsing npm:$ npm install --save react-native-foldview Using yarn:$ yarn add react-native-foldview Usageimport React, { Component } from 'react';
import FoldView from 'react-native-foldview';
const Frontface = (props) => (/*...*/);
const Backface = (props) => (/*...*/);
const Base = (props) => (/*...*/);
export default class Row extends Component {
constructor(props) {
super(props);
this.state = {
expanded: false,
};
}
componentWillMount() {
this.flip = this.flip.bind(this);
}
flip() {
this.setState({
expanded: !this.state.expanded,
});
}
renderFrontface() {
return (
<Frontface />
);
}
renderBackface() {
/**
* You can nest <FoldView>s here to achieve the folding effect shown in the GIF above.
* A reference implementation can be found in examples/Simple.
*/
return (
<Backface />
);
}
render() {
return (
<FoldView
expanded={this.state.expanded}
renderBackface={this.renderBackface}
renderFrontface={this.renderFrontface}
>
<Base />
</FoldView>
);
}
} Props
Root-only PropsFoldViews can be nested. The following props can only be set on the root
Advanced UsageYou can customize the behavior of expand and collapse animations using the const collapse = async (foldViews) => {
/**
* Internally, FoldView turns off rasterization when collapsed as an optimization to decrease
* memory usage. It's important to wrap your calls in a `Promise` here to avoid early disabling
* of rasterization.
*/
await Promise.all(foldViews.map(foldView => foldView.collapse()));
}
<FoldView
collapse={collapse}
renderBackface={/* ... */}
renderFrontface={/* ... */}
>
{ /* ... */ }
</FoldView> Platform SupportThis library heavily depends on the ContributingContributions are very welcome: bug fixes, features, documentation, tests. Just make sure the CI is |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论