Skip to content

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

@ssaxena00

Description

@ssaxena00
  • syr-cli version: latest
  • syr version: latest

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions