@@ -25,7 +25,7 @@ After vector-icons is installed and you have everything in place, we need to cre
2525Let's create a separate file ` feather-icons.js ` and place there the following code.
2626
2727``` js
28- import * as React from ' react' ;
28+ import React from ' react' ;
2929import { StyleSheet } from ' react-native' ;
3030import Icon from ' react-native-vector-icons/Feather' ; // <-- Import Feather icons
3131
@@ -54,6 +54,8 @@ function createIconsMap() {
5454And providing function
5555
5656``` js
57+ import Icon from ' react-native-vector-icons/Feather' ; // <-- Import Feather icons
58+
5759function IconProvider (name ) {
5860 return {
5961 toReactElement : (props ) => FeatherIcon ({ name, ... props }),
@@ -81,18 +83,24 @@ function FeatherIcon({ name, style }) {
8183After everything is configured, we simply need to import a feather icon map and register it with UI Kitten APIs.
8284
8385``` js
84- import * as React from ' react' ;
86+ import React from ' react' ;
8587import { mapping , light as lightTheme } from ' @eva-design/eva' ;
86- import { ApplicationProvider , Layout , IconRegistry } from ' react-native-ui-kitten' ;
88+ import { ApplicationProvider , IconRegistry , Layout , Text } from ' react-native-ui-kitten' ;
8789import { FeatherIconsPack } from ' ./path-to/feather-icons.js' ; // <-- Feather icons map
8890
91+ const ApplicationContent = () => (
92+ < Layout style= {{flex: 1 , justifyContent: ' center' , alignItems: ' center' }}>
93+ < Text > Welcome to UI Kitten< / Text >
94+ < / Layout>
95+ );
96+
8997const App = () => (
90- < ApplicationProvider
91- mapping = {mapping}
92- theme= {lightTheme}>
93- < IconRegistry icons = {[FeatherIconsPack]} / >
94- < Layout style = {{flex : 1 }} / >
95- < / ApplicationProvider >
98+ < React . Fragment >
99+ < IconRegistry icons = {[FeatherIconsPack]} / >
100+ < ApplicationProvider mapping = {mapping} theme= {lightTheme}>
101+ < ApplicationContent / >
102+ < / ApplicationProvider >
103+ < / React . Fragment >
96104);
97105
98106export default App ;
@@ -103,7 +111,7 @@ export default App;
103111## Use it with UI Kitten components
104112
105113``` js
106- import * as React from ' react' ;
114+ import React from ' react' ;
107115import { Button , Icon } from ' react-native-ui-kitten' ;
108116
109117export const FacebookIcon = (style ) => (
@@ -128,6 +136,8 @@ As a result, you should have a Button looking similar to this:
128136As you might notice, UI Kitten API allows you to register ** multiple** icon packages with the following instruction.
129137
130138``` js
139+ import { IconRegistry } from ' react-native-ui-kitten' ;
140+
131141< IconRegistry icons= {[FeatherIconsPack]}/ >
132142```
133143
@@ -175,19 +185,25 @@ function MaterialIcon({ name, style }) {
175185Now all we need to do is to extend our ` IconRegistry ` :
176186
177187``` js
178- import * as React from ' react' ;
188+ import React from ' react' ;
179189import { mapping , light as lightTheme } from ' @eva-design/eva' ;
180- import { ApplicationProvider , Layout , IconRegistry } from ' react-native-ui-kitten' ;
190+ import { ApplicationProvider , IconRegistry , Layout , Text } from ' react-native-ui-kitten' ;
181191import { FeatherIconsPack } from ' ./path-to/feather-icons.js' ; // <-- Feather icons map
182192import { MaterialIconsPack } from ' ./path-to/material-icons.js' ; // <-- Material icons map
183193
194+ const ApplicationContent = () => (
195+ < Layout style= {{flex: 1 , justifyContent: ' center' , alignItems: ' center' }}>
196+ < Text > Welcome to UI Kitten< / Text >
197+ < / Layout>
198+ );
199+
184200const App = () => (
185- < ApplicationProvider
186- mapping= {mapping}
187- theme= {lightTheme}>
201+ < React .Fragment >
188202 < IconRegistry icons= {[FeatherIconsPack, MaterialIconsPack]}/ >
189- < Layout style= {{flex: 1 }}/ >
190- < / ApplicationProvider>
203+ < ApplicationProvider mapping= {mapping} theme= {lightTheme}>
204+ < ApplicationContent / >
205+ < / ApplicationProvider>
206+ < / React .Fragment >
191207);
192208
193209export default App ;
@@ -200,7 +216,7 @@ export default App;
200216Now you're able to choose an icon library with simply changing ` pack ` property.
201217
202218``` js
203- import * as React from ' react' ;
219+ import React from ' react' ;
204220import { Button , Icon } from ' react-native-ui-kitten' ;
205221
206222export const HomeIcon = (style ) => (
0 commit comments