0

lib.js

import React, { Component } from 'react';
import { Text } from 'react-native';

const log = () => {
  console.log('hello');
};

class MyText extends Component {
  render() {
    return (
      <Text>Hello</Text>
    );
  }
}

export { log, MyText };

index.ios.js

import { log, MyText } from './lib';
...
  onPressLog() {
    log();
  }

  render() {
    return (
      <View style={styles.container}>
        <TouchableHighlight onPress={this.onPressLog} style={{padding: 20, backgroundColor:'red'}}>
          <Text style={{color: 'white'}}>Call Log</Text>
        </TouchableHighlight>
        <MyText></MyText>
      </View>
    );
  }
...

热重载适用于 的更改,MyText但不适用于log.

我不确定这是不支持还是错误,请帮助。

环境:OS X 10.10.5,节点 6.2.1,react-native 0.28

4

0 回答 0