Skip to content

Instantly share code, notes, and snippets.

@kenwheeler
Last active March 17, 2016 08:12
Show Gist options
  • Save kenwheeler/a889c7ba3042f8c70e95 to your computer and use it in GitHub Desktop.
Save kenwheeler/a889c7ba3042f8c70e95 to your computer and use it in GitHub Desktop.
import React from "react-native";
const {
View,
Text
} = React;
class OurComponent extends React.Component {
render() {
<View>
{this.props.items.map((item) => (
<View>
<Text>{item.name}</Text>
</View>
)}
</View>
}
}
@holyxiaoxin
Copy link

You need to export this or else the test can't require it.

import React from "react-native";

const {
  View,
  Text
} = React;

export default class OurComponent extends React.Component {
  render() {
    return(
      <View>
      {
        this.props.items.map((item) => (
          <View>
            <Text>{item.name}</Text>
          </View>
        ))
      }
      </View>
    )
  }
}

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