Skip to content

Commit 1b6fed7

Browse files
committed
Merge branch 'master' of github.com:APSL/react-native-floating-label
2 parents c7214d0 + e3ca621 commit 1b6fed7

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,61 @@
11
# react-native-floating-label
2-
A collection of useful tcomb-form-native factories
2+
A floating label factory to use with [``tcomb-form-native``](https://github.com/gcanti/tcomb-form-native) library.
3+
4+
<p align="center">
5+
<img src="https://raw.githubusercontent.com/wiki/alvaromb/react-native-floating-label/floating-form.gif" alt="Floating label" width="400">
6+
</p>
7+
8+
## Usage
9+
When configuring your ``tcomb-form-native`` ``Form``, use the ``factory`` option to set as ``FloatingLabel``:
10+
11+
```es6
12+
import React, { View } from 'react-native'
13+
import t from 'tcomb-form-native'
14+
import FloatingLabel from 'react-native-floating-label'
15+
16+
const Form = t.form.Form
17+
const Login = t.struct({
18+
email: t.String,
19+
password: t.String,
20+
})
21+
22+
class App extends React.Component {
23+
constructor (props) {
24+
super(props)
25+
this.state = {
26+
value: {},
27+
options: {
28+
fields: {
29+
email: {
30+
factory: FloatingLabel,
31+
},
32+
password: {
33+
factory: FloatingLabel,
34+
},
35+
},
36+
},
37+
}
38+
}
39+
40+
render () {
41+
return (
42+
<View style={{flex: 1}}>
43+
<Form ref='form'
44+
type={Login}
45+
value={this.state.value}
46+
options={this.state.options}
47+
/>
48+
</View>
49+
)
50+
}
51+
}
52+
```
53+
54+
## Author
55+
Álvaro Medina Ballester. 2015.
56+
57+
amedina at apsl.net
58+
59+
## License
60+
61+
MIT.

0 commit comments

Comments
 (0)