sekizlipenguen / react-native-popup-confirm-toast

MIT License
90 stars 13 forks source link

Spsheet hide not working #9

Closed jv640 closed 2 years ago

jv640 commented 2 years ago

I'm using spsheet in one of my project and stuck in this issue

` const component = ( props) => (

Subscribe to {plan.Title} props.spSheet.hide()} title={'Cancel'} /> console.log('confirmed')} title={'Confirm'} />

); const handleSubscribe = () => { console.log('purchasee clicked'); const spSheet = SPSheet; spSheet.show({ component: () => component({ spSheet }), dragFromTopOnly: true, height: '40%', }); };`

when I'm pressing cancel button it is showing this error

TypeError: spSheet.hide is not a function. (In 'spSheet.hide()', 'spSheet.hide' is undefined)

sekizlipenguen commented 2 years ago

Hi,

Can you print and forward the "props" console in the "component"?

sample code;


const component = (props) => {
    console.log('props',props);
    //console.log('spSheet',props.hide()); please try this 
   return (
        <View>
            <View style={styles.header}> <Text style={styles.sheetHeader}>Subscribe to {plan.Title}</Text> </View>
            <View>
                <SubmitButton isDisabled={isLoaded} handleSubmit={() => props.spSheet.hide()} title={'Cancel'}/>
                <SubmitButton isDisabled={isLoaded} handleSubmit={() => console.log('confirmed')} title={'Confirm'}/>
            </View>
        </View>
    );
};
const handleSubscribe = () => {
    console.log('purchasee clicked');
    const spSheet = SPSheet;
    spSheet.show({
        component: () => component({spSheet}), // {spSheet} or spSheet 
        dragFromTopOnly: true,
        height: '40%'
    });
};
sekizlipenguen commented 2 years ago

Hi

I'm using spsheet in one of my project and stuck in this issue

const component = ( props) => ( <View> <View style={styles.header}> <Text style={styles.sheetHeader}>Subscribe to {plan.Title}</Text> </View> <View> <SubmitButton isDisabled={isLoaded} handleSubmit={() => props.spSheet.hide()} title={'Cancel'} /> <SubmitButton isDisabled={isLoaded} handleSubmit={() => console.log('confirmed')} title={'Confirm'} /> </View> </View> ); const handleSubscribe = () => { console.log('purchasee clicked'); const spSheet = SPSheet; spSheet.show({ component: () => component({ spSheet }), dragFromTopOnly: true, height: '40%', }); };

when I'm pressing cancel button it is showing this error

TypeError: spSheet.hide is not a function. (In 'spSheet.hide()', 'spSheet.hide' is undefined)

Hi, maybe you forgot to add the provider integration

import { Root, SPSheet } from 'react-native-popup-confirm-toast'

App.js ->

<Root>
    ....
</Root>