From e09378d92dbaef3e3a9bb32e70b5482cc39eb48b Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Thu, 31 Dec 2015 21:11:47 +0800 Subject: [PATCH] remove Precomputing style --- docs/DirectManipulation.md | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/docs/DirectManipulation.md b/docs/DirectManipulation.md index 77551e590..a47a39fe2 100644 --- a/docs/DirectManipulation.md +++ b/docs/DirectManipulation.md @@ -161,37 +161,6 @@ that call back to the `TouchableOpacity` component. `TouchableHighlight`, in contrast, is backed by a native view and only requires that we implement `setNativeProps`. -## Precomputing style - -We learned above that `setNativeProps` is a wrapper around -`RCTUIManager.updateView`, which is also used internally by React to -perform updates on re-render. One important difference is that -`setNativeProps` does not call `precomputeStyle`, which is done -internally by React, and so the `transform` property will not work if -you try to update it manually with `setNativeProps`. To fix this, -you can call `precomputeStyle` on your object first: - -```javascript -var precomputeStyle = require('precomputeStyle'); - -var App = React.createClass({ - componentDidMount() { - var nativeProps = precomputeStyle({transform: [{rotate: '45deg'}]}); - this._root.setNativeProps(nativeProps); - }, - - render() { - return ( - this._root = component} - style={styles.container}> - Precompute style! - - ) - }, -}); -``` -[Run this example](https://rnplay.org/apps/8_mIAA) - ## setNativeProps to clear TextInput value Another very common use case of `setNativeProps` is to clear the value