Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update downDisplay prop dyamamicaly #19

Open
TylerOlthuizen opened this issue Jun 4, 2019 · 0 comments
Open

Update downDisplay prop dyamamicaly #19

TylerOlthuizen opened this issue Jun 4, 2019 · 0 comments

Comments

@TylerOlthuizen
Copy link

TylerOlthuizen commented Jun 4, 2019

Hello,

Good work on this! Is there a way to update the displayDown value after dynamically setting a state value? Heres what Im working with!

const HEADER_HEIGHT = 50;
const CONTAINER_HEIGHT = 300;
var DOWN_DISPLAY = 0 ;

export default class Drawer extends React.Component {

    state = {
        height:0,
    }
    
    handleLayout = ({nativeEvent}) => {
        this.setState({height: CONTAINER_HEIGHT - nativeEvent.layout.height});
    }
    renderContent = () => {
        return (
        <View style={styles.drawerContainer}>
            <TouchableOpacity 
                onPress={this._onPressButton}
                style={styles.grip}            
            />
            <View style={styles.HeaderBar} onLayout={this.handleLayout}>
                <Text style={[styles.H1,styles.header]}>Discover</Text>
                <StoryBarCat title="Test" icon={require("commonwealth/assets/svgs/color-circle.svg")}/>
            </View>
            <View style={styles.tabContent}>
            <Text>HERES SOME MORE TEXT</Text>
            </View>
        </View>
        )
    }

    render() {
        return (
        <BottomDrawer
            containerHeight={300}
            offset={0}
            roundedEdges={true}
            downDisplay={this.state.height}
            startUp={false}
            backgroundColor="#455154"
        >
            {this.renderContent()}
        </BottomDrawer>
        
        )
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant