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

Initial is not working on radio form tag #150

Open
Karthiksheety opened this issue Sep 22, 2020 · 1 comment
Open

Initial is not working on radio form tag #150

Karthiksheety opened this issue Sep 22, 2020 · 1 comment

Comments

@Karthiksheety
Copy link

Karthiksheety commented Sep 22, 2020

I have taken category array and looped, initially i need no radio button should selected so i passed initial as -1 but it is not working RadioForm initial={-1} formHorizontal={false} animation={true}

           <RadioForm initial={-1} formHorizontal={false} animation={true} >
                {this.state.types3.map((obj, i) => {
                    var amt = JSON.stringify(obj.amount);
                    var exactamt = amt*100;
                    var onPress = (value, index) => {
                        if(value == obj.value){
                            this.setState({
                                selectedObject: obj,
                                rupees: exactamt,
                                value3: value,
                                value3Index: index,
                                initialPayButton: exactamt,
                            })
                        }   
                    }

                    return (
                        <View>
                        <RadioButton labelHorizontal={true} key={i} >
                            <RadioButtonInput
                            obj={obj}
                            index={i}
                            isSelected={this.state.value3Index === i}
                            onPress={onPress}
                            buttonInnerColor={'black'}
                            buttonOuterColor={this.state.value3Index === i ? 'blue' : '#000'}
                            buttonSize={12}
                            buttonStyle={{}}
                            buttonWrapStyle={{marginLeft: 10}}
                            />
                            <RadioButtonLabel
                            obj={obj}
                            index={i}
                            onPress={onPress}
                            labelStyle={{fontWeight: 'bold', color: 'grey', marginLeft: 15}}
                            labelWrapStyle={{}}
                            />                             
                        </RadioButton>
                        <View style={{flex: 2, marginLeft: 45, flexDirection: 'row', marginBottom: 10}}>
                            <View style={{flex: 1.5}}>
                                <Text style={{color: 'grey'}}>{obj.entitlement}</Text>
                                <Text style={{color: 'grey'}}>{obj.warning}</Text>
                            </View>
                            <View style={{flex: 0.5,marginLeft: 10}}>
                                <Text>Rs. {exactamt/100} </Text>
                            </View>
                        </View> 

                       
                    </View>   
                    )
                    })} 
                    </RadioForm>

Please help if i am making any thing wrong

@devWaleed
Copy link

@Karthiksheety In my case it was the async function that was causing the issue. Only render this radio component once or re-render if you change state implicitly

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

2 participants