1
ref
만있는 경우 반응 네이티브 요소의 높이를 측정 할 수 있습니까?반응 네이티브 ref (ListView)의 높이 측정
NativeMethodsMixin을 참조하십시오. 그러나 구현 방법이 명확하지 않습니다.
나는 그것을 포함 시도했다 :
import { NativeMethodsMixin } from 'react-native';
class Foo extends Component {
mixins: [NativeMethodsMixin]
measure(ref) {
console.log(NativeMethodsMixin.measure(ref));
}
...
}
하지만 응용 프로그램은 NativeMethodsMixin
이 정의되지 불평.
나는 RCTUIManager
경로를 이동하는 경우 : Uncaught TypeError: Converting circular structure to JSON
난 그냥 그 ref
의 높이를 얻으려면 :
import { NativeModules } from 'react-native';
const RCTUIManager = NativeModules.UIManager;
class Foo extends Component {
measure(ref) {
const height = RCTUIManager.measure(ref, (x, y, width, height, pageX, pageY) => height));
console.log(height);
}
...
}
다음 나는 오류가 발생합니다. 내가 뭘 놓치고 있니?
이 발견하는. https://facebook.github.io/react/docs/more-about-refs.html – chandlervdw