-
Notifications
You must be signed in to change notification settings - Fork 130
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
How to use updateIsActiveIndex #136
Comments
Try following the example under Callback Refs. It worked for me. |
This is an example const Settings = () => {
const radioButtonRef = useRef(null);
const [settings, updateSettings] = useAsyncStorage(USER_SETTINGS);
useEffect(() => {
if (settings) {
const monitorOptionIdx = TRACKING_CHOICES.indexOf(settings.trackingOption);
radioButtonRef.current.updateIsActiveIndex(monitorOptionIdx);
setMonitoringOption(monitorOptionIdx);
setThreshold(settings.threshold.toString());
setUserCoinsToTrack(settings.coinsToTrack);
}
}, [settings]);
return (
<View style={styles.optionBlock}>
<Text style={styles.settingsText}>
How would you like to monitor prices?
</Text>
<RadioForm
initial={monitoringOption}
ref={radioButtonRef}
radio_props={monitoringOptions}
onPress={(value) => setMonitoringOption(value)}
buttonColor={colors.BLACK}
labelColor={colors.BLACK}
/>
</View>
);
} |
This example worked perfectly for me. Tks! |
I looked all over the web for how to change the initial value of a radio button with an asynchronous form update from the local device saved information. constructor(props) { make a function to loop through the button props and when a you find a match for the value you want to select: Refer to the function in your asynchronous get to set the new value in a .then(( in the form...I'm using Formik... |
I tried with a ref.
But every time i want to load the value i'm getting that this.ref.radioform.updateIsActiveIndex is not an object and the value isn't updated
The text was updated successfully, but these errors were encountered: