Skip to content

Commit e2503ae

Browse files
committed
documented native driver for Kohana
1 parent e488202 commit e2503ae

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Example/TextInputEffectsExample.js

+2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export default class TextInputEffectsExample extends Component {
173173
iconSize={40}
174174
labelStyle={{ marginTop: 8, color: '#91627b' }}
175175
inputStyle={{ color: '#91627b' }}
176+
useNativeDriver
176177
/>
177178
<Kohana
178179
style={[styles.input, { backgroundColor: '#f9f5ed' }]}
@@ -183,6 +184,7 @@ export default class TextInputEffectsExample extends Component {
183184
iconColor={'#f4d29a'}
184185
labelStyle={{ color: '#91627b' }}
185186
inputStyle={{ color: '#91627b' }}
187+
useNativeDriver
186188
/>
187189
</View>
188190
<View style={[styles.card2, { backgroundColor: '#d0efe0' }]}>

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const fumiInput = (
104104
105105
![](screenshots/kohana.gif)
106106
107+
Kohana supports [Animated Native Driver](https://facebook.github.io/react-native/docs/animations.html#using-the-native-driver). You can use native driver by passing `useNativeDriver`.
107108
108109
```js
109110
import MaterialsIcon from 'react-native-vector-icons/MaterialIcons';
@@ -118,7 +119,7 @@ const kohanaInput = (
118119
iconColor={'#f4d29a'}
119120
labelStyle={{ color: '#91627b' }}
120121
inputStyle={{ color: '#91627b' }}
121-
useNativeDriver={true}
122+
useNativeDriver
122123
/>
123124
);
124125
```

lib/BaseInput.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export default class BaseInput extends Component {
1212
labelStyle: Text.propTypes.style,
1313
easing: PropTypes.func,
1414
animationDuration: PropTypes.number,
15+
useNativeDriver: PropTypes.bool,
16+
1517
editable: PropTypes.bool,
1618

1719
/* those are TextInput props which are overridden
@@ -96,12 +98,13 @@ export default class BaseInput extends Component {
9698
}
9799

98100
_toggle(isActive) {
101+
const { animationDuration, easing, useNativeDriver } = this.props;
99102
this.isActive = isActive;
100103
Animated.timing(this.state.focusedAnim, {
101104
toValue: isActive ? 1 : 0,
102-
duration: this.props.animationDuration,
103-
easing: this.props.easing,
104-
useNativeDriver: this.useNativeDriver || false
105+
duration: animationDuration,
106+
easing,
107+
useNativeDriver,
105108
}).start();
106109
}
107110

0 commit comments

Comments
 (0)