sekizlipenguen / react-native-popup-confirm-toast

MIT License
89 stars 12 forks source link

on SPSheet component inner function problem ! #6

Closed mcatal closed 2 years ago

mcatal commented 2 years ago

First of all, thank you for this beautiful work.

When using SPSheet, I create its contents with my own special component (using component props) and make a menu list according to the array using map, TouchableOpacity and console.log with onPress method. Saw that I couldn't even console.log in, I'm waiting for your help to see if I'm making a mistake in my code example below or if there's a different problem, have a good day.

Problem

` const AdrRadioRender = () => (

        SPSheet.show({
            dragFromTopOnly: true,
            component: ()  => (
                    (dataAdr.map((adrData:any) => { return (
                        <TouchableOpacity key={adrData.id}  
                            style={{...styles.adrTouchMain, backgroundColor: adrChecked === adrData.id ? '"rgba(143, 206, 0, 1)"' : '"rgba(115, 115, 115, .7)"'}} 
                            onPress={() => { console.log('sad') }} >
                            <View style={{flex:.4, justifyContent:'center', alignItems:'center'}}>
                                <Icon 
                                    size={26}
                                    type='font-awesome-5'
                                    name={adrChecked != adrData.id ? 'circle' : 'check-circle'}
                                    color={adrChecked != adrData.id ? '#2a2526' : '#004d00'}
                                />
                            </View>
                            <View style={{flex:1, marginLeft:3, justifyContent:'center'}}>
                                <Text style={{...styles.adrText, color: adrChecked === adrData.id ? '#000' : '#ffffff'}}>{adrData.packName}</Text>
                                <TextMask
                                    style={{...styles.adrPackPrice, color: adrChecked === adrData.id ? '#000' : '#ffffff'}}
                                    type="money"
                                    options={{
                                        precision: 0,
                                        separator: ' ',
                                        delimiter: '.',
                                        suffixUnit: "₺",
                                        unit: adrData?.packPrice < 0 ? 'Fiyat : - ' : 'Fiyat : ',
                                    }}
                                    value={Number.parseFloat(adrData?.packPrice).toFixed(0)}
                                />
                            </View>
                        </TouchableOpacity>
                    )}) 
                )
            ),
            onCloseComplete: () => {
                //alert('onCloseComplete');
            },
            onOpenComplete: () => {
                //alert('onOpenComplete');
            },
            height:400
        }

    )
)`
sekizlipenguen commented 2 years ago

Hi, :)

https://github.com/software-mansion/react-native-gesture-handler/issues/578