henninghall / react-native-date-picker

React Native Date Picker is datetime picker for Android and iOS. It includes date, time and datetime picker modes. The datepicker is customizable and is supporting different languages. It's written with native code to achieve the best possible look, feel and performance.
MIT License
2.25k stars 346 forks source link

Error: Unsupported top level event type "spinnerStateChange" dispatched #777

Closed sirlojik closed 8 months ago

sirlojik commented 8 months ago

Screenshot_1709611436

Screenshot_1709610933

Describe the bug I am using an inline component as shown in code but when selecting date i get the error above "Error: Unsupported top level event type "spinnerStateChange" dispatched"

To Reproduce <DatePicker mode={'date'} androidVariant="iosClone" date={new Date()} onDateChange={(date) => { console.log(date) setStartDate(date); }} />



**Smartphone (please complete the following information):**
 - OS: [Android]
 - react-native: 0.72.6]
 -  "react-native-date-picker": "^4.4.0",
henninghall commented 8 months ago

Thanks for reporting this. I will have a look at it, meanwhile you can downgrade to the previous version of the package

sirlojik commented 8 months ago

Thanx for quick reply. I used v4.2.7 and it worked

MayurMax4 commented 8 months ago

getting same issue with latest version, please update once it is fixed

OrangeFrodo commented 8 months ago

Same error, fixed by downgrading to 4.3.7

dryusha commented 8 months ago

I had the same issue "react-native": "0.73.5", "react-native-date-picker": "^4.3.7", / tried 4.4.0, 4.2.7 same issue

this error is only reproduced in the Inlined version. The Modal version works well.

henninghall commented 8 months ago

Haven't been able to reproduce the issue, but might have a fix ready.

Can someone try version 4.4.1-alpha.0 and let me know if it solved the issue?

himangi14 commented 8 months ago

@henninghall tried with 4.4.1-alpha.0. having same issue Error: Unsupported top level event type "spinnerStateChange" dispatched, js engine: hermes

Luckfried commented 8 months ago

@henninghall also downgrades did not work for me.

dryusha commented 8 months ago

Haven't been able to reproduce the issue, but might have a fix ready.

Can someone try version 4.4.1-alpha.0 and let me know if it solved the issue?

For me, it works well right now with this alpha version.. thx

henninghall commented 8 months ago

@henninghall tried with 4.4.1-alpha.0. having same issue Error: Unsupported top level event type "spinnerStateChange" dispatched, js engine: hermes

Did you rebuild the app?

Luckfried commented 8 months ago

deleted evey cache file and removed node_modules and yarn.lock. Now it works with the alpha version. 👍

erickcrus commented 8 months ago

same here

deleted evey cache file and removed node_modules and yarn.lock. Now it works with the alpha version. 👍

this dont work for me.

Im using this version: "react-native-date-picker": "^4.1.3"

My code onDateChange prop just call setDate to handle view state. This has always worked, but in the last build, I noticed some crash logs triggering this error in production, for example:

const initialValue = "2024-03-10T16:00:27.218Z";

const FooComponent = () => {
   const [date, setDate] = useState(new Date(initialValue ?? ''));

   return <View>
      <DatePicker date={date}
         mode='date'
         androidVariant='iosClone'
         onDateChange={setDate}
         fadeToColor='none'
         textColor={theme.colors.fontPrimary}
         style={{ width, backgroundColor: theme.colors.card }} />
   </View>
}

export default FooComponent;
timmylindh commented 8 months ago

Haven't been able to reproduce the issue, but might have a fix ready.

Can someone try version 4.4.1-alpha.0 and let me know if it solved the issue?

I can confirm it working in 4.4.1-alpha.0. Will be running this until a new version is released.

alperpacin commented 8 months ago

I can also verify that 4.4.1-alpha.0 works without any problem.

Chbilalramzan commented 8 months ago

I used v4.2.7 and it worked for me

aishevdt12 commented 8 months ago

i am using npm i react-native-date-picker@4.3.7 then fixed my issue

MeAbhinavsharma commented 8 months ago

i try every solution @aishevdt12 @Chbilalramzan @alperpacin @Luckfried but not working .can you @henninghall provide me another solution.

BeerensJian commented 8 months ago

In version 4.4.1 this is still an issue, the error doesnt happen on version 4.3.7 and below

hamxahussain commented 8 months ago

getting same error even after upgrading to alpha version Error: Unsupported top level event type "spinnerStateChange" dispatched, js engine: hermes

Chbilalramzan commented 8 months ago

@MeAbhinavsharma @hamxahussain you need to check the react-native version of your project then choose the version of react-native-date-picker respectively. May be then it will work.

hamxahussain commented 8 months ago

@MeAbhinavsharma @hamxahussain you need to check the react-native version of your project then choose the version of react-native-date-picker respectively. May be then it will work.

yeah the alpha version works every where accept with old react native, which I made a tiny mistake in linking, Thanks now its working

Chbilalramzan commented 8 months ago

@hamxahussain I'm pleased to hear that it's working for you.

timmylindh commented 8 months ago

Is the fix pushed as of now?

gimi-anders commented 8 months ago

@MeAbhinavsharma @hamxahussain you need to check the react-native version of your project then choose the version of react-native-date-picker respectively. May be then it will work.

I am still getting this issue on 4.4.1. How do I know what version of react-native I need? (I am using 0.71.13)

hamxahussain commented 8 months ago

The React Native Version doesn't matter as far as I know, But the "react-native-date-picker": "^4.4.1" matters, Try running these commands, then checkout that helps are not.

yarn add react-native-date-picker@4.4.1-alpha.0 yarn start --reset-cache yarn android OR yarn ios

gimi-anders commented 8 months ago

Thanks, I thought the fix was included in 4.4.1. Hope it will make it into 4.4.2.

henninghall commented 8 months ago

The fix did not make it into 4.4.1. Now version 4.4.2 is released, could anyone with the error test it out? (remember to rebuild)

mduthilleul commented 8 months ago

4.4.2 is resolving the issue for me. Thanks for the fix !