syrjs / core

Light Dynamic UI Engine for Native and Web with a React Like API
http://syr.js.org
MIT License
56 stars 24 forks source link

Importing from '@syr/core' does not allow for state changes #299

Open ssaxena00 opened 5 years ago

ssaxena00 commented 5 years ago

Problem Description: After updating state variables in my syr.js class with this.setState({ var: newValue }); and running it in Xcode emulator, I get the following error in Xcode:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[UIView setText:]: unrecognized selector sent to instance 0x7fdd616193d0'
*** 

The issue occurs if importing syr components from the node module @syr/core, which was installed automatically by the syr-cli tool.

Suggested Solution: I fixed this by adding my syr.js classes to my cloned, local, version of the Syr core repo. In my classes, I imported all syr components from 'index' (referring to index.js in the core repo) as opposed to from '@syr/core'. [This is also the way imports are done in the samples.] State updates then work properly when running on emulators.