ReactNative for Android

93bc8fb48f57c11e417dad9d26a2fb8a?s=47 petitviolet
September 16, 2015

ReactNative for Android

93bc8fb48f57c11e417dad9d26a2fb8a?s=128

petitviolet

September 16, 2015
Tweet

Transcript

  1. 2.

    

  2. 3.

    How to Setup npm install -g react-native-cli brew install watchman

    brew install flow react-native init ReactSampleProject cd ./ReactSampleProject npm i react-native run-android
  3. 4.
  4. 5.
  5. 6.
  6. 9.

    var ReactSampleProject = React.createClass({ getInitialState: function() { return {text: “”};

    }, render: function() { var todoItem = {label: 'hoge'}; return ( <View style={styles.container}> <Text>{this.state.text}</Text> <ToastButton text={this.state.text}/> <TextInput style={styles.textInput} onChangeText={(text) => this.setState({text})} value={this.state.text} /> <TodoItem label={todoItem.label} /> </View> ); } });
  7. 10.

    var ReactSampleProject = React.createClass({ getInitialState: function() { return {text: “”};

    }, render: function() { var todoItem = {label: 'hoge'}; return ( <View style={styles.container}> <Text>{this.state.text}</Text> <ToastButton text={this.state.text}/> <TextInput style={styles.textInput} onChangeText={(text) => this.setState({text})} value={this.state.text} /> <TodoItem label={todoItem.label} /> </View> ); } });
  8. 11.

    var ReactSampleProject = React.createClass({ getInitialState: function() { return {text: “”};

    }, render: function() { var todoItem = {label: 'hoge'}; return ( <View style={styles.container}> <Text>{this.state.text}</Text> <ToastButton text={this.state.text}/> <TextInput style={styles.textInput} onChangeText={(text) => this.setState({text})} value={this.state.text} /> <TodoItem label={todoItem.label} /> </View> ); } });
  9. 12.

    var ReactSampleProject = React.createClass({ getInitialState: function() { return {text: “”};

    }, render: function() { var todoItem = {label: 'hoge'}; return ( <View style={styles.container}> <Text>{this.state.text}</Text> <ToastButton text={this.state.text}/> <TextInput style={styles.textInput} onChangeText={(text) => this.setState({text})} value={this.state.text} /> <TodoItem label={todoItem.label} /> </View> ); } });
  10. 13.

    var ReactSampleProject = React.createClass({ getInitialState: function() { return {text: “”};

    }, render: function() { var todoItem = {label: 'hoge'}; return ( <View style={styles.container}> <Text>{this.state.text}</Text> <ToastButton text={this.state.text}/> <TextInput style={styles.textInput} onChangeText={(text) => this.setState({text})} value={this.state.text} /> <TodoItem label={todoItem.label} /> </View> ); } });
  11. 14.

    var ReactSampleProject = React.createClass({ getInitialState: function() { return {text: “”};

    }, render: function() { var todoItem = {label: 'hoge'}; return ( <View style={styles.container}> <Text>{this.state.text}</Text> <ToastButton text={this.state.text}/> <TextInput style={styles.textInput} onChangeText={(text) => this.setState({text})} value={this.state.text} /> <TodoItem label={todoItem.label} /> </View> ); } });
  12. 15.

    var ToastButton = React.createClass({ propTypes: { text: React.PropTypes.string.isRequired, }, render:

    function () { return ( <TouchableNativeFeedback onPress={() => ToastAndroid.show(`Your input is ${this.props.text}`, ToastAndroid.SHORT)} background={TouchableNativeFeedback.SelectableBackground()} style={styles.toastButton}> <View> <Text style={styles.toastButtonText}>Tap me</Text> </View> </TouchableNativeFeedback> ); }, });
  13. 16.

    var ToastButton = React.createClass({ propTypes: { text: React.PropTypes.string.isRequired, }, render:

    function () { return ( <TouchableNativeFeedback onPress={() => ToastAndroid.show(`Your input is ${this.props.text}`, ToastAndroid.SHORT)} background={TouchableNativeFeedback.SelectableBackground()} style={styles.toastButton}> <View> <Text style={styles.toastButtonText}>Tap me</Text> </View> </TouchableNativeFeedback> ); }, });
  14. 17.

    var ToastButton = React.createClass({ propTypes: { text: React.PropTypes.string.isRequired, }, render:

    function () { return ( <TouchableNativeFeedback onPress={() => ToastAndroid.show(`Your input is ${this.props.text}`, ToastAndroid.SHORT)} background={TouchableNativeFeedback.SelectableBackground()} style={styles.toastButton}> <View> <Text style={styles.toastButtonText}>Tap me</Text> </View> </TouchableNativeFeedback> ); }, });
  15. 18.

    var ToastButton = React.createClass({ propTypes: { text: React.PropTypes.string.isRequired, }, render:

    function () { return ( <TouchableNativeFeedback onPress={() => ToastAndroid.show(`Your input is ${this.props.text}`, ToastAndroid.SHORT)} background={TouchableNativeFeedback.SelectableBackground()} style={styles.toastButton}> <View> <Text style={styles.toastButtonText}>Tap me</Text> </View> </TouchableNativeFeedback> ); }, });
  16. 19.

    var ToastButton = React.createClass({ propTypes: { text: React.PropTypes.string.isRequired, }, render:

    function () { return ( <TouchableNativeFeedback onPress={() => ToastAndroid.show(`Your input is ${this.props.text}`, ToastAndroid.SHORT)} background={TouchableNativeFeedback.SelectableBackground()} style={styles.toastButton}> <View> <Text style={styles.toastButtonText}>Tap me</Text> </View> </TouchableNativeFeedback> ); }, });
  17. 20.

    var ReactSampleProject = React.createClass({ getInitialState: function() { return {text: “”};

    }, render: function() { var todoItem = {label: 'hoge'}; return ( <View style={styles.container}> <Text>{this.state.text}</Text> <ToastButton text={this.state.text}/> <TextInput style={styles.textInput} onChangeText={(text) => this.setState({text})} value={this.state.text} /> <TodoItem label={todoItem.label} /> </View> ); } });
  18. 21.

    var ReactSampleProject = React.createClass({ getInitialState: function() { return {text: “”};

    }, render: function() { var todoItem = {label: 'hoge'}; return ( <View style={styles.container}> <Text>{this.state.text}</Text> <ToastButton text={this.state.text}/> <TextInput style={styles.textInput} onChangeText={(text) => this.setState({text})} value={this.state.text} /> <TodoItem label={todoItem.label} /> </View> ); } });
  19. 23.
  20. 24.

    ײ૝ • ·ͩૣ͍ • <Button>͢Βແ͍(͸ͣ) • Reactڧ͍ͳΒଟগָʹॻ͚Δ͸ͣ • JSͷauto reloadͰ։ൃग़དྷΔͷ͸࠷ߴ

    • CustomViewΊͪΌ؆୯ʹ࡞Εͯྑ͍ • StackTrace͕৘ใগͳ͗ͯ͢ݫ͍͠ • σόοάग़དྷͳ͍