Closed DataHippo93 closed 5 years ago
Hi, and thanks for your question. As explained in the react-admin contributing guide, the right place to ask a "How To" question, get usage advice, or troubleshoot your own code, is StackOverFlow.
This makes your question easy to find by the core team, and the developer community. Unlike Github, StackOverFlow has great SEO, gamification, voting, and reputation. That's why we chose it, and decided to keep GitHub issues only for bugs and feature requests.
So I'm closing this issue, and inviting you to ask your question at:
http://stackoverflow.com/questions/tagged/react-admin
And once you get a response, please continue to hang out on the react-admin channel in StackOverflow. That way, you can help newcomers and share your expertise!
I fixed this by adding react-final-form to my package JSON. For some reason webpack had an issue with it being a peer dependency of ra-core.
@DataHippo93 I already have react-final-form in my package json. I am using useForm like this -
//useFormComp.js
import React from 'react';
import { useForm } from 'react-final-form';
const UseFormComponent = ({ children }) => {
const form = useForm();
console.log("children", children);
console.log(form.change);
if (typeof children === 'function')
return children && children({ change: form.change });
};
export default UseFormComponent;
and using it in my react class component like this--->
<FormDataConsumer>
{({formData, ...rest}) =>
<UseFormComponent>{
({ change }) => (
<CaptureButton
uploadForCoverImage={(assetId) => {
change('image', assetId);
}}
{...rest}/>
)
}</UseFormComponent>
}
</FormDataConsumer>
I have the same problem with react-admin 3.10.0 and earlier versions The only way to make it work is by declaring the component using useForm in the same file and before the component generating the Form (in my case my Create component with a SImpleForm). I am not good enough to find why but I hope it helps.
What you were expecting: I followed the upgrade guide for linking two components and started using const form = useForm() instead of dispatch. The change works in Chrome browser but when I open in Electron I get the error:
I'm not sure how to proceed from here and it is strange that it works in chrome but not electron so any help would be greatly appreciated.
And here is the location picker custom components
Environment