Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native drivers support added for Kohana #42

Merged
merged 1 commit into from
Jul 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const kohanaInput = (
iconColor={'#f4d29a'}
labelStyle={{ color: '#91627b' }}
inputStyle={{ color: '#91627b' }}
useNativeDriver={true}
/>
);
```
Expand Down
1 change: 1 addition & 0 deletions lib/BaseInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export default class BaseInput extends Component {
toValue: isActive ? 1 : 0,
duration: this.props.animationDuration,
easing: this.props.easing,
useNativeDriver: this.useNativeDriver || false
}).start();
}

Expand Down
27 changes: 18 additions & 9 deletions lib/Kohana.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class Kohana extends BaseInput {
static defaultProps = {
easing: Easing.bezier(0.2, 1, 0.3, 1),
iconSize: 25,
useNativeDriver: false
};

render() {
Expand All @@ -63,10 +64,12 @@ export default class Kohana extends BaseInput {
style={{
justifyContent: 'center',
padding: PADDING,
marginLeft: focusedAnim.interpolate({
inputRange: [0, 1],
outputRange: [-15 - iconSize, 0],
}),
transform: [{
translateX: focusedAnim.interpolate({
inputRange: [0, 1],
outputRange: [-15 - iconSize, 0],
})
}],
}}
>
<Icon name={iconName} color={iconColor} size={iconSize} />
Expand All @@ -77,10 +80,13 @@ export default class Kohana extends BaseInput {
style={{
position: 'absolute',
top: PADDING,
left: focusedAnim.interpolate({
inputRange: [0, 1],
outputRange: [PADDING, 80],
}),
left: 0,
transform: [{
translateX: focusedAnim.interpolate({
inputRange: [0, 1],
outputRange: [PADDING, 80],
})
}],
opacity: focusedAnim.interpolate({
inputRange: [0, 1],
outputRange: [1, 0],
Expand All @@ -98,7 +104,10 @@ export default class Kohana extends BaseInput {
style={[styles.textInput, inputStyle]}
value={value}
onBlur={this._onBlur}
onFocus={this._onFocus}
onFocus={event => {
this.useNativeDriver = this.props.useNativeDriver;
this._onFocus(event);
}}
onChange={this._onChange}
underlineColorAndroid={'transparent'}
/>
Expand Down