UNPKG

react-native-swipe-a-lot

Version:

A swipe component for React Native that works on iOS and Android.

36 lines (28 loc) 646 B
import React, { Component, PropTypes } from 'react' import { View } from 'react-native' class FixedSizeView extends Component { static get propTypes() { return { store: PropTypes.object, children: PropTypes.object } } componentDidMount() { const { store } = this.props this.unsubscribe = store.subscribe(() => this.forceUpdate() ) } componentWillUnmount() { this.unsubscribe() } render() { const { width, height } = this.props.store.getState() return ( <View style={{width, height}}> {this.props.children} </View> ) } } export default FixedSizeView