Skip to content

undefined is not an object (evaluating 'Orientation.lockToPortrait') #43

@bpolonia

Description

@bpolonia

Hi I am trying to use the lockToPortrait function and I keep get this error in console:

undefined is not an object (evaluating 'Orientation.lockToPortrait')

I imported your package, set its name to Orientation just as in your usage examples, and inside of componentDidMount I am just calling Orientation.lockToPortrait();

Please help :)

Activity

yamill

yamill commented on Feb 10, 2016

@yamill
Owner

Did you import the files in xcode?

bpolonia

bpolonia commented on Feb 10, 2016

@bpolonia
Author

Yes I did. I right clicked on my project name, selected Add Files to Project Name I selected RCTOrientation from node_module/react-native-orientation/

The only thing I didn't see was an option to have Create Groups selected.

Here is what it looks like.

screen shot 2016-02-10 at 4 38 04 pm

tklivan

tklivan commented on Feb 11, 2016

@tklivan

@bpolonia after you click on "Add Files to Project Name" there is a button called "Options" on the screen where you select the file(s). "Create Groups" is there.

bpolonia

bpolonia commented on Feb 12, 2016

@bpolonia
Author

@Nurdeen Thank you! That worked. 👍

courthead

courthead commented on May 26, 2016

@courthead

@yamill @bpolonia I'm having the same error appear when I run my project on an Android device. I followed all of the instructions for Android setup in the README, plus I did the Xcode just in case. Any ideas?

EDIT: Nevermind, just had to rebuild via react-native run-android. Merely reloading the JS on my device was not enough!

mvayngrib

mvayngrib commented on Sep 26, 2016

@mvayngrib

@yamill this seems to be a recurrent issue for me. Any idea why I would have to rebuild periodically? I think it happens especially often when I switch from debugging the iOS simulator to debugging the android emulator and vice versa

mvayngrib

mvayngrib commented on Sep 26, 2016

@mvayngrib

nm, seems it has been fixed in #85. Could you republish the module to npm?

EDIT: installed from Github but still getting this occasionally...

jctadios

jctadios commented on Sep 5, 2017

@jctadios

same problem here but I'm using expo. Any idea?

andrerfneves

andrerfneves commented on Sep 11, 2017

@andrerfneves
Collaborator

@jctadios you cannot use this with Expo. You'll have to eject from your Expo build to be able to write native code, and thus integrate this package. Please refrain from commenting on closed tickets. Create a new one if you'd like further help/clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mvayngrib@courthead@yamill@andrerfneves@tklivan

        Issue actions

          undefined is not an object (evaluating 'Orientation.lockToPortrait') · Issue #43 · yamill/react-native-orientation