Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native #11

Closed
dabit3 opened this issue Apr 28, 2017 · 6 comments
Closed

React Native #11

dabit3 opened this issue Apr 28, 2017 · 6 comments

Comments

@dabit3
Copy link

dabit3 commented Apr 28, 2017

Should this work out of the box with React Native?

@erictraut
Copy link
Contributor

Yes, it should work with both React and React Native. Let us know if you're having problems.

@dabit3
Copy link
Author

dabit3 commented Apr 28, 2017

I'm sure it's something completely dumb, but I'm getting the attached error.

App.tsx:

import { ComponentBase } from 'resub';

import React from 'react'
import { View, Text } from 'react-native'

import TodosStore = require('./TodosStore');

interface TodoListState {
    todos?: String[]
}

class TodoList extends ComponentBase<{}, TodoListState> {
    protected _buildState(props: {}, initialBuild: boolean): TodoListState {
        return {
            todos: TodosStore.getTodos()
        }
    }

    render() {
        return (
            <View>
               <Text>Hello
<img width="368" alt="screen shot 2017-04-28 at 11 54 11 am" src="https://cloud.githubusercontent.com/assets/1857282/25538781/a9fa2c3e-2c09-11e7-810c-c629dfee305a.png">
</Text>
            </View>
        );
    }
}

export = TodoList;

@dabit3
Copy link
Author

dabit3 commented Apr 28, 2017

screen shot 2017-04-28 at 11 54 11 am

@berickson1
Copy link
Collaborator

@dabit3 Can you share the complete stack please?

@berickson1
Copy link
Collaborator

berickson1 commented Apr 28, 2017

Also what version of ReactNative are you using? RN 0.25.1 made some breaking changes that could be related to this error. I've only ever tested this using more recent versions or React Native See:
https://github.com/facebook/react-native/releases/tag/v0.25.1

@dabit3
Copy link
Author

dabit3 commented Apr 28, 2017

So, I was importing like this import React from 'react', but needed to do this:

import * as React from 'react'

I'm using commonjs in my compilerOptions -> module within my tsconfig.

I'll go ahead and close this, thanks for your help.

@dabit3 dabit3 closed this as completed Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants