Skip to content

Commit 4d2e2f2

Browse files
committed
Updated Keyframes.js with flow types
1 parent 7b92154 commit 4d2e2f2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Keyframes.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
import React, { PropTypes } from 'react';
1+
// @flow
2+
import * as React from 'react';
23
import {
3-
NativeModules,
44
requireNativeComponent,
5-
View,
65
UIManager,
76
findNodeHandle,
87
} from 'react-native';
98

109
const PTRKeyframesView = requireNativeComponent('PTRKeyframesView', Keyframes);
1110

12-
class Keyframes extends React.Component {
11+
type Props = {
12+
onStop: Function
13+
};
14+
15+
class Keyframes extends React.Component<Props> {
1316
constructor(props) {
1417
super(props);
18+
19+
this.ref = React.createRef();
1520
}
1621

17-
onStop = (e) => {
22+
onStop = () => {
1823
if (this.props.onStop) {
1924
this.props.onStop();
2025
}
@@ -24,13 +29,13 @@ class Keyframes extends React.Component {
2429
return (
2530
<PTRKeyframesView
2631
onStop={this.onStop}
27-
ref={ref => (this.ref = ref)}
32+
ref={this.ref}
2833
{...this.props}
2934
/>
3035
);
3136
}
3237

33-
seek(position) {
38+
seek(position: number) {
3439
this.runCommand('seek', [position]);
3540
}
3641

@@ -63,7 +68,7 @@ class Keyframes extends React.Component {
6368
}
6469

6570
getHandle() {
66-
return findNodeHandle(this.ref);
71+
return findNodeHandle(this.ref.current);
6772
}
6873
}
6974

0 commit comments

Comments
 (0)